Commit Graph

527 Commits

Author SHA1 Message Date
Alexander Markov ec4d48e241 [vm/bytecode] Add starting and ending source positions for closures
Issue: https://github.com/dart-lang/sdk/issues/36427
Change-Id: Ib2f55504f9238036a9700f1e2672b4641536ab7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103480
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-05-22 19:02:40 +00:00
Sam Rawlins b22cd05c51 Reland fix for #28233: add hint for missing returns to function expressions
The bulk of this change is actually correcting missing returns in the Dart SDK.

Bug: https://github.com/dart-lang/sdk/issues/28233
Change-Id: I52bcbc6c6f4a129d3fc22003f4448a7c3d4487ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100301
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-05-22 18:12:30 +00:00
Jacob Richman e2976acd22 Add --track-widget-creation flag to frontend_server.
This is needed to activate the kernel transformer embedded with the kernel package from the flutter engine.

Change-Id: I3253e01723b662eb48b4b3743ac5bcc1b44c7d46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102920
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Jacob Richman <jacobr@google.com>
2019-05-20 22:47:28 +00:00
Samir Jindel ed169c4bb0 Revert "[vm/ffi] FFI callbacks on X64."
This reverts commit be209f7846.

Reason for revert: failures on dartkb and windows bots

Original change's description:
> [vm/ffi] FFI callbacks on X64.
> 
> For context on the design, see go/dart-ffi-callbacks
> 
> Change-Id: I2482e3c932e73f9a4c00fa7e218ff85f9328fc51
> Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-simdbc64-try, vm-kernel-linux-release-simdbc64-try, vm-kernel-mac-debug-simdbc64-try, vm-kernel-mac-release-simdbc64-try, vm-kernel-reload-mac-debug-simdbc64-try, vm-kernel-reload-mac-release-simdbc64-try, vm-kernel-linux-debug-ia32-try, vm-dartkb-linux-debug-simarm64-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100240
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Daco Harkes <dacoharkes@google.com>

TBR=sjindel@google.com,ajcbik@google.com,dacoharkes@google.com

Change-Id: I4cb3d93675d68a51ac9e125ad1d572c47e8b5903
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-simdbc64-try, vm-kernel-linux-release-simdbc64-try, vm-kernel-mac-debug-simdbc64-try, vm-kernel-mac-release-simdbc64-try, vm-kernel-reload-mac-debug-simdbc64-try, vm-kernel-reload-mac-release-simdbc64-try, vm-kernel-linux-debug-ia32-try, vm-dartkb-linux-debug-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102983
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2019-05-18 15:29:19 +00:00
Samir Jindel be209f7846 [vm/ffi] FFI callbacks on X64.
For context on the design, see go/dart-ffi-callbacks

Change-Id: I2482e3c932e73f9a4c00fa7e218ff85f9328fc51
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-simdbc64-try, vm-kernel-linux-release-simdbc64-try, vm-kernel-mac-debug-simdbc64-try, vm-kernel-mac-release-simdbc64-try, vm-kernel-reload-mac-debug-simdbc64-try, vm-kernel-reload-mac-release-simdbc64-try, vm-kernel-linux-debug-ia32-try, vm-dartkb-linux-debug-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100240
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2019-05-18 06:15:46 +00:00
Ryan Macnak bd840b93cb [package:vm] Account for package map comments.
Bug: https://github.com/dart-lang/sdk/issues/36954
Change-Id: Id224e9358cadc1f3c30fe5890515332074ec6983
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102460
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-05-14 18:42:09 +00:00
Aske Simon Christensen 8754351283 [CFE] Run widget transformer before constant evaluation.
Change-Id: I51ded35ecb95cb5cfbac5ecf8967e0918a48269a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101987
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Jacob Richman <jacobr@google.com>
2019-05-10 11:02:49 +00:00
Alexander Markov 477ad3c0ea [vm/bytecode] Eliminate asserts from bytecode unless --enable-asserts
Total size of a large app:
Before: 23681504
After: 23207344 (-463K/-2%)

Size of bytecode instructions:

