Commit graph

198 commits

Author SHA1 Message Date
Johnni Winther 8510f27d37 [cfe] Change encoding of supported dart: libraries
This CL changes the way dart: libraries are considered supported when
used in conditional imports or bool.fromEnvironment constant using
the "dart.library.*" values.

Library nodes now has an isUnsupported flag which is set according to
the "supported" property in the libraries specification. Furthermore
the Target now supplies a DartLibrarySupport interface that allows
targets to override whether dart: libraries are unsupported.

This allows the JIT/AOT to use the same platform file but still
consider dart:mirrors unsupported in AOT mode, and dart2js to consider
the internal library `dart:_dart2js_runtime_metrics` supported.

Furthermore, the internal handling is changed so that condition imports
and bool.fromEnvironments constants are computed through the same logic
for "dart.library.*" values, avoiding the need for passing these values
through the environment.

TEST=pkg/front_end/testcases/general/supported_libraries/main

Closes https://github.com/dart-lang/sdk/issues/48057
Closes https://github.com/dart-lang/sdk/issues/47814
Closes https://github.com/dart-lang/sdk/issues/47243
Closes https://github.com/dart-lang/sdk/issues/32657
Closes https://github.com/dart-lang/sdk/issues/36460

Change-Id: Ie8f8dff99167de64ced51b71d89918bf0f3bbd13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/227020
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-01-11 14:52:38 +00:00
Alexander Markov e698500693 [vm/aot/tfa] Use RTA to improve AOT compilation speed
This change introduces Rapid Type Analysis (RTA) and uses it to
calculate initial set of allocated classes for Type Flow Analysis (TFA).
As a result, TFA converges much faster and AOT compilation time
improves.

RTA is less precise than TFA, so the set of allocated classes is
larger compared to the one calculated by TFA. However, it has only
marginal effect on the size of resulting AOT snapshots.

Time of AOT compilation step 2 on a large Flutter application
118.652s -> 59.907s (-49.5% / improved by a factor of 1.98x)
Snapshot size on armv8: -0.13%

Flutter gallery snapshot size in release and release-sizeopt modes
armv7 +0.19%, armv8 +0.2%

Just in case, RTA can be disabled using --no-rta option.

TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/42442
Issue: b/154155290

Change-Id: Iffbdabe7d486cad2e138f7592bffcb70474ddc34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/222500
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2021-12-10 15:00:51 +00:00
Johnni Winther 39533c285b [cfe] Pass tracked dill libraries through incremental compiler result
This avoids have tracked dill libraries as part of the incremental
compiler state, and avoids the need for public mutable state on the
incremental compiler.

Change-Id: Ia61f22499f619d7ead4eed23d3d1eb24b8caec9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221464
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2021-11-30 11:07:34 +00:00
Joshua Litt 4f6d813c3c [dart2js] Add '--no-summary' to compute_kernel.
Change-Id: Ie3493137794c95f5061ed7d2918568127c5e15ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221220
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-11-25 23:39:24 +00:00
Johnni Winther 87c953bd0c [cfe] Pass class hierarchy and core types through IncrementalCompilerResult
TEST=existing

Change-Id: I78a61147998a630d88997e0cebccb3e815592822
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221088
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-11-25 11:27:29 +00:00
Johnni Winther e92e60da78 [cfe] Change computeDelta to return a result object
This prepares for returning more that just the component from an
incremental compilation.

TEST=existing

Change-Id: I3ee269083290097f1a92d77d105b607a6a02f1f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221086
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-11-25 10:15:07 +00:00
Joshua Litt 3d1f6a48b7 [dart2js] Add dart2js target to build summaries.
Change-Id: I1ef0b3f87124333e44cb15001c556b1767ddf28f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219841
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-11-18 00:58:40 +00:00
Jens Johansen 363c71c9c1 [frontend_server] Add option to skip invalidation of files when initializing from dill
This CL adds a flag, `assume-initialize-from-dill-up-to-date`, to the
`frontend_server` which will skip the check and potential invalidation
of files from the dill we're initializing from.
Normally the sources included in the dill is used to figure out what
files that was used to produce the dill has changed and thus needs to
be invalidated after we've initialized from it. If we didn't do that
we'd be in a bad state where some changes would not be discovered.
In some circumstances, though, we might know that the sources haven't
changed and the check is thus not needed. This could for instance be
if we're initializing from a dill that was just build by another build
system.

Change-Id: Id8244125fd79465be89ac81d603cd624339fbc0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219040
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-11-03 08:58:43 +00:00
Kevin Moore 632f3428f3 Update dependencies in unpublished packages
TEST=No SDK affect. Just helping our outdated package tracking

Change-Id: I0d392694e9eb926f60667508b55094ffa208db18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218381
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2021-10-28 15:46:08 +00:00
Sigmund Cherem 38b5a841de [dart-web] Remove dart:web_sql library.
The WebSQL standard was abandoned more than 10 years ago and is not
supported by many browsers.

The `dart:web_sql` library was marked as deprecated in Dart 2.14. This
CL makes the library inaccesible, removes support for `dart:web_sql` imports,
and removes the `Window.openDatabase` API. The old code for `dart:web_sql` is
still generated by the html generators. Removing that will be handled by a
separate change.

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

Change-Id: I892107396b3b227b4f33344377585aa5e5328288
Bug: https://github.com/dart-lang/sdk/issues/46316
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216080
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2021-10-19 01:00:08 +00:00
Nicholas Shahan 6c4593929f Reland "[ddc] Add web library environment variables"
This is a reland of fb36bba5f2 with
a fix to the ordering to ensure all the expectations run.

Original change's description:
> [ddc] Add web library environment variables
>
> Ensure frontend server builds for the `DevCompilerTarget` add the
> environment variables needed for `bool.fromEnvironment()` calls for
> conditional imports.
>
> Change-Id: Ifd372c1cf385fc843534d85af1ac9ae75a6285b8
> Fixes: https://github.com/dart-lang/sdk/issues/47207
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213802
> Commit-Queue: Nicholas Shahan <nshahan@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>

Change-Id: Id88aeaf0ddc783936d413c06099df031bc7cb0a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214224
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-09-22 23:47:40 +00:00
Nicholas Shahan d0e013b49a Revert "[ddc] Add web library environment variables"
This reverts commit fb36bba5f2.

Reason for revert: New test fails on windows configurations.

Original change's description:
> [ddc] Add web library environment variables
>
> Ensure frontend server builds for the `DevCompilerTarget` add the
> environment variables needed for `bool.fromEnvironment()` calls for
> conditional imports.
>
> Change-Id: Ifd372c1cf385fc843534d85af1ac9ae75a6285b8
> Fixes: https://github.com/dart-lang/sdk/issues/47207
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213802
> Commit-Queue: Nicholas Shahan <nshahan@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>

TBR=johnniwinther@google.com,nshahan@google.com,annagrin@google.com

Change-Id: Iedfc4c1a5b24b515646d4f1b486bcb2f19bb7783
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214222
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-09-22 21:33:26 +00:00
Nicholas Shahan fb36bba5f2 [ddc] Add web library environment variables
Ensure frontend server builds for the `DevCompilerTarget` add the
environment variables needed for `bool.fromEnvironment()` calls for
conditional imports.

