Commit graph

13370 commits

Author SHA1 Message Date
Martin Kustermann dbb1d3d44f Revert "[VM] Introduction of type testing stubs - Part 1-4"
This reverts commit 2c52480ec8.
This reverts commit 25f98bcc75.
This reverts commit f226c22424.
This reverts commit 165c583d57.

Change-Id: I3892d672b9ca0b0acc0b9b83c32ecc92355839c2
Reviewed-on: https://dart-review.googlesource.com/49843
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-04-06 08:35:01 +00:00
Martin Kustermann 2c52480ec8 [VM] Introduction of type testing stubs - Part 4
In order to avoid generating type testing stubs for too many types in
the system - and thereby potentially cause an increase in code size -
this change introduces a smarter way to decide for which types we should
generate optimized type testing stubs.

The precompiler creates a [TypeUsageInfo] which we use to collect
information.  More specifically:

   a) We collect the destination types for all type checks we emit
      (we do this inside AssertAssignableInstr::EmitNativeCode).

      -> These are types we might want to generate optimized type testing
         stubs for.

   b) We collect type argument vectors used in instance creations (we do
      this inside AllocateObjectInstr::EmitNativeCode) and keep a set of
      of used type argument vectors for each class.

After the precompiler has finished compiling normal code we scan the set
of destination types collected in a) for uninstantiated types (or more
specifically, type parameter types).

We then propagate the type argument vectors used on object allocation sites,
which were collected in b), in order to find out what kind of types are flowing
into those type parameters.

This allows us to extend the set of types which we test against, by
adding the types that flow into type parameters.

We use this final augmented set of destination types as a "filter" when
making the decision whether to generate an optimized type testing stub
for a given type.

Issue https://github.com/dart-lang/sdk/issues/32603

Measured impact on flutter HEAD-HEAD-HEAD with TTS Part 1 - 4 applied (2018-04-03):

      * stock build benchmark: around 4% improvement
      * gallery app.so size: -2.68%  (13987348 -> 13612928)
      * gallery memory: no sigificant changes:
         - SubtypeTestCache: - 10kb
         - ObjectPool: + 6 kb
         - Type: no change (probably due to wasted alignment slot before)
         - TypeParameter: + 4 kb (can get rid of the field here later)
      * gallery AOT compile-time: measured +1.3%, inside flakiness range

Change-Id: I12a398d18f970ba2db741913bb47b0f36ae38d58
Reviewed-on: https://dart-review.googlesource.com/48640
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-04-06 07:00:50 +00:00
Martin Kustermann 25f98bcc75 [VM] Introduction of type testing stubs - Part 3
The changes include:

  * Make AssertAssignableInstr no longer have a call-summary, which
    helps methods with several parameter checks by not having to
    re-load/re-initialize type arguments registers

  * Lazily create SubtypeTestCaches: We already go to runtime to warm up
    the caches, so we now also create the caches on the first runtime
    call and patch the pool entries.

  * No longer load the destination name into a register: We only need
    the name when we throw an exception, so it is not on the hot path.
    Instead we let the runtime look at the call site, decoding a pool
    index from the instructions stream.  The destination name will be
    available in the pool, at a consecutive index to the subtype cache.

  * Remove the fall-through to N=1 case for probing subtypeing tests,
    since those will always be handled by the optimized stubs.

  * Do not generate optimized stubs for FutureOr<T> (so far it just
    falled-through to TTS).  We can make optimzed version of that later,
    but it requires special subtyping rules.

  * Local code quality improvement in the type-testing-stubs: Avoid
    extra jump at last case of cid-class-range checks.

There are still a number of optimization opportunities we can do in
future changes.

Issue https://github.com/dart-lang/sdk/issues/31798

Change-Id: I4dc5a8a49f939178fe74d44736ef69e4b9088e46
Reviewed-on: https://dart-review.googlesource.com/46984
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-04-06 07:00:50 +00:00
Martin Kustermann f226c22424 [VM] Introduction of type testing stubs - Part 2
This CL starts building type testing stubs specialzed for [Type] objects
we test against.

More specifically, it adds support for:

  * Handling obvious fast cases on the call sites (while still having a
    call to stub for negative case)

  * Handling type tests against type parameters, by loading the value
    of the type parameter on the call sites and invoking it's type testing stub.

  * Specialzed type testing stubs for instantiated types where we can
    do [CidRange]-based subtype-checks.

    ==> e.g. String/List<dynamic>

  * Specialzed type testing stubs for instantiated types where we can
    do [CidRange]-based subclass-checks for the class and
    [CidRange]-based subtype-checks for the type arguments.

    ==> e.g. Widget<State>, where we know [Widget] is only extended and not
	     implemented.

  * Specialzed type testing stubs for certain non-instantiated types where we
    can do [CidRange]-based subclass-checks for the class and
    [CidRange]-based subtype-checks for the instantiated type arguments and
    cid based comparisons for type parameters.  (Note that this fast-case migth
    result in some false-negatives!)

    ==> e.g. _HashMapEntry<K, V>, where we know [_HashMapEntry] is only
	     extended and not implemented.

   This optimizes cases where the caller uses `new HashMap<A, B>()` and only
   uses `A` and `B` as key/values (and not subclasses of it).  The false-negative
   can occur when subtypes of A or B are used.  In such cases we fall back to the
   [SubtypeTestCache]-based imlementation.

Issue https://github.com/dart-lang/sdk/issues/31798

Change-Id: Ic1853977bf55d815755b0d652ec8e20e51efb4cf
Reviewed-on: https://dart-review.googlesource.com/44788
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-04-06 07:00:50 +00:00
Martin Kustermann 165c583d57 [VM] Introduction of type testing stubs - Part 1
This CL:

  * Adds a field to [RawAbstractType] which will always hold a pointer
    to the entrypoint of a type testing stub

  * Makes this new field be initialized to a default stub whenever a
    instances are created (e.g. via Type::New(), snapshot reader, ...)

  * Makes the clustered snapshotter write a reference to the
    corresponding [RawInstructions] object when writing the field and do
    the reverse when reading it.

  * Makes us call the type testing stub for performing assert-assignable
    checks.

To reduce unnecessary loads on callsites, we store the entrypoint of the
type testing stubs directly in the type objects.  This means that the
caller of type testing stubs can simply branch there without populating
a code object first.  This also means that the type testing stubs
themselves have no access to a pool and we therefore also don't hold on
to the [Code] object, only the [Instruction] object is necessary.

The type testing stubs do not setup a frame themselves and also have no
safepoint.  In the case when the type testing stubs could not determine
a positive answer they will tail-call a general-purpose stub.

The general-purpose stub sets up a stub frame, tries to consult a
[SubtypeTestCache] and bails out to runtime if this was unsuccessful.

This CL is just the the first, for ease of reviewing.  The actual
type-specialized type testing stubs will be generated in later CLs.

Issue https://github.com/dart-lang/sdk/issues/31798

Change-Id: I174a11b3b812799f399a60af799144c2ba3c26ec
Reviewed-on: https://dart-review.googlesource.com/44787
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-04-06 07:00:50 +00:00
Ryan Macnak 077e8df630 [vm] Remove Dart_InterruptIsolate.
This is leftover from Dartium's debugger. It was paired with Dart_SetIsolateEventHandler, which has already been removed.

Bug: https://github.com/dart-lang/sdk/issues/32801
Change-Id: I9a7ced082fae36654fb8f1a5fad70d2cc0b4d053
Reviewed-on: https://dart-review.googlesource.com/49828
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-04-06 01:00:30 +00:00
Ben Konyi f5da30ef13 [ VM / Hot Reload ] Fixed IsolateReload_TearOff_Parameter_Count_Mismatch failing in non-strong mode (Fixes issue 32781).
Change-Id: If1d0cd92e0658640b243c0fc0f9aae161322309a
Reviewed-on: https://dart-review.googlesource.com/49824
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-04-05 22:14:53 +00:00
Ryan Macnak d96b26a78a [vm] Remove Dart_HandleMessages.
Use of this API was removed from Tonic because it did not correctly handle microtasks.

Change-Id: Ifff8a16c61f8df1c0a75b5da37e37f82fdf7bc49
Reviewed-on: https://dart-review.googlesource.com/25511
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-04-05 21:42:38 +00:00
Ryan Macnak 279e1083f1 [vm, reload] Disable check for leaked reload context.
The reload stress flags still have outstanding leaks.

Bug: https://github.com/dart-lang/sdk/issues/32796
Change-Id: I4b75c39270b3e5250ed4e437746e9dbb0054c875
Reviewed-on: https://dart-review.googlesource.com/49821
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-04-05 21:18:59 +00:00
Alexander Markov b29f19f4e1 [vm] In strong mode, only check for null in AssertBoolean
In strong mode, type of an expression used in AssertBoolean is already
checked and known to be 'bool' (either at compile time, or by additional
type checks inserted by CFE). So, AssertBoolean instruction should
only ensure that the value is not null.

AOT snapshot size of flutter_gallery:

Before:
Instructions(CodeSize): 7357472
Total(CodeSize): 11898596

After:
Instructions(CodeSize): 7297024
Total(CodeSize): 11833828

