Commit Graph

2008 Commits

Author SHA1 Message Date
Samir Jindel 9a683de40d [vm] Support testing assembly snapshots for ARM.
We have had several bugs propagate to Flutter end-users due to our lack of testing of
AOT Assembly snapshots on ARM (SIMARM_X64 in particular), causing reverts of SDK commits
and disrupting the Dart -> Flutter roll.

This leverages our custom ELF loader to load the generated ELF objects, which cannot be
loaded by dlopen() because they are marked with the ARM ABI.

For example, see:
  - https://github.com/flutter/flutter/issues/40114
  - https://github.com/flutter/flutter/issues/41228

Also do some tree-shaking of the snapshot writers for dart_precompiled_runtime.

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

Change-Id: I5990769c623b8a13131b1848349af2c0a026272b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118569
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2019-09-25 17:09:16 +00:00
Alexander Aprelev 69b5681546 Revert "[vm, compiler] Reduce alignment of Instructions and remove some debugging trap instructions."
This reverts commit b26636925d as it introduces failure to run `flutter run --profile` on ios 32-bit devices.

Revert "[vm, compiler] Further reduce alignment of Instructions."

This reverts commit e2adba804b as collateral damage.

Bug: https://github.com/flutter/flutter/issues/41228
Change-Id: Ia831a23d1237ef7635e6e1fa5d8fbcbcb91b2a74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118661
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2019-09-24 23:43:24 +00:00
Ryan Macnak e2adba804b [vm, compiler] Further reduce alignment of Instructions.
ARM64
Unaffected

ARM32
VMIsolate(CodeSize):       4731 ->     4730
Isolate(CodeSize):      2020887 ->  2020860
ReadOnlyData(CodeSize): 2161000 ->  2161000
Instructions(CodeSize): 6879032 ->  6811384 (-0.98%)
Total(CodeSize):       11065650 -> 10997974 (-0.61%)

Bug: https://github.com/dart-lang/sdk/issues/38452
Change-Id: Ic969a92814afd352767368e063e493099dd89377
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118181
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-09-20 22:29:18 +00:00
Teagan Strickland 5645cc64f5 [vm/compiler] Fix mismatches in early round trip.
Printing out the flow graph before and after round trip serialization
revealed slight differences between the flow graphs that might lead
to either bugs or different results in compilation. Remove these
differences.

Also in this change:
* Remove cases where printing or serializing a flow graph could have
  the side effect of creating new `CompileType`s or `AbstractType`s
  not previously in the graph.
* Ensure reaching types for `Value`s are cloned if the binding
  definition changes and check that reaching types either have no
  owner or are owned by the `Value`'s definition with the
  FlowGraphChecker. (Before this change, we had `CompileType`s in
  the graph whose owner had long since been removed from it.)
* Adds `ASSERT`s to check that unexpected non-canonical `Instances`
  are not allowed as the value of `ConstantInstr`s and adds some
  canonicalization that did not previously occur.

Bug: https://github.com/dart-lang/sdk/issues/36882
Change-Id: I334ffa2a6383291a7cb318343c71bd55a41269a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117143
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-09-20 08:35:44 +00:00
Ryan Macnak b26636925d [vm, compiler] Reduce alignment of Instructions and remove some debugging trap instructions.
ARM64
VMIsolate(CodeSize):       4732 ->     4731
Isolate(CodeSize):      2016536 ->  2016363
ReadOnlyData(CodeSize): 3185200 ->  3184400
Instructions(CodeSize): 7389056 ->  6878080 (-6.92%)
Total(CodeSize):       12595524 -> 12083574 (-4.06%)

ARM32
VMIsolate(CodeSize):       4729 ->     4729
Isolate(CodeSize):      2021187 ->  2021086
ReadOnlyData(CodeSize): 2161784 ->  2161216
Instructions(CodeSize): 7021152 ->  6880728 (-2.00%)
Total(CodeSize):       11208852 -> 11067759 (-1.26%)

