Commit Graph

1162 Commits

Author SHA1 Message Date
asiva bc7220a4fd [VM] Turn dart2 on by default on the command line VM
- make Dart2 the default option for the command line VM
- add option --no-preview-dart-2 as a fallback option to run dart1
- change test scripts to use the executable dart for testing dart2 mode instead of
pkg/vm/tool/dart2
- adjust numerous build and test configurations

Change-Id: Id813fa5b71a89c7ec9335d3f6e83cfc9f35f86e7
Reviewed-on: https://dart-review.googlesource.com/58240
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-06-18 22:31:32 +00:00
Alexander Markov cdd2553a12 [vm/kernel/bytecode] Fix null handling in operator ==
Change-Id: I2de516b98c2e49baa65c725e85a696850318ee36
Reviewed-on: https://dart-review.googlesource.com/60801
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-06-18 22:20:41 +00:00
Jens Johansen 2972ca61f8 Fix continue in invalidation logic
When invalidating changed files in frontend server, the state prior to
this CL was that a continue would jump to the next byte, not the next file
after it had seen that the file had changed. Thus it could possibly
invalidate the same file several times.

Change-Id: If6fb1042248d26a3ffe905b39fa3c3603198ca37
Reviewed-on: https://dart-review.googlesource.com/60245
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-06-14 14:06:09 +00:00
Jens Johansen 385d825469 Make frontend_server initialize from dill work again
It has probably been broken since
94a6a48edd.

Change-Id: I200b9ab6b2213a198d2fd4b396b0e501dc79273e
Reviewed-on: https://dart-review.googlesource.com/60241
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-06-14 12:16:19 +00:00
Jens Johansen 2716b6f9a6 Add test to frontend_server that mimics the flutter benchmarks
Change-Id: I1c968e5fb62fa42a38cf4e7d69683c6790385797
Reviewed-on: https://dart-review.googlesource.com/49902
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-06-14 09:38:28 +00:00
Alexander Markov 33feee3b03 [vm/kernel/bytecode] Fix arguments passing in native factory constructors
VM requires to pass null type arguments to factory constructors of
non-generic classes. This includes native implementation of native
factory constructors.

Bytecode generation for bodies of native factory constructors is fixed
to push this extra argument for NativeCall.

Change-Id: I741a783c6964da88ecd0bfd1d2ec4aa3b1868708
Reviewed-on: https://dart-review.googlesource.com/60200
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-06-13 22:28:04 +00:00
Ryan Macnak 9b5a931b06 [vm] Replace most runtime/vm uses of OS::Print with OS::PrintErr.
Leave --print-snapshot-sizes on stdout because it is parsed by Flutter benchmarks.

Replace all runtime/bin uses of OS::Print with Log::Print.

Bug: https://github.com/dart-lang/sdk/issues/32134
Change-Id: I74aacfb410cdfa9270d06e7f6ab0534520c7c7ba
Reviewed-on: https://dart-review.googlesource.com/60021
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-06-13 19:51:40 +00:00
Peter von der Ahé 3d98cce456 Replace Severity.nit by Severity.ignored
Change-Id: Ib249c2e383c25173bd25b965bdb0d67c9a487cb4
Reviewed-on: https://dart-review.googlesource.com/59085
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-06-13 08:12:34 +00:00
Alexander Markov 828a168622 [vm/kernel/bytecode] Generate bytecode for native methods
Change-Id: If47ef9ef4ff5ac3cb3f4f6737590370b647fc9ff
Reviewed-on: https://dart-review.googlesource.com/59180
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-06-13 01:16:03 +00:00
Ryan Macnak 26c7ab1331 [standalone] Record dependencies in DFE and include them in snapshot depfiles.
Bug: https://github.com/dart-lang/sdk/issues/33390
Change-Id: Ib1ce6078ccff1b8727c26a8ff7b24e9fb99fd086
Reviewed-on: https://dart-review.googlesource.com/60020
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-06-12 22:29:33 +00:00
Samir Jindel beb0432d6c Re-land "[vm/kernel/aot] Exclude vmservice_io from "product" AOT snapshots."
This reverts commit 17585c42fe.