Before: 6282376
After: 5981716 (-4.8%)
Change-Id: I57703616ecc91301c928672c83571482500dc365
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101883
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-05-09 20:41:21 +00:00
Alexander Markov e9bec21d13 [vm/bytecode] Cleanup after switching to compact bytecode instructions
Change-Id: Ie6ecdd88e8d1740c53cfb3fbc4b43f9e41c592b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101491
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-05-08 17:33:15 +00:00
Alexander Markov 68de477535 [vm/bytecode] Compact encoding of bytecode instructions (part 3/3)
Corresponding VM changes:
https://dart-review.googlesource.com/c/sdk/+/101062

On a large app, size of bytecode instructions:
Before: 12115384
After: 6282376 (-48.1%)

Total size of the app:
Before: 29790240
After: 23681504 (-20.5%)

Change-Id: Idd8f97e991236c25d663d1bcf18a51a53e73a2b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99400
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-05-08 17:33:15 +00:00
Sigurd Meldgaard 4934f766d7 [vm] protobuf aware treeshaker, Support freezing messages
This also bumps the protobuf version.

Change-Id: I3e2d4f8fddcac5f7ac213fbad5a36804d917e34c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101296
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2019-05-07 07:12:33 +00:00
Alexander Markov 836ace6fcb [vm/bytecode] Avoid recalcualting class hierarchy for each dilp file
Compilation time in package-split mode with bytecode on a large app:
Before: 98 seconds
After: 37 seconds

Issue: b/131915611.
Change-Id: Ibc0ea460c9bb78d33441f91e977a914f97e8ce7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101325
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-05-03 23:34:28 +00:00
Martin Kustermann 80d4b9a5db [vm/frontend_server] Expose protobuf aware tree shaker in frontend server
Change-Id: If195ab074278d4768d261b6f6ffd1529de1f7e2c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100241
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-04-23 13:40:52 +00:00
Alexander Markov 5ee20c99ac [vm/aot/tfa] Workaround for crash in getStaticType
Issues: b/131091988, https://github.com/dart-lang/sdk/issues/34496
Change-Id: I9ef8edfff39848e6f240402682d119fe35f7f776
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99972
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-04-22 22:49:24 +00:00
Alexander Markov 8924c18003 [vm/tests] Revert changes in pkg/vm unit tests after constant-update-2018 was disabled
Pkg/vm tests were adjusted after constant evaluation was enabled in the front-end.
As constant evaluation was reverted (4b7d256a06),
we also need to revert corresponding changes in pkg/vm unit tests.

Revert "[vm/bytecode] Update expectations for bytecode generator unit test"

This reverts commit 734c50cbf2.

Revert "[vm/aot/tfa] Update TFA tests after front-end starts evaluating constants"

This reverts commit 25cb45c02f.

Change-Id: I2fcc30571bec2dd904925724ddb7105567c7ecda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99782
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-04-19 18:12:21 +00:00
Alexander Markov 9cc008e49c [vm/bytecode] Add bytecode instructions for double operations
Change-Id: Ib1e8ca3b9bbf62f8282524fc5599eee5cae38389
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99089
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-04-12 20:17:01 +00:00
Alexander Markov 734c50cbf2 [vm/bytecode] Update expectations for bytecode generator unit test
This update is needed after constant-update-2018 is enabled in
e9ca6a5335

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

Change-Id: I25f33e504f4df09a0d936fd11c7fa9c6236e4c78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99265
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-04-12 20:15:40 +00:00
Liam Appelbe 47520b1856 test.py plumbing for ABI versions
Bug: https://github.com/dart-lang/sdk/issues/36047
Change-Id: I68ca1ad01dfb3126c1d8c7f60a87f47d392d2d75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98745
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2019-04-12 19:33:40 +00:00
Alexander Markov 25cb45c02f [vm/aot/tfa] Update TFA tests after front-end starts evaluating constants
Usually TFA takes kernel AST with all constants evaluated.
However, in order to avoid calling constant evaluator pass in TFA unit tests
there is a special implementation of pragma annotation parser (for testing)
which accepts annotations which are not ConstantExpressions.