Issue: https://github.com/dart-lang/sdk/issues/32718
Change-Id: If5da3d5275b2fb45f240f333d8f4408d67fb8bef
Reviewed-on: https://dart-review.googlesource.com/49760
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-04-05 18:36:51 +00:00
Ryan Macnak 09e1766e6c [vm] Omnibus memory leaks.
- Fix leak of IsolateReloadContext.
 - Fix leak kernel compilation request arguments.
 - Fix leak kernel compilation result errors in reload harness.
 - Fix leak of class table when a schema changes but there are no instances.
 - Fix leak of kernel::Reader during inlining bailout.

Bug: https://github.com/dart-lang/sdk/issues/32187
Bug: https://github.com/dart-lang/sdk/issues/28349
Change-Id: I9ccc65e018c30a3254e928a43b9727ae8d9314d6
Reviewed-on: https://dart-review.googlesource.com/49547
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-04-05 18:12:11 +00:00
Jens Johansen b2d7749643 Fix issue with missing sources
Before this CL, if initializing from a dill file, and then,
at a subsequent call to computeDelta asks for the full Component,
the sources from the originally loaded libraries was missing.
This also meant that some fileUris were missing.

This can basically break Flutter.

This CL introduces tests that catch this, fixes the issue and bumps the
kernel version to force recompilation in Flutter.

Change-Id: I9f62962db017cec232855377835103ffc324820b
Reviewed-on: https://dart-review.googlesource.com/49642
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-04-05 13:23:07 +00:00
Erik Corry 3acccedc40 Mark IsolateReload_TearOff_Parameter_Count_Mismatch failing
TBR=bkonyi@google.com

Change-Id: I3e2805c677b3c7f36c6a8c9bc1f82d47963e3920
Reviewed-on: https://dart-review.googlesource.com/49682
Reviewed-by: Erik Corry <erikcorry@google.com>
2018-04-05 11:44:23 +00:00
asiva 64315ae3a2 Skip Observatory UI tests on old browsers.
Change-Id: I7d7cc7780b9264896979111c93d11a5dc5d3f277
Reviewed-on: https://dart-review.googlesource.com/49621
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-04-05 00:42:35 +00:00
Ryan Macnak 7a3e852ebe [vm] Fix leak of kernel service's IsolateData in vm/cc tests.
Bug: https://github.com/dart-lang/sdk/issues/32616
Bug: https://github.com/dart-lang/sdk/issues/32187
Change-Id: I1d572b10c82cb157341241268d974ef087fe897f
Reviewed-on: https://dart-review.googlesource.com/49542
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-04-05 00:26:55 +00:00
Alexander Aprelev 85ee5ad29b Add timeline logging to kernel-related calls.
Bug: https://github.com/dart-lang/sdk/issues/32755
Change-Id: I3e8b22583090d264b96824a1478d635d1bc80a67
Reviewed-on: https://dart-review.googlesource.com/49300
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-04-04 23:56:56 +00:00
Ryan Macnak 3a3d2c0167 Revert "[vm, reload] Fix leak when shape changes but there are no instances."
This reverts commit deed9b0653.

Reason for revert: Debug Windows failures

Original change's description:
> [vm, reload] Fix leak when shape changes but there are no instances.
> 
> Fix leak of reload context when used by the test harness.
> 
> Bug: https://github.com/dart-lang/sdk/issues/28349
> Change-Id: I2d1bda5537befddbd1e615b355654a9fefc08273
> Reviewed-on: https://dart-review.googlesource.com/49321
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

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

Change-Id: I6f351645e1c9af4c2cbf1bbffdc339b68a11dbd5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/28349
Reviewed-on: https://dart-review.googlesource.com/49620
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-04-04 23:23:56 +00:00
Ben Konyi 090d9e9231 [ VM / Dart 2 ] Reland: Fixed StackTraceFormat test to expect file URIs in stacks generated by the Dart frontend.
This reverts commit a81f4babcc.

Change-Id: I88f0d004640dd1a994b211ab2a698fd2f87afeca
Reviewed-on: https://dart-review.googlesource.com/49540
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-04-04 21:28:16 +00:00
Ben Konyi f2bf297aa4 [ VM / Hot Reload ] Fixed missing NoSuchMethod exceptions when hot reloading in situations with tearoffs.
Change-Id: I43ebfe2d788114d028eebbe675308c272972e06d
Reviewed-on: https://dart-review.googlesource.com/49281
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-04-04 19:38:25 +00:00
Ryan Macnak deed9b0653 [vm, reload] Fix leak when shape changes but there are no instances.
Fix leak of reload context when used by the test harness.