Change-Id: Ifd372c1cf385fc843534d85af1ac9ae75a6285b8
Fixes: https://github.com/dart-lang/sdk/issues/47207
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213802
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-09-22 20:39:44 +00:00
Jens Johansen 211ad9acb1 [CFE] Don't mark procedures as async when not using await
This CL removes async markers where await wasn't used.

In a few cases this also meant the ability to make the procedure not
return a future at all.

Also - at least on the VM with my benchmark run on my PC - returning
new Future.value(whatever) in a non-async procedure is faster than
returning whatever in an async procedure.

TEST=CI and existing tests.

Change-Id: I4ba888313c87de76bb0ca02c19eb1ab45f168a85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213480
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-09-17 11:56:29 +00:00
Jens Johansen 48d8225b17 [VM] [CFE]: Expression compilation inside extension method
This CL handles expression compilation inside extension methods better.
It is now possible to evaluate "this" and other methods defined in the
extension.

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

TEST=service tests added.

Change-Id: I3c71eb23117e26b01961f32103f4046f0b537976
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212286
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-09-10 12:02:57 +00:00
Jens Johansen c17b2505da [flutter-frontend] Shard flutter-frontend bot
Speed up bot runtime by sharding the test-runs into - for now - a fixed
number of shards (4).

Change-Id: Id3a256db82a8fd7ed7902766d74c9f790adbc1cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201821
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-06-15 08:11:19 +00:00
Michal Terepeta 75e16cd318 Revert "Revert "Move most of the code from u/b/kernel_worker.dart to p/frontend_server""
This reverts commit e2cd8be814.

Now that we have dep override fixes in the Flutter Engine [1] we can
go forward with the original change.

[1] https://github.com/flutter/engine/pull/26564

Bug: http://b/187910394
Change-Id: I69f9ff5cd21b890e44fb1054df165c978abd4c5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202921
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Michal Terepeta <michalt@google.com>
2021-06-14 13:28:23 +00:00
Anna Gringauze 375dc2889b Reland "Emit empty symbols file under --emit-debug-symbols flag"
This reverts commit bca8a053e6.

Reason for revert: Issue found, fixed in this CL (by closing a file sink)..

Original change's description:
> Revert "Emit empty symbols file under --emit-debug-symbols flag"
>
> This reverts commit b666964948.
>
> Reason for revert: <Broke pkg-win-release bot, investigating>
>
> Original change's description:
> > Emit empty symbols file under --emit-debug-symbols flag
> >
> > Towards: https://github.com/dart-lang/sdk/issues/40273:
> > Change-Id: I9e735d7e77588ab6bc1c7e30176e2d96a0265a13
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202731
> > Reviewed-by: Nicholas Shahan <nshahan@google.com>
> > Commit-Queue: Anna Gringauze <annagrin@google.com>
>
> TBR=sigmund@google.com,nshahan@google.com,annagrin@google.com
>
> Change-Id: I4b26c26b6404519a1b46c1eca919455cb60ca5e8
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202869
> Reviewed-by: Anna Gringauze <annagrin@google.com>
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Commit-Queue: Anna Gringauze <annagrin@google.com>


Change-Id: Iaba56e82a5c5500437b98c3f69066a2f53f6ee4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203000
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2021-06-09 20:57:02 +00:00
Anna Gringauze bca8a053e6 Revert "Emit empty symbols file under --emit-debug-symbols flag"
This reverts commit b666964948.

Reason for revert: <Broke pkg-win-release bot, investigating>

Original change's description:
> Emit empty symbols file under --emit-debug-symbols flag
>
> Towards: https://github.com/dart-lang/sdk/issues/40273:
> Change-Id: I9e735d7e77588ab6bc1c7e30176e2d96a0265a13
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202731
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Commit-Queue: Anna Gringauze <annagrin@google.com>

TBR=sigmund@google.com,nshahan@google.com,annagrin@google.com

Change-Id: I4b26c26b6404519a1b46c1eca919455cb60ca5e8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202869
Reviewed-by: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2021-06-09 16:45:13 +00:00
Anna Gringauze b666964948 Emit empty symbols file under --emit-debug-symbols flag
Towards: https://github.com/dart-lang/sdk/issues/40273:
Change-Id: I9e735d7e77588ab6bc1c7e30176e2d96a0265a13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202731
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2021-06-08 16:44:37 +00:00
Alexander Markov 37806ba461 Cleanup toString transformer
This is a final cleanup of old version of toString removal transformer
which was moved to pkg/vm in https://dart-review.googlesource.com/c/sdk/+/200525.

Also, this change removes handling of _KeepToString annotation class
after dart:ui @keepToString switched to use pragma and _KeepToString
was removed.

TEST=existing tests

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

Change-Id: I7208ec70e6703d25b93d6ebbb306c18bae4b6987
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201162
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-06-07 16:56:22 +00:00
Jake Macdonald e2cd8be814 Revert "Move most of the code from u/b/kernel_worker.dart to p/frontend_server"
This reverts commit 659fdae898.

Reason for revert: Broke the HHH bots.

The fix according to zra@ should be:

"The new dependencies should be added as dependency overrides to flutter_frontend_server's pubspec.yaml: https://github.com/flutter/engine/blob/master/flutter_frontend_server/pubspec.yaml"

Original change's description:
> Move most of the code from u/b/kernel_worker.dart to p/frontend_server
>
> This should allow us to import the code in cases when we want to
> implement the Bazel worker loop ourselves. This opens some possibilities
> of extra optimizations for internal use cases.
>
> I'm leaving some of the code (e.g., `main`) in the old location, so that
> we do not break anything that depends on it.
>
> The only thing that I've done is to pass the input-digest map to
> `computeKernel` instead of using `Input` objects directly, this way
> we can avoid the dependency on `package:bazel_worker` from
> `frontend_server`. So now, if we're using the worker loop, the map will
> be computed by `kernel_worker.dart` (in non-worker mode, we rely on
> the default empty map).
>
> Bug: http://b/187910394
> Change-Id: I408407ebdebc17c7898552c053a8e1c269cf2df5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201187
> Commit-Queue: Michal Terepeta <michalt@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>

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

Bug: http://b/187910394
Change-Id: Ieb44d61b668a7d4629a27eef5a6ef61d0db9deaf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201880
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2021-06-01 19:29:54 +00:00
Michal Terepeta 659fdae898 Move most of the code from u/b/kernel_worker.dart to p/frontend_server
This should allow us to import the code in cases when we want to
implement the Bazel worker loop ourselves. This opens some possibilities
of extra optimizations for internal use cases.

I'm leaving some of the code (e.g., `main`) in the old location, so that
we do not break anything that depends on it.

The only thing that I've done is to pass the input-digest map to
`computeKernel` instead of using `Input` objects directly, this way
we can avoid the dependency on `package:bazel_worker` from
`frontend_server`. So now, if we're using the worker loop, the map will
be computed by `kernel_worker.dart` (in non-worker mode, we rely on
the default empty map).

Bug: http://b/187910394
Change-Id: I408407ebdebc17c7898552c053a8e1c269cf2df5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201187
Commit-Queue: Michal Terepeta <michalt@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-05-31 13:47:14 +00:00
Jens Johansen b3de23ef14 [flutter-frontend] Fix potential flutter-frontend bot failures caused by mismatch in NnbdMode
Previously there *could be* lots of failures caused by the compiler
auto-detecting nnbdmode (and as a consequence setting a specific nnbd
mode based on the first file compiled).