After CFE starts evaluating all constants (constant-update-2018 was enabled in
e9ca6a5335), TFA unit tests need be
switched to use ConstantPragmaAnnotationParser.

Also, empty environment defines are passed to CFE to avoid unevaluated constants
and unit test expectations are updated.

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

Change-Id: I2e7b0647e065cca129449b4531c6278c1d98061d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99269
Reviewed-by: Samir Jindel <sjindel@google.com>
2019-04-12 19:33:35 +00:00
Alexander Aprelev 229e00d97b [vm/frontend_server] Ensure incremental compiler gets vm environment defines set.
Change-Id: I86a2ccdd6c7ea6555384ff37966affccb7048055
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99180
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2019-04-11 16:15:16 +00:00
Jens Johansen 51433e65cc Compile flutter tests via the sdk
This CL includes:
* A dart script that - given a flutter checkout - finds and compiles
  tests to ensure we actually can.
* A shell script that checks out flutter, compiles the platform
  (to cope with any changes to the kernel format) and runs the above
  script.

Change-Id: I02806a375943361c3c111d9aa12a76d745391ca3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98140
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-04-11 08:38:53 +00:00
Alexander Markov ebd13e891f [vm/bytecode] Add UncheckedInterfaceCall instruction
dart --use-bytecode-compiler NavierStokes.dart
Before: NavierStokes(RunTime): 8909.053017777778 us.
After: NavierStokes(RunTime): 7221.510314079423 us.

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

Change-Id: Ib1be4dd20cdc25e3b979a91a098f67a7bc00df8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98945
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-04-10 21:49:23 +00:00
Alexander Markov 75a529f115 [vm/tests] Improve usability of pkg/vm tests
Fixes https://github.com/dart-lang/sdk/issues/36468

Change-Id: I7deecb1a4ef5cb337056049cdcf4781020a07a5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98946
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-04-10 15:24:36 +00:00
Ben Konyi 15b11b0183 [ VM / Service / Observatory ] The VM service now requires an authentication code by default.
Previously, a valid web socket connection would use the following URI:

`ws://127.0.0.1/ws`

Now, by default, the VM service requires a connection to be made with a
URI similar to the following:

`ws://127.0.0.1:8181/Ug_U0QVsqFs=/ws`

where `Ug_U0QVsqFs` is an authentication code generated and shared by the
service.

This behavior can be disabled with the `--disable-service-auth-codes`
flag.

Change-Id: I288aac58e3ba9d35dca8071f3f7e7a073896c271
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98433
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-04-09 22:57:29 +00:00
Alexander Markov e88363cffd [vm] Fix formatting and analyzer hints in pkg/vm
The following analyzer hints are fixed:

  hint • This function has a return type of 'String', but doesn't end with a return statement at pkg/vm/bin/compare_sizes.dart:140:3 • missing_return
  hint • This function has a return type of 'String', but doesn't end with a return statement at pkg/vm/bin/compare_sizes.dart:198:3 • missing_return

Change-Id: Ia34006eb023c0b3f9b60f8f38dc248cfa1c87a30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98983
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-04-09 22:38:27 +00:00
Alexander Markov 852b72b65e [vm/kernel] Integrate protobuf tree shaker into kernel compilers
This change adds option --protobuf-tree-shaker to enable protobuf tree
shaker transformation in gen_kernel and Fuchsia kernel compiler.

Protobuf tree shaker requires closed world and only works with --aot
and --tfa.

Change-Id: I9fcc7934624f2d11f9b04215f1a81367f8ec82e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98781
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Sigurd Meldgaard <sigurdm@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-04-09 21:22:27 +00:00
Johnni Winther 4fc0e1f13d Use .nullType as type of null and fix null type handling in getStaticTypeAsInstanceOf
The .getStaticType results for NullLiteral and NullConstant are inconsistent. The former returns `const BottomType()` and the latter return `TypeEnvironment.nullType`.

To avoid this inconsistency and since `const BottomType()` is really the "unreachable" type, used for instance of for the type of a throw expression, the implementation is changed to consistently use the .nullType.