Bug: https://github.com/dart-lang/sdk/issues/28349
Change-Id: I2d1bda5537befddbd1e615b355654a9fefc08273
Reviewed-on: https://dart-review.googlesource.com/49321
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-04-04 18:10:05 +00:00
Régis Crelier bd6e66c538 [VM runtime] Ignore 'implements Function' in strong mode type tests (fixes #32154).
Change-Id: I7d53594e6ffaef616b3384e073e2240a8ca7017c
Reviewed-on: https://dart-review.googlesource.com/49080
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2018-04-04 17:52:55 +00:00
Peter von der Ahé 47f09a619e Redesign LibraryPart
Before, the part-URI was serialized as a file-URI and conflated with
source location information. The part-URI is the URI in the following
declaration in a Dart source file:

   part "URI";

This is different from what we normally call a file-URI. A file URI
is used to point to the source location of the part declaration, not
the URI in the part declaration.

Furthermore, the field was serialized using writeUriReference which
only works for URIs that are in the uriToSource map on a Component.
Although this might seem like a safe optimization, it doesn't work
if the uriToSource map is omitted or if a part declaration refers to
a missing file.

Finally, due to the confusing use of fileUri, LibraryPart was
mistakenly implementing FileUriNode and annotations were stripped
of source locations if the source for the part were omitted from
uriToSource.

The partUri field is now an unresolved string that can be resolved
against either the parent library's import- or file-URI to obtain
either version as needed.

Change-Id: I255cb4eeaf89928292ab32a2f6be9ead6cc8cee1
Reviewed-on: https://dart-review.googlesource.com/49500
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-04-04 16:08:57 +00:00
Alexander Markov d39e5ccf4d [vm/compiler] Fix assignment of type to phi, take 2
Fixes https://github.com/dart-lang/sdk/issues/32597

Change-Id: I92fe329430420d5bf35f03763ec5b656bd034f6f
Reviewed-on: https://dart-review.googlesource.com/48443
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-04-03 20:32:09 +00:00
Ryan Macnak bfb9fae597 [vm] Don't keep events in memory when using systrace/traceutil.
Change-Id: Ic784e1f6c95d1c544958ec5510c168d3d58f50fb
Reviewed-on: https://dart-review.googlesource.com/48820
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-04-02 18:34:35 +00:00
Ryan Macnak 3db2338283 [vm] Remove old --break_at_isolate_spawn.
This has long been replaced with --pause_isolates_on_start.

Change-Id: Ibf5850473b0d2090ec8ff244897a214149fb250c
Reviewed-on: https://dart-review.googlesource.com/48882
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-03-30 22:52:02 +00:00
asiva c1432bf7a3 [observatory] Remove references to pkg:browser from web/index.html
Updated version of dart-lang/observatory_pub_packages in DEPS

Updated generated pubspec.yaml file after removing web_components from
third_party/observatory_pub_packages

This should fix part of issue https://github.com/dart-lang/sdk/issues/32539

Bug: 32539
Change-Id: I3d48fd59f1fedc9d64a652cde7d0229c0a7ace28
Reviewed-on: https://dart-review.googlesource.com/48804
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2018-03-30 21:13:52 +00:00
Ben Konyi 52afcba357 [ VM ] Fixed issue where process was suspended at exit when backgrounded.
Restoring console state when backgrounded causes SIGTTOU to be raised by
tcsetattr, which has the affect of suspending the process instead of
allowing it to complete. Blocking SIGTTOU results in tcsetattr failing
gracefully and the process running to completion.

Change-Id: I605dccbdbf311697881e5729e4fd64f1d60ed6b1
Reviewed-on: https://dart-review.googlesource.com/48823
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-03-30 20:33:12 +00:00
Ryan Macnak 4c0a09b79f [vm-service] Add setFlag.
Bug: https://github.com/dart-lang/sdk/issues/32709
Change-Id: I7777b005c477574c93430d56ede6cde2cd421203
Reviewed-on: https://dart-review.googlesource.com/48803
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Todd Volkert <tvolkert@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-03-30 18:17:55 +00:00
Ian McKellar 477a773cdb [fidl] Port Dart runtime to FIDL2.
Change-Id: I0423c17514027b282856f5796a550ceaa3b66baf
Reviewed-on: https://dart-review.googlesource.com/48840
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Adam Barth <abarth@google.com>
2018-03-30 05:23:36 +00:00
Régis Crelier b05ba71b0c [VM runtime] Minor clean up of type test with non-function type object.
Change-Id: I2d15c43d12f143d6566615c7b95fff678408beb5
Reviewed-on: https://dart-review.googlesource.com/48500
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-29 21:52:32 +00:00
Régis Crelier 7d90df42f1 [Kernel, VM runtime] Hook up bool checks in strong mode (fixes #32336).
Update kernel status file.

Change-Id: I08b153d431c15870e0251e7dd760213c795579c9
Reviewed-on: https://dart-review.googlesource.com/48707
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-03-29 16:10:52 +00:00
Ryan Macnak d9c3190e44 [vm] Remove some bin -> vm includes.
Change-Id: Id304de9618a299a201b946a901a54352772f56fb
Reviewed-on: https://dart-review.googlesource.com/48704
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-03-28 23:16:09 +00:00
Ryan Macnak 3dcdaf9e57 [vm] Check for OOM when allocating a new handle block.
Bug: https://github.com/dart-lang/sdk/issues/32706
Change-Id: I0159d794e11c18f24204d11d9ba3bbfe8a5a4140
Reviewed-on: https://dart-review.googlesource.com/48706
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-03-28 23:08:39 +00:00
Zach Anderson 865f52737a [dart:io] Adds IOOverrides.socketConnect
fixes #32535

Change-Id: I335e3698ec3505114d480ae6179254fa0ade3f7a
Reviewed-on: https://dart-review.googlesource.com/48702
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Todd Volkert <tvolkert@google.com>
2018-03-28 23:07:49 +00:00
Ben Konyi 4b682341d9 [ VM / Dart 2 ] Marked tests that exercise functionality not supported in Dart 2 as SkipByDesign.
Change-Id: I9e02b2663a00861c4e11dd21cc74bd32bbef33cb
Reviewed-on: https://dart-review.googlesource.com/47420
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-03-28 20:45:48 +00:00
Zach Anderson 0482cf4da1 [fuchsia] Add rules to build gen_snapshot targeting Fuchsia
This change enables building a gen_snapshot that targets Fuchsia during
an SDK build that targets the host (Mac, Linux).

Change-Id: I4cfbcbe4e26e4be7108fc40c96122fe9a2fb4c19
Reviewed-on: https://dart-review.googlesource.com/48683
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-03-28 19:39:49 +00:00
Ben Konyi 42581e4fa6 [VM] Added '--enable-asserts' to the top-level help message.
Change-Id: I91b22cc1563b7c5217f21032109d948a5bb78b57
Reviewed-on: https://dart-review.googlesource.com/48456
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-03-28 18:54:00 +00:00
Régis Crelier 85b4c604c5 [VM runtime] Improve type error messages in Dart 2 (fixes #32564).
Hide private class _Future and map it to core lib class Future.
In Dart 2, show dynamic as type argument(s) of raw generic types.

Change-Id: I70b0e1707bc767d04838ac12d16b3ad15623f51f
Reviewed-on: https://dart-review.googlesource.com/48502
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-03-28 17:12:04 +00:00
Alexander Markov c60199cf86 [vm/kernel/aot] Tree shaking based on results of TFA, take 2.
This is a re-landing of

06ebf884db

after the fix was submitted separately at

e3b9c2860e

Original review: https://dart-review.googlesource.com/c/sdk/+/46942

Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: I2d3a10acb9b5af0184b3d1504acb2f4ebebfff8a
Reviewed-on: https://dart-review.googlesource.com/48440
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-03-27 23:39:24 +00:00
Samir Jindel 70f455351d [kernel] Add field for instantiate-to-bounds algorithm in TypeParameter.
Change-Id: Idd1859b378080f01dc5d5078ee0960021c1689b6
Reviewed-on: https://dart-review.googlesource.com/48424
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-03-27 22:26:07 +00:00
Ben Konyi e305117519 [ VM / Flutter ] Replaced NO_RETRY_EXPECTED with VOID_TEMP_FAILURE_RETRY in console_posix.cc:69.
Change-Id: Iaa5772476bfc81b01a646b16a9d8280ef0edf788
Reviewed-on: https://dart-review.googlesource.com/48465
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-03-27 19:15:22 +00:00
Samir Jindel eeba621943 [kernel/vm] Build NSM forwarders for getters and setters.
They are necessary for performing type-checks.

Change-Id: Ie30f0617488730d920c00229fb2ec358cc8d6c4b
Reviewed-on: https://dart-review.googlesource.com/48421
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-27 14:40:04 +00:00
Ben Konyi 6e0f2f4e47 [ VM / Dart 2 ] Fixed StackOverflow tests.
Made modifications to the original VM flow graph builder so the token
position for the top frame of the overflow stack is the same as the
token position of the method (before we pointed to the opening '{' or
'=>').

Change-Id: I5c878fc238898e2fea197ea80ed4e320adca9439
Reviewed-on: https://dart-review.googlesource.com/48448
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-26 23:47:11 +00:00
Ben Konyi a7e3c2e365 [ VM / Dart 2 ] Fixed strong-mode issue in Native SendPort tests.
Change-Id: I37a437d338d67095038130981b5fa947e0425b9d
Reviewed-on: https://dart-review.googlesource.com/48452
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-03-26 22:42:02 +00:00
Samir Jindel 83c5778345 [kernel/vm] Cleanup NSM forwarding.
Change-Id: Ia2077d2752fbeb45da7d1051cdab0c16d67377d0
Reviewed-on: https://dart-review.googlesource.com/48420
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-26 22:34:02 +00:00
Alexander Markov 7386d7b5ec Revert "[vm/kernel/aot] Tree shaking based on results of TFA"
This reverts commit 06ebf884db.

Reason for revert: buildbot failures.

Change-Id: Ie6b33061cad80ae3b20b773cc435d64a755620fc
Reviewed-on: https://dart-review.googlesource.com/48263
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-23 22:57:19 +00:00
Alexander Markov 06ebf884db [vm/kernel/aot] Tree shaking based on results of TFA
This CL adds tree shaking transformation into TFA transformer, replacing
simple DropMethodBodiesVisitor. In addition to removing bodies of
unreachable members, tree shaker is able to remove unused classes, typedefs
and member declarations, and replace unreachable calls with 'throw'.

Total(CodeSize) of flutter_gallery in --release mode
before: 11,671,369
after:  11,499,694

https://github.com/dart-lang/sdk/issues/30480

Change-Id: I966cf222eb9725b7a75dd193ac479436b9b9b4c3
Reviewed-on: https://dart-review.googlesource.com/46942
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-23 22:21:39 +00:00
Ben Konyi 2187286251 [ VM / Dart 2 ] Fixed Mixin_PrivateSuperResolutionCrossLibraryShould fail which was expecting a NoSuchMethod error instead of a compilation error in strong-mode.
Fixes part of issue 32190.

Change-Id: Iab0d304b4c77deb57c449788797300d38087466b
Reviewed-on: https://dart-review.googlesource.com/47946
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-03-23 15:43:09 +00:00
Ben Konyi e11fcdc266 [ VM ] Added issue number to FunctionSourceFingerprint failure status entry.
Context: https://github.com/dart-lang/sdk/issues/30756

Change-Id: I4fc914cfecb2656a87f68170a79e85a0055c903e
Reviewed-on: https://dart-review.googlesource.com/47920
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-03-23 15:27:52 +00:00
Ben Konyi edf039d510 [ VM / Dart 2 ] Made StackMapGC test strong-mode clean. Fixes part of 32190.
Change-Id: I09d519a950c1e3c825c89a1f5e22292cedc6c14a
Reviewed-on: https://dart-review.googlesource.com/47941
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-03-22 19:36:04 +00:00
Ryan Macnak 77239ee1db [fuchsia] Replace use of deprecated fdio_get_vmo with fdio_get_vmo_clone.
Change-Id: I8961ed49c6e9269c3cb8699037717d7007e630a8
Reviewed-on: https://dart-review.googlesource.com/47905
Reviewed-by: Zach Anderson <zra@google.com>
2018-03-22 19:26:08 +00:00
Samir Jindel 95e9e890a9 [kernel/vm] Implement NSM-forwarding in the VM.
Change-Id: I43ce98235a7fdb43f99f433ef8dd10a6ed08fbbb
Reviewed-on: https://dart-review.googlesource.com/47621
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-22 19:14:04 +00:00
Vyacheslav Egorov 691bb9b299 [vm/compiler] Add a comment about MakeTemporary limitation.
You can't use it in a way that would require Phi in the SSA form
because SSA construction does not support generating phi-functions
for the expression stack.

Change-Id: I57a029412cbdd796ecfd3cdbd0ec68e0dbca2356
Reviewed-on: https://dart-review.googlesource.com/47740
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-22 10:04:33 +00:00
Ben Konyi 3a81263fee [ VM / Dart 2] Split DartAPI_PropagateError into DartAPI_PropagateError and DartAPI_PropagateCompileError since the compile time error from the missing semicolon prevented the code from being executed in Dart 2.
Change-Id: Iee9344e9246ce07a04cc99b57df31aff14f30458
Reviewed-on: https://dart-review.googlesource.com/47301
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-03-22 05:17:56 +00:00
Ben Konyi 068be3b656 [ VM / Dart 2 ] Fixed issue where TokenPosition::kNoSource was being registered as the position of native methods. Fixes DartAPI_CurrentStackTraceInfo
Change-Id: Ieae720357d1830c277f3e182f07afdfaa7a94e91
Reviewed-on: https://dart-review.googlesource.com/47665
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-03-22 00:05:56 +00:00
Régis Crelier f2806ab624 [Corelib, VM runtime] Fix handling of zero operand in Bigint operations (fixes #32465).
Fix VM, dart2js, and dcc Bigint implementations.
Add shift tests.
Re-enable Bigint intrinsics on VM.

Change-Id: Iec19eac8069cf17783a5346289ea2745ffcc7c26
Reviewed-on: https://dart-review.googlesource.com/46570
Reviewed-by: Florian Loitsch <floitsch@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-21 21:44:10 +00:00
Ben Konyi a81f4babcc Revert "[ VM / Dart 2 ] Fixed StackTraceFormat test to expect file URIs in stacks generated by the Dart frontend."
This reverts commit ae130bc187.

Reason for revert: snprintf doesn't like positional format strings on Windows.

Original change's description:
> [ VM / Dart 2 ] Fixed StackTraceFormat test to expect file URIs in stacks generated by the Dart frontend.
> 
> Change-Id: I26f09e094e934485575e55a6a60a8fccfbd94aa7
> Reviewed-on: https://dart-review.googlesource.com/47520
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

TBR=bkonyi@google.com,rmacnak@google.com,zra@google.com,asiva@google.com

Change-Id: Idbc15d59bcc7ff3534010f6c93cebdcc89c935fc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/47640
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-03-21 20:20:45 +00:00
Ben Konyi ae130bc187 [ VM / Dart 2 ] Fixed StackTraceFormat test to expect file URIs in stacks generated by the Dart frontend.
Change-Id: I26f09e094e934485575e55a6a60a8fccfbd94aa7
Reviewed-on: https://dart-review.googlesource.com/47520
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-03-21 20:03:46 +00:00
Ben Konyi fe5e2444ad [ VM / Dart 2 ] Fixed DartAPI_InvokeCrossLibrary test.
Change-Id: I4346fd8aa43c375bb3ff0b96d8aad850303df9c0
Reviewed-on: https://dart-review.googlesource.com/47501
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-03-21 17:33:20 +00:00
Martin Kustermann 521846c832 [VM] When generating the token position list for each line (for a [Script]), only scan relevant classes/functions/fields
The source-based pipeline was simply iterating the token script of a
[Script] to generate a list of (line, [token positions]) tuples.

The kernel-based pipeline is not based on the source (and therefore also
not based on the token stream).  Instead it's based on information from
two places:

  a) The .dill file constains a delta-encoded list of line start file
     offsets.  This line starts array is attached to [Script] objects via
     [RawScript.line_starts_].

  b) It scans the *entire* isolate's program structure (i.e. libraries,
     classes, functions and fields) and does abstract interpretation
     of the kernel blob (ast) and saves the encountered token positions
     on the side.  Afterwards the token positions are merged together
     with the line-starts from a) which then produces the list of (line,
     token positions) tuples.

