This allows dartdevk to compile tests that import packages like expect.
There are a few pieces to this:
- Add support to build_pkgs.dart to build the kernel summaries for each
test package (in addition to the analyzer summaries it already
builds).
- Plumb that through the dartdevc_test target in the GN build as well.
- While we're at it, use GN to build the ddc_sdk.dill file and have
test.dart load that one instead of the manually built one from calling
./tool/kernel_sdk.dart.
- Add command-line arguments to dartdevk for passing in the path to the
SDK summary and the other summaries to compile against.
- Fix a little typo in processed_options.dart that was preventing it
from resolving "package:" URIs.
- In test.dart, when compiling a test, link in the summaries for all of
the test packages.
At runtime, it still uses the JS for those packages generated from the
old analyzer-based front end since the kernel-based compiler isn't
complete enough to compile any of those packages yet.
With all of this, if I change a test to:
import "package:expect/expect.dart";
main() {
Expect.equals("a", "b");
}
Then it compiles but fails at runtime. The compiler is completing, but
the generated code has some bugs. I don't know enough to fix them
myself, but here's what I've found out:
- In _libraryToModule(), the Library we get from kernel has a null
fileUri, so this returns an empty string. That in turn means the
generated JS tries to use "$" as the module name.
Using this works around it temporarily:
if (moduleName.isEmpty) moduleName = library.name;
- In _emitTopLevelNameNoInterop(), it doesn't handle the case where the
NamedNode is a static method on a class. It just generates the library
and method name, skipping the class, so "Expect.equals(1, 2)" gets
compiled to "expect.equals(1, 2)" instead of
"expect.Expect.equals(1, 2)".
Change-Id: I6bd9d98bc9706965160d8fb7cf70b20eeebab3a8
Reviewed-on: https://dart-review.googlesource.com/16687
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Vijay Menon <vsm@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>
It's added as a new compiler, so pass "-c dartdevk" to use it.
It doesn't support any test packages yet, so tests that, say, import
package expect won't compile. I'll work on that next, but it will
require adding some stuff to the build scripts to build .dill files for
those packages.
This does get test.dart invoking the compiler, running the resulting
test, and correctly reporting the result:
- A test that doesn't throw an exception and stays within the bounds of
what is currently implemented in dartdevk passes.
- A test that compiles correctly but fails at runtime fails with a
RuntimeError.
- A test that contains a compile error fails with a non-zero exit code
and is reported as a CompileTimeError.
Change-Id: Icacbf1ff54dfe7aa4d245382d3b0aeb375cf105b
Reviewed-on: https://dart-review.googlesource.com/15420
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Compile return statements. Kernel function bodies are statements, not
necessarily blocks. In that case, blockify the JS function body.
Bug:
Change-Id: Ibbed1c2039b103151b7244774f3daf8992264a88
Reviewed-on: https://dart-review.googlesource.com/15280
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Generic function types were not previously renamed before using them
for inference, which resulted in capture problems when doing inference
on recursive generic method invocations.
Fixes#30980
Bug:
Change-Id: I1c610606dd65d86735cb615e077d720066a85e1a
Reviewed-on: https://dart-review.googlesource.com/15040
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
pkg/front_end/test/fasta/analyze_test is incorrectly failing because of DDC changes.
This must be fixed, but in the meantime this works around it.
Change-Id: I72fd56f9b306dce9b1f34e810c6ece3f6d8f49fb
Reviewed-on: https://dart-review.googlesource.com/14342
Reviewed-by: Jenny Messerly <jmesserly@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>
This change fixes bugs that users see when we mark declaration code,
while also reducing the source map size (improving startup & reducing
the load on devtools). The SDK source map is reduced by 41%.
Stack traces and stepping should be more accurate after this change, but
if we identify any node(s) that need different marking, we now have
the tools to refine it further.
Change-Id: Ie50c6aca873be7b7c0f7c238a9db2001acbceb5c
Reviewed-on: https://dart-review.googlesource.com/10210
Commit-Queue: Jennifer Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Alan Knight <alanknight@google.com>
- string/int keys use identity maps
- construct the correct type rather than relying on factory constructors when possible
- checks if key has identity semantics and use that when possible
- avoid helper calls/casts/etc in implementations
- use native ES6 Map/Set key order tracking
- optimized constructor for map literals
- fixes#30466, const maps are now canonicalized correctly
Change-Id: Id44acf3d9bf8cb153a4755aa28df08fe91bfc633
Reviewed-on: https://dart-review.googlesource.com/8167
Reviewed-by: Vijay Menon <vsm@google.com>
This appears to improve Gabriel's is-check benchmark by 2x and
DeltaBlue by about 30% (DDC on d8-tip).
I suspect this is improving inlining of top-level accesses on library
objects (including helpers like dart.is).
Change-Id: I1629d821b481194075a80dd6858334c1f678dd12
Reviewed-on: https://dart-review.googlesource.com/7446
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
In particular, some types like the base/mixin classes for Map in dart:collection did not work correctly.
This also has cleanups/optimizations to how DDC registers signatures, partially addressing #30499
Also fixes#29897, const maps are now immutable in DDC.
Change-Id: Icfdc7921d255a58a9e13908cf800832f787314ee
Reviewed-on: https://dart-review.googlesource.com/7442
Reviewed-by: Jennifer Messerly <jmesserly@google.com>