This allows tests that would fail in JS compatibility mode (e.g. tests that do a lot of string manipulation) to disable the mode for their own execution.
Also ensure dart2wasm-*-jscm-* builds do a "create_sdk" so that the dart2js platform dill is available for the test.
The alternative I considered was skipping the test but "--js-compatibility" is a dart2wasm-specific flag and the test infra is unaware of it so we can't skip the test via a status file.
Bug: https://github.com/dart-lang/sdk/issues/56858
Change-Id: I60179eaab2e4522acf1fe0b47c7c02ccb1ca957b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388644
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
After these changes the tests pass 100% of the time on all expected configurations.
- Emit 'unittest-suite-wait-for-done' at the start of tests to allow for async code loading. Tests must therefore emit 'unittest-suite-done' when they complete. Calling `asyncStart` and `asyncEnd` helpers will achieve this.
- Fix test_runner runtime.
- Add file deps on necessary files (dart2js platform dill & flute) to dart2wasm_hostasserts config.
- Mark dart2js compilation test as slow.
Change-Id: Iee993deb3905ccd50068325a5c5fd0bf0512a513
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386980
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Currently when the .wasm file path passed to run_wasm.js is a relative
path, `Uri.base` becomes something like `file://test.wasm`, which is not
a valid file URI, so it causes crashes in `Uri.toFilePath`.
When the file path is relative add a omit `file://` prefix.
`Uri.base` values before and after:
- Before, relative .wasm path: `file://test.wasm` (invalid)
- Before, absolute .wasm path: `file:///home/user/test.wasm`
- After, relative .wasm path: `test.wasm` (fixed)
- After, absolute .wasm path: `file:///home/user/test.wasm` (same as before)
Change-Id: I0d1c43716e07a9ee926e7feeeab514c2c66bac16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385700
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Adds a mode that puts every library (outside of the SDK) into its own wasm module. Each module is then loaded before the program executes.
This allows us to get better coverage on multi-module logic.
I chose to augment the SDK `_invokeMain` entry point because it allows us to push the user-defined main into a second module ensuring we always have at least 2 modules. The SDK alone is then the main module and all user-code is in deferred modules.
The next step is to make a test configuration for this and decide what frequency to execute it with.
Change-Id: I01bf3a5fee4604a890ef376ebd35113281a36a5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384404
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
All other constant types include similar logic.
This caused a failure when testing deferred loading logic. Laziness of static tear offs are module sensitive. A record containing a constant static tear off needs to match the inner laziness. Though there are other ways to get lazy subconstants that would also cause this to fail (e.g. very large strings).
Change-Id: Ia55b4f24a15e57b9721383726e7afb5f39557d5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384980
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This is a reland of commit fca5417d49
- Patchset 1 is the reland.
- Patchset 2 adds a regression test and fixes the bug.
Also tested engine chrome-dart2wasm-html-engine,chrome-dart2wasm-html-html,chrome-dart2wasm-html-ui,chrome-dart2wasm-canvaskit-canvaskit,chrome-dart2wasm-canvaskit-ui,chrome-dart2wasm-skwasm-ui tests manually.
Original change's description:
> Reapply "[dart2wasm] Allocate boxed bools once" and "[dart2wasm] Box `Pointer` values obtained from FFI calls"
>
> This reverts commit a4e9775a99.
>
> - Patchset 1 reverts the revert.
>
> - Patchset 2 adds regression tests. These tests fail.
>
> - Patchset 3 and the rest fixes the bug in `_loadPointer` and
> `_storePointer` intrinsics. Also adds some inline annotations to
> reduce the noise in unoptimized builds.
>
> Tested: updated test web/wasm/ffi/ffi_native_test
> Change-Id: I748a8aa8ff7cc663b1980d2bfab0d0da9f369e3b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384760
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Ömer Ağacan <omersa@google.com>
Tested: web/wasm/ffi/ffi_native_test updated. Manual run of engine chrome-dart2wasm-html-engine,chrome-dart2wasm-html-html,chrome-dart2wasm-html-ui,chrome-dart2wasm-canvaskit-canvaskit,chrome-dart2wasm-canvaskit-ui,chrome-dart2wasm-skwasm-ui tests.
Change-Id: Ifcd5156b8a03228119b2146edcfc56db8ac6273b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384843
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
This reverts commit a4e9775a99.
- Patchset 1 reverts the revert.
- Patchset 2 adds regression tests. These tests fail.
- Patchset 3 and the rest fixes the bug in `_loadPointer` and
`_storePointer` intrinsics. Also adds some inline annotations to
reduce the noise in unoptimized builds.
Tested: updated test web/wasm/ffi/ffi_native_test
Change-Id: I748a8aa8ff7cc663b1980d2bfab0d0da9f369e3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384760
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
There are several different kinds of implicit type checks. The most
common ones are the checks on covariant parameters of methods. Those are
not represented in the kernel AST via `AsExpression`s but backend
compilers have to insert them themselves.
Then there's other implicit type checks that users haven't written but
the CFE inserts as synthetic `AsExpression`s. There's several different
kinds.
=> We make --omit-implicit-checks now also not perform those anymore
(which one would expect given the name of the flag)
Change-Id: Ie61536c0a7269e5c62cd98c62e77d1b6a34e3f1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384740
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Clean up and optimize some RegExps, and fix uses of `.group`.
Switch to a newer language version, to be able to use newer features.
Add a little documentation about why some RegExps are as they are.
Add (tentative) warning for multitests.
Change-Id: I59f73b87ce30caaeca1c0e0aa7954af1b97abd1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382620
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
- Document which target needs to be built for the test
`web/wasm/ffi/ffi_native`.
- Add tests that passes and expects `double` and `float`s.
(The `sqrt` native function was previous unused)
- Define inputs in `wasm_module` gn template so that the
`ffi_native_test_wasm_module` target will rebuild the Wasm file when
`tests/web/wasm/ffi/ffi_native_test_module.c` changes.
Change-Id: Iff642ff2cdee48a617e8f2cf4cca4053122a7e05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384263
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
When `-O3` / `-O4` / `--omit-implicit-checks` are turned on then the
runtime type of tear off functions with covariant parameters was
incorrect.
=> The runtime type of any kind of function or object should always be
the same, irrespective of whether we're dropping some implicit or
explicit `as` checks - as the runtime type can also be observed via e.g.
`is` checks.
The issue was originally introduced in [0].
Issue https://github.com/dart-lang/sdk/issues/56664
[0] https://dart-review.googlesource.com/c/sdk/+/279965
Change-Id: I5c64134e4735d73cf228e12b8eb3bd4767616e11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384285
Reviewed-by: Ömer Ağacan <omersa@google.com>
Currently `Pointer` argument and return types of `FfiNative` functions
are translated to Wasm as `i32`.
This causes problems when we need to box those `i32` values as we don't
track which Dart types Wasm types come from when converting a Dart type
like `Pointer` to a Wasm type like `i32`.
Currently this works somewhat accidentally. All `i32`s are boxed as
`BoxedBool`, including `i32`s that represent `Pointer`s.
This breaks when we need to get the type parameter of a `Pointer` (e.g.
in a `is` or `as` check), but more importantly it means that we can't
cache boxed `true` and `false` values and return those cached values
when converting an `i32` to a boxed type as we don't know whether the
`i32` represents a bool or pointer.
Ideally we would have some kind of intermediate layer between
`wasm_builder` and dart2wasm that allows types like "a Wasm i32
representing an unboxed T" (for some T).
Alternatively we could attach extra information to `ValueType`s, for
example using expandos or maybe by adding a `dynamic` field to the base
class.
However it's unclear whether it's worth doing a major refactoring, when
a simpler alternative exist: we box `Pointer` values obtained from an
import in the Dart wrapper for the imported function.
VM already boxes `Pointer`s, so the performance should be acceptable.
This CL implements this simpler alternative of boxing `Pointer` values.
Tested: web/wasm/ffi/ffi_native_test updated.
Change-Id: I02e5c07fdb021a7b51ed5db2a44123b1608c9aad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383325
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
* Inline small `get iterator` & `get current` iterator methods
* Inline bodies that are small compared to arguments
* Make AST node counter more precise
* Manually mark ListIterator methods as prefer inline
CoreLibraryReviewExempt: Only adds annotation to existing functions
Change-Id: Ib6379e73713cd47a88e5cc67cecd4b5c8344adcb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382882
Reviewed-by: Slava Egorov <vegorov@google.com>
The fused utf8+json decoder ensures the bytes that it operates on are
U8List:
void parseChunk(List<int> value, int start, int end) {
if (value is U8List) {
chunk = value;
} else {
final bytes = U8List(end - start);
bytes.setRange(0, bytes.length, value, start);
...
}
...
}
This speeds up the `bytes.setRange()` call by using an optimized loop
that copies memory from JS arrays to wasm arrays.
=> This speeds up WasmDataTransfer.FromBrowserBytes.* by 10x
=> This speeds up Json*JS.*.FromBytes benchmarks by up to 3x
Issue https://github.com/dart-lang/sdk/issues/56494
Change-Id: I99fd1db280f503e91972c53537d7cd1fd4fd49ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382002
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
`Native.addressOf` is not implemented in dart2wasm (yet).
However, crashing the compiler means we cannot use packages which use
`Native.addressOf` even if these are not invoked.
This CL changes these expressions to a `throw` at runtime. This enables
using the subset of packages that use `@Native`s.
Implementation note: The existing FfiNative transformer doesn't
recurse into visitors. And it extends the transformer for the VM which
doesn't recurse. So I don't want to change it to recurse over the
whole AST. Instead, this introduces a new transformer that traverses
the whole AST.
TEST=tests/web/wasm/ffi/ffi_native_test.dart
TEST=existing tests with rolling `package:ffi` in via DEPS.
Closes: https://github.com/dart-lang/sdk/issues/56461
Change-Id: If8fab07a852939a4b519ae7cc47b4071adda8a3a
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-jscm-chrome-try,dart2wasm-linux-firefox-try,dart2wasm-linux-d8-try,dart2wasm-linux-chrome-try,dart2wasm-asserts-linux-chrome-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380260
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Partial instantiation constants are closures. Those closures have
vtables with all entries needed for the closure representation
corresponding to the instantiated closure.
The entries of those vtables have to either call the corresponding
method of the generic closure, or are unreachable dummy entries.
Dummy entries can be required due to clustering callees/callers together
where a particular target doesn't support the name combination.
The case that was incorrect is if the particular name combination did
not get clustered with anything for the generic closure representation.
Issue https://github.com/dart-lang/sdk/issues/56372
TEST=web/wasm/regress_56372_test
Change-Id: Ifbf624e10dd1162f4d5660b43914e5b34ba82294
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380100
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
To be able to know when we are generating a source map, make `dart
compile wasm` aware of the `--no-source-maps` flag.
The "name" segments of source mappings are also made `null` with this
patch. Browsers don't use that segment and binaryen doesn't support it.
Change-Id: I7b52c8fb7cef92ed60547e97ad137e0cd3967f26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378421
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
- Adds some missing type check cases to check whether a Dart
class that implements a JS class properly type-checks and vice
versa. Also adds the generic version of those cases.
- Furthermore, this file contains a number of tests that are
broken in both compilers so it's currently marked as failing
on all configurations. Instead of doing this, we mark the current
status for each individual test in the expectation, and place
the real expected value in a comment next to it. That way, if
the current status changes, we can detect it.
Change-Id: I7b208863fdebdf80b3735fae896943da65ecf69a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378565
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
--- Super fix ---
When the arguments to a call contain an async gap (an await in this case), the new lowering will save the receiver to a temp variable so it can be accessed on re-entry to the function body. This is skipped for literals as the literal does not need to be stored in a variable, it can simply be used as-is.
However, the DDC JS AST did not treat "this" or "super" as literals so we ended up with invalid JS like "let temp = super; // do await; temp.foo(...);". In this case "let temp = super;" is invalid, "super" cannot be used as a bare expression.
--- Function scope change ---
The original approach of using TemporaryIds for all the hoisted variables had a large flaw in that it didn't account for scopes captured by closures within async code. Hoisted variables were lifted out of their attached scope and so closures captured the single hoisted declaration and all modified the same variable. See async_scope_capture_test.dart for an example of this breaking.
To fix this we need to box any captured variables into a JS object. We then wrap any closures in an IIFE and pass the correct scope objects in as arguments to "capture" them. This is similar to dart2js's approach of boxing variables for closures. The approach is a little less fine-grained though and we simply box every variable. This makes the logic simpler and provides a better debug experience as users will just be able to look at the available "asyncScope" variables and see all the declarations in the original source code.
--- Add async callback ---
After further study, none of the other backends add implicit calls to 'async_helper.asyncStart' or 'async_helper.asyncEnd'. All the tests (with the exception of the hot_restart_timer_test updated below) are all set up to call asyncStart if they need it. As such we can simply remove and calls in the runtime/sdk to 'addAsyncCallback' (which is then calling 'async_helper.asyncStart'). Ditto with their remove/end counterparts.
Change-Id: Iac9a3774cc43fc2270e3bb2e992893358042e604
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/376020
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
When omitting checks, casts between unboxed types currently cause a
compile-time crash when generating the conversion.
This compile-time crash is useful to catch compiler errors, but when the
checks are omitted it can be triggered on invalid casts, such as when
casting a `double` to `int`.
So when omitting checks, generate an `unreachable` (consistent with
other type cast failure when omitting checks) instead of crashing.
An alterantive implementation (see patchset 1) would be checking for
cast failures when compiling `as` expressions with omitted checks.
However it makes the code slightly more complicated, and more
importantly `unreachable` gets a wrong source span as it's generated
after the `wrap` to compile expression.
Fixes#56234.
Change-Id: Ia93a850d028a69320ff671efd8344843fa7c4388
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375640
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
- Add SSA HArrayFlags{Check,Get,Set} instructions to check for
fixed-length and unmodifiable JSArray and JavaScript typed data
instances.
- Add optimizations to remove redundant checks.
- Added HOutputConstrained interface for instructions that must have
the input and output in the same JavaScript variable. This
generalizes some code generation logic already applied to HCheck.
Bug: #53785
Change-Id: I61750dd03aa3a964eed3bc76e1656c5f60f77109
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372002
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
This implements generating source maps for the generated Wasm files.
Copying dart2js's command line interface, a source map file with the
name `<program name>.wasm.map` is generated unless `--no-source-maps` is
passed.
When a source map is generated, the generated .wasm file gets a new
section `sourceMappingURL` with the contents `<program name>.wasm.map`.
This section seems to be undocumented, but Chrome and binaryen recognize
it as the URI to the source map file. Chrome is then loads it
automatically in the DevTools.
## Implementation
- `wasm_builder` package is updated with the new `source_map` library,
which describes the source mapping entries.
- `wasm_builder`'s `InstructionsBuilder` is updated with the new public
members:
- `startSourceMapping`: starts mapping the instructions generated to
the given source code.
- `stopSourceMapping`: stops mapping the instructions generated to a
source code. These instructions won't have a mapping in the source
map.
- `CodeGenerator` sets the source file URI and location in the file
when:
- Starting compiling a new member
- Compiling an expression and statement
Change-Id: Ic8f723f7a154402c0d34710689db57d640b83b86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370500
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
This wasn't caught by default CI builders, because
default configurations use `pkg/dart2wasm/tool/compile_benchmark`
which passes all unknown flags to the compiler (for convenience
of local development) but `dart compile wasm` doesn't
Change-Id: I6a92d3f04848e027c92b1feee3d54e7efba9fd27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371661
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Adds a flag users can use via
dart compile wasm \
--extra-compiler-option=--enable-experimental-wasm-interop
which allows code to import `dart:_wasm` and use import/export
pragmas.
Similar to how we have a way to import `dart:ffi`
dart compile wasm \
--extra-compiler-option=--enable-experimental-ffi
TEST=web/wasm/allow_import_export_pragmas_test (positive test)
TEST=web/wasm/reject_import_export_pragmas_test (negative test)
Change-Id: Ibdbbac6c3aa049b2759e96b7b749dd30ecc6aaed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370063
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
In most cases, the (now removed) SDK class was patched so that the constructor redirected to a platform-specific implementation of the unmodifiable view. Uses of the SDK class in the platform code could be rewritten to the more direct use of the implementation class.
The big +/- file changes are from moving the implementation classes from the patch file (typed_data_patch.dart), where they are no longer needed, to the internal file (typed_data.dart).
TEST=ci
Bug: #53785
Change-Id: Iaa7370de25b7fc2d26b24f7733c2892868e593cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370661
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
This CL adds a new --interop-null-assertions flag (cf.
--native-null-assertions) with the goal of validating that JS interop
APIs with non-nullable static return types do not return null values.
This flag is currently disabled by default but is intended to assist in
sound null safety migrations.
In general, we don't guarantee type soundness of package:js interop
since users can write incorrect static types which are not backed by
any runtime checks. However, it is likely that during the null safety
migration, some interop APIs which should have been made nullable
weren't. Therefore, we want to offer some additional (but limited)
checking for this case.
For static invocations of functions with non-nullable return types, we
can simply perform a null check on the result of the call.
For instance methods (which could be invoked virtually/dynamically), we
want to perform a null check on the return value in the callee (the
interceptor method) itself when possible.
It's possible for multiple interop bindings to share the same
interceptor method. We produce a null check in the interceptor method
body if all the methods have non-nullable return types. Otherwise, we
insert checks at callsites when appropriate.
Change-Id: Ifd155d7f8326152b6d57d61199e0b7973c4a1211
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369784
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
Make tool (by default) give error when test entry specified in status
file does not exist. Make -w (by default) remove such entries.
Cleanup most status files, fixing a few entries containing `.dart` and
removing obsolete entries (i.e. entries pointing to nonexisting tests).
This should for instance have given an error in
https://dart-review.googlesource.com/c/sdk/+/370600 saying that the file
I specified didn't exist (in that I shouldn't have specified the `.dart`
part).
TEST=No tests, this is status file maintenance.
Change-Id: Ie977bf15dea2e3dad8d771fd3e99917317e975f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370886
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Knowing whether Dart code is running in a WebAssembly context is useful
to potentially select different code paths exploiting differences in
JavaScript and WASM behavior or simply to report the information to
users (e.g. for crash reports).
Without such a constant, one has to rely on implementation differences
such as `identical(0, 0.0)` or check the available `dart:` libraries.
Both are error-prone, so having a reliable constant as an alternative
makes this easier.
Closes https://github.com/dart-lang/sdk/issues/55694
Change-Id: Ia969641e4b78223c394cbf251805cf77a30cb0fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365822
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Currently the type of a static field is only based on the dart type, not
inferred types. This can mean that the type of such field is e.g.
`dynamic`.
Though the return type of the initializer function used the unboxing
information.
=> There was an invariant that if we use `null` to signal uninitialized
in the global, then calling the initializer will also result in a
non-nullable reference type.
=> This was invariant was broken by recent changes to dart2wasm that
take advantage of TFA-inferred unboxing information.
=> We fix this inconsistency by ensuring the wasm global's type is the
same as the initializer function's return type.
Change-Id: I9c27c0b28d2f81f888b4c9afc59dad42af2229ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365825
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
For example code that uses `Completer` in parameters/fields/...
used to be represented as `Object` in wasm type system, which we
can now represent instead as `_Completer`.
Change-Id: I35b2d8cb45717e58a813756dfa6278804552fbcb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365020
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
This fixes issues where structs are accessed dynamically
or simply accessed in a nullable fashion, e.g. with `MyStruct? foo`
dart2wasm does not yet support using structs-by-value as arguments
or return values when calling linear-memory wasm functions.
dart2wasm also doesn't support structs-by-value created in dart
that are backed by WasmGC memory (e.g. arrays).
Change-Id: I9b9c60002d2d32db3f235f1cec25fe3b35fcc17b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365140
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
This reverts commit cd2c566bcf.
Reason for revert: Updating to not remove field used by Flutter engine.
Original change's description:
> Revert "Tweak `expect.dart` library."
>
> This reverts commit ff5f391c0a.
>
> Reason for revert: The expect library is used by Flutter engine, and some of its tests use assertStatementsEnabled. There should be a migration path that doesn't require an atomic change, like adding the replacement api before removing the old one.
>
> Original change's description:
> > Tweak `expect.dart` library.
> >
> > Make API more consistent for a few methods.
> > Reduce the number of language features used in tests:
> > * Never iterating an iterable, always converting it
> > using `.toList()` first and iterating using indices
> > (fx `setEquals`).
> > Also require a `List` in places where an `Iterable`
> > wasn't necessary.
> > * Avoid doing complicated computations that are also
> > used for the error message. Do simple check first,
> > then recompute to get better error messages
> > (fx `allDistinct`).
> >
> > Renamed some rarely used members for consistency
> > (`stringContainsInOrder`->`containsInOrder`,
> > where other string-contains functions just start
> > with `contains`, and `containsOneOf` -> `containsAny`
> > to match `Iterable.any` phrasing, and also it accepts
> > if containing at least one, not precisely one.)
> >
> > Removed a function that wasn't used anywhere.
> >
> > Moved `assertStatementsEnabled` to `variations.dart` as `asserts`.
> > Removed `typeAssertionsEnabled` and `checkedModeEnabled`. The former used in one place, where it was replaced with `checkedImplicitDowncasts` from `variations.dart`, the latter wasn't used anywhere.
> >
> > Deprecates `package:expect/minitest.dart`. It was never intended
> > to be used for new tests, only as a help to convert existing tests
> > written against `package:unit_test`.
> > All existing imports marked as `// ignore: deprecated_member_use`.
> >
> > Change-Id: I07e21d4c0f3ccf11b82ee34af2668fdbb22264d2
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352360
> > Reviewed-by: Slava Egorov <vegorov@google.com>
> > Reviewed-by: Ömer Ağacan <omersa@google.com>
> > Reviewed-by: Nate Bosch <nbosch@google.com>
> > Reviewed-by: Stephen Adams <sra@google.com>
> > Commit-Queue: Lasse Nielsen <lrn@google.com>
>
> Change-Id: I360b4347470a0bb2b63c3108e2b83ee2a771bf3f
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362020
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Reviewed-by: Ömer Ağacan <omersa@google.com>
> Reviewed-by: Stephen Adams <sra@google.com>
> Reviewed-by: Leaf Petersen <leafp@google.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: William Hesse <whesse@google.com>
CoreLibraryReviewExempt: Reland
Change-Id: I53db40edc0733842a008839c3913d51c885e39ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362502
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>