This CL changes b) to only do the abstract interpretation of
functions/fields which are relevant for the [Script] we are generating
the list of (line, [token position]) tuples for.

Nonetheless, b) will still iterate over the entire isolate's program
structure to find all possible elements belonging to a specific
[Script].  This is a separate issue which should be handled.


On one example it reduces time to get the coverage from ~ 35 seconds to 9.5
seconds (baseline from dart-v1 is around 6.5 seconds).

Issue https://github.com/dart-lang/sdk/issues/32562

Change-Id: I64cda28666c732938379cdf4b2ac62a2371cb3b7
Reviewed-on: https://dart-review.googlesource.com/47080
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-21 14:59:55 +00:00
Martin Kustermann 31dd6683f8 [VM] Optimize performance of dart_boostrap in debug-kernel-strong mode.
Since the kernel reading helpers have been extended to not only work
with a kernel blob in C heap, but also work based on a [TypedData]
buffer in the VM heap, access to the [TypedData] buffer is on the hot
path now.

This hot path is slowing things down considerably, in particular due
to NoSafepoingScope's.

This CL removes a critical NoSafepoingScope when accessing the
[TypedData] in read-only mode.  It also allows passing in the [Thread]
directly, to avoid TLS lookups.

Issue https://github.com/dart-lang/sdk/issues/32603

Change-Id: I91955bea5cd4eddbbd21c5d3bc6813504c2cece9
Reviewed-on: https://dart-review.googlesource.com/47222
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-21 10:24:29 +00:00
Ryan Macnak 00ec3b0867 [vm] Fix several kernel-specific memory leaks.
Bug: https://github.com/dart-lang/sdk/issues/32615
Change-Id: Ic969915c6084b9deef0d86c8f8a0e9aa4f4640e5
Reviewed-on: https://dart-review.googlesource.com/47321
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2018-03-20 23:23:49 +00:00
Alexander Markov b7c3c32f63 [vm] Do not assign type to phi if it was loaded from a different local
During SSA construction in strong mode, types of local variables are
propagated (assigned) to phis which are 'loaded' from slots corresponding
to those local variables.

It is incorrect if phi was stored in a different local variable with a more
specific type and then reloaded.

After this change, type is propagated from local variable to phis only if
phi was created for this local.

Fixes https://github.com/dart-lang/sdk/issues/32597

Change-Id: I7d86c2ef79d14895c9b4c3651d0234b3f9c66173
Reviewed-on: https://dart-review.googlesource.com/47200
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-03-20 23:08:49 +00:00
Ben Konyi 06638dd17f [ VM / Dart 2 ] Removed DartAPI_NativeFieldAccess and DartAPI_InjectNativeFields1 as they were using Dart_CreateNativeWrapper which doesn't make sense in the context of Dart 2. Also did some status file cleanup and reorganization.
Change-Id: I8e8b309ba7aa453e85f6e68d96bb8b4702ff7bb4
Reviewed-on: https://dart-review.googlesource.com/47322
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-03-20 22:43:09 +00:00
Ben Konyi ec65830504 [ VM / Dart 2 ] Fixed DartAPI_LookupLibrary test which was treating the script in Dart_LoadScript as kernel instead of source.
Change-Id: I979ddd774904d4a3058ff92d93ddf9c2efe14673
Reviewed-on: https://dart-review.googlesource.com/47320
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-03-20 21:50:19 +00:00
Ryan Macnak 3989d09c95 [vm] Move writing snapshot magic value from embedder to VM.
Add Dart_IsSnapshot and Dart_IsKernel to the embedding API.

Change-Id: I7d4e1d145557e8f11dbc3c143767ad38b3615a4a
Reviewed-on: https://dart-review.googlesource.com/46360
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-03-19 17:47:55 +00:00
Lasse Reichstein Holst Nielsen a81bc639b5 Fix bug in BigInt.from with certain double values.
Add test.

Change-Id: I385f7237e1b3d004b4401e18a82919b15d097181
Reviewed-on: https://dart-review.googlesource.com/46460
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Florian Loitsch <floitsch@google.com>
2018-03-19 17:46:35 +00:00
Vyacheslav Egorov d41794ee11 [vm/compiler] Fix UB in ToIntegerConstant helper
Change-Id: I5ffbebb12bd84eacca33fb81b3df51ba4ca291a8
Reviewed-on: https://dart-review.googlesource.com/46722
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-03-19 14:12:15 +00:00
Ryan Macnak 29749cd0d0 [vm] Remove dead DFE::ReadKernelBinary.
Change-Id: I167849cc1134925819e2c51d0234d80e7bed34e3
Reviewed-on: https://dart-review.googlesource.com/46701
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-03-17 00:40:57 +00:00
Ryan Macnak d1f8f8b259 [vm] Clean up any remaining API scopes in Dart_ShutdownIsolate.
Some embedders, i.e. tonic, sometimes call Dart_ShutdownIsolate after encountering a fatal error without calling Dart_ExitScope.

Change-Id: Iedba50b6d87acd277812ca6a476964c007b5416a
Reviewed-on: https://dart-review.googlesource.com/46840
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-03-17 00:01:48 +00:00
Ryan Macnak 8590919ca6 [vm] Add a timeline stream for recording the zone high watermark.
Change-Id: Ic7f899dbb29eb732b54d7164968a176d7b1025b9
Reviewed-on: https://dart-review.googlesource.com/45544
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-16 17:43:27 +00:00
Ryan Macnak f36358c370 [vm] Replace Dart_LoadKernel with Dart_LoadLibrary/ScriptFromKernel.
Dart_LoadKernel is only used in Flutter engine and dart_runner, where it is always used as Dart_LoadKernel(Dart_ReadKernelBinary). These uses should be replaced with Dart_LoadScriptFromKernel.

Dart_LoadLibraryFromKernel is needed for loading split kernel files and implementing IsolateMirror.loadUri.