The original revision is in Patchset 1.

Fixed Tests:

python tools/test.py -m debug -c dartkp -r dart_precompiled --strong standalone_2/no_support_service_test
python tools/test.py -m product -c precompiler -r dart_precompiled lib_2/isolate/function_send1_test

Change-Id: I6af715ee3c080b515c8312357f3d8be6e494747a
Reviewed-on: https://dart-review.googlesource.com/59760
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-06-12 15:31:19 +00:00
Alexander Markov 17585c42fe Revert "[vm/kernel/aot] Exclude vmservice_io from "product" AOT snapshots."
This reverts commit 23fff58503.

Reason: failures on vm-kernel-precomp-linux-debug-x64-4-8-be,
precomp-linux-debug-x64-1-3-be, precomp-linux-product-x64-be bots.
Change-Id: I7bd67038aac3795c4b6ec9562c6fd4afead41a36
Reviewed-on: https://dart-review.googlesource.com/59242
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-06-08 00:51:53 +00:00
Samir Jindel 23fff58503 [vm/kernel/aot] Exclude vmservice_io from "product" AOT snapshots.
The `@pragma` annotation on `vmservice_io.main` is modified to only mark it as a
root on non-product builds. Since the annotation is evaluated in the constant
transformation, we need to thread a flag through `gen_kernel.dart` indicating
whether the Kernel produced should target a product precompiler.

# Test Plan

Tested locally on Flutter. Unfortunately it's not possible to test the scenario where
`vmservice_io` is not included, since we don't have any "product" bots. Soon the
flag will be introduced into Flutter, and we will have some coverage from there.

Change-Id: I39f12343038fa221aafe5a55241bff4b8d14ec19
Reviewed-on: https://dart-review.googlesource.com/57501
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-06-07 20:22:21 +00:00
Alexander Markov d52d060950 [vm/kernel/bytecode] Count type arguments argument for factory calls
Implicit argument for type arguments vector is not counted
in the number of arguments in ArgumentsDescriptor when calling
generic functions, but VM requires it to be counted
when calling factory constructors.

Bytecode generator is adjusted to cope with this discrepancy.

Change-Id: Id041563dfc68491b87593bcb6dff5cae64bfedc6
Reviewed-on: https://dart-review.googlesource.com/58961
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-06-07 17:24:08 +00:00
Alexander Markov e285bc52d7 [vm/kernel/bytecode] Optimize instantiation of types and type arguments
This CL contains 2 optimizations:

* instantiator type arguments are reused if possible;

* instantiator and function type arguments are not loaded if they are
  not needed for a particular type being instantiated.

Change-Id: Id1f6e5385051044b3b9f78cef884a917e65e801d
Reviewed-on: https://dart-review.googlesource.com/58680
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-06-06 22:03:54 +00:00
Florian Loitsch 398ba13e4a Reapply "Make --sync-async the default for the VM."
Change-Id: I6e4da0da6c3f635d84380b384ae17fbb55587895
Reviewed-on: https://dart-review.googlesource.com/58721
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Florian Loitsch <floitsch@google.com>
2018-06-06 14:32:13 +00:00
Ryan Macnak 53f7bb175e Revert "Make --sync-async the default for the VM."
This reverts commit 1ddf553eb6.

Reason for revert: Failing service tests

Original change's description:
> Make --sync-async the default for the VM.
> 
> Change-Id: Ic6d7bbc27835ea7b197cccf05724adb99e95dd51
> Reviewed-on: https://dart-review.googlesource.com/57580
> Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

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

Change-Id: I062cb40badf0d1cf1808bee152fdd4074b00179d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/58380
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-06-04 21:04:20 +00:00
Alexander Markov c3b5939965 [vm] Remove --limit-ints-to-64-bits option and old _Bigint class
Closes https://github.com/dart-lang/sdk/issues/33306