That means that the ordering of the files - which seems to be different
on the bot and on my local machine for instance - decides the nnbd mode
and as a consequence if there are errors because of it.

This CL splits compiles up into weak and strong and compiles those in
chunks, thus avoiding the errors.

Change-Id: If796458782fdbf4f7da4ebc98f6110f0279a12cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201565
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-05-31 12:27:22 +00:00
Alexander Markov b9a0c0dfba Add --delete-tostring-package-uri option to kernel compilers
This change adds toString transformation to gen_kernel and
frontend_server tools in Dart SDK.

The implementation and tests are derived from
pkg/frontend_server/lib/src/to_string_transformer.dart and
https://github.com/flutter/engine/tree/master/flutter_frontend_server/test.

In addition to _KeepToString in dart:ui, toString transformation
now supports @pragma('flutter:keep-to-string') to exclude
certain toString methods from the transformation without depending
on dart:ui.

pkg/frontend_server/lib/src/to_string_transformer.dart is not
cleaned up in this change yet as it is still used by Flutter
engine. Cleanup will be done after Flutter engine is cleaned up,
after it is switched to the implementation of toString transformer
added in this change.

This is also a step towards a unified kernel compiler
(https://github.com/dart-lang/sdk/issues/39126).

TEST=pkg/vm/test/transformations/to_string_transformer_test.dart

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

Change-Id: Icbfd3fa193d54f1fc6b2d7fa0bace82b3704f91f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200525
Reviewed-by: Dan Field <dnfield@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-05-20 00:50:07 +00:00
Sam Rawlins a4d8a6aa34 Remove unnecessary imports in pkg/frontend_server
In each library where an import is removed, the library uses some elements
provided by the import, BUT there is another import which provides all of the
same elements, and at least one more which the library uses.

In this change, we remove the imports which can be simply removed in favor of
the other already present imports.

See https://github.com/dart-lang/sdk/issues/44569 for more information.

Change-Id: I3d4fea152048232b44db2f931a5be2c17b5c0f18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199463
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-05-17 17:37:42 +00:00
Johnni Winther 3e44898e08 [kernel] Make FileUriNode.fileUri non-nullable
TEST=existing

Change-Id: I72583e500cb0b69d9352b040c3e2885f9e0450c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195681
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-04-19 08:03:30 +00:00
Franklin Yow 03101c0c2b Update LICENSE
Changes to comply to internal review

Closes https://github.com/dart-lang/sdk/pull/45568
https://github.com/dart-lang/sdk/pull/45568

TEST=CL contains no code changes.

No-Try: true
GitOrigin-RevId: 65796784e5fdfddaa021b5c55ad435b1db419700
Change-Id: I085a948f16dc9a0de128ed0bd456ae69adf6c124
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193888
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2021-04-07 10:28:38 +00:00
Anna Gringauze f13285482d Fix expression evaluation failure after hot restart
The lifetime of program compilers in JavaScriptBundler is too short,
moving the program compiler cache to FrontendCompiler instead
so the ProgramCompilers created during main compilation could be reused
for expression evaluation until the next compilation.

Closes: https://github.com/dart-lang/sdk/issues/45266
Change-Id: I7d41476c7064f16cab2783f88c49114a08a0c038
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190301
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Jonah Williams <jonahwilliams@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2021-03-11 23:16:41 +00:00
Anna Gringauze 14eeb7507f First version of incremental DDC mode for expression compilation
- Support evaluate() calls from VM service in expression compiler
  - emit all accessed symbols, types, constants, extension symbols,
    and imports as part of synthetic evaluation function
    - Note: this fixes missing symbol issues in evaluateInFrame()
      as well
  - update expression evaluation tests
  - fix expression compilation broken after hot reload

See widget inspector layout explorer, a result of evaluate() call:
https://drive.google.com/file/d/16UdSE5_V1ZRXAf2KeBxNwYNHMfo1RbnT/view?usp=sharing&resourcekey=0-HZcPm68VbsVzrZ672CApvA

Closes: https://github.com/dart-lang/sdk/issues/41480
Closes: https://github.com/dart-lang/sdk/issues/44979
Closes: https://github.com/dart-lang/sdk/issues/44713
Closes: https://github.com/dart-lang/sdk/issues/44933
Closes: https://github.com/dart-lang/sdk/issues/44813
Closes: https://github.com/dart-lang/sdk/issues/44686
Change-Id: I96c74578c51503adbc4bfe6d6e6112319addc959
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188400
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2021-03-09 17:23:05 +00:00
Lasse R.H. Nielsen d352bc28b8 Remove (most) uses of the "non-nullable" experiment flag.
Since the flag is now enabled by default, there should be no mention of it.
There are still some uses in front_end/testcases that are not just removable
(it also uses `no-non-nullable`). There migth be more uses that are not
as easily found as grepping for `--enable-experiment

Removes two VM tests where fixing them meant they were just duplicating
the corresponding non *_2/ tests.
Fixes #44941

TEST= Large number of tests chaged.=(no-)?non-nullable`.

Change-Id: Ief755981ccde9a5482fcdf408c2929c74433a710
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183688
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-02-12 17:16:54 +00:00
Johnni Winther ee0c0bcd57 Reland "[kernel] Ensure that visitors don't implicitly returns null"
This is in preparation to migrate package:kernel to null safety.
For the visitor interfaces to support non-nullable return types, the
implementations must avoid using `null` as return value in its base case.

TEST=Refactoring

Change-Id: Ie8fa5d41b99850d9e4abb59634c72920c64128d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183691
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-10 07:51:52 +00:00
Johnni Winther b60e0aa5a1 Revert "[kernel] Ensure that visitors don't implicitly returns null"
This reverts commit ce81216885.

Reason for revert: Flutter dependency

Original change's description:
> [kernel] Ensure that visitors don't implicitly returns `null`
>
> This is in preparation to migrate package:kernel to null safety.
> For the visitor interfaces to support non-nullable return types, the
> implementations must avoid using `null` as return value in its base case.
>
> TEST=Refactoring
>
> Change-Id: Ie5e4153f8d3779d94957bb13b3d2d2a942040ff2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179760
> Commit-Queue: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Jens Johansen <jensj@google.com>

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

Change-Id: I61b838d3371e6b1de2427716d056324c120be499
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183689
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-09 12:41:12 +00:00
Johnni Winther ce81216885 [kernel] Ensure that visitors don't implicitly returns null
This is in preparation to migrate package:kernel to null safety.
For the visitor interfaces to support non-nullable return types, the
implementations must avoid using `null` as return value in its base case.

TEST=Refactoring

Change-Id: Ie5e4153f8d3779d94957bb13b3d2d2a942040ff2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179760
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-09 09:46:46 +00:00
Daco Harkes 5bfeed21c1 [frontend_server] Don't print Severity.info messages
The info severity level has only been used in one instance before, and
that could only occur in the compile command.

https://dart-review.googlesource.com/c/sdk/+/180361 and
https://dart-review.googlesource.com/c/sdk/+/180560 introduced the first
uses of this severity level outside the compile command.
This is the first time an `info` is emitted in the frontend_server.

We don't want to emit `info`s for the server. This is a quick solution
to fix that. The solution has been manually verified with a Flutter app
run with a local engine build with this change patched in.
Bug: https://github.com/flutter/flutter/issues/75429

Keeping the diff as small as possible to ease cherry pick for release.

The better solution is to make the frontend_server's verbosity level
configurable.
Bug: https://github.com/dart-lang/sdk/issues/44867

Change-Id: Ie40dbb27621053e90bc8943b8cb7c5ec4c9ed643
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183005
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-02-05 11:59:42 +00:00
Jens Johansen cb2aed6262 [frontend_server] Export to_string_transformer from frontend_server.dart
Change-Id: I0a3dae9c6d9357b71539ceacc16d0cf4f544ba69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179500
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-01-15 14:13:28 +00:00
Johnni Winther cad04f8604 [cfe,dart2js,dartdev] Show null safety mode for dart compile
This adds a new messages kind 'info' to the CFE for showing general
information during compilation. A 'configuration' options is added
to `CompilerOptions` for telling the CFE how it is run.

The configuration 'compile' is added for when the CFE is invoked to
produces an "executable" as when running `dart compile`. When
configuration is set, the CFE emits an info message about the
null safety compilation mode.

Support for `dart compile exe` and `dart compile js` is added in this
CL. Support for `dart compile kernel|app-jit|aot` is not included.

In response to https://github.com/dart-lang/sdk/issues/44234

TEST=pkg/dartdev/test/commands/compile_test.dart

Change-Id: I08f51e2a3f5ad4841c4d703bcd266b7afb63c7c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178982
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-01-15 11:28:13 +00:00
Alexander Markov f4bb16232a [vm] Remove old version of protobuf-aware tree shaker
New, faster version of protobuf-aware tree shaker was introduced in
https://dart-review.googlesource.com/c/sdk/+/152100. It has been
used in Flutter use cases for a while.

This change replaces old version of transformation with the new one in
the pkg/vm/bin/protobuf_aware_treeshaker.dart tool and removes
the old version.

TEST=existing tests in pkg/vm/test/transformations

Change-Id: I01546ae9fdc9fea3228595270c2aff04a0894e6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178281
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-01-15 00:54:48 +00:00
jonahwilliams d13b1e82a7 [frontend_server] allow dart define to contain commas
package:args seems to chop off commas unless disabled. This prevents users from having
dart defines that contain commas.

Bug: https://github.com/flutter/flutter/issues/72105
Change-Id: I9900a0db0d0ad24348dd06acff7a48d3c579564f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178881
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
2021-01-12 23:09:43 +00:00
Nicholas Shahan d0ee5dbe40 [ddc] Verify null safety modes of modules agree
Checks that the null safety mode of every module loaded matches the mode
of the SDK.

This relands https://dart-review.googlesource.com/c/sdk/+/173120 with
additional fix to correctly set the mode of a new component created
in the frontend_server.

Change-Id: I855b226f724ce0b6c83dbdc11ff6113853892dbb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174881
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-12-09 21:12:20 +00:00
Lasse R.H. Nielsen 6e29700e16 Update List constructor documentation, deprecate constructor.
Emphasize that the operation is going away,
and mark constructor as deprecated.

TEST= Refactoring+deprecation only, covered by existing tests.

Change-Id: I82aa044cd2cf7bf347b624371399f44bda8f4a07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173261
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-12-07 16:20:28 +00:00
jonahwilliams d86f0e2836 [frontend_server] add API stability documentatioon
Document some of the API stability guarantees that are required for the command line
API of the frontend_server binary. This will allow package:test and the webdev CLI to
begin using the frontend_server

Change-Id: I4bf05757c527e491b1059489b5dda53dfda876a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174840
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
2020-12-03 19:28:13 +00:00
Johnni Winther 3b24f36209 [frontend_server] Move ToStringTransformer to the Dart repo
The reduces the dependency of flutter/engine on the cfe internals.

Context: https://dart-review.googlesource.com/c/sdk/+/172180 had to be
reverted because the refactoring of the package:kernel code broke
the flutter/engine.

A follow-up CL is needed in the flutter repo to use the moved classes
instead.

Change-Id: I674ab3a09569d615b1549a5465da0f658945ec7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172762
Reviewed-by: Dan Field <dnfield@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-11-19 13:00:49 +00:00
Anna Gringauze 9c54996510 Fix issues in expression evaluation in google3
- Define private symbols load without reloading the module
  and knowing module format
- Remove libraryName->moduleName map from ExpressionCompiler's
  compileExpressionToJs API as a result of above
- Make ddc tolerate null locations on kernel loaded from dill
  during assert insertions for nullability
- Disable asserts in expression compilation worker
  due to ddc reading source for assert statement compilation
- Remove unused test configuration for expression compiler worker
- Add and update expression compiler tests

Part of: https://github.com/dart-lang/webdev/issues/1174

Change-Id: Idf8f508308915a5487fa0e9810b5674140393fed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170028
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-11-14 01:34:16 +00:00
Anna Gringauze 31c065ef4c Change frontend server expression evaluation tests to use strong
ddc platform sdk

This makes sure the tests are opted out of strong nnbd mode so they
don't break after https://dart-review.googlesource.com/c/sdk/+/166790

Related issue: https://github.com/dart-lang/sdk/issues/22

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


Change-Id: I8b2a6d9d33fedb154cb53ffdd89344c9274e9d77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169249
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Jonah Williams <jonahwilliams@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2020-10-28 21:27:40 +00:00
Alexander Markov 1615c04c63 Remove bytecode generator
Change-Id: Ic5fd2ab67c10ae642ee277a5acd9b4084e059861
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167762
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-10-23 19:30:43 +00:00
Johnni Winther b42f954364 [cfe] Use experiment release version when non-nullable is enabled explicitly
Even when non-nullable is enabled by default, enabling the experiment
explicitly should result in the experiment release version (and not
the experiment enabled version) to be used for opting in.

For this change, the semantics of parseExperimentalFlags was change
to _not_ normalize the flags to a full mapping including default values.
For this reason all uses of such maps are renamed to
'explicitExperimentalFlags'.

Closes #43879

Change-Id: I0d0262e68ec1403549abcfd305ae3a4404fe93e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168654
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-22 06:17:39 +00:00
Alexander Aprelev 4dd903d730 [frontend-server] Fix uri/path handling in frontend_server_test.
Use of path instead of uri breaks test on Windows.

Change-Id: Ie40d155def0ad17b0963c9af1dfa1f1c5e2a8c0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168744
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-10-21 19:19:19 +00:00
Alexander Aprelev deba2f7e65 [frontend-server] Make frontend-server tests ready for flipping nnbd switch on.
Bug: https://github.com/dart-lang/sdk/issues/43844
Change-Id: I12cdf00b9c8517d1f10fbc6a59c6ad69e138953e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168624
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-10-21 14:46:23 +00:00
Jens Johansen 29fa4e8148 [CFE et al] Compile flutter platform as agnostic for test; set component mode more
Bug: dartbug.com/43844 dartbug.com/43807
Change-Id: Iba662f0955897244aaac86ceace73b213fa06319
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168482
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-10-21 10:04:41 +00:00
Alexander Markov 80f12af7e8 [frontend_server] Add --no-print-incremental-dependencies option to suppress extra frontend_server output
Front-end server prints all dependencies after compilation, which could
result in a lot of output when AOT compiling a large application.

This change adds --no-print-incremental-dependencies option which
suppresses extra output. This skips printing dependencies which
takes time and avoids I/O which may be blocked.

Issue: https://github.com/dart-lang/sdk/issues/43299
Change-Id: I7779d3b5f1b513c2370978a5384a71cff371f017
b/154155290
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167860
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-10-16 01:56:21 +00:00
jonahwilliams ece36b1cea [frontend_server] do not run if full component is requested
Most of the time a hot restart will bail out due to the changed libraries,
but since the operation is pointless anyway it is better to short-circuit.

Change-Id: I86d3266f1502f612b0dd7cc6b7409c05bd7456c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165381
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
2020-09-30 18:11:34 +00:00
Anna Gringauze 1c8020cfc7 Emit module and add logging with timer to expression compilation
- Emit module before expression compilation to JavaScript so the
  ProgramCompiler has all types available.

- Add logging with ticker to expression compilation in expression
  compilation worker in DDC and in frontend server.

- Remove excessively verbose logging

Related:
https://github.com/dart-lang/webdev/issues/1006
https://github.com/dart-lang/webdev/issues/1106
Change-Id: Ia3a985f2d12d27f0bcc2c5d3923db137070e9cdd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162624
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-09-22 02:17:12 +00:00
Alexander Aprelev 0970586fbe [gardening] Fix frontend_server_test use of uris in reload list.
Fixes https://github.com/dart-lang/sdk/issues/43502

Change-Id: Iac4176bb6f8ed225214bcff605321f9162d5161f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163700
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-09-21 15:26:16 +00:00
jonahwilliams d0e095507c [frontend_server] connect widget cache to frontend_server
Connect the widget cache to the frontend server to be enabled when
--flutter-widget-cache is provided as a flag.

See also: go/fast-single-widget-reloads

Bug: https://github.com/flutter/flutter/issues/61407
Change-Id: I9d1f2c59dbb1dc56bb7e6ac7ebd05a01d1d47803
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162943
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
2020-09-16 15:09:18 +00:00
Anna Gringauze 34052bf2bb Add expression evaluation to ddc for google3
- Move expression evaluation to ddc in preparation for google3
- Added server to ddc to handle update and compileExpression requests
- Added tests
- Added 'experimental-output-compiled-kernel' option to ddc to generate
  full kernel files only for compiled libraries, and store with
  '.full.dill' extension
- Added AssetFileSystem to communicate to the asset server in the
  debugger
- Made expression_compiler_worker work with full kernel files,
  so removed invalidation of current file to improve performance
- Made expression_compiler_worker reuse already loaded imports
  to avoid reading them from source in the incremental compiler
- Updated tests to work with DDC (for simulating webdev)
- Disabled tests that work with bazel kernel worker for now
  as it does not generate full dill files yet
- Addressed code review comments from the prototype version:
  https://dart-review.googlesource.com/c/sdk/+/157005

Details:

Currently, in flutter tools, expression evaluation is supported via
expression compilation, which is done by the incremental compiler in
the frontend server. The same incremental compiler is used for initial
application compilation, incremental code compilation for hot reload,
and any number of expression compilation requests.

In google3, the apps are typically too large to be compiled as a whole
in memory by the frontend server. Build in google3 is currently done by
blaze, as a distributed build using a task dependency graph. Build tasks
output kernel outline files as an interface between components produced
by individual tasks.

We are proposing an implementation of the expression compilation in
google3 that is taking advantage of full kernel files produced by the
build (supporting build changes to follow). This change introduces a
small server based on dev_compiler, which can handle following requests:

- update: load full kernel for given modules (done on app start)
- compileExpression: compile expression in a given library and module
  (done when paused on a breakpoint)

Expression compilation uses previously loaded kernel files for the
application component and its dependencies to compile an expression.


Change-Id: Icf73868069faf3a2eb6d43ba78e459f8457e9e35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160944
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2020-09-03 03:05:13 +00:00
Devon Carew d26469f715 update the pubspec.yaml files to reflect actual package usage
Change-Id: I7a46c42dff3506cd5d09d3d793c072258e09a6e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159143
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-08-20 16:08:59 +00:00
Jens Johansen 9f79fe77fc [CFE] Don't turn flutter-frontend builder purple if there's a failing test
Change-Id: Ie3def22b66fe4d86627e3a8dc11ec887e0909a4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156503
Reviewed-by: Karl Klose <karlklose@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-07-30 12:00:37 +00:00
Jens Johansen a40d68f291 [CFE] Report error for flutter-frontend builder if there's a crash
We've recently had the flutter-frontend be green even though the
underlying script crashed. This CL should make sure the bot had turned
red (or at least not green) in such a case.

Change-Id: I8ae4916a82604500c37d0ce4389dc71f5260c7f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156461
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-07-30 08:38:40 +00:00
Nate Bosch 5e6d949757 Remove some misleading int returns from main
During normal execution the return value from `main` is _not_ used as an
exit code. Fix some cases that try to use it that way.

Change-Id: I292dc8ebf0acc8cb3d4d72f55107e438df9112de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156143
Auto-Submit: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-07-29 00:47:01 +00:00
Alexander Markov baf740ee92 [vm/nnbd] Remove obsolete --null-safety option
Option --null-safety was replaced with --sound-null-safety
(in https://dart-review.googlesource.com/c/sdk/+/153660).
This change cleans up obsolete option from the VM and kernel compilers.

Issue: https://github.com/dart-lang/sdk/issues/41853
Change-Id: I605703bd5bf526391b21704b842bb9e6ca452061
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155020
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-07-20 23:09:29 +00:00
Anna Gringauze 57cf6ebbd5 Enable tests for a fixed issue
https://github.com/dart-lang/sdk/issues/41976

Change-Id: Ia294b421f52a9cccd98198e16fd17d3eff7e9238
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153941
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2020-07-10 17:48:09 +00:00
Anna Gringauze 16e607ede5 Set --debugger-module-names to true by default in preparation for removal of the flag
first step for resolving https://github.com/dart-lang/sdk/issues/42104

Change-Id: Ie385e1d014149d67c5223aef698132b67df7ee43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153949
Reviewed-by: Jonah Williams <jonahwilliams@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2020-07-10 16:56:37 +00:00
Alexander Markov 6f6b1f8818 [vm] Rename --null-safety option to --sound-null-safety
Deprecated option --null-safety still remains in order to allow
graceful migration.

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

Change-Id: Ie47b1bebc9dd6532658a60743ecb85dc7fdc108c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153660
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-07-09 01:37:23 +00:00
Jens Johansen ad4d43cf5b [CFE] Constant transformation for expression compilation
Fixes https://github.com/dart-lang/sdk/issues/42240

Change-Id: Idc75e99aed6acbb67755c77faa1904183a630f91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153355
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-07-08 07:17:40 +00:00
Alexander Markov 467c98b846 [vm/aot/tfa] Re-implement protobuf-aware tree shaker inside TFA
This change introduces handling of protobufs while doing type flow
analysis. Metadata in protobuf message classes is updated dynamically
according to the set of called accessors, invalidating and rebuilding
TFA summaries as needed.

Previously, protobuf-aware tree shaker required the 2nd run of TFA
in order to do the actual tree-shaking after protobuf messages are
pruned. This significantly increases compilation time.

AOT compilation time of a large app (--from-dill): 274s -> 152s

New tree shaker is available in kernel compilers under the flag
--protobuf-tree-shaker-v2.

Issue https://github.com/dart-lang/sdk/issues/42442
Fixes https://github.com/dart-lang/sdk/issues/40785

Change-Id: I4347896737b9b0f7407b845e614dda9ba7621921
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152100
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-06-23 21:17:03 +00:00
Michael Thomsen f0c87e9f21 Clean up no-publish comments in pubspecs
Change-Id: I6cc1ab404de75cd02183b862842198c85b6d9256
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152005
Reviewed-by: Alexander Thomas <athom@google.com>
2020-06-23 10:34:09 +00:00
Anna Gringauze c909e16ee2 Added module information to metadata and use by frontend_sever
- created class representing module metadata, added metadata to JsCode
  class
- added module information to metadata, such as module name, load
  function name
- added import and file uris for libraries
- added experimental-emit-debug-metadata flag to frontend_server
- added frontend server tests to check for saved metadata

Related: https://github.com/dart-lang/sdk/issues/41852
Closes: https://github.com/dart-lang/sdk/issues/40774
Change-Id: Iecbbf1e4eea1919e01f002f45363d30707cb1590
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150181
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
2020-06-20 00:40:35 +00:00
Alexander Markov ecc7a21106 [vm/kernel] Add --from-dill option to kernel compilers
This option can be used to split AOT kernel generation into two rounds:

* The 1st round uses CFE to parse source files and generate intermediate
  dill file in *non-AOT* mode.

* The 2nd round loads intermediate dill file and applies AOT global
  transformations, then generates final dill file.

Each round is faster than one-shot generation of a dill file in AOT mode.

In order to use this 2-round compilation, command

  gen_kernel <other-options> --aot -o output.dill main.dart

should be replaced with the following 2 commands:

  gen_kernel <other-options> --no-aot -o intermediate.dill main.dart
  gen_kernel <other-options> --aot --from-dill intermediate.dill -o output.dill main.dart

Bug: b/158101962

Change-Id: I2d4deef45b50eab11df47f4a372598e6cf1d0edf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150272
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-06-08 18:16:33 +00:00
Jens Johansen 86f3fde23f [frontend_server] Plug leaks caused by saving the first compilation result
The first compilation result is leaked in two ways:
1) Directly by saving the component in a variable; and
2) Via an unfortunate context thing, probably a variation of
   http://dartbug.com/36983. I will update that bug with a reproduction
  example later.

