Commit Graph

2523 Commits

Author SHA1 Message Date
Ryan Macnak 018c5349a8 [vm] Handle short writes in Builtin_PrintString.
Also avoid polluting the repository working directory when fuzzing.

TEST=lib/mirrors/invocation_fuzz_test
Bug: https://github.com/dart-lang/sdk/issues/60721
Change-Id: Ibe2f2d35479bbf969cff74c954acd606c1fc0679
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428381
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-05-13 14:25:36 -07:00
Ryan Macnak c0e2f38f02 [dart:io] Fix some code to be safe in the face of reflective invocation.
Reflection can invoke public members of dart:* private types when values of the private types can be returned from public members.

TEST=lib/mirrors/invocation_fuzz_test
CoreLibraryReviewExempt: does not change public API
Bug: https://github.com/dart-lang/sdk/issues/31838
Bug: https://github.com/dart-lang/sdk/issues/46435
Bug: https://github.com/dart-lang/sdk/issues/51213
Change-Id: I969cd935d60455bd9cf4775b8df19838f9e6107c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428065
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-05-13 10:39:23 -07:00
Srujan Gaddam 8f3dd793a8 Update Chrome to v137
Also filters two WebGL-related tests. Starting with
Chrome 137, WebGL is unsupported for devices without a
GPU and therefore, the try bots start failing on these
tests.

https://chromestatus.com/feature/5166674414927872