Change-Id: I7088d8b7143edbe24f5cefe4be037ad2006e0625
Reviewed-on: https://dart-review.googlesource.com/58101
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-06-04 20:10:40 +00:00
Florian Loitsch 1ddf553eb6 Make --sync-async the default for the VM.
Change-Id: Ic6d7bbc27835ea7b197cccf05724adb99e95dd51
Reviewed-on: https://dart-review.googlesource.com/57580
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-06-04 18:05:20 +00:00
Kevin Millikin 6ac6baae8e Record interfaceTargets for calls on dynamic receivers
When calling Object methods on dynamic receivers, record the
interfaceTarget it Kernel.  Back ends will use this to treat the call
as a statically typed one.  This is half of the problem in
https://github.com/dart-lang/sdk/issues/33293

Bug: https://github.com/dart-lang/sdk/issues/33293
Change-Id: I8d05903e5b85370a4e697ad3afc494cbc14bcc6a
Reviewed-on: https://dart-review.googlesource.com/57820
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-06-04 09:47:21 +00:00
Alexander Markov d319d3eda4 [vm/kernel/bytecode] Do not generate bytecode for external (native) members
Change-Id: I5887893528b8b0d4c93ef5e1088e229e0338ecef
Reviewed-on: https://dart-review.googlesource.com/58040
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-06-01 22:13:19 +00:00
Alexander Markov b7266fa3b3 [vm/kernel/bytecode] Support async/async*/sync* in bytecode generator
Change-Id: If164289608322647c0ee5d1f1ed35eb2562b1a03
Reviewed-on: https://dart-review.googlesource.com/56627
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-06-01 21:57:44 +00:00
Alexander Markov c8860b4ca2 Remove all uses of --limit-ints-to-64-bits VM option
VM option --limit-ints-to-64-bits was enabled by default a while ago,
and now we're preparing to remove it from Dart VM.

This CL removes all uses of this option in preparation for this cleanup.

Issue: https://github.com/dart-lang/sdk/issues/33306
Change-Id: I8f33cf4ca8ce7ef9a171a982346e43dd8cb722a9
Reviewed-on: https://dart-review.googlesource.com/57960
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-06-01 19:32:24 +00:00
Paul Berry 5db95fbb61 Upgrade mockito to latest version.
And fix frontend_server_test.dart accordingly.

Change-Id: Ic6a57afc9582780e55015a36f3cec6969de13c54
Reviewed-on: https://dart-review.googlesource.com/56709
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-06-01 19:32:13 +00:00
Kevin Millikin b62b438e8a Infer Object members for dynamic receivers
For method, getter, and setter invocations with names of methods on
Object on expressions with static type `dynamic`, if the invocation
cannot possibly be an invocation of noSuchMethod, infer the type of
the invocation using the type of the member of Object.

This implements the feature spec
https://github.com/dart-lang/sdk/commit/472ec7780f1bb38f049d0fcc903a69bfb8ef9133

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

Change-Id: I135156346fe1468561d56a01cf3c5f0efde30739
Reviewed-on: https://dart-review.googlesource.com/56942
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-05-31 12:43:22 +00:00
Alexander Markov 377eb52f5a [vm/kernel/bytecode] Add library reference and invocation kind to ConstantICData
Library reference is added for private names in order to resolve them correctly.
Invocation kind byte supersedes VM-specific name mangling and makes
ConstantICData more uniform with ConstantStaticICData.

Change-Id: I66542356209d98b3d0cf0e6b8eb19bda052c6b7e
Reviewed-on: https://dart-review.googlesource.com/57485
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-05-31 00:53:21 +00:00
Samir Jindel 3d2b66074c Reland "[vm] Support definition of entry-points via @pragma('vm.extern') annotations.""
When the constant transformation is enabled on annotations, we need to fix handling
of @ExternalName annotations in the kernel_loader to ensure that we are setting
is_external = false on native methods.

The original revision is in patchset 1.

# Test Plan

The only regression was on benchmarks, Golem results are pending.

Change-Id: Ib80bb9f532299056e770a3b378cc5ad9ee451f57
Reviewed-on: https://dart-review.googlesource.com/56960
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-30 20:06:40 +00:00
Vyacheslav Egorov 3b86f823d0 [vm/corelib] Remove GrowableArrayMarker hack.
GrowableArrayMarker was a class that implemented int and was used to
enable implementation of default List factory constructor in pure Dart:

  factory List([int length = GROWABLE_ARRAY_MARKER]) {
    return identical(length, GROWABLE_ARRAY_MARKER) ? new _GrowableList<E>(0)
                                                    : new _List<E>(length);
  }