The reason this creates a (big) leak is illustrated with an example:
* Say the first component (A) has 10 libraries in it. Each of these
  libraries has parent pointers and points (currently) to A, which again
  points to all of the 10 libraries.
* We then do a recompilation, say 5 libraries are reused and 5 are new.
  They are put into a component (B). We really should have 10 libraries,
  the 5 old ones and the 5 new ones (and for simplicity lets say these are
  the ones in B). Notice that the 5 old ones will have their parent
  pointers updated and also still be in the list of libraries in A.
  We keep 15 libraries alive because we have the 10 original ones saved via
  A and the 10 (where 5 is new) saved via B.
* We then do a recompilation, say 2 of the same libraries as was also
  recompiled before, these end up in compnent C which has 5 libraries from A,
  3 libraries from B and the 2 new ones. All of these libraries will have
  their parent pointers updated to point to C.
* Because we saved A we keep all the 10 libraries in A though.
  Because we saved A and some of the libraries in A had parent pointers
  updated to point to B we also keep B and all libraries in B.
  Because we keep B and some of the libraries in B had parent pointers
  updated to point to C we also keep C and all libraries in C.
  So instead of only having the 10 "live" libraries, we have 10 + 5 + 2 = 17
  libraries, a leak of 7. With more compilations this keeps happening and
  the leak keeps growing.