For this to work, getStaticTypeAsInstanceOf (and the equivalent dart2js implementation), and the `Type.fromStaticType` constructor in the VM type flow analysis have to special case the .nullType.

Change-Id: If6b806d4a39ef7b906275c43fa2089b9d140523b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98563
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-04-09 06:49:17 +00:00
David Worsham d4ba266e66 Remove legacy mozart.internal reference
Change-Id: I996b269dca3b31ccbab2199bc4d5bd57e4f5fd23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98868
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-04-08 22:32:59 +00:00
Clement Skau 4958a4e782 [vm] Adds a --help flag to vm/lib/kernel_front_end.dart (and by extension gen_kernel).
Bug:None
Change-Id: I6f2a1748189a586e42d84db2989bade751acb467
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98568
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2019-04-05 09:40:24 +00:00
Kevin Millikin b700223542 [cfe] Do not reset the VM async name generator
In the VM-specific async transformation, an index is used to generate
fresh temporary names for values that are live across an await.
Before it was always 0 when translating a statement because there are
no live values on entry or exit to a statement.

When translating statements nested inside block expressions there can
be live values, so the index should not be reset.

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

Change-Id: I6103d75c25f312ab1538a7c0f8fee0fea9f01b27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98664
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-04-05 09:00:24 +00:00
Alexander Markov 38dbddc90d [vm/bytecode] Add AllocateClosure bytecode
AllocateClosure bytecode is used to convey information about closure
function into an instance allocation site. This allows VM inliner to see
closure function very early at the optimization pipeline and enables
inlining of closure calls.

DeltaBlueClosures in JIT/bytecode mode (--use-bytecode-compiler):
Before: DeltaBlueClosures(RunTime): 1746.5404424083767 us.
After: DeltaBlueClosures(RunTime): 1291.4649496449324 us.

Issue: https://github.com/dart-lang/sdk/issues/36342
Issue: https://github.com/dart-lang/sdk/issues/36429
Issue: https://github.com/dart-lang/sdk/issues/36428
Change-Id: I6e94cdc2eb30110b0651a86bd2bdc40dcdd63207
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98439
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-04-05 00:00:13 +00:00
Daco Harkes 395e5f6037 [cfe/vm] make dart:ffi compatible with constant-update-2018
I added TODOs for removing the old code after the constants update has landed.

Change-Id: Icde8d68e4e7c4b51e9536f09ce4e514e3b00336d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98661
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-04-04 11:09:51 +00:00
Alexander Markov 7c9d02b313 [vm/bytecode] Generate empty list literals more efficiently
Issue: https://github.com/dart-lang/sdk/issues/36429
Change-Id: I47e189bff4e9998123c06afa2e5b0d1c79d74566
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98608
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
2019-04-03 23:43:21 +00:00
Alexander Markov bf293ea34c [vm/bytecode] Remove support for old version of bytecode format (v1)
Bytecode format version 2 was introduced Feb 05 2019 in
https://dart-review.googlesource.com/c/sdk/+/91108

This change cleans up code related to old constant pool entries which
were removed in v2.

Change-Id: Ic9cccd2fdec26758f377691bf4edc26d1309a524
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98610
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-04-03 22:44:21 +00:00
Alexander Markov dfdd974390 [vm/kernel] Pass environment defines through CompilerOptions for front-end const evaluator
Front-end constant evaluator doesn't fully evaluate constants if
CompilerOptions.environmentDefines is not set. Unevaluated constants
are not handled in bytecode generator or AOT tranformations.

As we're moving towards constant evaluation in the front-end, all
VM-specific kernel compilers such as gen_kernel and front-end server
should set CompilerOptions.environmentDefines.

Change-Id: I0c3021f87e4afdcb289822c57c2a19195b0dc467
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98435
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-04-03 17:43:56 +00:00
Alexander Markov 8fb77ec84d [vm/bytecode] Preliminary support for new language features in bytecode
Issue: https://github.com/dart-lang/sdk/issues/36214
Issue: https://github.com/dart-lang/sdk/issues/36218

Change-Id: I39149b82cb93c1cb87c64cf9c41c56b753bba13a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98400
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
2019-04-02 19:11:09 +00:00
Samir Jindel 154c324786 [vm/ffi] Lock out structs on 32-bit platforms.
Addresses https://github.com/dart-lang/sdk/issues/36334