Its existence complicated all kinds of things in the VM and it is finally
time to remove it.

Instead we build List factory body directly in IL.

This CL also provides inlining rule for `new List(n)` case.

Change-Id: I870751658a4ac17fce649c9ac70395ff88a5436c
Reviewed-on: https://dart-review.googlesource.com/57262
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-05-30 13:44:43 +00:00
Alexander Markov 1ca17b6d03 [vm/kernel] Recognize desugared mixin applications in dart:mirrors
Kernel mixin transformation desugars mixin applications into normal
classes. Mixed-in type is pulled into interfaces list.
However, dart:mirrors needs to know the original mixed-in type of
a mixin application.

This change solves this problem by propagating a 'isTransformedMixinApplication'
attribute of a class through kernel AST, kernel binary and VM objects
into dart:mirrors implementation.

Fixes: https://github.com/dart-lang/sdk/issues/33240
Change-Id: I98ca69294e1ad445402a5ca91d90c30447aabcb2
Reviewed-on: https://dart-review.googlesource.com/56721
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-05-29 18:12:26 +00:00
Samir Jindel 58dc4e476d Revert "[vm] Support definition of entry-points via @pragma('vm.extern') annotations."
This reverts commit 3e50ea32b5.

Reason for revert: Severe performance regressions on many aot-v2 benchmarks.

Original change's description:
> [vm] Support definition of entry-points via @pragma('vm.extern') annotations.
> 
> The `@pragma` annotations are evaluated by the constants transformation and
> visible to TFA and the precompiler, which match on the "options" field of the
> annotation to determine whether to mark the class/procedure as a root.
> 
> This required enabling the transformation of annotation constants by default.
> 
> # Test Plan
> 
> The "vmservice_io.main" entry-point is removed from `main.cc` and annotated with
> `@pragma`. All precompiler tests will crash if "vmservice_io.main" is not
> available at runtime.
> 
> Debug/release precompiler bots are visible in "cl-linux" button.
> 
> Change-Id: I03c5d6ba7918672ed9905fcaee8dabe675a93a5d
> Reviewed-on: https://dart-review.googlesource.com/56660
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

TBR=vegorov@google.com,alexmarkov@google.com,sjindel@google.com

Change-Id: I779c17d003659129a4b3fcf284423104948f60e2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/56820
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-05-28 19:23:16 +00:00
Samir Jindel 3e50ea32b5 [vm] Support definition of entry-points via @pragma('vm.extern') annotations.
The `@pragma` annotations are evaluated by the constants transformation and
visible to TFA and the precompiler, which match on the "options" field of the
annotation to determine whether to mark the class/procedure as a root.

This required enabling the transformation of annotation constants by default.

# Test Plan

The "vmservice_io.main" entry-point is removed from `main.cc` and annotated with
`@pragma`. All precompiler tests will crash if "vmservice_io.main" is not
available at runtime.

Debug/release precompiler bots are visible in "cl-linux" button.

Change-Id: I03c5d6ba7918672ed9905fcaee8dabe675a93a5d
Reviewed-on: https://dart-review.googlesource.com/56660
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-28 15:13:55 +00:00
Alexander Aprelev 5cc3736644 [vm/frontend-server] Include errors count into compile expression response.
Change-Id: Ifc42ff221eb5a0d95f7ed0f29f410ab18740b0e6
Reviewed-on: https://dart-review.googlesource.com/56140
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2018-05-24 18:16:16 +00:00
Vyacheslav Egorov eb19be5ff8 [vm/tool] Teach precompiler2 script to build ELF binaries.
Usage: pkg/vm/tool/precompiler2 --build-elf a.dart liba.so