This CL stops the leak by not holding on to A (which, in turn, stops holding
on to B etc.)

Change-Id: If4f8b1e240b7c39f084df9cb2690570ff26fa9b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149280
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-28 11:59:08 +00:00
Nicholas Shahan d76b5318b4 [ddc] Make amd modules a named function
Apply the same naming used in the ddc module format to amd modules.

Change-Id: Ib766c20cb35c3c6e11a345e45cba5c49f3a34b3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148941
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-05-27 20:44:07 +00:00
Alexander Markov dae51f08d1 Reland "[vm/aot] Enable tree-shaking of write-only fields by default"
This is a reland of 9c50efcf07

There are no changes to the original CL.
Fixes for bugs revealed by this change are in separate CLs:

 * Crash in disassembler
   https://dart-review.googlesource.com/c/sdk/+/148942

 * Crash in --print_instructions_sizes_to
   https://dart-review.googlesource.com/c/sdk/+/149043

Original change's description:
> [vm/aot] Enable tree-shaking of write-only fields by default
>
> Tree-shaking of write only fields is implemented in
> https://dart-review.googlesource.com/c/sdk/+/143286
> This change just enables it by default.
>
> Flutter gallery in release mode
> armv7 app.so size -0.41% (gzip -0.24%, brotli -0.20%)
> armv8 app.so size -0.38% (gzip -0.23%, brotli -0.29%)
>
> Issue: https://github.com/dart-lang/sdk/issues/35310
>
> Change-Id: Iaae3e893b4a6bf4d468d6cd05aba5f8ee8810afc
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148543
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

