Commit Graph

882 Commits

Author SHA1 Message Date
Alexander Markov 1cd6518897 Revert "[vm/bytecode] Workaround for incorrect type parameters in function types"
This reverts commit 98837e6e43.

Reason for revert: proper fix landed in CFE (https://dart-review.googlesource.com/c/sdk/+/115368),
so reverting this workaround in bytecode generator.


Original change's description:
> [vm/bytecode] Workaround for incorrect type parameters in function types
>
> Fixes crashes on the following tests in bytecode mode:
> co19_2/LanguageFeatures/Extension-methods/generic_parameter_inference_A01_t02
> co19_2/LanguageFeatures/Extension-methods/generic_parameter_inference_A01_t05/01
> co19_2/LanguageFeatures/Extension-methods/generic_parameter_inference_A01_t05/02
> co19_2/LanguageFeatures/Extension-methods/generic_parameter_inference_A01_t05/none
> co19_2/LanguageFeatures/Extension-methods/generic_parameter_inference_A01_t06
>
> Issue: https://github.com/dart-lang/sdk/issues/37536
> Change-Id: Ief39058056fa2b1ad351dd99f630d11d17f8ce59
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116090
> Reviewed-by: Régis Crelier <regis@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

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

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

Issue: https://github.com/dart-lang/sdk/issues/37536
Change-Id: Id4886c398a7e97d6f183dbca61d7a287439074a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117100
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-09-13 00:08:00 +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 76bc894576 [vm/bytecode] Generate explicit DebugCheck for assignment to static field
Instead of always implying debugger stop at StoreStaticTOS bytecode,
bytecode generator now explicitly generates (or omits) DebugCheck bytecode.
This is needed to match behavior of AST flow graph builder of omitting
extra debugger stops when RHS expression is not trivial.

Fixes service/debugging_test with bytecode.

Change-Id: Id2e70998efb2a32a101fba4133ffa6a259ab1eb2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116443
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-09-09 23:24:09 +00:00
Alexander Markov 98837e6e43 [vm/bytecode] Workaround for incorrect type parameters in function types
Fixes crashes on the following tests in bytecode mode:
co19_2/LanguageFeatures/Extension-methods/generic_parameter_inference_A01_t02
co19_2/LanguageFeatures/Extension-methods/generic_parameter_inference_A01_t05/01
co19_2/LanguageFeatures/Extension-methods/generic_parameter_inference_A01_t05/02
co19_2/LanguageFeatures/Extension-methods/generic_parameter_inference_A01_t05/none
co19_2/LanguageFeatures/Extension-methods/generic_parameter_inference_A01_t06

Issue: https://github.com/dart-lang/sdk/issues/37536
Change-Id: Ief39058056fa2b1ad351dd99f630d11d17f8ce59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116090
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-09-09 21:22:28 +00:00
Alexander Markov 13a69b5631 [vm/bytecode] Replace ICData constant pool entries with DynamicCall
VM no longer relies on distinct ICData entries in constant pool, and
it no longer creates actual ICData objects.

This change introduces new DynamicCall constant pool entry which is
 * de-duplicated;
 * stores arguments descriptor inline instead of allocating a separate
   constant pool entry and referencing it by index;
 * reserves extra slot in constant pool (like other call constants), so
   we can eventually remove creation of extra UnlinkedCall objects.

Change-Id: I8d21954803ca5be5b6fc8335b700e8a9086245cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116120
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-09-07 02:17:37 +00:00
Martin Kustermann 70a7cbf49d [vm] Support extensions in ffi transformation and tfa tree shaker
Change-Id: I8c3d13b1683224b918f51b2c75885dabf81fb906
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115709
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2019-09-06 10:05:29 +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
Alexander Markov 4fbd758f9e [vm/bytecode] Optimize comparisons with null
BinaryTrees(RunTime): 72191.33325 us. -> 68058.06103333333 us.
(linux/x64, bytecode compiler enabled)

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

Change-Id: Ie5344d874f6b4afc5e8b6516fc6283d83963f17f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115601
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-09-05 17:52:41 +00:00
Régis Crelier 15c1487874 [vm/bytecode] Allow breakpoint on rethrow; mark closures as debuggable or not.
Generated rethrow statements do not require a 'DebugCheck', but explicit rethrow
statements do, so that user breakpoints can be set on rethrow.
Add a IsDebuggable flag on bytecode closures and set it properly.
Remove unused code in a service test.
Add verbosity to debugger.

Change-Id: Ia436cbe62e38cfaec6f9fdf7f8cc2ee5607228e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115602
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-09-04 23:56:16 +00:00
Jens Johansen a01dd3655f [CFE] Let compile platform include more required libraries"
That should allow us to "implement"
6f85cb83cf again in two steps:
* first we remove the dart:profiler as a required library, but retain it in the platform
* (we wait for stuff to roll, both in flutter and in google3)
* we remove it completely (i.e. not retaining it in the platform, removing the source etc)

Change-Id: Ieb77c2ba909300c05f3923c2edba7cab7d34fae6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115244
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-09-04 06:57:10 +00:00
David Morgan 54b95f1c8b Revert "[SDK] Remove dart:profiler library which has been deprecated since Dart 1.2"
This reverts commit 6f85cb83cf.

Reason for revert: CFE built before this CL breaks with dill built after; it expects dart:profiler to be present in the dill.

Original change's description:
> [SDK] Remove dart:profiler library which has been deprecated since Dart 1.2
>       and remove all references to it in tests and the SDK build scripts.
> 
> Change-Id: I65a4d71b74c66ca090eba28e922e2f70a7b2989d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114965
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>

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

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

Change-Id: I5fec5c7aec55377ba5cba0b55a25e67682220276
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115242
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
2019-09-03 14:26:26 +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
Sigurd Meldgaard af9e298391 Reland "Use identical as shortcut in equality checks"
This is a reland of 4b5893f9cf

Nothing has changed, the revert was accidental.

Original change's description:
> Use identical as shortcut in equality checks
>
> These equality checks are showing up in a profile-run of the type flow analysis.
> For this particular benchmark, time went down ~10% from ~32.2s to ~29.5s.
>
> Change-Id: I158f1db0d0816aa347f89ae0228f7a9a5158318f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115203
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>

Change-Id: Ia7bdf790f48eab2060f51328a50eaff153483203
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115216
Reviewed-by: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2019-09-03 09:24:50 +00:00
Sigurd Meldgaard 8fb0152af8 Revert "Use identical as shortcut in equality checks"
This reverts commit 4b5893f9cf.

Reason for revert: Got the operator associativity wrong

Original change's description:
> Use identical as shortcut in equality checks
> 
> These equality checks are showing up in a profile-run of the type flow analysis.
> For this particular benchmark, time went down ~10% from ~32.2s to ~29.5s.
> 
> Change-Id: I158f1db0d0816aa347f89ae0228f7a9a5158318f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115203
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>

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

Change-Id: Ib71ca9595ad7d163de07911b813e9de3c93efcf9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115213
Reviewed-by: Sigurd Meldgaard <sigurdm@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2019-09-03 07:12:09 +00:00
Sigurd Meldgaard 4b5893f9cf Use identical as shortcut in equality checks
These equality checks are showing up in a profile-run of the type flow analysis.
For this particular benchmark, time went down ~10% from ~32.2s to ~29.5s.

Change-Id: I158f1db0d0816aa347f89ae0228f7a9a5158318f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115203
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2019-09-02 14:10:46 +00:00
Régis Crelier 5da853060c [vm/bytecode] Move prologue CheckStack opcode after closure context is copied.
The bytecode generator should not emit a CheckStack before the initial context
is properly setup. This fixes #38110.

Change-Id: I94000ebe698437d088c0e307a8735b11cfcd9c8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115066
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-08-30 21:22:29 +00:00
asiva 6f85cb83cf [SDK] Remove dart:profiler library which has been deprecated since Dart 1.2
and remove all references to it in tests and the SDK build scripts.

Change-Id: I65a4d71b74c66ca090eba28e922e2f70a7b2989d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114965
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2019-08-30 17:03:04 +00:00
Alexander Markov 011144b43b [vm/tfa] Infer type for indexing into a const list
Before:
DartNTZ.NTZ32(RunTime): 351.9357010381841 us.
DartNTZ.NTZ64(RunTime): 351.99127771911304 us.

After:
DartNTZ.NTZ32(RunTime): 150.19256867162275 us.
DartNTZ.NTZ64(RunTime): 149.48622578475337 us.

Issue: https://github.com/dart-lang/sdk/issues/37789
Change-Id: Ie8b16b2602a15140df9f0f21199ee9eb2bbf158c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115012
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-30 16:34:24 +00:00
Alexander Markov d7c944b4c0 [vm/bytecode] Support library dependencies in bytecode for mirrors and vm-service.
Library dependencies are serialized in bytecode as extended annotations.

Fixes the following tests with bytecode:
co19_2/Language/Metadata/before_export_t01
co19_2/Language/Metadata/before_import_t01
service/library_dependency_test

Change-Id: Idfbac6fcd56318d994d179864f0f5fd7d95089a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114928
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-08-29 21:07:06 +00:00
Samir Jindel 792c3aa92d [vm/tfa] Don't drop abstract classes with entry-point annotation.
Issue https://github.com/dart-lang/sdk/issues/38082

Change-Id: I766c3efdd876bec016f17d714dd60e6e9e7591eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114864
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-08-29 18:53:49 +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
Régis Crelier d57a8f7451 [vm/bytecode] Remove DebugCheck in synthetic non-local transfer (no source pos).
This fixes the following test:
service/async_star_step_out_test

Change-Id: I5def5fd277dcc4d32838c6ddb225441ece45e71f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114751
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-08-28 22:32:31 +00:00
Régis Crelier a290271dea [vm/bytecode] Throw should be 'debug checked', but not ReThrow.
Since both throw and rethrow statements share the same 'Throw' bytecode opcode
(differentiated by an operand), we make the opcode not implicitly 'debug
checked' anymore.
Instead, we emit a 'DebugCheck' opcode for the throw statement only.

This fixes the following test:
service/async_single_step_exception_test

Change-Id: I4e540ea0a640fda5365d51933ce4e5125548e2f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114754
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-08-28 22:20:53 +00:00
Alexander Markov 6784bcb370 [vm/bytecode] Fix source position for catch clause
Fixes service/next_through_multi_catch_test with bytecode.

Change-Id: I095b3a784f3e59b64f493ec43b265a70f295a0f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114880
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-28 18:19:51 +00:00
Martin Kustermann dfbb9083c6 [vm] Allow vm tests to import private platform libraries for testing purposes
Issue https://github.com/dart-lang/sdk/issues/36097

Change-Id: I1acec0b7c683ffa363e9b6f7056e76ea2f61d27d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114843
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-08-28 10:19:22 +00:00
Alexander Markov 5cbcc88304 [vm/bytecode] Add DebugCheck for variable set with as-expression RHS
This emulates behavior of AST-based flow graph builder which would
insert DebugStepCheck if RHS is LoadLocal.
As-expression generated by AST-based flow graph builder results
in LoadLocal (unless it's casting to a top type).

Fixes service/next_through_is_and_as_test with bytecode.

Change-Id: Icb809d42daf2a4ebbad22bfa92bc737406144489
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114740
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-28 02:27:03 +00:00
Régis Crelier 726762c4bd [vm/bytecode] Remove source information from setAsyncThreadStackTrace in prolog.
Removing source information for this call prevents the debugger to set a
breakpoint in compiled bytecode on this call which occurs prior to the first
DebugStepCheck in the function.

However, this change uncovered a bug in debugging interpreted bytecode:
The first source range of an async_op function gets split into 3 ranges, with
the middle range specifying a NoSource token position. The debugger does not
set a breakpoint in the first range, because DebugCheck is not yet encountered,
which is correct, but it failed to look for another range (the 3rd one) with the
same token position.

Change-Id: I11dcc75d115cb57b37f62afd83c783cf563b63e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114700
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-08-27 22:45:52 +00:00
Alexander Markov f2ab9478ee [vm/bytecode] Avoid extra DebugCheck in variable declaration
The extra DebugCheck is skipped depending on the initializer expression,
similarly to VariableSet.

This matches how AST-based flow graph builder inserts DebugStepCheck for
VariableDeclaration.

Test: runtime/observatory/tests/service/async_star_step_out_test.dart
Change-Id: Id1b11813b533996e219891f416e7008a994dbc51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114593
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-27 16:52:17 +00:00
Aske Simon Christensen d44ada3c52 [vm] Remove constant evaluator calls in the VM and bytecode generator.
These are unnecessary now that constant evaluation is performed as
part of the front-end transformations.

Change-Id: Ia7c47476ddd4d4b3d0483eb4e40cab7677ec5b7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112243
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-08-27 14:07:55 +00:00
Aske Simon Christensen 497765f59f [vm] Move VM constant patching before constant evaluation.
This ensures that the VM host endian optimization described in
http://dartbug.com/32836 works properly after the explicit call to
the constant evaluator in the AOT compiler is removed.

Change-Id: I69424c7d27d113a70700a5cdad345bf632272ab6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112083
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-27 14:07:55 +00:00
Aske Simon Christensen a6596cfd40 [cfe] Allow backend target to specify extra libraries to be indexed.
Change-Id: I35e1857bee3a9cc237da7e8bc70d90a1c83e2b1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112345
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-27 14:07:55 +00:00
Alexander Markov e878bdafe9 [vm/bytecode] Add DebugCheck to stop at return statement before executing finally blocks
Fixes service/debugging_inlined_finally_test in bytecode mode.

Change-Id: I323c3db7a5c31b840d178daffa65d0281e072a21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114588
Reviewed-by: Régis Crelier <regis@google.com>
2019-08-26 23:52:30 +00:00
Alexander Markov 6db6a0ce67 [vm/bytecode] Capture :controller_stream variable in async* functions
Test: runtime/observatory/tests/service/async_star_step_out_test.dart

Change-Id: If6dec1b5005b0736edaf85b974581f294e602f40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114463
Reviewed-by: Régis Crelier <regis@google.com>
2019-08-26 23:52:19 +00:00
Alexander Markov da4e6eb6e3 [vm/bytecode] Correct source positions for for-in statements
Fixes service/next_through_for_each_loop_test in bytecode mode.

Change-Id: Ida3269f3ca6127b088855f173bd8a2e18faf884d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114553
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-26 22:03:08 +00:00
Alexander Markov a00a8df2d9 [vm/bytecode] Correct source positions for switch cases
This fixes the following tests in bytecode mode:
service/step_through_switch_test broke
service/step_through_switch_with_continue_test

Change-Id: I3f6f835185b9dae86e5ebebfdd4484b4d1cb6af0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114549
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-26 20:44:06 +00:00
Alexander Markov 524f78e6cb [vm/bytecode] Fix symbols for private parameter names
Fixes lib_2/mirrors/initializing_formals_test/03 test in bytecode mode.

Change-Id: I937b9f1d3651cbfb3ea7531105d21589f94e7961
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114460
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-23 23:36:18 +00:00
Alexander Markov 41981f4192 [vm/bytecode] Ensure top-level class is loaded when querying library annotations
Fixes co19_2/Language/Metadata/before_library_t01 in bytecode mode.

Change-Id: I2c488ca76e6eeede83fe046aa1dd00e6ced5b25e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114450
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-23 23:36:01 +00:00
Alexander Markov 6ee9e67156 [vm/bytecode] Mark synthetic calls in source positions so debugger can skip them
Change-Id: I40ea385f650e04433ed404c51ee78e128f37445a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114303
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-08-23 17:06:11 +00:00
Daco Harkes a7fa63789a [cfe/ffi] Only catch FFI transformation exceptions
Closes: https://github.com/dart-lang/sdk/issues/37596
Change-Id: I0167a4a9841ce0adc03125db777fcd9798776cf1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114203
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2019-08-23 09:54:28 +00:00
Alexander Markov 5e428ed638 [vm/bytecode] Fixes for expression evaluation
* Set parent for TypeParameters created in createExpressionEvaluationComponent.

* Resolve references from bytecode to an expression evaluation class
  using real class. Expression evaluation class could be referenced
  from type parameters.

* Avoid registering expression evaluation classes in hierarchy. They
  shouldn't be discovered through direct subclasses or implementors,
  as expression evaluation classes don't have cids.

* Add :function_type_arguments_var local variable to bytecode local
  variables info, so expression evaluation can find function type
  arguments which are in scope.

Change-Id: I515431a989b4d02af4ecf90579931dd59d3acadd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114182
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-22 22:53:12 +00:00
Alexander Markov 3617c8d704 [vm/bytecode] Add missing DebugCheck to local function declaration
This debugger stop is generated by AST-based flow graph builder but
not covered by stopping at any particular bytecode instruction.

Change-Id: Id9c53cbbcda5ec589c7a24917fb9d79f5a27452b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114183
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-22 21:17:45 +00:00
Alexander Markov 9fda4c1101 [vm/bytecode] Avoid using closure call instructions if code coverage may be needed
This is a workaround to https://github.com/dart-lang/sdk/issues/37944.
Closure call instructions are not tracked by code coverage, so this change
avoids generating them in bytecode if incremental kernel compiler is used -
when vm-service is enabled with command-line option and code coverage
may be needed.

Change-Id: Ifb3bc5e90a9f8ccb04073994d761bc301bc274ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114045
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-22 00:28:34 +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
Alexander Markov 5e5313c8d6 [vm/bytecode] Keep unreachable code for code coverage
This change adds a bytecode generation option 'keep-unreachable-code' to
avoid eliminating unreachable code from constant conditions.
This option is enabled in kernel service.

If unreachable code is eliminated, then call instructions are not generated
and ICData objects are not created. Source code report is collected
using created ICData objects and will not flag the unreachable code as
not executed.

Change-Id: Ic73e19c653505e0dfab4648ab65ef6b90370e0b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113960
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-21 02:28:44 +00:00
Alexander Markov 922c2bfbb0 [vm/bytecode] Include source info and asserts into platform with bytecode
* Include source positions, source text (if provided by front-end, which is
  controlled by a separate option) and assertions into platform with bytecode.
  Also use environment defines if provided.

* Omit bytecode for synthetic static fields '_redirecting#' injected
  by front-end, as they contain invalid AST nodes (taking tear-off of
  a constructor). This is needed to avoid emitting bytecode which cannot be
  loaded.

* Correctly merge source information such as source text and line numbers
  in bytecode generator if the script was originally created for an
  anonymous mixin application without such information.

* Always include import URIs into source information, even if other information is
  excluded (for members in anonymous mixin applications / noSuchMethod forwarders /
  forwarding stubs).

* Set native resolvers for vm/cc/PrintJSON test, as printing all objects to JSON
  involves collecting token positions, which may read bytecode from platform and
  need native resolvers to process native method entries.

Change-Id: I971e880c25439c0ec69db3a231a0085ccd5d15ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113780
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-08-21 01:08:24 +00:00
Régis Crelier b2b74e6312 [vm/bytecode] Restore source positions removed by mistake in previous CL.
Fixes #37894.

Change-Id: I8a05790d9ad3f783125c279387d02e0afa07ab33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113383
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-08-16 18:53:40 +00:00
Régis Crelier f236abc902 [vm/bytecode] Emit DebugStepCheck calls when compiling bytecode.
Change-Id: I3a5afbdbefbf7c034e6ee01a6bcf5f6922fedf43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113261
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-08-16 02:38:52 +00:00
jonahwilliams d8462dd015 Catch filesystem exception during output of dependencies delta.
When the frontend server attempts to compile dart code with an invalid
import (perhaps due to a missing entry in the .packages file), it will
get stuck in a bad state due to attempting to output said invalid import
uri as a new dependency.

Instead failures here should probably be caught and ignored, since the error messages are already reported through the existing diagnostics.

See also:

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

To reproduce this case:

1. Run the flutter gallery application (device unimportant).
2. Add an import for
`package:flutter_localizations/flutter_localizations.dart` in
`lib/main.dart`.
3. Request hot reload.

Before change:

```
Compiler message:
Error: Could not resolve the package 'flutter_localizations' in 'package:flutter_localizations/flutter_localizations.dart'.
lib/gallery/home.dart:12:8: Error: Not found: 'package:flutter_localizations/flutter_localizations.dart'
import 'package:flutter_localizations/flutter_localizations.dart';
       ^
Unhandled exception:
FileSystemException(uri=org-dartlang-untranslatable-uri:package%3Aflutter_localizations%2Fflutter_localizations.dart; message=StandardFileSystem only supports file:* and data:* URIs)
<asynchronous suspension>
<asynchronous suspension>
<asynchronous suspension>
<asynchronous suspension>
<asynchronous suspension>
```

It then gets stuck as from the perspective of the flutter tool the
reload request never completed.

After change:

```
Compiler message:
Error: Could not resolve the package 'flutter_localizations' in 'package:flutter_localizations/flutter_localizations.dart'.
lib/gallery/home.dart:12:8: Error: Not found: 'package:flutter_localizations/flutter_localizations.dart'
import 'package:flutter_localizations/flutter_localizations.dart';
       ^
Performing hot reload...
Reloaded 4 of 617 libraries in 837ms.

```

Change-Id: Ibb72624c492747a9339b15cb0b064edad8ebe4b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113135
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2019-08-15 23:07:42 +00:00