Bug: https://github.com/dart-lang/sdk/issues/37103
Bug: https://github.com/dart-lang/sdk/issues/38452
Change-Id: I6ac64ea0270ab1ee49518e58e14b6ab1ba4ff236
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117683
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-09-19 21:10:57 +00:00
Samir Jindel 205b90f0de Take 3 for '[vm/ffi] Implement FFI callbacks on AOT for ELF and Asm snapshots (excl. blobs).'
Fixes the changes to assembly snapshot writer in SIMARM_X64 mode. This unfortunately can't be tested until the ELF loader is available.

Take 2 is in patchset 1.

Change-Id: Ib8b067dd4f09dcba3b142705e9cb4dfbf4e3eb53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117726
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-09-18 14:56:27 +00:00
Alexander Markov f8f0b845c2 [vm/bytecode] Fix lazy lookup of line starts with bytecode and app-jit
Lazy lookup of source and line starts for scripts loaded from bytecode
(implemented in https://dart-review.googlesource.com/c/sdk/+/112680)
relied on source == Symbols::Empty() as an indication that lazy lookup is
needed. However, when Script object is written into app-jit snapshot,
its source is set to null which disables lazy lookup.

This change introduces 'LazyLookupSourceAndLineStarts' flag in Script
objects to avoid relying on value of 'source'.

Fixes service/valid_source_locations_test with bytecode in app-jit mode.

Change-Id: I38174a13d745a1ad9fecad466df745b1df527878
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117214
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-09-14 19:31:25 +00:00
Zichang Guo 35d1333c2f [vm] remove token position for ExceptionHandlers
Remove this unnecessary field. Both ExceptionHandlerList and ExceptionHandlers not use token position. TokenPosition passed from CatchBlockEntryInstr() is always NoSource.
Change-Id: I3857ff3d1f9217f565c2d159fa980350ebd4bc47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117040
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2019-09-12 21:48:32 +00:00
Alexander Markov cfd1efc0d9 [vm/bytecode] Fix getting of target of dynamic invocation forwarder
Before this change, there were 2 ways of getting target of dynamic invocation
forwarder: Function::GetTargetOfDynamicInvocationForwarder() which looks up
using the name, and Function::ForwardingTarget() which returns a target saved
when dynamic invocation forwarder was created.

Apparently we should use Function::ForwardingTarget() when compiling dynamic
invocation forwarder, as we might find a different function after hot reload.

It was the last use of GetTargetOfDynamicInvocationForwarder(), so cleaned it up.

Fixes language_2/flatten_test/01 with bytecode in hot reload mode.

Change-Id: Ibe3117c16509fe5d94fcdd1a2a2b12f2049efad2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117014
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-09-12 21:23:52 +00:00
Zichang Guo 59bcc4ea1e [vm/kernel] record yield positions at streaming flow graph builder
Collect yield positions inside StreamFlowGraphBuilder. BuildGraph() when yield_positions() are required. All yield positions will be stored into script as a hashmap. Key of hashmap is the starting token position of function, value is an array containing all yield positions.

Bug: https://github.com/dart-lang/sdk/issues/37635
Change-Id: I6d301d1cb0f74c432f855c9dbc20ac2c13acb07f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116743
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2019-09-12 16:37:16 +00:00
Teagan Strickland 420b292410 [vm/compiler] More work on the IL serializer.
Adds support for:
  AssignAssertable
  BooleanNegate
  LoadClassId
  NativeCallInstr
  Throw

Results from compiling hello world program:

* Early round trip:
  * Contains unhandled instructions: 1565
  * Failed during deserialization: 10
  * Successful round trips: 2696
* Late round trip:
  * Contains unhandled instructions: 2404
  * Failed during deserialization: 12
  * Successful round trips: 1755

Deserialization failure reasons:
* Early round trip:
  * no handling for local functions: 10
* Late round trip:
  * no handling for local functions: 7
  * out of range index for pushed argument: 5
    (see https://github.com/dart-lang/sdk/issues/38354)

Bug: https://github.com/dart-lang/sdk/issues/36882
Change-Id: I56f875a68876b4d94ac1256be207df8b98ba0ea0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116320
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-09-12 14:18:40 +00:00
Teagan Strickland ebf1f01ca5 [vm/compiler] Continued work on the IL deserializer.
Adds support for:
  AssertBoolean
  InstanceCall

Also handles deserializing of TypeRefs and
serialization/deserialization of non-megamorphic
ICData.

Results from compiling hello world program:

* Early round trip:
  * Contains unhandled instructions: 2469
  * Failed during deserialization: 9
  * Successful round trips: 1772
* Late round trip:
  * Contains unhandled instructions: 2892
  * Failed during deserialization: 11
  * Successful round trips: 1268

Deserialization failure reasons:
* Early round trip:
  * no handling for local functions: 9
* Late round trip:
  * no handling for local functions: 6
  * out of range index for pushed argument: 5
    (see https://github.com/dart-lang/sdk/issues/38354)

Bug: https://github.com/dart-lang/sdk/issues/36882
Change-Id: I7a3731d4cc3df0bfa1e270adbdfc2faddd110af0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115219
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-09-12 13:29:26 +00:00
Alexander Aprelev 0c481a196c Revert Reland '[vm/ffi] Implement FFI callbacks on AOT for ELF and Asm snapshots (excl. blobs).' as it breaks flutter profile execution on ios 32-bit platform.
Fixes https://github.com/flutter/flutter/issues/40114

Change-Id: If8d71e9c19c2e794d29f7ecbacb87457890a2fd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116883
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2019-09-12 00:10:09 +00:00
Alexander Markov ef2a21ffd9 [vm/bytecode] Use local variable information when compiling from bytecode
This includes types and names of local variables.
Fixes vm/cc/IRTest_TypedDataAOT_FunctionalGetSet with bytecode.

Change-Id: I6130f19b4028f4930dbfcb282b90dd2ec4f963e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116082
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-09-09 19:23:16 +00:00
Ryan Macnak 84db16381d [vm] Remove dead --load_deferred_eagerly and dependent code tracking for library prefixes.
Since Dart 2, library prefixes are always loaded eagerly on the VM.

Also remove reload check for deferred prefixes. This check was added to avoid behavior of library prefixes giving spurious "not loaded" errors after a reload, but now this error can never occur. Resolves a difference in reload between AST and bytecode modes, since bytecode mode isn't surfacing the deferred property.

Change-Id: Ide5fb6cac2efc90ca1b108a35bc09d342cbd60de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116051
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-09-06 23:37:33 +00:00
Martin Kustermann f5c0e2e362 [vm/concurrency] Ensure instance size in class table is either 0 or the correct size
Until now it was possible to register classes with a default size (16 bytes on 64-bit)
and later on change the size for the cid.

This CL changes this to ensure the size information in the class table
for a given cid is either 0 or the final instance size (and adds an
ASSERT for it)

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

Change-Id: I94c61c6a1566c13dec7b9eb80c9ae0dadf0e6b6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115861
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-09-06 22:06:30 +00:00
Samir Jindel c219a76652 Reland "[vm/ffi] Implement FFI callbacks on AOT for ELF and Asm snapshots (excl. blobs)."
The original change is in Patchset 1.
The dependency contains the fix for the non-bare-instructions bot.

Change-Id: Iab02ab0736a2ee9144b667d2777ca526341b2a36
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-android-release-arm-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-bare-linux-release-x64-try,vm-kernel-precomp-mac-debug-simarm_x64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115241
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-09-05 20:19:22 +00:00
Aart Bik 8ee3f314cb [vm/gardening] clang tidy fixes
https://github.com/dart-lang/sdk/issues/38196

Change-Id: I0a61eae20d8cfc1c2ada8d6a607d437d02136d33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115609
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-09-05 17:00:33 +00:00
Ryan Macnak a7723d5c40 [vm] Out-line handle allocation.
Handle allocation is extremely common, and it always already has a call to VMHandles::Allocate[Zone]Handle, so we save a lot of binary size by avoiding inlining the TLS and initialization code.

-488k (-2.04%) out/ProductX64/exe.stripped/dart
-256k (-5.07%) out/ProductX64/exe.stripped/dart_precompiled_runtime

Change-Id: I677005c9653c87597ba20144b4326b66d0bf0ee5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115608
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-09-05 16:43:33 +00:00
Ryan Macnak 67bb2b7819 [vm, compiler] Consistently use CallTargets instead of ICData or MegamorphicCache.
Bug: https://github.com/dart-lang/sdk/issues/37575
Change-Id: I15f3862af380b04498cb58c8658aa6de76212733
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114445
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-09-04 18:49:40 +00:00
Samir Jindel 72e8bdc56b Revert "[vm/ffi] Implement FFI callbacks on AOT for ELF and Asm snapshots (excl. blobs)."
This reverts commit ecbea5a58e.

Reason for revert: broken with bare instructions and ABI bot

Original change's description:
> [vm/ffi] Implement FFI callbacks on AOT for ELF and Asm snapshots (excl. blobs).
> 
> To do this, we add writable data sections (currently uninitialzed) to ELF and Asm snapshots
> and allow Instructions to have patchable relocations against (the start of) these sections.
> 
> Issue https://github.com/dart-lang/sdk/issues/37295 (see also for design & discussion).
> 
> Change-Id: If20bfa55776f4044aaa6bb8ea2101d2ada41842c
> Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-android-release-arm-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110221
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,rmacnak@google.com,alexmarkov@google.com,sjindel@google.com

Change-Id: I9787da6d42575ca4f5ae0a698052a19ac4275afd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-product-x64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-android-release-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115240
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2019-09-03 12:31:15 +00:00
Samir Jindel ecbea5a58e [vm/ffi] Implement FFI callbacks on AOT for ELF and Asm snapshots (excl. blobs).
To do this, we add writable data sections (currently uninitialzed) to ELF and Asm snapshots
and allow Instructions to have patchable relocations against (the start of) these sections.

Issue https://github.com/dart-lang/sdk/issues/37295 (see also for design & discussion).

Change-Id: If20bfa55776f4044aaa6bb8ea2101d2ada41842c
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-android-release-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110221
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-09-03 12:02:02 +00:00
Teagan Strickland d2e99c4935 [vm/compiler] Continued work on the IL serializer.
Adds support for:
  Constant
  Goto
  JoinEntry
  PushArgument
  StaticCall

Adds canonical name parsing, which allows us to parse Function
and Field values. Adds ImmutableList, Instance, and TypeParameter
parsing.

Results from compiling hello world program:

* Early round trip:
    * Contains unhandled instructions: 4070
    * Failed during deserialization: 2
    * Successful round trips: 106
* Late round trip:
    * Contains unhandled instructions: 3789
    * Failed during deserialization: 4
    * Successful round trips: 385

Bug: https://github.com/dart-lang/sdk/issues/36882
Change-Id: If9cb4c133e3ba8c62016e545f8471c67cc126290
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113684
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-09-03 09:14:00 +00:00
Teagan Strickland 1573f4e877 [vm/compiler] Further work on the IL deserializer.
Adds support for:
  CheckStackOverflow
  Parameter
  SpecialParameter

Adds handling of Integer, Double, Class, Type, and TypeArguments
in ParseDartValue. Adds handling of values visited in the graph prior
to the corresponding definition to keep traversal of block contents as
one pass.

Results from compiling hello world program:

* Early round trip:
    * Contains unhandled instructions: 4157
    * Failed during deserialization: 0
    * Successful round trips: 21
* Late round trip:
    * Contains unhandled instructions: 4023
    * Failed during deserialization: 29
    * Successful round trips: 126

Bug: https://github.com/dart-lang/sdk/issues/36882
Change-Id: Icb2972749ee86891d5847519a3b5097ad5c63c54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113326
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-08-29 16:52:24 +00:00
Liam Appelbe 05c28c6115 Reland "Scaffolding for dart:wasm"
This reverts commit 9198813a55.

Reason for revert: Relanding with a fix

Original change's description:
> Revert "Scaffolding for dart:wasm"
> 
> This reverts commit f39a3f188e.
> 
> Reason for revert: https://golem.corp.goog/BuildInfo?target=flutter-profile&machine-type=android-armv7&revision=84750
> 
> Original change's description:
> > Scaffolding for dart:wasm
> > 
> > This CL doesn't have any tests because it's just boilerplate. I'll
> > add a test in the follow up CLs where I add actual functionality.
> > 
> > Bug: https://github.com/dart-lang/sdk/issues/37882
> > Change-Id: I47c81f5f1be724f8226e756ba5d01880a45f1ac7
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112841
> > Reviewed-by: Siva Annamalai <asiva@google.com>
> > Reviewed-by: Liam Appelbe <liama@google.com>
> > Commit-Queue: Liam Appelbe <liama@google.com>
> 
> TBR=asiva@google.com,liama@google.com
> 
> Change-Id: I0fd0f29d66a07fc29e840ddaec2d4161c8d599cb
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: https://github.com/dart-lang/sdk/issues/37882
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114044
> Reviewed-by: Liam Appelbe <liama@google.com>
> Commit-Queue: Liam Appelbe <liama@google.com>

TBR=asiva@google.com,liama@google.com

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

Bug: https://github.com/dart-lang/sdk/issues/37882
Change-Id: Idb43cbd3a0521776ac420bfef91c8a9a4362f18e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114757
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2019-08-28 23:11:21 +00:00
Martin Kustermann 3c54aeae6b [vm/compiler] Ensure proper release/aquire fences are used when turning ICData to be megamorphic.
The mutator has to ensure all writes to the ICData are flushed before we set the
megamorphic bit.

Similarly the BG compiler has to ensure (during cloning of ICData) that all
loads from the ICData happen after we've determined whether the megamorphic
bit has been set.

This allows us to maintain the invariant that if the ICData is marked as
megamorphic, the entries in it will have reached FLAG_max_polymorphic_checks.

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

Change-Id: Idec7aef8ca1369668f5c9c57b7b32759acbd270d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114322
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-08-23 14:51:18 +00:00
Ryan Macnak fdbc2920c7 [vm, bytecode] Use the global lookup cache for dynamic calls.
Removes all ICData from bytecode, avoding the need to clear bytecode when CIDs are reassigned.

Change-Id: I185f9f7acef6a32ef46adb73c6d2652bc1231bab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114053
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-08-22 21:43:43 +00:00
Régis Crelier 223724fa76 [vm/bytecode] Lookup source and line starts for bytecode scripts specifying uri only.
Collect token positions of field declared in bytecode.
Improve debugger debugging: Disassemble both bytecode and code when applicable.

Change-Id: I56188cf24ef4bfe8a93cce11c2f4505152abdd02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112680
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-08-22 18:31:18 +00:00
Ryan Macnak 0176526799 [vm, compiler] Always clone MegamorphicCaches before accessing on a background compiler thread.
This is to prevent the compiler from becoming confused by mutations from the Dart execution thread.

Bug: https://github.com/dart-lang/sdk/issues/37575
Bug: https://github.com/dart-lang/sdk/issues/37595
Change-Id: I43c42feff54d76b780beb6e8d627f1b1641f4bee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114054
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-08-22 18:26:39 +00:00
Liam Appelbe 9198813a55 Revert "Scaffolding for dart:wasm"
This reverts commit f39a3f188e.

Reason for revert: https://golem.corp.goog/BuildInfo?target=flutter-profile&machine-type=android-armv7&revision=84750

Original change's description:
> Scaffolding for dart:wasm
> 
> This CL doesn't have any tests because it's just boilerplate. I'll
> add a test in the follow up CLs where I add actual functionality.
> 
> Bug: https://github.com/dart-lang/sdk/issues/37882
> Change-Id: I47c81f5f1be724f8226e756ba5d01880a45f1ac7
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112841
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Liam Appelbe <liama@google.com>
> Commit-Queue: Liam Appelbe <liama@google.com>

TBR=asiva@google.com,liama@google.com

Change-Id: I0fd0f29d66a07fc29e840ddaec2d4161c8d599cb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/37882
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114044
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2019-08-21 21:06:10 +00:00
Liam Appelbe f39a3f188e Scaffolding for dart:wasm
This CL doesn't have any tests because it's just boilerplate. I'll
add a test in the follow up CLs where I add actual functionality.

Bug: https://github.com/dart-lang/sdk/issues/37882
Change-Id: I47c81f5f1be724f8226e756ba5d01880a45f1ac7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112841
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2019-08-21 19:55:04 +00:00
Ryan Macnak 6e2b3f0326 [vm] Greatly reduce handle allocation during reload.
Saves 10ms from non-empty reloads of Flutter Gallery.

Change-Id: If9a1f9970d562f8fd7996de875dfe231350efaa9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113282
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-08-20 00:49:52 +00:00
Ryan Macnak 6e987b6eb5 [vm, service] Add requestHeapSnapshot.
This replaces _requestHeapSnapshot and _getObjectByAddresses, which relied on the invalid assumption that objects don't move and the heap hasn't mutated since the initial snapshot.

Updates Observatory to the new format. Adds treemap visualization of the dominator tree. Adds the ability to save and load heap snapshots to files. Removes analysis grouping references by source and target class. Removes ability to navigate from a pixel in the fragmentation view to inspector. Removes ability to query the top retaining instance from an ordinary class browser.

Change-Id: Ia7781c05d43bf3ec149f8b4ecab803b37c3ee981
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112181
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2019-08-19 19:31:42 +00:00
Ben Konyi 1219c5e3ab [ VM / Service ] Use the name of the a function's defining mixin instead of the
mixin application to qualify function names in profiler and exception stack traces.

Given:

```
class Foo {
  foo() => "foo";
}

class Bar with Foo {}
```

The stack frame for `foo()` currently displays as `Bar&Foo.foo`. Now,
the stack frame for `foo()` will have the name `Foo.foo`.

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

Change-Id: Ic1c0d00f38725ee088812ff0926eef4f343ebdf1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111482
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-08-15 21:10:47 +00:00
Ryan Macnak cd16fba718 [vm, bytecode, reload] Rebind static referents instead of clearing bytecode.
Fixes vm/cc/IsolateReload_SavedClosure.

Change-Id: I792dad83c1d96c17bac9f65eb80cefa2875b5307
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113132
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-08-15 16:31:01 +00:00
Teagan Strickland 2c49015cd5 [vm] Add (Zone*) overload for Object::ZoneHandle()
This aligns the overloads for ZoneHandle() in Object to match those
available in other classes.

Change-Id: I92ea915699b96966d67a030f011b371ea88ee756
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113180
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Teagan Strickland <sstrickl@google.com>
2019-08-15 09:12:00 +00:00
Jens Johansen 39a007678e [VM] Save kernel binary version in KernelProgramInfo
This is the beginning of allowing us to - wherever we process kernel
data - make decisions based on the kernel version. Said another way,
we can actually start to change the kernel format without breaking
backwards compatibility in the VM.

Change-Id: Ied7b3d9fe72976c4f3c0895d02b6ab70e0f5dba9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111642
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-08-05 06:51:24 +00:00
Teagan Strickland 4932ee6d80 Reland "[vm/compiler] Use pragmas instead of separately-maintained lists for inlining."
This closes https://github.com/dart-lang/sdk/issues/36571.

Change-Id: I14c623aba6b7183191ae93e294e26af9f4dcf34f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110441
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-07-30 13:14:57 +00:00
Martin Kustermann fc54f900de [vm] Cleanup some outdated code from hot-reload (and deferred loading)
Hot-reload used to be implemented by calling a tag handler (i.e. embedder),
which would load new Dart source code and call recursively into hot reloading
code.

=> This no longer happens, since the hot reload implementation obtains and
   loads the kernel diffs itself in isolate_reload.cc.

With the switch to the Dart 2.0 CFE the VM no longer supports any kind of
deferred library loading. The CFE provides the VM with all sources together.

This CL cleans up some unnecessary code and outdated comments.

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

Change-Id: I63aaa6e2a1910165185172a9dd975c3974ac5dd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110720
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-07-29 14:32:47 +00:00
Alexander Markov 16f7076547 [vm/bytecode] Generate bytecode for expression evaluation
Issue: https://github.com/dart-lang/sdk/issues/36427

Change-Id: I0a07bd8ff1be357d2962e6745c8ef1e500d45477
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109984
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-07-26 18:22:51 +00:00
Ryan Macnak 9fe8865f4a [vm, bytecode] Implement ParameterMirror and enable mirror tests.
In particular, mirrors_reader_test no longer crashes.

Change-Id: I602e7d85755dafd943fe84d20831f0f35484b387
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108968
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-07-25 00:04:02 +00:00
Régis Crelier 35fb2377c5 [vm/bytecode] Properly handle non-live bytecode frames in debugger.
Change-Id: I30db495fbda03a983f21dc45d27c57c5cb35f162
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110139
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-07-24 21:42:32 +00:00
Régis Crelier 1ddb120eaa [vm/bytecode] Improve bytecode debugger.
While stepping, do not stop more than once in the same token range.
Adjusted tests expecting multiple stops at same location.
Fixed emitted source position of DebugCheck opcode in async op.
Ignore all possible breakpoint positions until the first DebugCheck opcode of
the function, so as to not stop in the prologue where arguments are not yet
accessible.
Fixed look up of context level in debugger.
Use receiver to look up async op closure in frame instead of named captured
variable.
Made StoreContextVar a 'debug checked' opcode.
Implemented rewind of interpreted frames.
Marked get_source_report_test as (temporarily) failing in status file.
Removed fixed and passing regression test from status file.

Change-Id: I9396d3cf4b6accc85753bb6d227b7c068acc8df7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109558
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-07-19 18:19:50 +00:00
Daco Harkes 48d92b3176 [vm/ffi] Fix GC relocation bug
Issue: https://github.com/dart-lang/sdk/issues/37511

Change-Id: Ibabe6a49b6fe38032da544a6520bdc398d496ba0
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try, app-kernel-linux-debug-x64-try, vm-kernel-linux-debug-simdbc64-try,vm-kernel-linux-debug-ia32-try,vm-dartkb-linux-debug-simarm64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-dartkb-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-ffi-android-product-arm-try,vm-ffi-android-release-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108805
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2019-07-19 15:17:50 +00:00
Aart Bik 873cc9a787 [dart/vm] peek prior to constant class evaluation
Rationale:
Only look for "external" and "pragma" to avoid
cyclic or unloaded class evaluation

https://github.com/dart-lang/sdk/issues/37533
https://github.com/dart-lang/sdk/issues/36220


Change-Id: I78ef5dcd2c7e7dee0d196394320e994f8aa8a695
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109300
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-07-18 17:17:49 +00:00
Siva Annamalai 1eaaca642d Revert "[vm/compiler] Use pragmas instead of separately-maintained lists for inlining."
This reverts commit 33a757284b.

Reason for revert: This CL seems to depend on
@pragma('vm:never-inline')`
@pragma('vm:prefer-inline')`
being implemented which has been reverted.

Original change's description:
> [vm/compiler] Use pragmas instead of separately-maintained lists for inlining.
> 
> This closes https://github.com/dart-lang/sdk/issues/36571.
> 
> Change-Id: I4d77192f2c33dd4872d58ef07ccd32069b8b63df
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99154
> Commit-Queue: Teagan Strickland <sstrickl@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,sstrickl@google.com

Change-Id: Ied0686ad282f2ed772ff9adbc551f64ba8855aff
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109340
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2019-07-16 22:44:50 +00:00
Teagan Strickland 33a757284b [vm/compiler] Use pragmas instead of separately-maintained lists for inlining.
This closes https://github.com/dart-lang/sdk/issues/36571.

Change-Id: I4d77192f2c33dd4872d58ef07ccd32069b8b63df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99154
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-07-16 10:37:02 +00:00
Ryan Macnak c6bc0031f3 [vm, bytecode] Field initializer for schema changes.
Bug: https://github.com/dart-lang/sdk/issues/32299
Change-Id: Id6359ad36db183f4cdd091e7fd778c879e868d99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108901
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-07-15 22:58:16 +00:00
Régis Crelier 55b67e9eae [vm/bytecode] Ignore source positions not denoting a debug point in debugger.
The CheckStack bytecode does not denote a debug point anymore after the
introduction of the DebugCheck bytecode.
Fix caller/callee determination in mixed mode.
Factorize some code.

Change-Id: Ide1e0bbad022a83e6113243dc996396f9f5d2f3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108565
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-07-12 00:18:21 +00:00
Alexander Markov 96906936b4 [vm/bytecode] Fix writing and reading of nested function types in bytecode
Fixes https://github.com/dart-lang/sdk/issues/37486

Change-Id: Id6b10288cf9afeddb8a9972eb1dd455184b15789
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108740
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-07-12 00:15:32 +00:00