Change-Id: I609db3fec8b0798f55aa2067127dfdc90a21ead4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149044
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-27 16:52:30 +00:00
Alexander Aprelev d551980ac9 Revert "[vm/aot] Enable tree-shaking of write-only fields by default"
This reverts commit 9c50efcf07.

Reason for revert: vm-kernel-precomp-win-release-x64 language_2/unsorted/disassemble_test test started to fail on this cl

Original change's description:
> [vm/aot] Enable tree-shaking of write-only fields by default
> 
> Tree-shaking of write only fields is implemented in
> https://dart-review.googlesource.com/c/sdk/+/143286
> This change just enables it by default.
> 
> Flutter gallery in release mode
> armv7 app.so size -0.41% (gzip -0.24%, brotli -0.20%)
> armv8 app.so size -0.38% (gzip -0.23%, brotli -0.29%)
> 
> Issue: https://github.com/dart-lang/sdk/issues/35310
> 
> Change-Id: Iaae3e893b4a6bf4d468d6cd05aba5f8ee8810afc
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148543
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

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

Change-Id: Iafeb6c35eced8344fc86bae9c2b7617718158163
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Issue: https://github.com/dart-lang/sdk/issues/35310
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148860
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-05-21 05:07:58 +00:00
Alexander Markov 9c50efcf07 [vm/aot] Enable tree-shaking of write-only fields by default
Tree-shaking of write only fields is implemented in
https://dart-review.googlesource.com/c/sdk/+/143286
This change just enables it by default.

Flutter gallery in release mode
armv7 app.so size -0.41% (gzip -0.24%, brotli -0.20%)
armv8 app.so size -0.38% (gzip -0.23%, brotli -0.29%)

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

Change-Id: Iaae3e893b4a6bf4d468d6cd05aba5f8ee8810afc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148543
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-21 00:12:40 +00:00
Anna Gringauze 0218c66698 Emit types during incremental expression compilation
During expression compilation, if the compiled expression is using
a type that was not used in the current function, the incremental
compiler and DDC produce code that refers to undefined types.
To fix that, discharge types created during expression compilation
and add their definitions at the beginning of the generated
function.

Added tests to validate the behavior.