Change-Id: Ib505350eff53ec889406747f8f99393ebbdb4c7d
Reviewed-on: https://dart-review.googlesource.com/46220
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-03-15 23:24:44 +00:00
Ryan Macnak 82ed3eb9ed [vm, kernel] Fix loading enum classes from kernel when the embedder does not use DFE.
Change-Id: I3a88d1d4bb3741bf9199acd62d4be54d60849146
Reviewed-on: https://dart-review.googlesource.com/46823
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-03-15 23:05:06 +00:00
Ben Konyi 769f082ff9 [ VM / Tests ] Status file fix for IsolateReload_LibraryLookup failures.
Change-Id: Ieb3225b5388e5d2f893769d6525e61cd82477b6a
Reviewed-on: https://dart-review.googlesource.com/46703
Reviewed-by: Ben Konyi <bkonyi@google.com>
2018-03-15 00:03:28 +00:00
Ben Konyi f52af63798 [VM] Fixed issue where console state on Windows was not restored correctly.
Change-Id: I3f4814af0095f20448298c9ba45116bd8f27c352
Reviewed-on: https://dart-review.googlesource.com/46680
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-03-14 23:52:12 +00:00
Ben Konyi 0ff7eb02cf [VM] Fix for crash when changing root script uri during reload.
Change-Id: I3eec560c94022e536f6cc3623cf47cb791a9a159
Reviewed-on: https://dart-review.googlesource.com/46401
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-03-14 23:25:32 +00:00
Ben Konyi 217e3e56fa [VM] Release SignalInfo objects on Isolate shutdown. Fixes #30042.
Change-Id: I611d6729e684e2b67acaa95ec304f5242c8ef946
Reviewed-on: https://dart-review.googlesource.com/46125
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-03-14 23:14:52 +00:00
Kevin Millikin 65b19ffa3c Translate asserts in the VM-specific async translation
Translate assert statements in async functions.  The translation of
the condition subexpression can produce a sequence of statements that
have been hoisted out of it.  These need to be guarded so they are
executed only when asserts are enabled.

For this purpose, we introduce an AssertBlock.  The semantics of the
assert block:

assert { s0; ...; sn; }

is the same as:

if (assertsEnabled) { s0; ...; sn; }

where assertsEnabled is a more primitive nullary expression that is
true iff. assertions are enabled.  We chose not to encode this using a
construct like assertsEnabled because (1) we would have to support it
appearing as an arbitrary expression which we don't currently need
and (2) it requires deeper pattern matching to detect and skip the
guarded code when desired.

The translation is more complicated because if there is a message
subexpression in an assert, it is conditionally evaluated only if the
assert's condition is false.

Fixes https://github.com/dart-lang/sdk/issues/28498

Change-Id: I0912a57104ede3160533e49f65b6fb79b76f1500
Reviewed-on: https://dart-review.googlesource.com/46442
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-03-14 19:41:09 +00:00
Martin Kustermann aeee91ac5d [VM] Remaining fixes for flutter coverage issue
This CL changes:

   * package:kernel/clone.dart: To not clone file offsets if the
     file-uri we copy from is unknown.

   * package:kernel/binary/ast_to_binary.dart: To not write out file
     offsets if the file-uri is not written/indexed (which happens if
     the file uri is not in the `Program.uriToSource` map).

   * It reverts the file renaming part of 60a2cfa219 which
     fixed the name collision problem only partially (it missed to
     rename `runtime/lib/double.dart`, which is not possible because
     there's already a `double_patch.dart` file).

     Instead of renaming, we solve the problem by mangling the names as follows:

         .../sdk/lib/core/double.dart       ->  dart:core/double.dart
         .../runtime/lib/double.dart        ->  dart:core/runtime/lib/double.dart
         .../runtime/lib/double_patch.dart  ->  dart:core/runtime/lib/double_patch.dart

   * It changes the test to ignore any negative token positions.  The vm
     service does not just expose `-1` token positions for places where
     there is no source, but also e.g. `-9` (which means TokenPosition::kMethodExtractor),
     this was one reason why the appjit test failed.

   * It changes the test to try to force-compile everything (unsure if that works).

Issue https://github.com/dart-lang/sdk/issues/32489

Change-Id: Ia9f42ca9d56d987e3041175add549bb7a133f269
Reviewed-on: https://dart-review.googlesource.com/46341
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-14 17:08:17 +00:00
Erik Corry 79942bf18f [VM] Unify filter methods in assemblers
R=kustermann@google.com

Inspired by https://chromereviews.googleplex.com/593797014/
(Vipunen StoreField write-barrier improvements)
Next step is to move part of the write barrier to the end
of the function.
Bug:
Change-Id: I4d49625c9cf5b3488e4633084790f4a018021866
Reviewed-on: https://dart-review.googlesource.com/31100
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-03-14 07:38:45 +00:00
Ben Konyi b28c4664c0 Revert "[VM] Move runtime/lib/{developer,profiler,timeline}.dart -> ..._patch.dart, fix owner of constructors"
This reverts commit 60a2cfa219.

Change-Id: I6d83653c72d5e8576952a631d23be5be5d9c71f6
Reviewed-on: https://dart-review.googlesource.com/46384
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-03-13 22:24:19 +00:00
Zach Anderson ffb4bc0d5b [vm] Relax low profile period conditions
The lower profiler period should only be needed on older ARM hardware.

Change-Id: I737aee2385f74a5026d9d8155ea8e33c94d92422
Reviewed-on: https://dart-review.googlesource.com/46361
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-03-13 19:58:25 +00:00
Alexander Markov 881c0196aa [vm] Fix type test '_Closure class IS FunctionType' in strong mode
Closes https://github.com/dart-lang/sdk/issues/32508

Change-Id: Ib3455edd393d0ce5ccd5fe315f8d54f14606cc25
Reviewed-on: https://dart-review.googlesource.com/46201
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-13 19:08:56 +00:00
Martin Kustermann 8dadc89bfb [VM] Disallow ConstructorInvocation/ListLiteral/MapLiteral in constant evaluator
Change-Id: I4ef12bd25974bba9aa69127630b05f2e4fd46657
Reviewed-on: https://dart-review.googlesource.com/46241
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-13 12:59:09 +00:00
Lasse R.H. Nielsen 00dae36b47 Add of constructors to collections.
Change-Id: Ic9a180cbb758cf8fe51369d904fa4b51fd1b8e27
Reviewed-on: https://dart-review.googlesource.com/44480
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-03-13 12:57:49 +00:00
Martin Kustermann 60a2cfa219 [VM] Move runtime/lib/{developer,profiler,timeline}.dart -> ..._patch.dart, fix owner of constructors
This makes sure we can distinguish e.g. 2 different timeline.dart files
(from runtime/lib/timeline.dart and sdk/lib/developer/timeline.dart)

This CL also fixes the owner of constructors to be patch classes, if
the constructors come from a patch.

This CL also adds a service/valid_source_locations_test, which loops
over libraries/classes/fields/functions and obtains source locations for
them, including line numbers.  This ensures that if there is a source
location attached to a member, we can use it's token position to get to
the line number.

This CL also changes package:kernel's [Cloner] to clone fileOffsets (and
not just fileEndOffsets). This is important for mixin resolution, where
we copy members into mixin application classes.

Issue https://github.com/dart-lang/sdk/issues/32489

Change-Id: I4fea5cd646d81f47e1c4ede1e86d477ba6de3e82
Reviewed-on: https://dart-review.googlesource.com/46141
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-13 10:27:26 +00:00
Erik Corry 65776fdc3e [VM] ARM64: Fix tbz instruction for bit positions >= 32
R=kustermann@google.com

Change-Id: I03f42ee44a37da7e064f79db18a7f45fa25ee010
Reviewed-on: https://dart-review.googlesource.com/46063
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-03-13 09:31:50 +00:00
Jens Johansen 5e629d24ac Hot reload test that demonstrated a hot reload failure before fix
Fix was given in 66af0113de

Change-Id: I5209d4951cc00a5656e852c7c418dd198a317a5a
Reviewed-on: https://dart-review.googlesource.com/46041
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-13 08:44:42 +00:00
Adam Barth 3c6961fcc2 [fuchsia] Update to the FIDL2 String API
Change-Id: Ie7dc0ee3236587c9e86fba862c9ae2275f8e44dc
Reviewed-on: https://dart-review.googlesource.com/46200
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Adam Barth <abarth@google.com>
2018-03-12 22:58:29 +00:00
Ryan Macnak 66af0113de [vm, reload] Eagerly assign static field initializers a PatchClass owner.
Static field initializers are not added as members of their owning class, so they must be pre-emptively given a patch class to avoid the meaning of their kernel/token position changing during a reload. Member functions and fields have their owner changed to patch class only when the class is changed during a reload.

Curiously, this was originally done in the C++ front end before hot reload: https://codereview.chromium.org//1317753004

Bug: https://github.com/dart-lang/sdk/issues/32497
Change-Id: I236c188a4b9e05a1e3c011d27e123979db1ca2e5
Reviewed-on: https://dart-review.googlesource.com/46124
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-12 21:12:29 +00:00
Ben Konyi 3c8d3b6870 [VM] Refactored console configuration out of platform_*.cc into console_config.h and reapplied c9700040c3 for POSIX platforms (Windows needs more work). We may also want to move code in bin/stdio.h.
Change-Id: Ic7cbc690f490e0127387d9a23866ea7eddbc84cf
Reviewed-on: https://dart-review.googlesource.com/45746
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-03-12 20:31:09 +00:00
Ryan Macnak 180866dc46 [vm] Make Dart_DumpStackTrace work when there is no current isolate.
Bug: https://github.com/dart-lang/sdk/issues/32391
Change-Id: Idb1b44509a7bf2269e2f2c0dc1f7ffa0a2a4408c
Reviewed-on: https://dart-review.googlesource.com/44804
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-12 19:59:23 +00:00
Vyacheslav Egorov d8e96a8700 [vm/cleanup] Remove vm/cc/Sleep test.
This test was skipped for ages and it does not seem to be very useful.

Closes https://github.com/dart-lang/sdk/issues/5133.

