eval is disallowed by CSP and the dart2js-minified-csp-linux-chrome
bot is currently red. This uses Math.max, which should be available
both on d8 and with CSP enabled.
Change-Id: I5e348a72d50cf10db713934151473f0d15782ba3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421502
Commit-Queue: Ömer Ağacan <omersa@google.com>
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
This is a reland of commit 4bb05dc562
Initial commit didn't properly box the `void` return value, so when we
cast the return value to `ref #Top` to pass it to a Dart function (as
`Object?` or `dynamic`) it caused "illegal cast" traps.
In this commit we properly box the `externref` as `JSValue` (a proper
Dart class). A new test added passing the return value of a `void` JS
return to `print`.
Original change's description:
> [dart2wasm] Don't dartify JS values when returning as void
>
> When calling a JS function that returns `void`, avoid dartifying the
> result.
>
> Technically the return value of `void` functions can still be used, by
> casting the return type to `Object?` or `dynamic`. However this
> shouldn't be done, and `dartifyRaw` overhead just to support this case
> which should be extremely rare is too much.
>
> Any hacky code that uses return values of `void`-returning JS interop
> functions can manually dartify the retrun values with `toDart` or
> similar.
>
> Issue: https://github.com/dart-lang/sdk/issues/60357
> Change-Id: Ic370c7cf6eb6982f61f8a07c91e3bb93c5345ac6
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417240
> Reviewed-by: Srujan Gaddam <srujzs@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Ömer Ağacan <omersa@google.com>
Change-Id: I264211cca4f6b87e63d68909647975ab96f0b5bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421080
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
This replaces the individual lookups of getables and setables in LookupScope and NameSpace with single lookup that returns a LookupResult holding both the getable and the setable. This prepares for having getter/setter pairs in the same SourcePropertyBuilder and avoids the need for AccessErrorBuilder for handling lookups of getters where only setters exist and vice versa.
Change-Id: I2b1e2477ed43506d9f94c48acd4b44277b490540
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/420080
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
The same should happen for `Int32x4` and `Float64x2`,
but this is a start.
The existing class was basically uncommented and you had
to guess or explore to find out what, fx, the returned
values for the relational operators means.
I've tried to discover and document the current behavior,
but I had to fall back on "it's implementation specific"
in some places where platforms behave differently.
(For example it seems VM on Mac treats `.reciprocalSqrt()`
as doing `.sqrt().reciprocal()` where the other platforms do
`.reciprocal().sqrt()`, which makes a difference for exactly
one value.)
CoreLibraryReviewExempt: Doc and parameter name changes only.
Tested: Added more tests to float32x4_test.dart.
Change-Id: I3f8804f842d8a5d95e1d378a7edb9438a2f3ed2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415000
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
The new `lib/isolate/handle_throwing_to_string_error_test` was relying on
symbol names not being obfuscated and fails on
`vm-aot-obfuscate-linux-release-x64`.
=> Make it more robust by using `Symbol`s instead of `Strings`.
Change-Id: Ib1cd793b100b1c0b31f0a909f4ec8db442590540
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/413660
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Currently we have 3 different string types (JS Strings, OneByteString
and TwoByteString)s. There's some advantages to this, mainly that
if strings are used purely inside Dart we have more control over
optimizing them. But it does come with some issues
* Operations on mixture of strings are slow
* We get JS strings from outside (in DevTools e.g. websocket messages)
* Any kind of DOM interaction requires copying strings
* Regular expression matches can result in O(N*N) instead of O(N)
* Encoding of string literals/constants is terrible, high size overhead
* ...
Now that there's a standardized way to access JS strings (via
the `js-string` builtin spec) and this standard is finalized and
enabled in Chrome & Firefox it makes sense for us to switch to it.
It reduces app size:
* Smaller size: hello world -25%, flute -5.5%
* Faster startup
The performance changes are nuanced, some workloads will improve
significantly, some workloads will regress.
Improvements will come especially in cases where
strings are concatenated (due to JS not actually allocating new
strings in this case). That impacts e.g. string interpolations,
string buffer, json-to-string encoding, ...
Regressions will come especially for cases where we have to
construct strings from bytes (e.g. in utf8 decoder, utf8+json
decoder) - mainly due to having to go through an intermediary
`WasmArray<WasmI16>` to allocate strings. Also in cases where we
access individual char codes from the strings.
There's some follow-up improvements we can do, but it's better to
not iterate on this CL even longer but get it landed.
This CL will make the benchmarking system use
`--require-js-string-builtin` as well as most of test CI
(in `pkg/dart2wasm/tool/compile_benchmark`)
Though we run some configurations via overriding with
`--no-require-js-string-builtin`
(in `tools/bots/test_matrix.json`)
Issue https://github.com/flutter/flutter/issues/159400#issuecomment-2538593980
Issue https://github.com/dart-lang/sdk/issues/59699
TEST=ci
Change-Id: I238ac65efe092de569da870f23134f889ac929f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392903
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Make `Zone.createTimer`, `Zone.createPeriodicTimer` and `Zone.scheduleMicrotask`
not call register on the same zone.
These are low-level functions that should not build on top
of other low-level functions.
Instead the function is registered in the `Timer` constructors and
top-level `scheduleMicrotask` code, and the root zone's `createTimer`
and `scheduleMicrotask` just make sure that the callback will run
in its original zone, and that uncaught errors are handled in the
correct zone.
Avoids a double-registration that timers did.
Significant clean-up.
- The private `_Zone`, `_ZoneSpecification` and `_ZoneDelegate`
subclasses are not necessary now that their superclasses are `final`.
- Stopped using type aliases instead of function types
and old-style function arguments.
- Renamed some parameters to not be, fx, `f`.
Avoided some closure allocations for microtasks by putting the zone
into the queue entry, instead of wrapping the callback in a closure calling `zone.run`.
This is a potentially visible change if any code uses the zone functions
directly and expect them to invoke `Zone.register*`.
(Suspiciously no test failed with this change. May need to add some.)
Fixes#59913.
CoreLibraryReviewExempt: Have had all +1s, just not at the same time.
Bug: https://dartbug.com/59913
Change-Id: Ie3c87f5f22aedcbe30ab04718df98e1c0f0659c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405020
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Remove uses of async_minitest and multitests.
Removed two files that were checking dynamic behavior that no longer exists (compile-time errors reported at runtime).
Rewrote and/or added to enum_const_test.dart and _deferred_in_isoltae_test.dart.
Otherwise mainly removing multitest `//# ok:...` comments, or `//# 01: ...error...` that only existed because the test failed in dart2js, along with anything else that tried to special-case dart2js (which no longer supports isolates at all).
Some sporadic general clean-up like removing library names.
Change-Id: I99b55f05710347343286e86b37ce02f1006868dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402700
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
This is a reland of commit cb9ecbc363
This reland only turns on the entry point verification flag by
default in AOT mode. After Flutter tests that use native access
in JIT mode have been appropriately updated, a followup CL will
turn this flag on by default in JIT mode as well.
Original change's description:
> [vm] Enforce that entry points must be annotated by default.
>
> Changes the default value of the --verify-entry-points flag
> to true.
>
> Changes the default value for the check_is_entrypoint argument to
> to the Invoke/InvokeGetter/InvokeSetter flags to true. The mirrors
> library implementation and calls via vm-service explicitly pass
> false for this argument now.
>
> Add annotations as needed, such as annotating classes with
> annotated generative constructors. In some cases, the annotations
> were more general than needed (e.g., annotating with a no-argument
> entry point annotation when only the setter is needed), so make
> those annotations more specific.
>
> As this pattern is already common in downstream code, allow
> Dart_Invoke on fields as long as the field is annotated for getter
> access. (That is, calling Dart_Invoke for a field is equivalent to
> retrieving the closure value via Dart_GetField and then calling
> Dart_InvokeClosure.)
>
> TEST=vm/cc/DartAPI_MissingEntryPoints
> vm/dart/entrypoints_verification_test
>
> Issue: https://github.com/dart-lang/sdk/issues/50649
> Issue: https://github.com/flutter/flutter/issues/118608
>
> Change-Id: Ibb3bf15632ab2958d8791b449af8651d47f871a5
> Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-product-arm64-try,vm-aot-dwarf-linux-product-x64-try
> CoreLibraryReviewExempt: adding/editing vm-only pragma annotations
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363566
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Tess Strickland <sstrickl@google.com>
TEST=vm/cc/DartAPI_MissingEntryPoints
vm/dart/entrypoints_verification_test
Change-Id: I24919c32ab4760c7c5435c378879791086256f02
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-product-arm64-try,vm-aot-dwarf-linux-product-x64-try,flutter-linux-try,vm-linux-debug-x64-try,vm-linux-release-x64-try,vm-appjit-linux-product-x64-try
CoreLibraryReviewExempt: adding/editing vm-only pragma annotations
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391620
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Currently `convertSingle` converts the input to `U8List`, but
`convertChunked` works on `Uint8List`. This makes functions common in
both (`decode8`, `decode16`) polymorphic in input.
Update `convertChunked` to also convert the input to `U8List`. With this
`decode8` and `decode16` becomes monomorphic in the input type. Also
update array accesses in these methods to avoid bounds checks.
Check for a few fast cases in `List<int>` to `U8List` copying. If the
list is a `WasmI8ArrayBase` (used in typed data) or `WasmListBase` (used
in lists), we avoid polymorphism, indirections, and bounds checks during
copying.
Golem reports up to 600% improvement in some chunked parsing micro-
benchmarks.
Change-Id: Iddf6dae1a5d77cf574be77313dff779b4715e283
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395980
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
The new formatter supports opting a region of code out from being
formatted. I'm applying this marker to all of the multitests since
those tests are often very sensitive to formatting and easily broken.
This way, anyone touching a multitest (including me when I reformat
the tests) doesn't have to remember to not run the formatter on it.
Change-Id: I34831719cd35e669b49e02a0d00c32b44068a34e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396103
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
The Iterables have been separated and specialized.
The `keys` Iterable specialized so that the `contains` method uses the Map's `containsKey` method. This is required for correctness and usually much faster that the linear scan of `Iterable.contains`.
The default `MapBase.entries` maps over the keys and does lookups. It is faster to scan the data like `get keys` and `get values`.
Issue: #52909
Change-Id: Id3400c3efd8e657c74b41b3fce71e0713dc790bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389266
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This reverts commit cb9ecbc363.
Reason for revert: causes failures during Dart->Flutter roll and on Flutter HHH bots (see comments on the original CL).
Original change's description:
> [vm] Enforce that entry points must be annotated by default.
>
> Changes the default value of the --verify-entry-points flag
> to true.
>
> Changes the default value for the check_is_entrypoint argument to
> to the Invoke/InvokeGetter/InvokeSetter flags to true. The mirrors
> library implementation and calls via vm-service explicitly pass
> false for this argument now.
>
> Add annotations as needed, such as annotating classes with
> annotated generative constructors. In some cases, the annotations
> were more general than needed (e.g., annotating with a no-argument
> entry point annotation when only the setter is needed), so make
> those annotations more specific.
>
> As this pattern is already common in downstream code, allow
> Dart_Invoke on fields as long as the field is annotated for getter
> access. (That is, calling Dart_Invoke for a field is equivalent to
> retrieving the closure value via Dart_GetField and then calling
> Dart_InvokeClosure.)
>
> TEST=vm/cc/DartAPI_MissingEntryPoints
> vm/dart/entrypoints_verification_test
>
> Issue: https://github.com/dart-lang/sdk/issues/50649
> Issue: https://github.com/flutter/flutter/issues/118608
>
> Change-Id: Ibb3bf15632ab2958d8791b449af8651d47f871a5
> Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-product-arm64-try,vm-aot-dwarf-linux-product-x64-try
> CoreLibraryReviewExempt: adding/editing vm-only pragma annotations
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363566
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Tess Strickland <sstrickl@google.com>
Issue: https://github.com/dart-lang/sdk/issues/50649
Issue: https://github.com/flutter/flutter/issues/118608
Change-Id: Idba168f77b0636a50ad93309e29dc9989cc1f388
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-product-arm64-try,vm-aot-dwarf-linux-product-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391460
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Changes the default value of the --verify-entry-points flag
to true.
Changes the default value for the check_is_entrypoint argument to
to the Invoke/InvokeGetter/InvokeSetter flags to true. The mirrors
library implementation and calls via vm-service explicitly pass
false for this argument now.
Add annotations as needed, such as annotating classes with
annotated generative constructors. In some cases, the annotations
were more general than needed (e.g., annotating with a no-argument
entry point annotation when only the setter is needed), so make
those annotations more specific.
As this pattern is already common in downstream code, allow
Dart_Invoke on fields as long as the field is annotated for getter
access. (That is, calling Dart_Invoke for a field is equivalent to
retrieving the closure value via Dart_GetField and then calling
Dart_InvokeClosure.)
TEST=vm/cc/DartAPI_MissingEntryPoints
vm/dart/entrypoints_verification_test
Issue: https://github.com/dart-lang/sdk/issues/50649
Issue: https://github.com/flutter/flutter/issues/118608
Change-Id: Ibb3bf15632ab2958d8791b449af8651d47f871a5
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-product-arm64-try,vm-aot-dwarf-linux-product-x64-try
CoreLibraryReviewExempt: adding/editing vm-only pragma annotations
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363566
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Makes `whenComplete` create a new future with either the result of the
original, or the error of a future returned by the callback.
Until now it was returning the original future, causing it to be chained after
it was completed. That caused issue with `ignore()`.
(Which suggests that there is still something iffy about ignore and chaining.)
Combines `chainCoreFuture{Sync,Async}` into one function with boolean flag.
Most of the code is the same, and they had accidentally drifted apart.
Fixes#56806.
CoreLibraryReviewExempt: Should be simple refactoring.
Tested: Regression test added
Bug: http://dartbug.com/56806
Change-Id: I52751c078a4e26a10e9da0a64460e2c5c7f34ae5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387360
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Collects files from `package:async_helper` and `tests/language`
that are generally useful, so that all test-related helpers are
in `package:expect`.
Moves the two libraries from `package:async_helper` into `package:expect`,
and the `tests/language/static_type_helper.dart` file too.
Deprecates `async_minitest.dart`, to follow `minitest.dart`,
expecting the Flutter use of it to have been fixed to not break
on deprecation (I believe Flutter no longer breaks builds on deprecations at all).
Patch 1 is the actual change.
Patch 2+4+8 is changing all existing references to the files.
Patch 6 ignores deprecation in files still using `async_minitest.dart`.
3+5+7+9 are updating this text to make the numbers match.
Then it's just test-expectations and small tweaks from there.
Change-Id: I1b665135b5fef9b9a0c3b340ffe9daf874d0174c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373120
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Tests that we can use JSAny? as the type without
violating cross-origin policy. This will then be
used in package:web to implement a wrapper.
Change-Id: Ic30557138b61e27e421747ead81ea2fb7f6db240
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381886
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@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>
Aligns exit codes of
* `dart compile wasm` and
* `pkg/dart2wasm/tool/compile_benchmark`
Also make them use exit codes recognized by the test runner to
distinguish CFE crashes, CFE compile-time-errors and other failures.
Also update status file entries to from D8 specific entries
to JS commandline shell entries
=> Step towards aligning D8 & JSC test results
Change-Id: I1acb8803f5db7c732ad546d5989b1c555583e7c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383660
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Also removed a bunch of `CheckNotNullable`s that shouldn't be necessary any more. Any remaining non-sound-null-safety code runs today, and no more should be written. (And if it is, it'll mostly just err somewhere else, with a worse error message.)
Tested: New test added. Removed older tests checking for unsound null-safety.
Change-Id: I28626909cd8c1f91db6c61fc2b93042ed1b085dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380780
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
This change removes the implementation of `dart:js` for dart2wasm. The
code is no longer in use and the compiler already provides a static
error if you import `dart:js` internally.
By removing the implementation from the libraries.json spec, we also
show this as unaccessible on conditional imports. This will allow
developers to distinguish JS and Wasm backends
This adapts the original implementation in
https://dart-review.googlesource.com/c/sdk/+/368642 with a few small
changes, but keeps around the existing allowances on `package:js`. Those
can be addressed separately to reduce the disruption from this change.
Closes#55266.
Change-Id: I0d01a424f2fdb4f48879bd1a41c847a92439e74a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380583
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>