In particular,
* Provides a DDC implementation for dynamic modules, where the download
and instantiation of the module is delegated to the embedder of the
program.
* Exposes an embedding API to allow embedders to define the loading logic.
* Adds a flag to compile code as a dynamic module. This includes
generating an entrypoint trampoline and checks to validate that a
dynamic module doesn't stump over previously defined libraries.
* Adds test coverage for DDC under `pkg/dynamic_modules/test/`.
Test suite can be run by executing:
```
DART_CONFIGURATION=ReleaseX64 out/ReleaseX64/dart-sdk/bin/dart \
pkg/dynamic_modules/test/runner/main.dart -t ddc
```
Once we provide integration of test configuration results to that test
runner, we will add it as part of the test matrix.
Change-Id: I626b5fefe9a27546cc6d1630d17e812544a711c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379748
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Add a simple implementation that throws out all libraries and runs the
main method again which triggers all libraries to be initialized with
fresh values.
Move the hot reload tests to the ddc canary test configuration
since that is where the support works at this time.
Update frontend server to use the use the new version of the DDC
LibraryCompiler when the emit library bundle option is true.
Change-Id: I6eba613106672536ef8bfcb0ff0a55749e2fb63c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381902
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Import URIs are normalized by the CFE and should be globally unique in
the program. They serve as a good identifier to name a library in the
new "ddc" module format.
Change-Id: I9e255221bcffba52ad80138a4672d0490b7cbacd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381781
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
These new modules are only used when compiling with the `--canary`,
`--modules=ddc` and no other module formats.
This new flavor of the module system treats the output .js files as
a bundle of one or more Dart libraries.
In this change the Dart SDK module is still compiled with it's
libraries mixed together but exports them individually. Ideally this
is temporary and eventually they can be compiled in isolation as
well.
All other modules are compiled in isolation so class hierarchies many
may be broken until proper cross library linking is implemented in a
followup change.
Change-Id: I27e58a445476198bd8613bb63c57cb96c0d5bc55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379261
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
* Adds tests for the memory filesystem
* Enables hot restart/reload tests
* Adds flags to the hot reload suite
* Makes path resolution logic windows-friendly
* Adds test-reporting logic for trybots to hot reload tests
Change-Id: Ic51a0b8a3c6f8b6de20b58b2ac185dacf444cf47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353788
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
The hot reload runner currently only supports d8, but I plan to add support for Chrome and VM execution.
Notable changes:
* Creates `package:reload_test` with helpers for running this suite.
* Updates the module loader with D8-specific branches and hooks for hot reload/restart.
* Exposes DDC runtime variables via a `HotReloadTestRuntime` API.
* Ports constant equality hot restart tests from webdev/dwds (validated to fail if either cache-clearing mechanism fails).
* Partially rolls DDC's d8 preamble forward (towards dart2js's).
* Wraps D8's timer implementation with custom timeout logic to better match Chrome's timing semantics when executing with native JS async.
Tests for the framework and matrix updates will be added in an upcoming change.
Change-Id: I2773b29f464cfd0330e4c653c05e117ae150b4a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350021
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
This is part of a series of CLs to enable real deferred loading in DDC.
- Creates a new top-level object in dart_library.js for holding the state/API
for deferred loading.
- Only supported in the DDC module system
This also contains a bunch of cleanup/comments for our internal JS Linter. Notably, 'var' is not allowed, so we're attaching our top level namespace objects to `self`.
Change-Id: I230d63f044e85e7d16644525ff79fa9522398c87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289400
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
- Copy the internal version of dart_library.js without any changes.
- Unblocks syncing this file again.
- Update ddb script to use the dart2js preamble for d8 which includes
assignment of a global `self` and the fake event loop for better
error handling.
Change-Id: I01c2ad82fe7c36bb393f9eab897f558daabf6b8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181522
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Just some preliminary formatting to make it easier to see the diffs
when I merge the changes from the version in google3. The diff
algorithm gerrit uses doesn't handle the change in indentation very
well.
Change-Id: I2a4daa50d0051140569d51bea5845a0366ba1dad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180700
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This change makes dart_library.js more resilient so it can run in a
browser or in d8.
This is a necessary step to later enable test.py dartdevk tests in d8.
Change-Id: Ic8e5bbc9f1bbc6707a876208605f4fcaad41cee7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177000
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
- Fixes broken benchmarks in ddc because the benchmarks run in
d8 with the ddc module system can handle conflicting library
names more gracefully than es6.
- In the future we need to update the source of truth for
dart_library.js so we can keep the file in sync.
- Removes the ability for ddb to run with any precompiled sdk.js
from a dart installation. Now you must run a build first and
the sdk.js files from that build will be used. This means the
`--debug` flag no longer changes which sdk.js files are used.
Change-Id: Icaf78956f93ff643d23e68001354ec08c9c28b12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166926
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This adds a method to the internal SDK runtime library that can be
called to clear state when a hot restart is desired.
This also refactors some of the logic around ignoring type errors,
as we need to ensure we can clear those caches. Also I noticed a bug
where the result of isSubtypeOf was assumed to be non-null, but this
was not the case. The new structure should make this more clear.
(Note: I think we may be able to remove a lot of the code for ignoring
type errors soon.)
Change-Id: Icf5072ffe21aefd85e9816ffc2fc29f679839bc4
Reviewed-on: https://dart-review.googlesource.com/c/78324
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
This involves a few main pieces:
- Add code to the GN scripts to generate DDC's patched SDK and then
compile it to summaries and JS in the build output directory.
- Add support to the underlying DDC build scripts to support controlling
which files are built where.
- Update test.dart to use the DDC SDK from the build directory.
- Update create_sdk to use the built SDK instead of the checked in one.
- Fix various internal DDC tools to build their own copy of the SDK
(since they can't easily find the one in the build directory because
it's path if config-specific) and use those.
- Delete the checked DDC SDK JS and summaries.
I think I got everything working. The built Dart SDK looks fine -- it's
identical to one built using the old build scripts.
The various tools and DDC's little test runner I *think* work, but there
may be a bug or two in there. I tried the various things I could and it
seems like they work but it's hard to tell since they may be kind of
broken right now anyway.
Bug:
Change-Id: Iea77915a5c1cc8450f60ebfbdf8c725c7ea2f32c
Reviewed-on: https://dart-review.googlesource.com/18144
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Eliminate uses of the comment syntax in lib/async. This is mostly
done simply by turning explicit (but commented) casts into implicit
casts to avoid regressing dart2js performance.
Bug:
Change-Id: I286c7bffbf609b5e2fa24b9d48b90876c2c45a9b
Reviewed-on: https://dart-review.googlesource.com/21566
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Casts for function types got moved off of the generic path, and hence
are missing the memo cache. Added a second function type cast cache.
Fixes#31392
Bug:
Change-Id: Ie1b87adf630f5059b57d01956778f5adde0533fc
Reviewed-on: https://dart-review.googlesource.com/21525
Reviewed-by: Vijay Menon <vsm@google.com>
For ObjectFormatter right now we just show the class name. Some objects,
e.g. Int64, have descriptive toString() operations that are much more
informative than their internal structure.
This changes the default header to be
Instance of 'Thing'
rather than just
Thing
which is a little worse, but it's much better for these kinds of classes.
For Int64 we will now show
12345 (Int64)
We also clip the toString() if it's too long.
Bug:
Change-Id: Iae6a8e66fdbe1d9f5c157ecdb983a833e26d00f4
Reviewed-on: https://dart-review.googlesource.com/21522
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Alan Knight <alanknight@google.com>
The new front end doesn't support generic comment syntax yet, so it's
getting the wrong type for LineSplitter in strong mode. Since we no
longer to preserve legacy mode semantics for LineSplitter, we can just
use the correct strong mode types without generic comment syntax.
Change-Id: If2dcb2fb3fae9eb49685838e4e84958e545650c7
Reviewed-on: https://dart-review.googlesource.com/21286
Reviewed-by: Florian Loitsch <floitsch@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This is for compatibility with Kernel, as well as fixing several bugs,
and generally being a more robust architecture.
This may also perform better than the current design.
Notable fixes include several issues around deferred classes.
Change-Id: I1b6f44ebdf6304b10b47d19026156a25e04146ef
Reviewed-on: https://dart-review.googlesource.com/16337
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Other improvements:
* avoids an extra intermediate future in `async`, and unnecessary type tests
* uses optimized type tests instead of older isSubtypeOf
* avoids an extra closure for async/async*
* avoids Function.apply for async/async*/sync*
* avoids an extra cosure for sync* if the arguments are not modified
Change-Id: I897708387fce59a97696f05b01cc668f1043fe5c
Reviewed-on: https://dart-review.googlesource.com/16332
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
This ports a fairly large part of DDC's Analyzer-based code generator,
however most nodes are not supported yet.
The goal is to preserve all functionality of code that was ported,
except for deprecated features (e.g. mirrors, fuzzy arrows, libraryRoot).
Change-Id: I3b10d5773c7c10a740fa336720243b03c6b82529
Reviewed-on: https://dart-review.googlesource.com/10705
Reviewed-by: Vijay Menon <vsm@google.com>