This version adds support for the `extern.externalize` and
`external.internalize` Wasm instructions.
Change-Id: I2285217feff0afa8107ec6685eeec91487667254
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255461
Reviewed-by: Stephen Adams <sra@google.com>
The API for the JS Promise integration API has changed to be part of
the `new WebAssembly.Function` constructor. This requires parameter
types to be specified explicitly. Apparently, these types currently
must be all `externref`.
Change-Id: Ifae634f65cfa377441be4b2dc0643c34b702fbe7
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255061
Reviewed-by: Stephen Adams <sra@google.com>
This splits the type hierarchy into three separate hierarchies with
the top types `any`, `func` and `extern`.
Update d8 to 10.6.91, which switches to the new type hierarchy.
Also, all ref shorthands for abstract heap types are now nullable, so
the type emitter in the `wasm_builder` is updated to follow that scheme.
To reduce confusion about the nullability of abstract reference types,
these now all require the nullability to be specified explicitly.
Change-Id: I4774d08cbed18307e481c466b2e3402a8d8fb6bd
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255060
Reviewed-by: Joshua Litt <joshualitt@google.com>
This implementation has a number of limitations:
- Returning a Future from an async function is not supported.
- Every async call switches to a new stack. A later optimization will
stay on the same stack if the call is directly awaited.
- Exceptions that cross async boundaries do not receive full stack
traces including the async suspension points. The stack trace of the
final exception just reflects the stack trace for the outermost
async call.
Change-Id: I2a5d5e30d6e955999ba55842c8b2ca3427cbf954
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241010
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
The Promise integration API has been updated to automatically
instantiate suspenders when an async export is called, which enables
the async/await implementation in dart2wasm to avoid a limited-size
stack pool.
Also, the --experimental-wasm-nn-locals options has been removed,
since non-nullable locals are now always enabled.
This is the last version before the (backwards-incompatible) change
over to the three-pronged WasmGC type hierarchy.
Change-Id: Ide164d83059877fa32f4ada9907290dd3d091b7a
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254924
Reviewed-by: William Hesse <whesse@google.com>
This reverts commit 9700458975.
Reason for revert: breaks Dart SDK build using gcc and dart-sdk-linux-main bot.
Original change's description:
> [vm/compiler] Initial implementation of IL binary serialization
>
> This change adds binary serialization/deserialization of flow graphs.
> It supports all IL instructions and certain objects which can be
> referenced from IL instructions. IL binary serialization is a useful
> machanism which would allow us to split compilation into multiple parts
> in order to parallelize AOT compilation.
>
> The program structure (libraries/classes/functions/fields) is not
> serialized. It is assumed that reader and writer use the same
> program structure.
>
> Caveats:
> * FFI callbacks are not supported yet.
> * Closure functions are not re-created when reading flow graph.
> * Flow graph should be in SSA form (unoptimized flow graphs are not
> supported).
> * JIT mode is not supported (serializer currently assumes lazy
> linking of native methods and empty ICData).
>
> In order to test IL serialization, --test_il_serialization VM option is
> added to serialize and deserialize flow graph before generating code.
>
> TEST=vm/dart/splay_test now runs with --test_il_serialization.
>
> TEST=Manual run of vm-kernel-precomp-linux-debug-x64-try with
> --test_il_serialization enabled (only ffi tests failed).
>
> Issue: https://github.com/dart-lang/sdk/issues/43299
> Change-Id: I7bbfd9e3a301e00c9cfbffa06b8f1f6c78a78470
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254941
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>
TBR=vegorov@google.com,kustermann@google.com,rmacnak@google.com,alexmarkov@google.com
Change-Id: Iae4e4868f183815a8fc3cd79597141b3896e23d7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Issue: https://github.com/dart-lang/sdk/issues/43299
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255780
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
I'm reasonably confident that this is incomplete, but I'm hoping that
it's a least headed in the right direction.
There aren't any tests because I believe that our resolution tests are
all based on source code, and we can't yet parse record literals. I'm
happy to hold off on landing this CL until we have the parser work
landed and the AstBuilder updated so that I can have tests to go with
the changes.
Change-Id: I7cd2a9b3a2e496c1220d569b36497dc326ff6915
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255146
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This is a reland of commit 6abea1381b
Original change's description:
> Migration: fix generate_resources.dart to use `dart compile js`.
>
> This is necessary because the command `dart2js` is no longer present
> in the SDK.
>
> Change-Id: Iea3cf3092bcda6c889c55a51d1b5601773404fb9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253862
> Reviewed-by: Samuel Rawlins <srawlins@google.com>
> Commit-Queue: Paul Berry <paulberry@google.com>
Change-Id: Ibc25641aca165b578b2c4348ef0b841263298e3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255740
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
These subtypes were previously colliding with instances of the base ir.InterfaceType class in the interner map.
Change-Id: Iec6b53fa82e0994142c408a0a2be1ddd045898e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255257
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Add several more inlining metrics to SSA:
- getters (ellisions vs. inlines)
- setters (ellisions vs. inlines)
- intercepted length calls
- if conditions
- is checks
- late sentinel checks
After digging these are all the opportunities for optimization that I saw that I thought might be affected by changes in global inference. Open to feedback on whether any of these are unnecessary or if there's any other things worth tracking.
Change-Id: I70ff279a797f71b39b2bc02c00fbb3f6e149cb2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255202
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Dartdev will use the user's home directory to store the server information and will keep a directory for cached kernel files in each dart package's .dart_tool directory and in the .dart directory for stand alone dart programs.
This functionality is accessed by providing the --resident flag to the Dart CLI, and the server can be manually shutdown with the new shutdown command.
Change-Id: I5231a00b7535266ab0704ca3ae35c039738bd38b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254341
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Michael Richards <msrichards@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
This change adds binary serialization/deserialization of flow graphs.
It supports all IL instructions and certain objects which can be
referenced from IL instructions. IL binary serialization is a useful
machanism which would allow us to split compilation into multiple parts
in order to parallelize AOT compilation.
The program structure (libraries/classes/functions/fields) is not
serialized. It is assumed that reader and writer use the same
program structure.
Caveats:
* FFI callbacks are not supported yet.
* Closure functions are not re-created when reading flow graph.
* Flow graph should be in SSA form (unoptimized flow graphs are not
supported).
* JIT mode is not supported (serializer currently assumes lazy
linking of native methods and empty ICData).
In order to test IL serialization, --test_il_serialization VM option is
added to serialize and deserialize flow graph before generating code.
TEST=vm/dart/splay_test now runs with --test_il_serialization.
TEST=Manual run of vm-kernel-precomp-linux-debug-x64-try with
--test_il_serialization enabled (only ffi tests failed).
Issue: https://github.com/dart-lang/sdk/issues/43299
Change-Id: I7bbfd9e3a301e00c9cfbffa06b8f1f6c78a78470
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254941
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Adds static method on `Isolate` to run an asynchronous function
in a separate isolate.
Change-Id: I673373fa02524f1d0b88099027cfaf1b796eb344
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254960
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This reverts commit f5228127f8.
Reason for revert: causes a VM crash, see b/242964932 (the test is also publicly available at 93fb0da38a/drift_dev/test/analyzer/sql_queries/query_analyzer_test.dart (L8))
Original change's description:
> [vm/compiler] Optimize switch statements
>
> Switch statements that either contain only integers or only enum values of the same type can be optimized.
>
> Depending on the number of switch expressions and the number of holes that the range of switch expressions contains, either a binary search or a jump table is used.
>
> TEST=runtime/test/vm/dart{,_2}/optimized_switch
> TEST=tests/language{,_2}/switch
>
> Fixes: https://github.com/dart-lang/sdk/issues/49585
>
> Co-authored-by: Gabriel Terwesten gabriel@terwesten.net
>
> Change-Id: I62dcdb7843107f03de7e468c60b4db52ec78f676
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253787
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
TBR=vegorov@google.com,alexmarkov@google.com,gabriel@terwesten.net
Change-Id: I8c673ea70e7ed91dffb3674e7dcb4aaa0611e978
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255258
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Ilya Yanok <yanok@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
This change disables certain debug mode checks for commonly used
constants which were enabled in https://dart-review.googlesource.com/c/sdk/+/253840.
It turns out they affect compilation time considerably in debug mode,
especially if low optimization threshold is used and kernel service
snapshot is not used (for example in debug/ia32 mode).
Time of running standalone_2/regress31114_test in debug/ia32 mode:
78s -> 34s.
TEST=CQ + a few debug bots
Fixes https://github.com/dart-lang/sdk/issues/49676
Change-Id: I9e09d6e5b9c1c86d9026a924a367301e0dac85b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255500
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This reverts commit a547cfc096.
Reason for revert: With 15 shards this ends up holding too much serialized data and causes an increase in memory usage.
Original change's description:
> [dart2js] Defer deserialized CodegenResults by members.
>
> For large applications only ~60% of these objects are used. This defers their deserializtion until they're accessed in the codegen member map.
>
> In local testing on large applications this saved ~200MB of memory usage in the linker phase.
>
> Change-Id: I8ff87803fc23ef2d3f954646687e3fc67b68a4f7
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254600
> Commit-Queue: Nate Biggs <natebiggs@google.com>
> Reviewed-by: Joshua Litt <joshualitt@google.com>
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I51d292531be30b358a025d7c472f25e8aba4dc3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255283
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Statically type String variables to avoid dynamic calls for substring or concatenation.
Change-Id: If485243dc0580fd1f4e53ec4cf69cb3819a57b5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255301
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Switch statements that either contain only integers or only enum values of the same type can be optimized.
Depending on the number of switch expressions and the number of holes that the range of switch expressions contains, either a binary search or a jump table is used.
TEST=runtime/test/vm/dart{,_2}/optimized_switch
TEST=tests/language{,_2}/switch
Fixes: https://github.com/dart-lang/sdk/issues/49585
Co-authored-by: Gabriel Terwesten gabriel@terwesten.net
Change-Id: I62dcdb7843107f03de7e468c60b4db52ec78f676
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253787
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
These fields can be `null`, but if they aren't, then the
`DecoratedType`s they contain cannot be `null`.
Change-Id: I9f07d06017ff9814e531f3517b4f452766dc0ebf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255341
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Also adds `RecordType.==` as equality of the shape and field types.
We intentionally don't check that elements are the same.
Change-Id: I4f5ef66a838a410843696f4f569ce3ed36bb7053
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255147
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Instead of using checked-in binaries in snapshot_utils_test.cc,
write out the binaries manually and check the written binaries.
TEST=vm/cc/CanDetectMachOFiles
Issue: https://github.com/dart-lang/.allstar/issues/159
Change-Id: I024ecac2084cfaef6bf8fe2a7cecceb9ae5d8de9
Cq-Include-Trybots: luci.dart.try:vm-kernel-mac-release-arm64-try,vm-kernel-mac-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255460
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
- task_dependency_graph no longer exists.
- summary/generate.dart expects an IDL file, it fails
when run without any args. There's only one such
file in the repo so I passed that.
Change-Id: I63854acc070c1cf4c49bb82d03f1312930e447e5
Tested: Ran the script, it generates all files without errors.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255481
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>