Change-Id: Ic5eaf972188aae0f44de4273c2f42f3d2337bfa2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428062
Reviewed-by: Nate Biggs <natebiggs@google.com>
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2025-05-12 21:59:07 -07:00
Robert Nystrom d6ef495a9a Format tests/lib/mirrors using 3.8 style.
Change-Id: I9f922f8a4106f993c63b55ebbe3c54ea999cbbd4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426287
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2025-05-05 02:31:55 -07:00
Robert Nystrom 36117c443c Format tests/lib/typed_data/ using 3.8 style.
Change-Id: I85d53883d8f976246cae6f3caece157f906cf829
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426320
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2025-05-05 02:24:20 -07:00
Robert Nystrom 8717ff636a Format tests/lib/math/ using 3.8 style.
Change-Id: Ib34bac4962df8927cf2952a4cc5e388c84dcea79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425984
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2025-05-05 02:23:50 -07:00
Robert Nystrom d3904f5a54 Reformat tests/lib/async/** using 3.8 style.
Change-Id: I6ccbe1494165c2bda142ece13584c4738e3b43e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425347
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2025-05-02 04:08:54 -07:00
Robert Nystrom 8a51cb6093 Reformat tests/lib/isolate/** using 3.8 style.
Change-Id: I8fafc8c2788faf848a8a8488b76cb163b7679308
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425330
Commit-Queue: Lasse Nielsen <lrn@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2025-05-02 04:01:24 -07:00
Robert Nystrom bf13a576fd Reformat tests/lib/collection, /convert, and /developer using 3.8 style.
Change-Id: I550bb08a2c933799cbaa9586c85869bfc56ce1b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425328
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2025-05-02 03:57:54 -07:00
Robert Nystrom 2f2bdc3c22 Reformat tests/lib/js and /js_interop_unsafe using 3.8 style.
Change-Id: I182e28a3c4b44dd899e5ea30ac5c5c3ba60fd6cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425333
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2025-04-29 21:21:29 -07:00
Robert Nystrom 4cc31f8f4f Reformat tests/lib/html using 3.8 formatting style.
There are no behavioral changes here, I just ran `dart format` on the
`tests/lib/html/` directory.

Change-Id: I221b2a370adc393e49621db1d37aa6eeb09b3015
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425329
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2025-04-29 19:23:05 -07:00
Stephen Adams 2cc7d381a5 [rti/js_interop] Accelerate is JSObject
Change-Id: I36501521db9922068f8e5246e9edb0e63b561d0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/422200
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2025-04-26 21:57:20 -07:00
Nicholas Shahan 183f8b2f51 [tests] Fix typing information in package:js tests
Makes this test consistent with the others in the "family"
which all use `String` as the return type.

Change-Id: Id50de839094f766f29170d4b42e922635e12683a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423561
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2025-04-21 17:25:11 -07:00
Srujan Gaddam af7f6393e6 Change void_return_test to not use eval
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>
2025-04-09 01:29:40 -07:00
Ömer Ağacan b372b54ecb Reland "[dart2wasm] Don't dartify JS values when returning as void"
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>
2025-04-08 09:29:33 -07:00
Johnni Winther 0dde212150 [cfe] Add LookupResult
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>
2025-04-08 03:49:31 -07:00
Mayank Patke cc0527decb Remove babel from DEPS and (dart2js) IE support from test infra.
Tested: N/A
Change-Id: Ib1804b49c40cac9be52e732090e8160444ebb48d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417948
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2025-03-28 11:26:47 -07:00
Lasse R.H. Nielsen 13df9529fd Add documentation, tests and better parameter names to Float32x4.
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>
2025-03-14 06:22:42 -07:00
Martin Kustermann d3027d5ba4 [gardening] Make new test work also in obfuscation modified
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>
2025-03-05 02:46:58 -08:00
Mylo Fawcett aeb2581f30 [vm] Use toString when generating stacktrace in isolate error handler
Closes https://github.com/dart-lang/sdk/issues/50438

TEST=tests/lib/isolate/handle_error_stacktrace_test, tests/lib/isolate/handle_exiting_to_string_error_test, tests/lib/isolate/handle_throwing_to_string_error_test

Change-Id: I098153ecd65360aa724e25fc52e25368ca27ffe7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277341
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2025-03-04 14:10:46 -08:00
Martin Kustermann 20fc102287 [dart2wasm] Switch to only using JS strings
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>
2025-02-27 00:33:34 -08:00
Ryan Macnak 5c6f92fe47 [test] Unskip many tests in reload stress testing.
Change-Id: I9ef008b00bb043b210d18659a49ee07fde081f67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409202
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2025-02-11 12:49:41 -08:00
Lasse R.H. Nielsen 0dfbab89cb Make tests/lib/js/static_interop not use minitest.
Change-Id: Id7a8a6ac0098df55b04fa089587c62b07e9cf3c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403860
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2025-02-04 01:44:02 -08:00
Alexander Markov aa34e70d50 Revert "Make Zone functions not call register*, but properly catch errors."
This reverts commit fc2c46ae82.

Reason for revert: broke Flutter tests:
https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8724303399273084113/+/u/Run_framework_coverage_tests/stdout
https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8724303399273084097/+/u/Run_framework_tests_libraries_tests/stdout
https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8724303399273084081/+/u/Run_framework_tests_misc_tests/stdout
https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8724303399273084049/+/u/Run_framework_tests_widgets_tests/stdout
https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8724303399273084033/+/u/Run_tool_tests_tests/stdout

Original change's description:
> Make Zone functions not call `register*`, but properly catch errors.
>
> 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>

Bug: https://dartbug.com/59913
Change-Id: I386b2b6d2594a50a7597363e13fe24111ea72ade
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406685
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2025-01-30 09:48:40 -08:00
Lasse R.H. Nielsen fc2c46ae82 Make Zone functions not call register*, but properly catch errors.
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>
2025-01-30 06:58:51 -08:00
Mohamed Abdelaal 9b7bb9df90 Fix "the the" typo
Closes https://github.com/dart-lang/sdk/pull/59926

GitOrigin-RevId: cb37bca473b0c177b876a0f4e75858cd1862e699
Change-Id: I6827241b22e99db455945afcdfbaee0450999ce9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404923
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2025-01-21 14:08:20 -08:00
Lasse R.H. Nielsen 722e4f2cca Update isolate tests.
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>
2025-01-15 05:49:03 -08:00
Alexander Markov 3a73f32824 [vm,mirrors] reflectClass: throw ArgumentError for function and record types
TEST=tests/lib/mirrors/reflect_class_test.dart
Fixes https://github.com/dart-lang/sdk/issues/59863

Change-Id: Ic9ab394da9abeb7f793556a4827a496c372576a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403620
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-01-08 09:25:09 -08:00
Tess Strickland 9b06e26620 Reland "[vm] Enforce that entry points must be annotated by default."
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>
2024-12-04 14:36:46 +00:00
Ömer Sinan Ağacan c6362da241 [dart2wasm] Convert UTF-8 chunks to U8List before decoding
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>
2024-11-21 12:59:47 +00:00
Robert Nystrom 246050a1ef Opt multitests out of formatting in corelib/ and lib/.
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>
2024-11-19 11:14:40 +00:00
Stephen Adams 23a98d808c [vm, wasm] Separate Iterables for _Map.{keys,values,entries}
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>
2024-11-19 03:06:10 +00:00
Stephen Adams 680749e655 Add test for #47852
Bug: #47852
Change-Id: If17635dfcf9794edc2cf23ad5219ed87fda41fcb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393182
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2024-11-07 00:40:28 +00:00
Devon Carew 3488fd58e9 [package:js] remove a test related to package:mockito
Change-Id: Ic060e250d5e6e481a37b23032da79d021496fec2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392465
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2024-10-29 20:50:55 +00:00
Alexander Markov 2b899adb4c Revert "[vm] Enforce that entry points must be annotated by default."
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>
2024-10-22 14:18:04 +00:00
Tess Strickland cb9ecbc363 [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>
2024-10-22 09:34:22 +00:00
Srujan Gaddam e661776f80 [pkg:js] Add tests for allowInterop idempotency
Closes https://github.com/dart-lang/sdk/issues/56897

Adds a few missing tests to make sure we handle already
converted functions, Dart functions that were wrapped
by a previous call, and JS functions correctly in
allowInterop and allowInteropCaptureThis.

Change-Id: Iaa6f34652717787fad8141ad941c47e944e70a5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390400
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-10-16 18:18:23 +00:00
Lasse R.H. Nielsen 6f1b279922 Fix issue 56806, incorrect ignore on futures.
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>
2024-10-15 13:40:52 +00:00
Lasse R.H. Nielsen f8086c81ae Collect all test-related files in package:expect.
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>
2024-10-11 16:53:52 +00:00
Parker Lougheed c73677e606 [tests] Minor spelling and grammar fixes
Change-Id: I18c309b9037cf94a883443ac9067f911f829516c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388945
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2024-10-09 08:38:48 +00:00
Srujan Gaddam dc3b6af33d Add location rename to locationString in test
The SecurityError was being hidden because of
https://github.com/dart-lang/sdk/issues/56772.
With this, single-stepping through the test succeeds.

Change-Id: I47a768e803598d5f918a4d2bed9aa4391377464f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386401
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2024-09-23 22:38:57 +00:00
Srujan Gaddam 591b774213 Add tests for cross-origin window and location
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>
2024-09-12 21:30:00 +00:00
Lasse R.H. Nielsen 7e75d881a0 Tweak test_runner.
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>
2024-09-10 15:29:28 +00:00
Ryan Macnak 214b83c1e4 [vm] Work around C compiler bug with simulation of ARM64 vsub.
TEST=ci, dartfuzz
Bug: https://github.com/dart-lang/sdk/issues/55879
Change-Id: Iadf71b315de3462af6b739c8b49865469368b647
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384443
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-09-10 01:11:15 +00:00
Martin Kustermann 0e620b27a0 [dart2wasm] Align test outcomes of dart2wasm across configurations
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>
2024-09-05 11:22:18 +00:00
Rutvik Tak 1fb6869585 Adds a static from method on JSArray which helps a create a JSArray from a given JS iterable or array-like object. (Resolves #56069)
R=brianwilkerson@google.com, nshahan@google.com

Change-Id: I4b913107f5789f48af521b90052052d87453951d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382080
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Auto-Submit: Rutvik Tak <takrutvik@gmail.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2024-09-04 23:27:18 +00:00
Srujan Gaddam e9a72b80c1 [dart:js_interop] Clear up wording about isA requiring non-generic type argument
Closes https://github.com/dart-lang/sdk/issues/56564

CoreLibraryReviewExempt: Doc-only change.
Change-Id: I0086a0778d53d850c8d746e0474d22382d5e451c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381942
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2024-09-03 16:03:57 +00:00
Lasse R.H. Nielsen 310d91aee8 Make async error injection set stack trace on errors.
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>
2024-08-27 12:51:26 +00:00
Sigmund Cherem e8a049fd8e [dart2wasm] Make dart.library.js false in conditional imports (attempt 2)
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>
2024-08-16 16:22:50 +00:00
Nate Biggs 2f97501551 [js_interop] Fix JsInteropChecks not recursing into constructor's AST children.
The JS interop transformer assumes the entire AST has been checked and ends up trying to cast to FunctionType. If there is malformed, unvisited interop code this results opaque failure (failed type cast) rather than the useful error message from the check.

Bug: https://github.com/dart-lang/sdk/issues/56443
Change-Id: I5b911d0da7a839e3045dce61121496d464b79af9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380381
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2024-08-15 01:47:34 +00:00