Change-Id: I06f673453c8fc6f103c0ccc345b8586edaf6d1a0
Reviewed-on: https://dart-review.googlesource.com/56503
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-05-24 16:56:58 +00:00
Alexander Markov 3c6907ed0d [vm/kernel/aot] Approximate numerous invocations per selector in TFA
This change adds tracking of number of invocations with the same
selector but different arguments. If this number reaches certain limit,
all subsequent invocations with such selector are approximated.

On Flutter gallery, 1 selector is approximated:
  dart.core::Object::==

On Analyzer, 2 selectors are approximated:

  analyzer.dart.ast.ast::AstNode::visitChildren
  dart.core::List::[]=

Flutter gallery Total(CodeSize): +11 K.

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

Change-Id: I3598555194262a4f08fe1bc207d10880a25eb432
Reviewed-on: https://dart-review.googlesource.com/56420
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-05-24 16:13:22 +00:00
Martin Kustermann bca70073ae [vm/kernel] Move kernel2kenrel "constants" transformation before TFA
Change-Id: Iffa9cea655a0b731c2784a172096d450571eaf1c
Reviewed-on: https://dart-review.googlesource.com/53220
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-05-24 10:53:42 +00:00
Sigmund Cherem 9b44fc39c8 Deprecate chaseDependencies option.
The option is not used by any client at this time and removing it simplifies the
next stack of changes I'll be making on how we compose file systems.

I also don't believe we will necessarily add this back as an option, but instead
it might be that clients requriing hermeticity will provide a custom file system
that helps with that.

Change-Id: I401efb042920d234382b6c041b13d40ffae5c908
Reviewed-on: https://dart-review.googlesource.com/56462
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-05-24 04:57:01 +00:00
Martin Kustermann 3582e30d8e [VM] Remove unused _Random._A field in Dart sources and make constant in C++ code instead
Issue https://github.com/dart-lang/sdk/issues/33185

Change-Id: I256a66ebf81d4433bded15f19b4147327df9b588
Reviewed-on: https://dart-review.googlesource.com/56329
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-23 13:06:25 +00:00
Ben Konyi 6d8f473d4f [ VM / Hot Reload ] Updated kernel_service and hot reload behavior to run as long as the compiler returns valid kernel.
Change-Id: Id2b20d95488ccd374f4ca337355dde9f5057292a
Reviewed-on: https://dart-review.googlesource.com/46820
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-05-22 23:50:28 +00:00
Sigmund Cherem 8c0f5747a0 Add build_integration package and move multi_root_file_system there.
This is following the design discussion we had a few months ago.

Change-Id: I48b2e82af33d10b9cd1e599e1b3a4e8e419417c8
Reviewed-on: https://dart-review.googlesource.com/56035
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-05-22 20:09:24 +00:00
Alexander Markov 714697efbb [vm/kernel/bytecode] Write constant pool before bytecode and exceptions table
This simplifies reading, as exceptions table refers to constant pool.

Change-Id: Id20d2a315ad87aa4e5247fcd98d7e5996c188eec
Reviewed-on: https://dart-review.googlesource.com/56032
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-05-21 23:51:41 +00:00
Alexander Aprelev 80b48195b1 [frontend-server] Serialize compiled expression procedure into the file.
Improve comments and test, report errors.

Follow-up to https://dart-review.googlesource.com/c/sdk/+/49040.

Change-Id: Ie02dae1c0edfcb54e3cd7333641e2c5eface1412
Reviewed-on: https://dart-review.googlesource.com/56030
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2018-05-21 23:50:22 +00:00
Alexander Markov 68b19b4ff4 [vm/kernel/bytecode] Add invocation kind to StaticICData constant
VM will use the invocation kind to distinguish between getters,
setters and calls via field/getter.

Change-Id: I97cf36bc8778533e53f8251c25b373fddec3c2e8
Reviewed-on: https://dart-review.googlesource.com/55581
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-05-21 23:03:01 +00:00
Alexander Aprelev d5b99860e4 [frontend-server] Introduce compile-expression command.
Change-Id: I5b200ab00076710b08527ec4b35322a6a5fcc4b9
Reviewed-on: https://dart-review.googlesource.com/49040
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2018-05-21 18:11:09 +00:00
Alexander Markov 6202749429 [vm/kernel/bytecode] Support try-catch-finally in bytecode generator
Change-Id: I2882546741b1dd8f6e03a21d85b5487fb754b742
Reviewed-on: https://dart-review.googlesource.com/55324
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-05-20 19:52:07 +00:00
Jens Johansen e491bc5d86 Allow to specify what dill file to initialize from
This CL updates the frontend_server to allow specifying what dill
file to initialize from.