Fixes: https://github.com/dart-lang/sdk/issues/41443
Change-Id: If3fdce85a50ab2590d107f3b9e8c19b4768fd482
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148468
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2020-05-20 18:51:20 +00:00
Alexander Markov bbe469eabd Reland "[vm/nnbd] Auto-detect null-safety from entry point in kernel compilers"
This is a reland of fd19c8cc25
No changes were made to the original CL.

The following fixes landed separately:
* Flutter tests which use --enable-experiment=non-nullable are
  disabled in https://github.com/flutter/flutter/pull/57235.
* Auto-detection of null-safety mode from dill file in gen_snapshot is
  implemented in https://dart-review.googlesource.com/c/sdk/+/148152.

Original change's description:
> [vm/nnbd] Auto-detect null-safety from entry point in kernel compilers
>
> If --null-safety flag is not specified, tools should infer null safety
> mode from a legacy status of an entry point script.
> This change adds such auto-detection to kernel compilers (front-end
> server and gen_kernel).
>
> Issue: https://github.com/dart-lang/sdk/issues/41206
> Change-Id: If78491d08390c28b98e86857ec7d61520433dee9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148024
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

Change-Id: Ibc185caa6975087a35c89ff69faf3f6c11fcf14c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148201
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-14 22:10:45 +00:00
Alexander Markov d1b9a93363 Revert "[vm/nnbd] Auto-detect null-safety from entry point in kernel compilers"
This reverts commit fd19c8cc25.

Reason for revert: Flutter has tests with --enable-experiment=non-nullable, but dart:ui is not migrated yet and gen_snapshot doesn't detect null-safety from kernel file. This change causes failures in those tests as dill file is now compiled with null-safety enabled due to the auto-detection.

Original change's description:
> [vm/nnbd] Auto-detect null-safety from entry point in kernel compilers
> 
> If --null-safety flag is not specified, tools should infer null safety
> mode from a legacy status of an entry point script.
> This change adds such auto-detection to kernel compilers (front-end
> server and gen_kernel).
> 
> Issue: https://github.com/dart-lang/sdk/issues/41206
> Change-Id: If78491d08390c28b98e86857ec7d61520433dee9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148024
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

TBR=aam@google.com,rmacnak@google.com,alexmarkov@google.com,asiva@google.com

Change-Id: Ie6105552c9d88101a3188f5daec4ee9a9c24a530
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Issue: https://github.com/dart-lang/sdk/issues/41206
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148141
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-14 16:40:22 +00:00
Alexander Markov fd19c8cc25 [vm/nnbd] Auto-detect null-safety from entry point in kernel compilers
If --null-safety flag is not specified, tools should infer null safety
mode from a legacy status of an entry point script.
This change adds such auto-detection to kernel compilers (front-end
server and gen_kernel).

Issue: https://github.com/dart-lang/sdk/issues/41206
Change-Id: If78491d08390c28b98e86857ec7d61520433dee9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148024
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-14 00:41:22 +00:00
Anna Gringauze 6f16174d56 remove private fields and modules calculations from expression compiler
- Remove collecting private fields from scope calculation
  We only need to collect the fields from the evaluated
  expression and they are already collected separately.

- Correct private fields calculation
  Currently, library names are assumed to be the same as the module,
  which creates redefinitions of library variable in produced Javascript
  code, and exceptions in chrome for modules that contain more than one
  library.
  The actual fix will come from making DDC incremental by storing more
  information, for now make a best effort to compute correct names for
  library variables from the module data that expression compiler
  receives from chrome. The following code will be produced to calculate
  private symbols _pf1 (from lib1, module1) and _pf2
  (from lib2 module1):

  let lib1 = require('module1.dart').lib1;
  let lib2 = require('module1.dart').lib2;

  let _pf1 = dart.privateNames(lib1, '_pf1');
  let _pf2 = dart.privateNames(lib2, '_pf2');

  Note that this seems to work even if the current breakpoint is inside
  the define statement for lib1, and the lib1 symbol is not exported
  yet.

Closes: https://github.com/dart-lang/sdk/issues/40272
Closes: https://github.com/dart-lang/sdk/issues/41585
Change-Id: I141719d2d5d5c08dd3c0ef5f0406756dce5575ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145307
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2020-05-05 17:41:17 +00:00
Robert Nystrom d9bb487ca8 Treat the expect and async_helper packages as opted in to NNBD.
This should enable strong mode tests to be fully NNBD opted in. At the
same time, legacy tests when run with the experiment off should
hopefully be able to still consume these libraries because they don't
actually use any NNBD features.

To do this, I changed the script that generates the SDK repo's package
config to not put in a language version for any package whose pubspec
has no SDK version. According to language versioning, that means the
package should be considered to be at the "current" version of the SDK
running the code.

In NNBD, that's opted in. With the experiment off, that is (presumably)
"opted out" in the sense that NNBD doesn't exist.

In order to *not* opt in some of the other packages that currently
lack SDK constraints, I put those in and pinned them to "^2.7.0" which
was what the package config script used to implicitly fill in for them.

I see a bunch of other changes in the generated package config too. The
update script probably hasn't been run in a while.

Change-Id: I55193d42eac0696a6b0105546551efa45a1f3252
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144305
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2020-04-27 21:04:56 +00:00
Anna Gringauze bd3d08a891 Convert exceptions on expression evaluation to errors
Currently expression evaluation in frontend server throws exception
when it cannot find a ProgramCompiler (DDC) to compile the module
where the expression is located. Given that IDEs use expression
evaluation for many information displaying cases, such as watch window,
hover over, and more, this results in unexplained exceptions thrown
during debugging.

Instead of throwing exception, return an error for the debugger
to report.

Fixes: https://github.com/flutter/flutter/issues/54520
Change-Id: Ie87c67d715a76f70439702181114ce422fad7ce1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143660
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
2020-04-17 01:03:16 +00:00
Alexander Markov 12c8b02c84 Reland "[vm/aot/tfa] Tree shake write-only fields"
This relands commit ff34fd8110,
but puts tree shaking of write-only fields under the flag which is
disabled by default.

So far tree shaking was removing fields which are not used at all.
This change improves tree shaking of fields so fields
which are only written or used as interface targets can be removed.

The following limitations apply:

* Field is not removed if there is a constant object with that field, as
  it may impact identity of constant objects which is an observable
  behavior.
* Instance field is not removed if it has a non-trivial initializer as
  it may have side-effects when executed by constructors.
* Late final fields are not removed, as writing such fields may have
  side-effect.
* When field is removed, we may need to introduce an abstract getter
  or abstract setter if field is used as a target of an interface call.
  If a field was written, then setter would be non-abstract (but empty).

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

Change-Id: Iec75b8301892664f4f955a01e5960b17e6620531
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143286
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-04-16 18:24:05 +00:00
Anna Gringauze 9f65693f57 Use offset for detecting scope in ExpressionCompiler
ExpressionCompiler currently translates offsets of scopes to line
numbers during the binary search in the library in order to find
the inner-most scope containing the line where debugger has stopped.
This results in many offset-to-line translations per evaluation request,
each translation also performing a binary search in Source.lineStarts
table.

To make scope lookup more efficient, this change uses Source.lineStarts
table to find the offset for the debugger stop once, and uses integer
offset comparisons instead in the scope binary search.