Change-Id: I9035956069fc7d42e710c3c49f98811db10f7d36
Reviewed-on: https://dart-review.googlesource.com/46062
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-03-12 17:15:28 +00:00
Vyacheslav Egorov f0455493de [vm/kernel] Do not skip type checks on closure functions.
Fixes https://github.com/dart-lang/sdk/issues/32502

Bug: 32502
Change-Id: I3e4e9d6dd884f9660380994b24b7a263777f1a18
Reviewed-on: https://dart-review.googlesource.com/46066
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-03-12 17:13:20 +00:00
Vyacheslav Egorov 009b6673ce [vm/kernel] Make 'unsupported tag' errors more verbose
This simplifies figuring out what went wrong from just
debugging output in some cases.

Change-Id: Ie7a775c57fb691d6bd3ca1c70a04fb6cbe9e0875
Reviewed-on: https://dart-review.googlesource.com/43060
Reviewed-by: Jens Johansen <jensj@google.com>
2018-03-11 20:57:08 +00:00
Ryan Macnak 439badf2c0 Revert "[build] Declare dependency of the version strings on the current Git commit."
This reverts commit c080951d45.

Reason for revert: Breaks Debian source package

Original change's description:
> [build] Declare dependency of the version strings on the current Git commit.
> 
> Bug: https://github.com/flutter/flutter/issues/15348
> Change-Id: Ifef1b55c6efe0f030ee83e4c43a774c7cd049fac
> Reviewed-on: https://dart-review.googlesource.com/45921
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>

TBR=aam@google.com,rmacnak@google.com,zra@google.com,phosek@google.com

Change-Id: I16ff18213bd1592c21bd9ae99b6e97fbdfc1824c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/flutter/flutter/issues/15348
Reviewed-on: https://dart-review.googlesource.com/45980
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-03-10 00:39:50 +00:00
Ryan Macnak c080951d45 [build] Declare dependency of the version strings on the current Git commit.
Bug: https://github.com/flutter/flutter/issues/15348
Change-Id: Ifef1b55c6efe0f030ee83e4c43a774c7cd049fac
Reviewed-on: https://dart-review.googlesource.com/45921
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2018-03-09 23:24:08 +00:00
Alexander Markov aff70cafc1 [vm] Fix reading of Object::extractor_parameter_types() from a snapshot
Before this fix, Object::extractor_parameter_types() and Object::extractor_parameter_names()
were initialized in Object::FinalizeVMIsolate(), which was called after
reading VM snapshot. So VM snapshot reader was registering nulls in place
of these VM objects in Deserializer::AddVMIsolateBaseObjects().
As a result, all references to Object::extractor_parameter_names()
were replaced with nulls while reading a snapshot.

The fix is to move initialization of those objects to Object::InitOnce().

Change-Id: I5f68853d9de23c94eb901080d9677100a6856c0c
Reviewed-on: https://dart-review.googlesource.com/45747
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-03-09 17:55:39 +00:00
Erik Corry 23fccf2e59 [VM] ARM64 unboxed 64 bit fix signed/unsigned const shift
R=vegorov@google.com
TBR=vegorov@google.com

Change-Id: I3f67bbce487a1d2133080a1c441814ba0dd47ead
Reviewed-on: https://dart-review.googlesource.com/45706
Reviewed-by: Erik Corry <erikcorry@google.com>
2018-03-09 14:18:55 +00:00
Erik Corry 30a87ce3fa [VM] ARM64: Add unboxed 64 bit integers
R=rmacnak@google.com

Change-Id: I9b18ef5385d3fbf615b82713f1af3f6a2facfb3d
Reviewed-on: https://dart-review.googlesource.com/45421
Commit-Queue: Erik Corry <erikcorry@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-03-09 09:09:18 +00:00
Zach Anderson 76b8e397ed Revert "Reland "[VM runtime] Switch intrinsics from old to new Bigint implementation.""
This reverts commit be62fff82f.

Reason for revert: See https://github.com/dart-lang/sdk/issues/32465

Original change's description:
> Reland "[VM runtime] Switch intrinsics from old to new Bigint implementation."
> 
> The change was reverted (thanks Slava) because gen_snapshot was failing to
> find the core lib class _BigIntImpl on flutter.
> The PR https://github.com/flutter/engine/pull/4735 fixed that issue on flutter.
> 
> Change-Id: Id6863d79f7fdb17f0076b63b0168394d5e95ec8d
> Reviewed-on: https://dart-review.googlesource.com/44660
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

TBR=alexmarkov@google.com,regis@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I412f5143442ca6ad43784b037c01fcf9bb42c348
Reviewed-on: https://dart-review.googlesource.com/45800
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-03-09 08:59:58 +00:00
Zach Anderson 2cb80620bd Revert "[vm/simarm] Fix VRECPS/VRSQRTSQS instruction implementation."
This reverts commit 3da9c349d4.

Reason for revert: Broke the build on vm-kernel-precomp-linux-release-simarm

Original change's description:
> [vm/simarm] Fix VRECPS/VRSQRTSQS instruction implementation.
> 
> This instruction handles 0.0 and infinity operands
> specially because otherwise it produces NaN where it
> should produce appropriate infinity or zero.
> 
> Fixes https://github.com/dart-lang/sdk/issues/24399
> Fixes https://github.com/dart-lang/sdk/issues/26675
> 
> Change-Id: I0741d0daa8b92b4dcd780b1453c9ec449552b1fd
> Reviewed-on: https://dart-review.googlesource.com/45382
> Reviewed-by: Zach Anderson <zra@google.com>

TBR=whesse@google.com,vegorov@google.com,alexmarkov@google.com,zra@google.com

Change-Id: I413be56fdce8afa0e2faa6ed2b16ef0f68b795b0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/45683
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-03-09 06:09:40 +00:00
Alexander Markov 97bbe2f20b [vm] Avoid using objects in VM isolate heap for de-duplication
Parameter types in application isolate could be modified during
execution, so it is incorrect to de-duplicate them with
read-only objects from VM isolate.

Fixes crash in pkg/front_end/tool/incremental_perf.dart
benchmark running from appjit snapshot. This crash appears after
https://dart-review.googlesource.com/c/sdk/+/45747 is applied.

Change-Id: I42a2007d02e04e0720c7e5d15224fcb6994bc515
Reviewed-on: https://dart-review.googlesource.com/45752
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-03-09 01:53:17 +00:00
Alexander Markov 7aa3e54acf [vm] Fix computation of hashCode of a closure with null receiver
As tests/language_2/tearoff_dynamic_test.dart shows, it is perfectly
valid to take a tear-off of an instance method from null, and then call
hashCode from such tear-off.

The implementation of hashCode for closures, Closure::ComputeHash()
was calling Instance::Cast(receiver) which asserts for null.
This code is revised to allow null receiver.

Change-Id: I85cc7abf25aab99590b53403904e8bac25328308
Reviewed-on: https://dart-review.googlesource.com/45749
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-03-09 00:26:31 +00:00
Leaf Petersen 4c881188b2 Disable the .whereType method until generic methods are turned on.
The whereType method silently does the wrong thing without methods,
so make it throw until we turn them on everywhere.

Change-Id: Id934c8bdb4f682dbc3560d78fbca580e37297e2d
Reviewed-on: https://dart-review.googlesource.com/45744
Reviewed-by: Nate Bosch <nbosch@google.com>
2018-03-08 23:14:22 +00:00
Ryan Macnak 22ccad1aa6 [vm] Stream writing snapshots as assembly to reduce peak memory usage.
Bug: US-449
Change-Id: Ic1ce6881b54c8c0eb7c93cbbda8057d7268bb3fd
Reviewed-on: https://dart-review.googlesource.com/45580
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-08 19:26:17 +00:00
Vyacheslav Egorov 3da9c349d4 [vm/simarm] Fix VRECPS/VRSQRTSQS instruction implementation.
This instruction handles 0.0 and infinity operands
specially because otherwise it produces NaN where it
should produce appropriate infinity or zero.

Fixes https://github.com/dart-lang/sdk/issues/24399
Fixes https://github.com/dart-lang/sdk/issues/26675

Change-Id: I0741d0daa8b92b4dcd780b1453c9ec449552b1fd
Reviewed-on: https://dart-review.googlesource.com/45382
Reviewed-by: Zach Anderson <zra@google.com>
2018-03-08 17:50:29 +00:00
Lasse Reichstein Holst Nielsen b3c12d4e3a Dart 2 Libraries Wave 3
Add `typeArguments` to Invocation.
Add constructors to Invocation, making it less necessary for users to create their own implementations.
Add tests.
Add Symbol.unaryMinus and Symbol.empty constants.