Change-Id: I880812941748207ea93a789db2f2d4d2938d3f37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97961
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Samir Jindel <sjindel@google.com>
2019-04-01 10:30:58 +00:00
Aske Simon Christensen 0b57b67ecb [CFE] Move const set desugaring to constant evaluator.
To properly recognize control-flow constructs in sets, the constant
evaluator needs to get un-desugared set literals. This commit skips the
desugaring of const set literals if the constant evaluator is enabled
and adds a similar desugaring in the constant evaluator.

Doing the desugaring in the constant evaluator (which can be called
independently of Fasta) necessitates that dart:collection is indexed
in CoreTypes. We can remove this indexing again when the VM gains
native support for set constants.

Change-Id: Ibddafdcb182e4471012801745b51b529805b7b9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98008
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-03-28 15:00:58 +00:00
Jens Johansen ef168de000 [vm/kernel] Index all source and line starts before using them (2nd try)
By indexing all sources in a concatenated dill file and then using that
index to find the sources and line starts we can fix missing information
(leading to crashes when collecting coverage) in for instance circular
instances.

This reverts commit 57321c1590 and adds a
fix.

Change-Id: I7a91801fb318cad0218cf3101d6a15f1ec929175
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98006
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-03-28 08:36:51 +00:00
Alexander Markov 0d93a85916 [vm/bytecode] Clean component metadata except bytecode when dropping AST
Change-Id: If0a7894406458b0cb6f4e1c5e4d60a6377b2459b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98044
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-03-27 21:07:50 +00:00
Keerti Parthasarathy 57321c1590 Revert "[vm/kernel] Index all source and line starts before using them"
This reverts commit a7ab99dd84.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> [vm/kernel] Index all source and line starts before using them
> 
> By indexing all sources in a concatenated dill file and then using that
> index to find the sources and line starts we can fix missing information
> (leading to crashes when collecting coverage) in for instance circular
> instances.
> 
> Change-Id: I454cff57f84f21de72f6486e1cecf15d1389a498
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96901
> Commit-Queue: Jens Johansen <jensj@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

TBR=vegorov@google.com,jensj@google.com

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

Change-Id: Iea75c9dd56e74fa0e98c90ea6841ed66b39d40cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97941
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2019-03-26 22:13:10 +00:00
Alexander Markov 61f0f5bc43 [vm/bytecode] Declare members in bytecode
This change replaces kernel AST declarations of fields and functions
with bytecode declarations.

Size of dilp files is reduced by 11-12%.

Startup latency:
Time to the first full frame: 1.945s -> 1.687s
FinalizeClass: 554ms -> 277ms
FinishClassLoading: 296ms -> 156ms

There are following regressions in bytecode mode, which will be fixed
in future:

