Commit Graph

140 Commits

Author SHA1 Message Date
Jennifer Messerly 3a79c35f3c optimize maps/sets in DDC, fixes #29865
- string/int keys use identity maps
- construct the correct type rather than relying on factory constructors when possible
- checks if key has identity semantics and use that when possible
- avoid helper calls/casts/etc in implementations
- use native ES6 Map/Set key order tracking
- optimized constructor for map literals
- fixes #30466, const maps are now canonicalized correctly

Change-Id: Id44acf3d9bf8cb153a4755aa28df08fe91bfc633
Reviewed-on: https://dart-review.googlesource.com/8167
Reviewed-by: Vijay Menon <vsm@google.com>
2017-10-04 19:04:27 +00:00
Jennifer Messerly 3a907e5cab add a script to build DDC's SDK to a dill file
Change-Id: I93f9d55bd99a3b98ee823c38255e9a8081954a4b
Reviewed-on: https://dart-review.googlesource.com/10213
Reviewed-by: Vijay Menon <vsm@google.com>
2017-10-03 20:27:12 +00:00
Jennifer Messerly 9978b808b4 implement NoSuchMethodError.withInvocation in DDC
Change-Id: If51546abb290d2956bacce9b5ae5adf6f2ca2d11
Reviewed-on: https://dart-review.googlesource.com/9429
Reviewed-by: Jennifer Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2017-09-28 23:39:43 +00:00
Vijay Menon 84cde41da5 Add NoSuchMethodError.withInvocation to DDC patch
TBR-jmesserly@google.com

Change-Id: I7352d0caefe12f3d8a10d1383cfb2ec983b1051b
Reviewed-on: https://dart-review.googlesource.com/9368
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Jennifer Messerly <jmesserly@google.com>
2017-09-28 22:27:22 +00:00
Zachary Anderson 2948f8c1b7 Reland: [dart:io] Moves Http code into a separate library.
This moves Http code into dart:_http. dart:io then imports and
re-exports dart:_http. This is the first stage of moving
dart:_http into its own pub package.

This CL was reverted due to a failure in the Flutter engine build
which happened due to an incomplete change in gen_snapshot.cc, and to
update sdk/lib/libraries.yaml and sdk/lib/libraries.json

Change-Id: Ie90c77ef631aea7a163774b58e8ccbaf71a24d3c
Reviewed-on: https://dart-review.googlesource.com/7588
Reviewed-by: Zach Anderson <zra@google.com>
2017-09-21 19:21:25 +00:00
Zach Anderson 64bf1b49b0 Revert "[dart:io] Moves Http code into a separate library."
Reverting for broken Flutter build and kernel platform compilation test. It looks like the new _http library is missing from various snapshots. Not sure why this didn't fail locally.

This reverts commit ac9ff3f3af.

Change-Id: I7fbc2f842cf1380793e7af9fb869cacd14682885
Reviewed-on: https://dart-review.googlesource.com/7600
Reviewed-by: Zach Anderson <zra@google.com>
2017-09-21 15:57:59 +00:00
Zachary Anderson ac9ff3f3af [dart:io] Moves Http code into a separate library.
This moves Http code into dart:_http. dart:io then imports and
re-exports dart:_http. This is the first stage of moving
dart:_http into its own pub package.

Change-Id: Icd33232a97b3d75511ef7ec88b01fd47cdcf5a23
Reviewed-on: https://dart-review.googlesource.com/6420
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Florian Loitsch <floitsch@google.com>
2017-09-21 15:10:22 +00:00
Ryan Macnak 3d21a46b72 Limit preserialized JSON for timeline events from Dart code to the arguments.
Avoids string copies in C++ and map copies in Dart.

Also remove some vestiages of removed feature that allowed an embedder to add pre-encoded events to the timeline.

Change-Id: I962a67093ba461c991d9169b0391c44af1d489db
Bug: https://github.com/dart-lang/sdk/issues/30787
Reviewed-on: https://dart-review.googlesource.com/6762
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2017-09-19 23:29:55 +00:00
Jennifer Messerly ab226fd40c optimize Object members in DDC
This should improve performance of these members in most cases:
- toString
- operator ==
- hashCode
- runtimeType
- noSuchMethod

The helpers for checking `null` and then dispatching to the method are now very small again. Also, because we can lookup symbolized names always, we can start taking advantage of this in our Map/Set implementations (for a follow up CL).

This also improves correctness of these helpers given JavaScript objects; we were previously falling back to calling a Dart method name like `.hashCode`, which is incorrect (except for `toString` where fallback is probably the correct behavior).