Closes: https://github.com/dart-lang/sdk/issues/40281
Change-Id: I72052b144d15acef684a5f8d29b40f6c5774b723
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142461
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-04-09 22:29:14 +00:00
Alexander Markov 6f24f88ef9 [vm] Add --minimal-kernel option to kernel compilers
New option can be used instead of --aot to produce a tree-shaken
minimal .dill file which can run on the VM in JIT mode.

Can be used along with --no-link-platform and --gen-bytecode to further
decrease size of the .dill file.

Change-Id: I35e8d81263a5e223decf160d79322c06cfd27321
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140740
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-04-06 00:54:40 +00:00
Jacob MacDonald 4eebe712f5 add --dartdevc-module-format argument to frontend_server
This allows us to start experimenting with the legacy module format in flutter web/internal.

This also updates the DDC module name parsing to throw an ArgumentError on invalid formats, and exposes the parsing method.

Change-Id: I4ce85ecd4078a9827aba046e34425a4f1d1e9abd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142263
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-04-03 16:10:46 +00:00
Anna Gringauze 0e8ee2b668 Do not crash on invalid offsets in ExpressionCompiler
ExpressionCompiler crashes while detecting current scope
if there are any scopes in the library with valid fileOffset
and invalid fileEndOffset.

Make ExpressionCompiler more tolerant to incomplete offset
information by just skipping scopes where fileEndScope is not set.

Fixes: https://github.com/dart-lang/sdk/issues/41241
Change-Id: I357017be1cb641053f23144edd5b74f30a9240ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142080
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2020-04-01 23:16:58 +00:00
Alexander Markov 7a2c8b3f90 [vm/nnbd/aot/tfa] Support NNBD strong mode in type flow analysis
This change adds support for types with different nullabilities to TFA,
and adjusts subtyping checks in TFA to take nullability into account.
This change assumes that NNBD strong mode is sound and there are no
opted-out libraries.

Fixes: https://github.com/dart-lang/sdk/issues/40717
Change-Id: I739b6ae317f218ced07636c09cfdbb277e1f81a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140375
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2020-03-27 18:56:47 +00:00
Vijay Menon d29e79a595 [dartdevc] record metrics
This reverts commit 056bd5e72f.

Change-Id: I12479342060b276c54a981ce17d96c179c0e4554
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140620
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
2020-03-23 15:38:37 +00:00
David Morgan 056bd5e72f Reland "Revert "[dartdevc] record metrics""
This reverts commit a0e4f0575a.

Reason for revert: Issues with hot restart in google3, see b/152181536.

Original change's description:
> Revert "Revert "[dartdevc] record metrics""
> 
> Reland with fixes for internal build (patch set 2+)
> 
> Change-Id: I5b130d020c9437a2c52dd074ad007e1fef7a8fa5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139241
> Commit-Queue: Vijay Menon <vsm@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Reviewed-by: Gary Roumanis <grouma@google.com>

TBR=vsm@google.com,sigmund@google.com,grouma@google.com

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

Change-Id: I012e1adaa405e85fd1a3d7d280b889b7df44e5b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140580
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
2020-03-23 12:16:13 +00:00
Vijay Menon a0e4f0575a Revert "Revert "[dartdevc] record metrics""
Reland with fixes for internal build (patch set 2+)

Change-Id: I5b130d020c9437a2c52dd074ad007e1fef7a8fa5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139241
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
2020-03-19 13:09:59 +00:00
jonahwilliams af46f7b103 [frontend_server] output dill during initial compilation to JavaScript
This will allow the tool to use initialize from dill to speedup subsequent runs. In local testing, adding this and initialize from dill sped up the initial compile of the flutter_gallery from 14 seconds to 7 seconds.

https://github.com/flutter/flutter/issues/50616

Change-Id: Ie6bf08ec547c903da75177d892fdbb36a8924d0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139313
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
2020-03-16 20:34:46 +00:00
Jens Johansen 6b4c4faf28 [CFE] Combine 'inputSummaries' and 'linkedDependencies'
The two fields are already treated the same, so having two is just
confusing.

Change-Id: I649db2a77bced62429dfd94ab300673cf886e367
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138291
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-03-05 12:38:34 +00:00
Anna Gringauze 7466c1f9da [frontend_server] Make module names debugger-friendly
Module names and import module names generated by the frontend server
are currently breaking debugger's assumptions on module names. This
change fixes it to make debugger works with various compiler
configurations, such as build_runner, frontend server with dwds tests,
and unblocks flutter tools to continue debugger and frontend server
integration.

JavaScriptBundle
  - Change module import names to module names instead of file paths,
    omit leading '/' as it cannot be in a module name in requireJS
  - Module name changes are hidden under "debugger-module-names" flag
    to prevent breaking flutter tools.

FrontendServer
  - Always call exit after listening to commands is finished,
    otherwise process running frontend server does not exit on 'quit'
    command.
  - Call computeCanonicalNames after initial compilation to support
    subsequent module importing in compileExpressioToJs calls
  - Add error handling to usage of kernelToJs compilers

ExpressionCompiler
  - Separate library variables from library fields for loading modules,
    as they can be different, for example
    ```main = require('web/main.dart').web__main```

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

Change-Id: Ic103c22932c7181ee325f239193d32361d057ed0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138010
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Jonah Williams <jonahwilliams@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2020-03-05 07:39:33 +00:00
Jacob MacDonald 6746579d1b Use package_config instead of package_resolver in frontend_server
We want to deprecate package_resolver and it isn't migrating to the latest package_config format.

Bug: https://github.com/dart-lang/package_resolver/issues/30
Change-Id: I657ff16dfbf9fa75493d0975b5efcc7f4162431c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138322
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2020-03-04 19:02:06 +00:00
Jens Johansen 70b4ffae4b [kernel] Delete limited_ast_to_binary.dart
Change-Id: I11277942cd8bb9f3f3b875233934ec0281c0369b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138085
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-03-04 11:45:55 +00:00
jonahwilliams 5a1ff9f870 [frontend_server] add libraries spec option
Expose an option to configure the libraries specification path for the frontend_server

Change-Id: Icc50fd79fd1b8a5fd03d616bc2e58679bb0c8032
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137649
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
2020-02-27 23:15:34 +00:00
Alexander Markov aa2c1a4950 [vm/nnbd] Add --null-safety option to VM's kernel compilers
This change adds --null-safety option to the front-end server and
gen_kernel tools. This option is forwarded to CFE via
CompilerOptions.nnbdMode.

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

Change-Id: I410b1d5466d93d9514cb7571bf37b32c848f136c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137106
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-02-25 19:04:43 +00:00
Alexander Aprelev 612728f970 [frontend-server] Only set VM environment defines for VM compilation target.
Fixes https://github.com/dart-lang/sdk/issues/40669.

Change-Id: I9e58deed5d2c67c953de7dae10ccbf9c46ab6fd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136411
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-02-20 03:05:25 +00:00
Jens Johansen e5befd1d66 [flutter-frontend-test] Run flutter-frontend compile tests in custom test runner (fix)
The previous commit did not set the exit code properly.

Change-Id: Iba468bb3fb7a71e029e6abe245074db109625f4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136187
Reviewed-by: Karl Klose <karlklose@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-02-18 14:07:34 +00:00
Jens Johansen 8652404193 [flutter-frontend-test] Run flutter-frontend compile tests in custom test runner
Change-Id: Iecf2f40dd1bc8c0fffd877911e81ccd6055d9dc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136121
Reviewed-by: Karl Klose <karlklose@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-02-18 10:58:59 +00:00