* dart:mirrors are not supported yet (implementation of mirrors relies
  on reading kernel AST in certain cases).

  As the result, lib_2/mirrors/* tests fail.

* native extensions are not supported yet (annotations on libraries
  and classes in AST are cleaned up as they could reference members
  which are now removed from AST).

  As the result, standalone_2/entrypoints_verification_test test fails.

* language_2/spread_collections/const_error_test/* tests fail
  due to https://github.com/dart-lang/sdk/issues/36286.

Change-Id: I5130f401fd7b84038b136136e7ccc1a6e51b6cea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97561
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-03-26 21:40:10 +00:00
Liam Appelbe 93e4ae4fdf [vm] Add flags to gen_kernel script to support old ABIs
Bug: https://github.com/dart-lang/sdk/issues/36047
Change-Id: If6343223c03dc7f53d597294ef7a32c204236da6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97566
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-03-25 19:17:10 +00:00
Jens Johansen a7ab99dd84 [vm/kernel] Index all source and line starts before using them
By indexing all sources in a concatenated dill file and then using that
index to find the sources and line starts we can fix missing information
(leading to crashes when collecting coverage) in for instance circular
instances.

Change-Id: I454cff57f84f21de72f6486e1cecf15d1389a498
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96901
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-03-21 12:05:15 +00:00
Jens Johansen 1f10174891 [vm/service] Test collecting coverage for a concatenated dill file
This CL adds a test where:
* Two libraries depend on each other and both have mixins where
  the body comes from the other file.
* The two-library component is then split into two one-library
  components and loaded by the VM via the "multiple kernels"
  functionality (basically as a concatenated dill file).
  (Notice, that each individual component has a reference
  (but no line starts or source), to the other library in its
  uriToSource table. This currently causes the VM to let (at least)
  one script have an empty source and and an empty line starts table.)
* The test then checks that it via the service protocol can find
  a) a non-null, non-empty "tokenPosTable" for each script,
  b) a translation between token positions and line-column via the
     tokenPosTable for each token position the VM specifies as a
     hit, a miss etc.
  Said another way, it basically checks if we can collect coverage.

The test is currently skipped because it fails and we can't -
to my knowledge - mark it as such.

Change-Id: I76a049bffdd554755372a19235bf0c270bad3764
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96103
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-03-21 12:04:01 +00:00
Jens Johansen eb344e2072 Keep live libraries and uri to source in sync
This CL removes the sources from uriToSource for libraries
the incremental compiler doesn't keep around.

This includes:
* Explicitly invalidated libraries, also if in a package.
* Transitively invalidated libraries, also if in a package.
* Libraries that are now no longer referenced in the resulting whole
  program, unless it's in a package.
* Libraries from packages that are implicitly invalidated by an
  updated .packages file (e.g. if the .packages file no longer
  reference it or reference a new version of it).

This does *NOT* include:
* Libraries from packages that are not invalidated and that are still
  mentioned in .packages, even if the actual libraries are no longer
  referenced in the resulting whole program. The reason is that these
  libraries are kept around in the incremental compiler.

Bug: 36197
Change-Id: I0ed41567ab54828585326ffd4dcb3722980bf874
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97201
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-03-21 10:08:30 +00:00
Aske Simon Christensen 1ea717f1c9 [CFE] Use Fasta diagnostics in constant evaluator.
The constant evaluator now generates all errors as Fasta diagnostic
messages. The ErrorReporter is simplified to just accept a diagnostic
message, or a notification that the constant evaluator encountered an
invalid expression (presumably put there due to an earlier error).

Also, the flow of control between the error reporter and the internal
abort exceptions is reversed, so the error reporter is now called as a
result of an abort exception being caught by the evaluate method.

Reland of https://dart-review.googlesource.com/c/sdk/+/96300

Change-Id: I7d32b6e98962b6ee781a6c96b593b00ee7fd8a89
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97225
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-03-18 15:42:05 +00:00
Aske Simon Christensen c10ee9971f [CFE] Move constant evaluator to Fasta.
Reland of https://dart-review.googlesource.com/c/sdk/+/96081

Change-Id: Ie9e6a0d26703469396fa6ea4803f49ce387f495b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97224
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-03-18 15:42:05 +00:00
Sigurd Meldgaard 9d3988eb67 [vm] First stab at a protobuf aware treeshaker
Relies on https://dart-review.googlesource.com/c/sdk/+/96782
Change-Id: I820e884f96923f9eb9a856faef6442f6ed645fe1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96162
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-03-18 13:07:44 +00:00
William Hesse 3b2e368376 Revert 5 changes with failures
TBR=askesc@google.com

Revert "[CFE] Move constant evaluator to Fasta."

This reverts commit 845b5b2df1.

Revert "[CFE] Always call the constant evaluator by the evaluate method."

This reverts commit 91bc4ec2b9.

Revert "[CFE] Use Fasta diagnostics in the constant evaluator."

This reverts commit c7b572aa29.

Revert "[CFE] Check for null in constant evaluation"

This reverts commit e6d2751e9c.

Revert "Rename import after moving file."

This reverts commit a6e2c5eb4c.

Change-Id: Iadfe087c0110f6f331b82d990213f95d3ef4541b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97223
Reviewed-by: William Hesse <whesse@google.com>
2019-03-18 12:25:32 +00:00