Change-Id: I39cbc80ca3e93ca7672652610b02bce899894da1
Reviewed-on: https://dart-review.googlesource.com/3427
Commit-Queue: Jennifer Messerly <jmesserly@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2017-09-06 08:12:11 +00:00
Zachary Anderson e2bce948ed [dart:io] Adds Platform.operatingSystemVersion
fixes #30018

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/3006873002 .
2017-09-01 22:08:48 -07:00
Zachary Anderson d0295c873c [dart:io] Namespaces for file IO
Fuchsia requires the ability to sandbox Isolates w.r.t. file IO.
When a new Isolate starts, Fuchsia will pass the Isolate an object
called a namespace. We can translate the namespace object into a
file descriptor suitable for passing to the *at() family of
POSIX file system calls. The file system calls will then
have visibility only into the specified namespace.

We also plumb Namespaces through on all the other platforms as well to
make the change easier to test and so that in the future we can
implement e.g. per-isolate cwds.

This change adds a new internal class to dart:io called _Namespace,
which is implemented in a patch file. See:

sdk/lib/io/namespace_impl.dart
runtime/bin/namespace_patch.dart

The embedder can set up a non-default namespace by calling
_Namespace._setupNamespace during Isolate setup.

Instances of _Namespace have a native field that holds a pointer
to a native Namespace object. See:

runtime/bin/namespace.h

Calls from e.g. file_impl.dart are now also passed a
_Namespace object. The implementations in e.g. file.cc and
file_linux.cc then extract the namespace, and use it to compute a
file descriptor and path suitable for passing to e.g. openat().

related US-313

R=asiva@google.com, rmacnak@google.com

Review-Url: https://codereview.chromium.org/3007703002 .
2017-08-30 09:34:36 -07:00
Jennifer Messerly 087c5c6a81 fix list_test for strong mode, and fix DDC List constructors
R=vsm@google.com

Review-Url: https://codereview.chromium.org/3009623002 .
2017-08-25 18:32:43 -07:00
Jennifer Messerly 45592ee4bb improve DDC's type checks
fixes #30495 - optimize subtype cache
fixes #30464 - optimize `is List`