Change-Id: I70cb3265f9413617cf57fce1297e393a29eeb26a
Reviewed-on: https://dart-review.googlesource.com/40741
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-03-08 16:36:07 +00:00
Régis Crelier 383517d292 [VM runtime] Fix type canonicalization (fixes #32425).
A reused type argument vector that is longer than necessary needs to be
shortened to the correct length upon type canonicalization.
The runtime call comparing two instance runtime types also needs to consider
reused vectors.
Add regression test.

Change-Id: Ib3b9620409b9cff313f270c4f3fb7051fecbb604
Reviewed-on: https://dart-review.googlesource.com/45340
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-03-08 09:55:35 +00:00
Ben Konyi e3ecc87eb9 [VM / Kernel ] Fixed issue where enum classes were not being marked as such in the VM. Enum class fields are now eagerly initialized.
Change-Id: I6e5a95a3289d417e1f01f14b289960e45cce6c7b
Reviewed-on: https://dart-review.googlesource.com/45365
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-03-08 01:11:45 +00:00
Martin Kustermann aecf5bf56e [VM] Remove locking in code called by signal handler, ensure profiler thread sees valid [Redirection] list
Change-Id: Ib108b92ce67f2fe0bd18318a966cba345c834f67
Reviewed-on: https://dart-review.googlesource.com/45504
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-07 14:27:29 +00:00
Peter von der Ahé a55cdaee08 A bit of gardening
Change-Id: I5cee2e167e283c7e89d2a5c9a3f83edc1cf005b3
Reviewed-on: https://dart-review.googlesource.com/45422
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-07 14:11:40 +00:00
Peter von der Ahé 94aa20dd07 Update status for $compiler == fasta
Change-Id: I5d073d1c678dc313e79193074c6491085c093596
Reviewed-on: https://dart-review.googlesource.com/45381
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-03-07 10:32:33 +00:00
Martin Kustermann 8d6b050e28 [VM] Guard against duplicate entries in the static [Redirection::list_]
The ARM simulator has assertions that there are no duplicates in the
[Redirection::list_] but the code does not guarantee this, since
multiple threads can add the same add [Redirection] entries for the same
native concurrently.

This CL guards the modification of [list_] with a [Mutex] and ensures
there's no duplicates.

This issue caused flakiness on the debug-simarm configuration.

Change-Id: Ia84a08e6e6f851a6047bae047ffb990044fb4a4b
Reviewed-on: https://dart-review.googlesource.com/45281
Reviewed-by: Erik Corry <erikcorry@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-03-06 16:42:21 +00:00
Lasse R.H. Nielsen d22ac9f071 Faster first/last on VM implementation of (Linked)HashSet.
See issue #31470

The performance numbers from the example in that issue improved as follows:

Before:
Set.first  2669 ms
Set.last  15509 ms
HashSet.first  2845 ms
HashSet.last  22053 ms

After:
Set.first  1244 ms
Set.last  1422 ms
HashSet.first  1075 ms
HashSet.last  4552 ms

Bug: http://dartbug.com/31470
Change-Id: I8afc91ad8835ac18bcc37737570c7f4be0bb6e8a
Reviewed-on: https://dart-review.googlesource.com/44782
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Corry <erikcorry@google.com>
2018-03-06 12:50:21 +00:00
Erik Corry 235e62264e [VM] Reland Support some 32bit instructions in 64bit assemblers.
These instructions will soon be used for for smaller (32 bit) Smis.
Also fix broken ubfiz instruction in ARM64 assembler.

This reland fixes the disassembler test that used Stop
instructions which disassemble differently on Mac
because constants have higher addresses.

Originally reviewed at
https://dart-review.googlesource.com/c/sdk/+/43668

Fix assembler test on Mac

R=kustermann@google.com

Change-Id: I61f8626184af495f18a74b5fef07bad02b6615e9
Reviewed-on: https://dart-review.googlesource.com/45240
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Erik Corry <erikcorry@google.com>
2018-03-06 10:50:21 +00:00
Mike Fairhurst 080e7e6073 Fix status files: file is excluded and so dartanalyzer errs on test.
Change-Id: Id134bd81d02a8166ee2756f0323db8f650ccde84
Reviewed-on: https://dart-review.googlesource.com/45160
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2018-03-06 01:40:26 +00:00
Erik Corry 3ac86d759e Revert "[VM] Support some 32bit instructions in 64bit assemblers."
This reverts commit a5f173f165.

Reason for revert: Some test failures.

Original change's description:
> [VM] Support some 32bit instructions in 64bit assemblers.
> 
> These instructions will soon be used for for smaller (32 bit) Smis.
> 
> Also fix broken ubfiz instruction in ARM64 assembler.
> 
> R=​kustermann@google.com
> 
> Change-Id: I9068a1c4281047dbd7c1c447fc32ac0e92c89e9d
> Reviewed-on: https://dart-review.googlesource.com/43668
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

TBR=vegorov@google.com,kustermann@google.com,erikcorry@google.com

Change-Id: I0991712936d903f2cb1f3851c919ed6171a96711
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/44981
Reviewed-by: Erik Corry <erikcorry@google.com>
Commit-Queue: Erik Corry <erikcorry@google.com>
2018-03-05 15:29:56 +00:00
Erik Corry a5f173f165 [VM] Support some 32bit instructions in 64bit assemblers.
These instructions will soon be used for for smaller (32 bit) Smis.

Also fix broken ubfiz instruction in ARM64 assembler.

R=kustermann@google.com

Change-Id: I9068a1c4281047dbd7c1c447fc32ac0e92c89e9d
Reviewed-on: https://dart-review.googlesource.com/43668
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-05 14:45:23 +00:00
Régis Crelier c89055ee32 [VM] Fix type finalization for Kernel function types.
Change-Id: I45d1f9686ba52526af17bb9b720eb09f91f91876
Reviewed-on: https://dart-review.googlesource.com/44803
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2018-03-05 09:18:06 +00:00
Ryan Macnak 47ba426b62 [vm] Dump stack on SIGILL; print exception codes.
Bug: https://github.com/dart-lang/sdk/issues/32391
Change-Id: Ie75511fa17a4ef7a4794a52c34fef7bcb8b4ba81
Reviewed-on: https://dart-review.googlesource.com/44802
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-02 21:54:59 +00:00
Jens Johansen 80e2d30c20 [vm] Fix issue causing recursive_mixin_test to crash
In the VM, TypeRef (extending AbstractType) did _not_ implement
error(), meaning that callong error() on such a type would call it in
AbstractType which basically just says `UNREACHABLE();`.

This fixes the issue.

Change-Id: I6cb9ebe8f814296db8383c187c880f367b096312
Reviewed-on: https://dart-review.googlesource.com/44420
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-03-02 17:39:39 +00:00
Martin Kustermann 2c956749a5 [VM] Add support to HierarchyInfo to not only create [CidRangeVector]s of subtypes but also subclasses
Issue https://github.com/dart-lang/sdk/issues/31798

Change-Id: I1df4b9238500a1f78b5237ee6a6be4154e7f41d2
Reviewed-on: https://dart-review.googlesource.com/44543
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-02 17:02:49 +00:00
Martin Kustermann 5d92543f42 [VM] Fix accidental double assignment
This broke ARM on a non-standard compiler.

Change-Id: Idf4e7d5ea9072e6e07d796dc676ec3e7afd6f235
Reviewed-on: https://dart-review.googlesource.com/44786
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-03-02 15:40:14 +00:00
Martin Kustermann 80805ff1c1 [VM] Make FlowGraphCompiler::EmitTestAndCallCheckCid static and therefore usable from stubs
Issue https://github.com/dart-lang/sdk/issues/31798

Change-Id: I375cc01bf59d848a203dbcdbd59377d55e9aafe4
Reviewed-on: https://dart-review.googlesource.com/44540
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-02 15:11:59 +00:00
Martin Kustermann 9cfd721f78 [VM] Handle kVoidCid/kDynamicCid/kVectorCid the same way
Issue https://github.com/dart-lang/sdk/issues/31798

Change-Id: Ifb08ec17b29a5e8d1f2a9b8b53a32cb810a8a3da
Reviewed-on: https://dart-review.googlesource.com/44520
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-03-02 15:03:49 +00:00
Martin Kustermann 65b2b1a671 [VM] Split handling of Code from non-Code in Thread::{CanLoadFromThread,OffsetFromThread}
Not only does it speed the two methods a bit up, it will also allow us to use the assembler
before all of the stubs are initialized.

Issue https://github.com/dart-lang/sdk/issues/31798

Change-Id: Ic14743ecd9d11ca4cbc5208cacad30beee0982ef
Reviewed-on: https://dart-review.googlesource.com/44500
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-02 14:52:04 +00:00
Lasse R.H. Nielsen 3a769b9dbe Add missing methods to make classes Dart 2 valid.
Change-Id: I9a2e07de692127069d8098e3a0ea45846a3f45ae
Reviewed-on: https://dart-review.googlesource.com/43672
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2018-03-02 14:01:49 +00:00
Erik Corry 7d83584c5b Some kernel status file adjustments
R=dmitryas@google.com

Change-Id: Ide4ec93d556195c8e1ce92e6ef2ec49816d2a7d9
Reviewed-on: https://dart-review.googlesource.com/44740
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-03-02 10:29:10 +00:00
Régis Crelier be62fff82f Reland "[VM runtime] Switch intrinsics from old to new Bigint implementation."
The change was reverted (thanks Slava) because gen_snapshot was failing to
find the core lib class _BigIntImpl on flutter.
The PR https://github.com/flutter/engine/pull/4735 fixed that issue on flutter.

Change-Id: Id6863d79f7fdb17f0076b63b0168394d5e95ec8d
Reviewed-on: https://dart-review.googlesource.com/44660
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-02 00:01:54 +00:00
Vyacheslav Egorov 4fb15fcbf2 [vm/compiler] Consolidate compiler passes and share them between JIT and AOT.
Passes bodies are moved into compiler_pass{.cc,.h}.

Invoking a pass is just INVOKE_PASS(Name) now, instead of putting a bunch of
if-s and calls in compiler.cc or precompiler.cc.

We also consolidate ability to print IL and enable-disable passes under a
single flag --compiler-passes, e.g.

--compiler-passes=-Inlining,-CSE    disable inlining and CSE passes

--compiler-passes=Inlining+         print IL after Inlining pass and all
                                    subsequent passes

Change-Id: I90ff54b04a54f20099f5bf38dd45b16b8e3c4781
Reviewed-on: https://dart-review.googlesource.com/43968
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-01 16:43:58 +00:00
Martin Kustermann 52bc1ac4d7 [VM] Ensure we use the most specific types for fields
The VM uses normally strong mode types for LoadField instructions.
Though for certain fields we have known class-ids which we attach to the
Field instructions.

Before we had a case where the strong mode type was dynamic, but we had
a very specific cid for the Field.  Though when using the [CompileType]
afterwards via [CompileType()->ToAbstractType()] it was returning
`dynamic`.

We should use CompileType::ComputeRefineType() to get the most specific
one of those two.

Issue https://github.com/dart-lang/sdk/issues/31798

Change-Id: Ib0b7a596449cba0bc53e118ee603b2039aa312b3
Reviewed-on: https://dart-review.googlesource.com/43422
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-01 15:06:58 +00:00
Martin Kustermann 9104b5d387 [VM] Eliminate more type checks when not needed
Clear out generic-covariant-{impl,interface} on parameters which are
statically checked on call site.  If all call sites are this-dispatches then
we are guaranteed to not need the checks.

Issue https://github.com/dart-lang/sdk/issues/31798

Change-Id: I5452a1c9eb3c3e36c1dfc978327bfdcb256cc003
Reviewed-on: https://dart-review.googlesource.com/43421
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-01 14:31:38 +00:00
Martin Kustermann acf86bfb22 [VM] Type _CompactIterator/_CompactIterable._table
With the [_table] field being `dynamic` we were unable to eliminate
checks for the [_isModifiedSince] method, since there is a dynamic call
site.

This CL adds a type to [_table] so [_isModifiedSince] does not need to
perform any checks (via package:vm/transf.../no_dynamic_invocations_annotator.dart)

Issue https://github.com/dart-lang/sdk/issues/31798

Change-Id: If773c4b63fab62d1ccdd2e783aa16c19f780000a
Reviewed-on: https://dart-review.googlesource.com/43423
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-01 14:03:28 +00:00
Ryan Macnak 558a931409 [vm] Move some string utils from runtime/vm to runtime/platform.
Change-Id: I552086445a7e07792f9da85afa5edf23b6c450d5
Reviewed-on: https://dart-review.googlesource.com/44402
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-03-01 02:07:46 +00:00
Siva Chandra d45d5a72d2 Pass --preview-dart-2 to dart_bootstrap and dart_precompiled in dartkp config.
Change-Id: I728d085b6433d7ad35fb389ce61b4959311a9b4a
Reviewed-on: https://dart-review.googlesource.com/44383
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Chandra <sivachandra@google.com>
2018-02-28 23:49:05 +00:00
Vyacheslav Egorov 471f9a0a63 [vm/aot] Ensure that types and type arguments are handled correctly in tree-shaking
Move the code deciding whether instance needs to be handled specially
into AddConstObject, instead of having it spread around - this ensures
uniform handling.

Fixes https://github.com/flutter/flutter/issues/14891

Bug: 14891
Change-Id: I92b6383f37f6b6cf2e917013d17e8ae7ee977150
Reviewed-on: https://dart-review.googlesource.com/44300
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-02-28 21:23:33 +00:00
Ryan Macnak b5966dbddc [vm] Don't use popcount intrinsic on both x86s.
Bug: https://github.com/dart-lang/sdk/issues/32314
Change-Id: I5589a22de5777af664c83f221758ba5b35d8678a
Reviewed-on: https://dart-review.googlesource.com/43886
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-02-28 17:48:16 +00:00
Lasse R.H. Nielsen 9ee735b659 Add missing methods to List and Map implementations.
Optimize FollowedBy when the operands have efficient length.

Change-Id: I0af59240d70b929358c06b8d57a85df2deee6aaf
Reviewed-on: https://dart-review.googlesource.com/43665
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-02-28 12:26:53 +00:00
Vyacheslav Egorov 4a11a27b53 Revert "[VM runtime] Switch intrinsics from old to new Bigint implementation."
This reverts commit 9ba8c08953.

Reason for revert: broke Flutter, to reproduce build Flutter engine with HEAD dart and try running animation benchmark in release or profile mode in --preview-dart-2, gen_snapshot would crash. Similarly this also breaks Flutter tests in --preview-dart-2 mode.

Original change's description:
> [VM runtime] Switch intrinsics from old to new Bigint implementation.
> 
> Change-Id: I43dfbdf76267bb96d1b1ce4aeb695d02bb18b7f8
> Reviewed-on: https://dart-review.googlesource.com/44025
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Régis Crelier <regis@google.com>

TBR=alexmarkov@google.com,regis@google.com

Change-Id: I926cc72e1ed89d8631e33ebcc8198853c05a08dc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/44065
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-02-28 11:27:45 +00:00
Paul Berry 063a244a7f Fix analyzer bot failures in non-strong mode.
Change-Id: I614f2b5869e8b2ac022cc401df08d4dda4efd513
Reviewed-on: https://dart-review.googlesource.com/44101
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-02-28 09:22:13 +00:00
Siva Chandra 27d28702a6 Update status files after 4f5ad1918c
Change-Id: I96c56728521a507fe9870fa3f53060d594fa8a78
Reviewed-on: https://dart-review.googlesource.com/44023
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Chandra <sivachandra@google.com>
2018-02-28 02:06:36 +00:00
Régis Crelier 9ba8c08953 [VM runtime] Switch intrinsics from old to new Bigint implementation.
Change-Id: I43dfbdf76267bb96d1b1ce4aeb695d02bb18b7f8
Reviewed-on: https://dart-review.googlesource.com/44025
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2018-02-28 01:37:06 +00:00
asiva 1aaebedd70 Reland https://dart-review.googlesource.com/c/sdk/+/43497
(Strip out platform dill files and the kernel service dill file from a
 product build)
After fixing the issue of using 'is_product' which is not present in the
flutter build environment.

Change-Id: I49dd68e63b1f6d7ac0981b28bf2b08618551ae2e
Reviewed-on: https://dart-review.googlesource.com/44024
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-02-28 01:15:47 +00:00
Régis Crelier b766ec170c [VM runtime] Optimize new Bigint implementation for digit pair processing on 64-bit platforms.
Added Montgomery reduction in new Bigint implementation to support faster crypto (modPow).

Change-Id: Ic6872c9809485db27d0175c1d1f348232250b682
Reviewed-on: https://dart-review.googlesource.com/43300
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2018-02-28 00:52:57 +00:00
Siva Chandra 4f5ad1918c Make strong mode the default under --preview-dart-2.
Change-Id: Ic1637d65a34f6b0310439293f7d83cb351f2c89c
Reviewed-on: https://dart-review.googlesource.com/43200
Commit-Queue: Siva Chandra <sivachandra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-02-27 22:16:07 +00:00
Vyacheslav Egorov 9e7279bce9 [vm/compiler] Fix illegal code motion where LoadField is hoisted past CheckNull.
Canonicalizer should not remove Redefinitions that have no uses before LICM
happens. Even though Redefinition itself has no uses it might be still
dominating uses of the original value - is we expect RenameUsesDominatedByRedefinitions
that is run before LICM to normalize the graph by routing those uses
through Redefinition.

Fixes https://github.com/dart-lang/sdk/issues/32322

Bug: 32322
Change-Id: Ice310aaf8ab62cd6d3ec575876c12e8634a91dce
Reviewed-on: https://dart-review.googlesource.com/44040
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-02-27 20:45:59 +00:00
Alexander Markov a681867054 [vm/kernel/aot] Prepare to enable type flow analysis in Flutter
* Introduce --tfa option in gen_kernel and 'useGlobalTypeFlowAnalysis'
  parameter in compileToKernel(), which is used in Flutter's frontend
  server.

* Split entry_points_extra.json into 2 parts: common to all embedders
  and specific to a standalone VM (entry_points_extra_standalone.json).

* Extract generation of entry points JSON files into a separate .gni
  file, introduce action to generate entry points JSON using
  gen_snapshot instead of dart_bootstrap (required for Flutter), and
  action to copy checked-in extra entry points file.

Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: Ie0af9d7128d7fc0e3a9d623fd3c1589e87c83f5c
Reviewed-on: https://dart-review.googlesource.com/43884
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-02-27 19:59:19 +00:00
Dmitry Stefantsov e7830a9f7b Add a flag to Procedures indicating that it's a redirecting factory
Fixes #32282

Bug: http://dartbug.com/32282
Change-Id: Iee8535b053ced415e3047e990a0940d859faa86a
Reviewed-on: https://dart-review.googlesource.com/43440
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-02-27 10:42:07 +00:00
Jens Johansen df92e14975 [kernel/vm] Initial obfuscate support for kernel pipeline
Change-Id: I72ca9f690ad46578b963f06af24c3b85d960cac5
Reviewed-on: https://dart-review.googlesource.com/42240
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-02-27 10:11:17 +00:00