Normally, it tries to initialize from the same dill file as is the
output. This is fine in many cases (e.g. flutter run always says it
should output to build/app.dill): The first time it compiles
everything, subsequent times (across restarts) it only recompiles
what's needed.

When running tests, however, the output is in a temporary directory,
so it doesn't work across restarts. The startup time for tests is
always rather high, because it always has to recompile everything.

This CL updates the frontend_server to allow specifying what dill
file to initialize from. Flutter can thus save the compiled test
file in a centralized location (e.g. build/test.dill) and load from
that across restarts.

Plumbing this into flutter yields the following result, when running
a single test (the one automatically created when creating a new
flutter project):

Before: ~5.5 seconds
Now, first run: ~5.5 second (unchanged)
Now, subsequent runs: ~3.4 seconds

Approximate breakdown:

Startup cost (e.g. if there's no test directory):        ~ 800 ms
Starting up the actual frontend server: ~150 ms
Reading source from old dill, loading all relevant files
and invalidating source:                                 ~ 300 ms
Compiling everything (or, rather, nothing as it's all
from the dill at this point):                            ~ 650 ms
Serializing:                                             ~ 250 ms
Copying files:                                           ~  50 ms
Running the actual test:                                 ~1100 ms

Total:                                                   ~3300 ms

`time flutter test --local-engine=host_debug --preview-dart-2`
says ~3.4 seconds...

To compare, --no-preview-dart-2 takes ~2.2 seconds,
so dart2 still has a (significantly) higher startup cost.

Moves the needle on https://github.com/flutter/flutter/issues/15767.

Change-Id: I36a2d05bc76e0193d369df42eb3b9f08416dd78f
Reviewed-on: https://dart-review.googlesource.com/51820
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-05-17 06:49:41 +00:00
Martin Kustermann 775eeece8a [VM] Enable kernel2kernel constants evaluation in AOT for the VM.
Change-Id: Iff40aaf464f870235c9a15c4ee33385256e58023
Reviewed-on: https://dart-review.googlesource.com/55461
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-05-16 16:11:22 +00:00
Martin Kustermann aafc2a6d43 Reland "[vm/kernel] Enable kernel2kernel "constants" transformation in AOT mode (after running TFA)"
The CL was originally committed in 039e8a175 (and reverted in
46ab040e5). The fix for the issue has landed in 9d9ce8d69 .

This time the CL will land in "disabled" form and will be enabled in a separate CL.

Change-Id: I3d5eb952230aee99875e3c58a6595691c5145e25
Reviewed-on: https://dart-review.googlesource.com/55361
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-16 12:48:38 +00:00
Alexander Markov a2b1ce8418 [vm/kernel/bytecode] Add an option to drop AST if bytecode was generated
This CL adds experimental option --drop-ast to the gen_kernel tool in
order to remove AST bodies of members with bytecode.

Change-Id: Ib5f02eb189ec1ccd9fa77159c175fc3774998ce5
Reviewed-on: https://dart-review.googlesource.com/55262
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-05-15 20:04:36 +00:00
Alexander Markov 6b65dcbcf6 [vm/kernel/bytecode] Support closures in bytecode generator
Change-Id: I038ba92c7bc210568d817ebaa109ca0ad02550e1
Reviewed-on: https://dart-review.googlesource.com/52988
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-05-15 16:51:06 +00:00
Martin Kustermann f2b37ab643 [VM] Add support for conditions in switch-case expressions to "constants" transformation
This seems to be the last remaining case which causes constant
evaluation in the VM in AOT mode.

Change-Id: I37dba2c634afa3bebd918ebe6dd93ff52a7708e7
Reviewed-on: https://dart-review.googlesource.com/55163
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-05-15 12:52:22 +00:00