Additional changes:
- optimize double type checks
- optimize Object type checks
- optimize FutureOr<T> checks
- optimize interface checks for some dart:core and dart:async types (List, Map, Iterable, Future, Stream, and StreamSubscription )
- optimize checks for generic class default instantiations and exact instantiation (e.g. `C<dynamic>` on any instance `C<T>`, and `C<T> on an instance of C<T>`
- optimize checks for native types
- optimize getReifiedType
- optimize dcall/dsend/dput checks to use faster Type._check pattern
- optimize instanceOf/cast functions by moving special cases to appropriate types
- optimize Object.runtimeType
- optimize JS interop type checks
- optimize all function type checks

There's more we can do (especially for class/interface types) but this should cover a lot of cases.

R=leafp@google.com

Review-Url: https://codereview.chromium.org/3003613002 .
2017-08-25 12:45:13 -07:00
Leaf Petersen 1b8f4ac1e7 Optimize DDC private runtime library files.
Eliminate numerous type checks not needed in strong mode.  Use
private nullability annotations instead of inline JS to mark known
non-null variables, and to make the compiler generate null checks
for null checked variables. Use nullability annotations and code refactoring to
remove redundant null checks and to move checks out of loops.

BUG=
R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2994203002 .
2017-08-23 10:28:45 -07:00
Zachary Anderson 633ed4cf83 [corelib] dart:developer timeline flow events
This change adds an API to dart:developer Timeline for
adding flow events to the timeline. For details see the
changes in:

sdk/lib/developer/timeline.dart

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2985253002 .
2017-07-31 07:46:52 -07:00
Zachary Anderson 9e7e66602f Compute the script Uri lazily
Previously, the string set up by the embedder was eagerly passed to
Uri.parse during Isolate startup. This is expensive both in time and
memory footprint. This CL causes Uri.parse() to be called only
when needed. This change will allow reducing the memory footprint
of Fuchsia's Dart content handler on hello world by ~1MB.

fixes #25603

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2988613002 .
2017-07-24 12:56:21 -07:00
Jennifer Messerly 04f3c8835f implement Invocation.typeArguments in DDC
also fixes various bugs:
* setters now use the correct memberName symbol, fixes #30223
* object members work for callable classes, fixes #30213
* some test fixes to work in strong mode
* a few other small cleanups (e.g. obsolete `dart.list` is removed)

R=vsm@google.com

Review-Url: https://codereview.chromium.org/2979353002 .
2017-07-21 15:51:16 -07:00
Natalie Weizenbaum 5a74d8ab09 Properly handle Windows file: URLs on Node.js (#30098)
This adds logic to the JS implementation of URI to determine whether
the code is running on Windows under Node.js.
2017-07-12 14:57:01 -07:00
Jennifer Messerly 5533a256cb fix #30030, fix #27327 - fix tearoffs and various Object member bugs
this includes various cleanups found along the way:
* various issues with JS annotations, see #30043
* getGenericClass is now optimized when used in a JS builtin with a Type literal
* typed list literals should be slightly faster to create
* memoized getters used by dart:_runtime should be faster
* registerExtension should be a tad faster, and now understands JSArray
* dart.bind "safeName" hack gone in codegenerator
* JSArray<E>.runtimeType returns List<E>
* JSArray<E>.noSuchMethod works
* cleans up code that generates `setExtensionBaseClass` (used only by JSArray)
* _throwUnsafe helper for generating a `throw` in --unsafe compile mode
* fix tearoff of JS interop types (_emitSimpleIdentifier)
* fix TODO about splitting LazyJSType and AnonymousJSType
* fix is/as/cast methods on TypeRep and related classes
* fix codegenerator to not tearoff "hashCode" and "runtimeType" (they are not methods)
* fix NoSuchMethodError.toString()   (update via dart2js sdk impl)

R=vsm@google.com

Review-Url: https://codereview.chromium.org/2962263002 .
2017-07-05 14:17:53 -07:00
Erik Corry 029b1cb948 Spelling fixes e to i.
R=kevmoo@google.com
BUG=

Review-Url: https://codereview.chromium.org/2957593002 .
2017-06-24 13:41:39 +02:00
Vijay Menon 7d73159017 Fix ddc build
Not sure why this just started breaking.  I don't think Ben added this
param - just a use of it.  Our patch script might not be catching the
mismatch.

TBR=jmesserly@google.com,bkonyi@google.com

Review-Url: https://codereview.chromium.org/2954513003 .
2017-06-22 14:27:22 -07:00
Vijay Menon ecca1e1c2a Add FallThroughError patch
TBR=jensj@google.com,rnystrom@google.com

Review-Url: https://codereview.chromium.org/2953693002 .
2017-06-21 16:33:31 -07:00
Alan Knight 9e3fdbf94d Update DDC core patch for ConstantExpressionError
BUG=
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2941593002 .
2017-06-13 13:57:42 -07:00
Ben Konyi 033c18472d Revert "Removed SecurityContext.alpnSupported, as ALPN is now supported on all platforms. Also updated CHANGELOG.md to announce its removal."
This reverts commit 4b6fa0d5fb.

BUG=
R=kevmoo@google.com

Review-Url: https://codereview.chromium.org/2928013002 .
2017-06-08 14:32:41 -07:00
Ben Konyi 4b6fa0d5fb Removed SecurityContext.alpnSupported, as ALPN is now supported on all platforms. Also updated CHANGELOG.md to announce its removal.
BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2926153004 .
2017-06-07 15:15:58 -07:00
Vijay Menon 6402ad477d Use the dart2js patch for dart:convert to get latest type fixes
BUG=
R=floitsch@google.com

Review-Url: https://codereview.chromium.org/2896253003 .
2017-05-24 07:33:19 -07:00
Bob Nystrom 4145a49503 Move Dart versions of math.min() and math.max() into VM patch file.
For DDC and dart2js, we call the corresponding JS function. This is
shorter and avoids a strong mode type error in the Dart implementation.

R=jmesserly@google.com, lrn@google.com

Review-Url: https://codereview.chromium.org/2858353003 .
2017-05-05 15:15:21 -07:00
Lasse R.H. Nielsen 7998f590b1 Update documentation on trignometric functions.
Fixes #17515
BUG= http://dartbug.com/17515
R=floitsch@google.com

Committed: https://github.com/dart-lang/sdk/commit/40220ec0766bb2b179d3623d3f298223df842279
Review-Url: https://codereview.chromium.org/2852053002 .
2017-05-03 09:49:14 +02:00
Florian Loitsch 05e0e1ea40 Revert trigonometric function updates.
The VM has a fingerprint on the function and failed during compilation.

Revert "Fix patch errors."

This reverts commit ff1d7488d9.

Revert "Update documentation on trignometric functions."

This reverts commit 40220ec076.

BUG=

Review-Url: https://codereview.chromium.org/2851163003 .
2017-05-01 16:06:56 +02:00
Florian Loitsch ff1d7488d9 Fix patch errors.
Review-Url: https://codereview.chromium.org/2853813002 .
2017-05-01 15:57:40 +02:00
Bob Nystrom 7f7c681893 Fix a batch of DDC SDK compile errors.
R=floitsch@google.com, vsm@google.com

Review-Url: https://codereview.chromium.org/2848703003 .
2017-04-27 17:27:02 -07:00
Zachary Anderson 9ce608e89d [dart:io] Adds ProcessInfo.{max,current}Rss. Adds OS::MaxRSS on Fuchsia.
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2822943002 .
2017-04-17 14:41:40 -07:00
Ben Konyi 6fbdd19ddb Various fixes for sync socket implementation.
Revert "Revert "Added sync_socket.h include in sync_socket_win.cc""

This reverts commit 2bd6168e1ebf35f6dbd9b2724339362c493377fc.

Revert "Revert "Added synchronous socket implementation to dart:io.""

This reverts commit a47bce03f5502dac7fb12e777e87b5aa1cfc830b.

BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2814773004 .
2017-04-12 14:20:48 -07:00
Ben Konyi b439bd9a54 Revert "Added synchronous socket implementation to dart:io."
This reverts commit a1f87ebdb8.

Revert "Added sync_socket.h include in sync_socket_win.cc"

This reverts commit bdec13e865.

BUG=

Review-Url: https://codereview.chromium.org/2812153002 .
2017-04-11 15:18:46 -07:00
Ben Konyi a1f87ebdb8 Added synchronous socket implementation to dart:io.
BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2803543006 .
2017-04-11 14:41:09 -07:00
Zach Anderson bc923bed16 [dart:io] Reland: Adds Platform.localeName
The Mac OS build broke because a typedef wasn't added until 10.12.

related #29126

Review-Url: https://codereview.chromium.org/2786183003 .
2017-03-30 13:51:46 -07:00
Zachary Anderson e75df3cce3 Revert "[dart:io] Adds Platform.localeName"
This reverts commit ae6d854ec6.

The build failed on the mac build bots. Need to investigate.

Review-Url: https://codereview.chromium.org/2791453002 .
2017-03-30 13:35:02 -07:00
Zachary Anderson ae6d854ec6 [dart:io] Adds Platform.localeName
related #29126

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2785073002 .
2017-03-30 13:31:11 -07:00
Vijay Menon ac68d598cf Add patch code for List.filled growable param
Looks like a missing param doesn't break patch_sdk.  I think this was a recent add.

Fixes #28508

R=jakemac@google.com, jmesserly@google.com

Review-Url: https://codereview.chromium.org/2771953004 .
2017-03-24 14:27:47 -07:00
Jennifer Messerly 13d6c5cd98 fix ddc build, adds some unsupported methods to dart:io
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2756463006 .
2017-03-17 16:23:52 -07:00
Jacob Richman 9484ac8bdf Format all dart dev compiler files
BUG=
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2752163002 .
2017-03-15 21:34:25 -07:00
Vijay Menon 338304a6c7 Fix DDC patch
TBR'ing to get build green.

TBR=rnystrom@google.com

Review-Url: https://codereview.chromium.org/2749703006 .
2017-03-15 09:23:49 -07:00
Jennifer Messerly fe294f3753 unfork DDC's copy of most SDK libraries
There's some changes in strong mode errors we may want to follow up on.

Unforks the following: async, collection, convert, core, developer, internal, io, isolate, math, mirrors.

Does not unfork: html, indexed_db, js, js_util, svg, typed_data, web_audio, web_gl, web_sql.

R=vsm@google.com

Review-Url: https://codereview.chromium.org/2698353003 .
2017-02-28 17:10:52 -08:00
Vijay Menon 53971cb67e Fix Function.apply
Fixes #27257.

R=alanknight@google.com, jmesserly@google.com

Review-Url: https://codereview.chromium.org/2716583006 .
2017-02-24 19:24:48 -08:00
Jacob Richman a8c7e74424 Remove dynamic call from _LinkedHashSet. Remove some dcalls from the dart:html util library.
BUG=
R=alanknight@google.com, vsm@google.com

Review-Url: https://codereview.chromium.org/2666053004 .
2017-02-01 13:26:41 -08:00
Jacob Richman f3c33b047d Remove spurious call to captureStackTrace.
Just creating an Error object is sufficient on FF,
Chrome, Safari, and Edge. Note that captureStackTrace
was not supported by other browsers so those browsers
were going down the even slower path of throwing an
exception.

BUG=
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2668503002 .
2017-01-30 13:30:31 -08:00
Vijay Menon be95523221 Cleanup references to the old DDC repo
Reachable issues migrated over.

R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2621543004 .
2017-01-10 12:56:29 -08:00
Vijay Menon dd16c377fb Enable more async code on node
This is primarily for easier testing/repro on node which has "global",
but not "self".

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/2558133002 .
2016-12-07 10:52:04 -08:00
Bob Nystrom aa749dbd8d Sprinkle some types on the SDK like the static typing fairy.
When I'm looking at the dynamic call profiles of an internal app test,
I see a bunch coming from the SDK itself. In fact, the top five most
common dynamic call sites are in the SDK.

This fixes four of them. (The fifth is in runUnary() in Zone, and I
don't think can be made typed yet.)

R=vsm@google.com

Review URL: https://codereview.chromium.org/2542723003 .
2016-11-30 17:04:54 -08:00
Alan Knight 667fc8dbe9 Make the dart:developer library available in DDC so debugger statement works
BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org/2534263002 .
2016-11-29 16:13:45 -08:00