Commit Graph

23988 Commits

Author SHA1 Message Date
Slava Egorov 7b5bd07e87 [vm/io] Fix pausing read on SecureSocket
Pausing read on the SecureSocket should pause read on the underlying
socket, because otherwise we will be stuck calling _readHandler
which will not read anything but still schedule an SSL filter
wasting CPU time.

Fixes https://github.com/dart-lang/sdk/issues/62037

CoreLibraryReviewExempt: No API changes, VM specific implementation change
Change-Id: I4144815d34c1e77a68533b6ebcb66c146a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467804
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-01-07 03:41:35 -08:00
Ömer Ağacan c552af0a9e [dart2wasm] Minor refactoring and comments in variable declaration compiler
Refactoring:

- Update the checks when updating a local for a captured variable to
  check whether `local` is null, instead of whether it's not updated.

  If the `local` is available then we know that it's not updated. It's
  more direct to check whether we've created a local for the variable or
  not.

- Add an assertion checking the the capture field and local for a
  variable can only differ in nullability.

Documentation:

- Document that context field for a captured local will always be
  nullable, to be able to allocate the context without dummy values.

- Document in a few places that `!capture.written` means the variable is
  captured but not updated, so they can be held in a local (instead of
  getting them from the context on every read).

Change-Id: I66048cb36f75e35ee3c479c41f2bbfca247a990f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/470981
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2026-01-07 03:38:06 -08:00
Nate Biggs 600f8a9601 [dart2wasm] Use default value sentinel when member body unreachable
This issue was partially fixed by:
https://dart-review.googlesource.com/c/sdk/+/428541

However, this only looked at the case of a member in an abstract class
that itself was made abstract if it was unused. TFA does not make the
member abstract if the enclosing class is not abstract:
pkg/vm/lib/transformations/type_flow/transformer.dart#L2289

Instead we can use the unreachable metadata to identify these
unreachable body members (that have default values cleared):
pkg/vm/lib/transformations/type_flow/transformer.dart#L736

Attached test fails prior to this fix.

Bug: https://github.com/dart-lang/sdk/issues/62273
Change-Id: I1ccb818ec41bbe805ee828be0b96ba23e73beae4
Tested: Introduced unit test.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/469280
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2026-01-06 21:24:51 -08:00
Konstantin Shcheglov 8109b8ec52 DeCo. Fix typos in language/primary_constructors/type_inference/optional_parameter_test
Change-Id: If315f8f45c44ae8f9d96cd014601733ecc6ec133
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/470802
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-01-05 13:49:06 -08:00
Ryan Macnak cee7000c1a [test] Enable TSAN thread leak detection for most tests.
Disable for tests that use dart:io's exit.

Add missing thread joins to cc tests.

TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/41811
Change-Id: Id4e1a468a986c886fb5ae9e9677b4d8d0281cc79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468880
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-01-05 10:04:25 -08:00
Daco Harkes b277407152 [ffi][cfe] Support @Native() external Array<Struct> fields
For structs, we were already loading the size of the struct at
runtime for the size of the memcopy. This CL makes that work for
the `Array`s as well.

TEST=pkg/vm/testcases/transformations/ffi/regress_62087.dart
TEST=tests/ffi/native_assets/asset_absolute_test.dart

Closes: https://github.com/dart-lang/sdk/issues/62087
Change-Id: I15a5796d713879a613971e080d18101111704b9b
Cq-Include-Trybots: dart/try:vm-aot-linux-debug-arm64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-debug-arm64-try,vm-aot-mac-debug-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-x64c-try,vm-asan-linux-release-arm64-try,vm-asan-linux-release-x64-try,vm-asan-mac-release-arm64-try,vm-asan-win-release-x64-try,vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try,vm-ffi-dyn-mac-debug-simarm64_arm64-try,vm-msan-linux-release-arm64-try,vm-msan-linux-release-x64-try,vm-tsan-linux-release-arm64-try,vm-tsan-linux-release-x64-try,vm-tsan-mac-release-arm64-try,vm-ubsan-linux-release-arm64-try,vm-ubsan-linux-release-x64-try,vm-ubsan-mac-release-arm64-try,vm-ubsan-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464706
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
2026-01-05 08:01:26 -08:00
Ömer Ağacan 02a3163219 [dart2wasm] Catch JS exceptions with the right tag, improve toString and stack traces
Example:

    import 'dart:js_interop';

    @JS()
    external void eval(String code);

    @JS()
    external void throwFunction();

    void main() {
      eval('''
        self.throwFunction = function() {
          throw new Error('Hi from JS');
        }
      ''');
      try {
        throwFunction();
      } catch (e, st) {
        print(e);
        print(st);
      }
    }

Output before: ("..." parts are code locations, omitted)

    JavaScriptError
        at module0.main ...
        at module0._invokeMain ...
        at InstantiatedApp.invokeMain ...
        at main ...
        at async action ...
        at async eventLoop ...

Output after:

    Error: Hi from JS
        at self.throwFunction ...
        at _277 ...
        at module0.main ...
        at module0._invokeMain ...
        at InstantiatedApp.invokeMain ...
        at main ...
        at async action ...
        at async eventLoop ...

Fixes #62218.

Issue: https://github.com/dart-lang/sdk/issues/62218
Change-Id: Ia9347e938af209b8b87752479d35b6236f721acf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/469062
Reviewed-by: Martin Kustermann <kustermann@google.com>
2026-01-02 02:27:58 -08:00
Natalie Weizenbaum 9947e20c36 Add additional definitions to JSSymbol
Closes https://github.com/dart-lang/sdk/pull/61917

GitOrigin-RevId: 16c03048f0108a22a36713513ea646cf43d89e87
Change-Id: Ia2f7d79d3e1048da7684da2a55eda0266c57489f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/460141
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2025-12-22 09:50:26 -08:00
Alexander Aprelev a949c74530 [vm/shared] Ensure stores into shared static variables are checked.
Closures going into shared variables in particular have to be confirmed to capture appropriate values.

BUG=https://github.com/dart-lang/sdk/issues/62179
TEST=run_isolate_group_run_test

Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try,vm-aot-dyn-linux-debug-x64-try
Change-Id: I27416773fd77077018739ea4dbcc6e4695e67be8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/469103
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2025-12-22 07:53:44 -08:00
Ben Konyi 364b36691c Reland "[ DDC / CFE ] Add support for allowing imports of unsupported libraries"
This reverts commit c616db31d2.

Reason for revert: Fix landed downstream in Flutter engine: https://github.com/flutter/flutter/pull/180127

Original change's description:
> Revert "[ DDC / CFE ] Add support for allowing imports of unsupported libraries"
>
> This reverts commit b5e60be49d.
>
> Reason for revert: broke Flutter web engine tests
>
> Original change's description:
> > [ DDC / CFE ] Add support for allowing imports of unsupported libraries
> >
> > This change adds support for allowing for imports of unsupported
> > platform-specific libraries when the
> > `--include-unsupported-platform-library-stubs` flag is provided to the
> > CFE.
> >
> > This flag sets the `includeUnsupportedPlatformLibraryStubs` property in
> > `TargetFlags`, which `Target`s can use to conditionally return different
> > `DartLibrarySupport` objects with different supported/unsupported
> > library sets.
> >
> > A `checkForUnsupportedDartColonImports` function has been added to
> > `Target` that uses the value of `dartLibrarySupport` to determine if
> > there's any unsupported library imports. This function is called after
> > the various transformation operations provided by the `Target`
> > implementation, meaning the import of an unsupported library specified
> > in `dartLibrarySupport` will now result in a compilation error (this
> > includes `dart:mirrors` imports for VM targets when mirrors are
> > disabled, which was previously handled by the VM itself).
> >
> > Related to https://github.com/dart-lang/sdk/issues/62125
> >
> > TEST=Tests added / modified
> >
> > Change-Id: Ife819b2e1a6d28f67d80aab6701cd23a1724aa4d
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465760
> > Reviewed-by: Nicholas Shahan <nshahan@google.com>
> > Reviewed-by: Johnni Winther <johnniwinther@google.com>
> > Commit-Queue: Ben Konyi <bkonyi@google.com>
>
> Change-Id: I0b59f00e55a2424f783351abd977eb38409ce01f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/469100
> Reviewed-by: Nate Biggs <natebiggs@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>

Change-Id: I1ae2eac675432286aebabea3c1f58caf35a27fbb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/469240
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2025-12-19 12:53:22 -08:00
Konstantin Shcheglov 23a903e9ae DeCo. Build extension type primary constructors like regular ones.
Previously, the AST builder enforced strict constraints on extension
type primary constructors during parsing, often discarding or
transforming invalid parameters (e.g., multiple, optional, or named
parameters) to force a valid representation field structure. This
limited recovery and resulted in inaccurate element models for invalid
code.

This change updates the AST builder to parse and build elements for the
primary constructor's formal parameters exactly as written. The
validation logic ensuring a single, positional representation field has
been moved to `ErrorVerifier`.

To maintain the invariant that an extension type has a representation, a
synthetic "recovery" representation field is now added to the element
model if the parsed parameters do not provide a valid one.

Bug: https://github.com/dart-lang/sdk/issues/61701
Change-Id: I37b7eaf2c085db6317b2c2b0bf35ff31423f9738
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465180
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-12-19 07:38:31 -08:00
Sergey G. Grekhov 823ffa0bee [co19] Roll co19 to 911100f1901c7e6de8ba5c8c290a0a3b7e33a997
2025-12-18 sgrekhov22@gmail.com dart-lang/co19#3182. Add more augmenting getters/setters tests (dart-lang/co19#3448)
2025-12-17 sgrekhov22@gmail.com dart-lang/co19#3182. Add more tests for augmenting external getters and setters (dart-lang/co19#3447)
2025-12-17 sgrekhov22@gmail.com dart-lang/co19#3182. Add more augmenting getters/setters tests (dart-lang/co19#3446)
2025-12-16 sgrekhov22@gmail.com dart-lang/co19#3182. Add more tests for augmenting getters (dart-lang/co19#3444)
2025-12-12 sgrekhov22@gmail.com dart-lang/co19#3182. Replace augmenting getter tests (dart-lang/co19#3443)

R=athom@google.com, eernst@google.com

Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try,dart2js-minified-linux-d8-try
Change-Id: I04af7a7a61611fc599d885be641a2aecd71fa9f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/469140
Reviewed-by: Erik Ernst <eernst@google.com>
Auto-Submit: Sergey Grekhov <sgrekhov22@gmail.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-12-19 03:53:01 -08:00
Alexander Markov c616db31d2 Revert "[ DDC / CFE ] Add support for allowing imports of unsupported libraries"
This reverts commit b5e60be49d.

Reason for revert: broke Flutter web engine tests

Original change's description:
> [ DDC / CFE ] Add support for allowing imports of unsupported libraries
>
> This change adds support for allowing for imports of unsupported
> platform-specific libraries when the
> `--include-unsupported-platform-library-stubs` flag is provided to the
> CFE.
>
> This flag sets the `includeUnsupportedPlatformLibraryStubs` property in
> `TargetFlags`, which `Target`s can use to conditionally return different
> `DartLibrarySupport` objects with different supported/unsupported
> library sets.
>
> A `checkForUnsupportedDartColonImports` function has been added to
> `Target` that uses the value of `dartLibrarySupport` to determine if
> there's any unsupported library imports. This function is called after
> the various transformation operations provided by the `Target`
> implementation, meaning the import of an unsupported library specified
> in `dartLibrarySupport` will now result in a compilation error (this
> includes `dart:mirrors` imports for VM targets when mirrors are
> disabled, which was previously handled by the VM itself).
>
> Related to https://github.com/dart-lang/sdk/issues/62125
>
> TEST=Tests added / modified
>
> Change-Id: Ife819b2e1a6d28f67d80aab6701cd23a1724aa4d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465760
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>

Change-Id: I0b59f00e55a2424f783351abd977eb38409ce01f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/469100
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2025-12-18 09:47:11 -08:00
Ben Konyi 4cbf367b94 [ dart2bytecode ] Skip more tests that depend on dart:mirrors
Change-Id: I3dadc31c7cb2ba351ec797d8a851d82bf5bab232
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468920
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
2025-12-17 11:54:43 -08:00
Ben Konyi b5e60be49d [ DDC / CFE ] Add support for allowing imports of unsupported libraries
This change adds support for allowing for imports of unsupported
platform-specific libraries when the
`--include-unsupported-platform-library-stubs` flag is provided to the
CFE.

This flag sets the `includeUnsupportedPlatformLibraryStubs` property in
`TargetFlags`, which `Target`s can use to conditionally return different
`DartLibrarySupport` objects with different supported/unsupported
library sets.

A `checkForUnsupportedDartColonImports` function has been added to
`Target` that uses the value of `dartLibrarySupport` to determine if
there's any unsupported library imports. This function is called after
the various transformation operations provided by the `Target`
implementation, meaning the import of an unsupported library specified
in `dartLibrarySupport` will now result in a compilation error (this
includes `dart:mirrors` imports for VM targets when mirrors are
disabled, which was previously handled by the VM itself).

Related to https://github.com/dart-lang/sdk/issues/62125

TEST=Tests added / modified

Change-Id: Ife819b2e1a6d28f67d80aab6701cd23a1724aa4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465760
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-12-17 09:30:38 -08:00
Martin Kustermann b0e18fa40b [dart2wasm] Fix bug in @pragma('wasm:static-dispatch') & remove corresponding dispatch table entries
There was a bug in `CallTarget.signature` which triggers if there's only
one entry that's statically dispatched against, which causes us to
inline the polymorphic dispatcher, which relies on this (previously
incorrect) signature.

The CL also changes the dispatch table building logic to not allocate
table entries for the statically dispatched regions (as they would
never be used).

Change-Id: Ic2d0c387e8863e89ef811e1892642fe81df9189a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468000
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-12-16 01:42:00 -08:00
Nate Biggs 774c454ffa [dart2js] Fix duplication of code after for..in loop containing a break.
`builder.current` at the time of creating the labelGraph is the block
after the body. So setting that as the end node of the subGraph was
including all the code after loop into the body of the labeled
statement.

Instead we use the `bodyBlock` as the end of the labelGraph as this is
the last block in the body of the loop. If no such body exists, we use
the `conditionEndBlock` which is the block right before the body (and
still includes the logic to exit the loop).

Also changes codegen to not emit a labelStatement if it has no body.
AFAICT we don't do DCE on flow blocks so codegen is the best time to
avoid emitting this code.

Bug: https://github.com/dart-lang/sdk/issues/62185
Change-Id: Ia80cc7d3b44782c6193a67e8adbbc66f00b8f133
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468060
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2025-12-15 08:55:50 -08:00
Martin Kustermann d38e30d65a [dart2wasm] Fix bug in JS typed data .sublist() implementations
Issue https://github.com/flutter/flutter/issues/179853

Change-Id: I97ce8d7177dfdd612714fafbc2a6b13555d9bba1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468300
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-12-15 06:46:18 -08:00
Slava Egorov 9bf1f2529a [vm/io] Fix crashes in Socket.setOption
Don't call native methods on a socket which is closed
or in process of being closed. On some OSes this will
crash the VM because underlying FD is actually a malloc
allocated handle object which will be destroyed by 
the event handler once it receives and processes close
request.

BUG=b/335437875
TEST=standalone/io/abrupt_close_test

Change-Id: I557d725a6cce020a6a1e3df0bd3e2c836a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467841
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2025-12-15 02:31:18 -08:00
Alexander Markov 9a049d5b2d [gardening] Mark ffi/function_structs_by_value_generated_args_native_test test as slow on simarm64_arm64
Fixes https://github.com/dart-lang/sdk/issues/62230

Change-Id: If4a30a2d115748e6cc3272d71063e62251dc6358
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467660
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-12-11 11:33:32 -08:00
Alexander Aprelev 2c715e92b6 [vm/sdk] Use FinalThreadLocal for Iterable toString.
This allows use of toString in isolategroup-bound callbacks.

BUG=https://github.com/dart-lang/sdk/issues/61030.
TEST=ci
CoreLibraryReviewExempt: effectively vm-only change
Change-Id: Iccdc218716cbbe2346aa85bb6134f4129debe057
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/451841
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2025-12-11 09:32:41 -08:00
Kallen Tu aae871a607 [analyzer] Dot shorthands: Remove error when a constructor conflicts with a non-static member.
Users are getting an extra error when a constructor and an instance method/getter have the same name.
In the implementation, we produce an error once we see that the retrieved dot shorthand element isn't static. Instead, we should be falling through to check for constructor elements of that name.

This CL makes the necessary changes.

Testing:
`element != null && element is InternalExecutableElement && element.isStatic` is tested by existing tests.

`element != null && element is InternalExecutableElement && !element.isStatic` is tested in the `test_conflict_instance_*` unit tests. This is the behavior with the bug.

`element != null && element is! InternalExecutableElement` should not
exist since the `_resolveElement only returns `ExecutableElement`s or
`null`. (There's definitely something we can refactor here, but I'll leave it for a future CL.)

If we can't find a static method/field of that name, we should be
checking if it's the name of a constructor for both of the above cases.

`element == null` occurs when we can't find any method/getter of a given
name. If there's a setter of the given name, this will be `true` as well. This is well tested by prior unit tests.

Fixes: https://github.com/dart-lang/sdk/issues/62045
Change-Id: Icc6b66a95cfc79312891453b6f277f1347e059bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467261
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-12-11 09:29:41 -08:00
Nate Biggs e8b8ecfd52 [dart2wasm] Fix signature selection for direct closure invocation.
Direct closure invocation on tearoffs was using the signature of the raw
member reference rather than the checked entry function. These don't
always have the same signature and therefore it was possible to generate
an invalid code by putting the incorrect # of parameters on the stack.

The added test fails prior to this fix when assertions are enabled.

Also include some small changes that helped with debugging this.

Change-Id: I8c50dca3999781213ea251c6ab97eb1eaf7d0c8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467500
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2025-12-11 00:32:20 -08:00
Alexander Aprelev f1a1f6a986 [vm/shared] Maintain visited set when assessing immutability in closures.
Fixes https://github.com/dart-lang/sdk/issues/62178
TEST=run_isolate_group_run_test

Change-Id: Ia722ef6417e5cf2506bbc70d55299ce1ec04d13f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/466842
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-12-10 09:19:04 -08:00
Alexander Aprelev 170df25b66 [vm/shared] Prohibit capturing of 'late final' variables by isolategroup-bound closures.
TEST=run_isolate_group_run_test
BUG=https://github.com/dart-lang/sdk/issues/62181

Change-Id: I50037ede337367020176262b98d2c2fd100b050a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/466820
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2025-12-10 08:29:57 -08:00
Mayank Patke 2cddb8eee6 [DEPS] Update Chrome
Also delete a test for a deprecated lib (dart:html) which is affected by
Chrome removing support for a JavaScript API. (See code review
comments.)

Change-Id: Ia8c974464c2fe0729ea72ae00e10b6f66a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/466460
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2025-12-09 12:58:53 -08:00
Kallen Tu 222947daa2 [tests] Primary constructors: Optional parameters, constructor body, extension type optional parameters.
Tests the following:
- Optional/named parameters for extension type primary constructors.
- We should still produce an error when there's a body on a const constructor.
- Inferring `Object?` as the representation type when the type isn't specified.
-  We can omit the type of an optional parameter with a default value,
in which case, the type is inferred from the default value.

Bug: https://github.com/dart-lang/sdk/issues/61687
Change-Id: Id10fb3f3a14cf683601f52b0b3182a10d0730927
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465801
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2025-12-09 12:31:06 -08:00
Alexander Aprelev f04ff0410e [vm/shared/bytecode] Support use of vm:shared in bytecode/interpreter.
Fixes https://github.com/dart-lang/sdk/issues/62032
TEST=ci

Change-Id: I80600d81ee73b16338a337f7139bf4e898af6eca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/466124
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2025-12-05 21:38:41 -08:00
Johnni Winther f631577638 [cfe][InternalNodes] Move argument checks to inference visitor
This moves checking of arguments on initializers to the inference visitor. This prepares for separating ArgumentsImpl from Arguments by ensuring that checking is always performed on ArgumentsImpl.

Change-Id: I41e96377d141034adecf03bc7d0f130eb260fb72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/466061
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2025-12-05 02:37:32 -08:00
Sergey G. Grekhov e0138f3963 [co19] Roll co19 to a4f8892316baf06ce23e404de6d6a526ef814cb5
2025-12-04 sgrekhov22@gmail.com dart-lang/co19#3182. Update `augmenting_functions_A02_*.dart` test (dart-lang/co19#3426)
2025-12-04 sgrekhov22@gmail.com dart-lang/co19#3182. Add more tests for augmenting functions (dart-lang/co19#3431)
2025-12-03 sgrekhov22@gmail.com dart-lang/co19#3182. Update `augmenting_functions_A05-07*` test (dart-lang/co19#3430)
2025-12-03 sgrekhov22@gmail.com dart-lang/co19#3182. Update `augmenting_functions_A04_*.dart` test (dart-lang/co19#3429)
2025-12-02 sgrekhov22@gmail.com dart-lang/co19#3182. Delete tests that checks `augmented()` expression (dart-lang/co19#3428)
2025-12-01 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 5.0.0 to 6.0.0 in the github-actions group (dart-lang/co19#3427)
2025-12-01 sgrekhov22@gmail.com dart-lang/co19#3182. Update `augmenting_functions_A01_*.dart` test (dart-lang/co19#3425)
2025-12-01 sgrekhov22@gmail.com dart-lang/co19#3182. Fix syntax errors in enums (dart-lang/co19#3424)
2025-11-28 sgrekhov22@gmail.com dart-lang/co19#3182. Update `augmenting_enum_values_*` test (dart-lang/co19#3423)
2025-11-28 sgrekhov22@gmail.com dart-lang/co19#3182. Update augmenting_constructors_A19-20* tests (dart-lang/co19#3418)
2025-11-28 sgrekhov22@gmail.com dart-lang/co19#3182. Add tests for constructors with initializing formals (dart-lang/co19#3421)
2025-11-28 sgrekhov22@gmail.com dart-lang/co19#3182. Rename some augmenting constructors tests (dart-lang/co19#3422)

R=athom@google.com, eernst@google.com

Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try,dart2js-minified-linux-d8-try
Change-Id: I3f3ea2184eb96b3a4beb5021e4a8b08ef1f7ad37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/466300
Auto-Submit: Sergey Grekhov <sgrekhov22@gmail.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-12-05 01:30:16 -08:00
Robert Nystrom 34a63b5a9d [private named parameters] Update static error test expectations.
This pins the expected errors down more precisely. It should also fix
the failure in initializing_formal_collision_error_test.dart where there
are two expected errors on the same line and using "unspecified"
confuses the test runner.

Change-Id: I44fe14295bb34ea2f836774d1dd24daae2524ebb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465989
Reviewed-by: Kallen Tu <kallentu@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2025-12-04 14:05:15 -08:00
Johnni Winther 65ce2c2473 [cfe] [InternalNodes] Remove InitializerJudgment
This replaces the use of ShadowInvalidInitializer and ShadowInvalidFieldInitializer with InvalidInitializer.

This is part of creating a clearer separation between the body builder and inference, creating internal syntactical nodes in the body builder and transforming these into the lowered nodes during inference.

Change-Id: I5d227fecb375efc124ec5cf2769e7b764dcb4c1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465880
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2025-12-04 00:55:31 -08:00
Robert Nystrom d11262d694 Add language tests for "Private Named Parameters".
Fix #61641.

Change-Id: Id523b0015074d5cb66f5d17b089bedb501e5bc46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453646
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2025-12-03 15:15:13 -08:00
Ryan Macnak 13507d2594 [test] Don't test the profiler in a test with a large number of threads.
TSAN's vector clocks become more expensive as the number of threads that touch a variable increases. The Mac/Windows/Fuchsia profilers will sample threads by suspending it and accessing it from another thread.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/61960
Change-Id: I2bfb7908af8ff864bc52577bacbb89a4778150d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465980
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-12-03 13:56:31 -08:00
Brian Quinlan c847a7bf43 test: Fix many_pending_secure_sockets_test timeouts.
Bug:https://github.com/dart-lang/sdk/issues/62064
Change-Id: Ie3aafd9549d7c26494faa7dddba85025e4b2cb69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465462
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-12-03 13:24:32 -08:00
Alexander Aprelev f2475606c6 [vm/shared/test] Add Encoding.getByName test when used in isolategroup-bound context.
Follow-up to https://dart-review.googlesource.com/c/sdk/+/461185/comment/323d39ca_c22b0862/

TEST=ci

Change-Id: Iea9c68c0761a63804e87d9d2f54f1571ff983cd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465962
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2025-12-03 11:32:00 -08:00
Alexander Aprelev 4bc746a1cb [sdk/vm] Make Encoding._nameToEncoding map const.
This allows use of Encoding class in isolategroup-bound callbacks.

TEST=run_isolate_group_run_test
BUG=https://github.com/dart-lang/sdk/issues/61541

Change-Id: Iaa545bc2df7ffd98e9fc09381826c566f4b833ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461185
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2025-12-02 05:51:22 -08:00
Kallen Tu 2110e90d68 Rename 'declaring-constructors' to 'primary-constructors' experiment flag.
Changed the flag to `primary-constructors` to align with the rest of
the feature's public naming.

Renamed tests and existing usages of the flag.

Bug: https://github.com/dart-lang/sdk/issues/61526
Change-Id: Id649447a50917ba5bcddb49661555889dc81ba14
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464761
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
2025-12-01 13:54:52 -08:00
Nate Biggs 43f234799e [dart2wasm] Fix JS callback wrappers invoked in deferred modules.
The generated callback wrappers were referring to exported functions via
'dartInstance.exports' which is always the main module. But in order to
avoid bloating the main module we put some of these JS exports into
submodules.

So the wrapper must be fetched from the correct module that defines the
wrapped function. In order to facilitate this we give each module a
self-reference that it can then pass up to the JS wrapper as an
externref.

Change-Id: Id2514de2c13d38a0cee1f6c935e45a9ef826f805
Fixes: https://github.com/dart-lang/sdk/issues/62094
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464820
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2025-12-01 12:12:48 -08:00
Alexander Aprelev c7fc60c78b [sdk/vm] Use FinalThreadLocal to store _Random singleton object.
This allows use of Random in isolategroup-bound callbacks.

BUG=https://github.com/dart-lang/sdk/issues/61541
TEST=run_isolate_group_run_test

Change-Id: Id847e900be05f2866386c025b1796b3f34c1e8df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461940
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2025-12-01 11:37:01 -08:00
Alexander Aprelev d793fc0ed5 [sdk/vm] Make Base64._inverseAlphabet shared.
This is so that Base64 decoding is available for isolategroup-bound callbacks.

TEST=run_isolate_group_run_test
BUG=https://github.com/dart-lang/sdk/issues/61541
CoreLibraryReviewExempt: vm-only pragma
Change-Id: I30b8f0c36b0f980a1f5a13cec3cb07e214324ce0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461180
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2025-12-01 10:20:11 -08:00
Martin Kustermann c942b23b07 [dart2wasm] Fix access of constants under deferred load guard
When accessing a constant under a load guard we can push the constant to
the deferred module (as we only access it under the guard that the
module has been loaded). The access has to therefore also use the
constant initializer function from the deferred module.

We also remove `--extra-compiler-option` prefix for
`--enable-deferred-loading` as the prefix isn't recognized by
dartdev.

Change-Id: I58489303dc10bb265ef730c05a4fc78a8f598edb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464980
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-11-28 03:23:01 -08:00
Martin Kustermann ba35b8c59c [dart2wasm] Fix pkg/dart2wasm/tool/compile_benchmark script
The script was incorrectly handling source maps when deferred
loading is enabled and we emit & optimize multiple wasm modules
(the source maps very completely bogus)

Change-Id: Ib65b72a4d2a3c8958bbe80e94c76145b6e1a0e5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464480
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2025-11-26 01:49:53 -08:00
Martin Kustermann 407afe84ca [dart2wasm] Remove dynamic closure call vtable entry in most cases
This reduces acx main: module -0.35%,  global section: -2.3%

Previous change in [0] made dynamic call sites have per-caller-shape
dynamic forwarders.

In this change we utilize this: Since we know the dynamic caller shape
we can make the dynamic forwarder call via a closure representation that
matches this caller shape (modulo the type arguments - as a dynamic call
without type arguments may get default type arguments of unknown count).

=> This means we no longer have to pass types, positionals and named
   arguments as wasm arrays to dynamic call forwarder. Instead we can
   pass the arguments unpacked to the vtable.

Additionally we change `Function.apply`: If we know there's no
`Function.apply` usage with named arguments, we can enumerate all
possible closure representations and call the corresponding vtable
entry. We use 2 `br_table` instructions for this:

  * branch on number of type parameters
  * branch on number of positional parameters

Together these two changes means that neither dynamic forwarders nor
`Function.apply` will use the dynamic call entry.

=> We remove the dynamic call entry from the vtable construction

The only exception to the above are:

* If dynamic submodules is enabled we don't compute closed world
  information about closures and always call via dynamic call entry

* If `Function.apply` is used with named arguments then call via dynamic
  call entry (and make vtables have it).

[0] https://dart-review.googlesource.com/c/sdk/+/461720


Issue https://github.com/dart-lang/sdk/issues/60458

Change-Id: I26e6a2a48ee37616061d701dc4d4327c2e109e82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/462060
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-11-26 01:02:31 -08:00
Kallen Tu a56cd8c261 [tests] Primary constructors: Remove in-body constructor test, and remove non-errors.
Updating some primary constructor tests based on Konstantin's comments
in https://github.com/dart-lang/sdk/issues/61687#issuecomment-3568650165.

Bug: https://github.com/dart-lang/sdk/issues/61687
Change-Id: I758a39fc5c71db5d5646e606419b09c6afeef343
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464321
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2025-11-25 10:34:00 -08:00
Christophe Coevoet b6e5ae4b45 Add tests covering more cases for Uri.resolve
Closes https://github.com/dart-lang/sdk/pull/62073

GitOrigin-RevId: 3a50ef21cf15e7b0e0a2ef87c389da619bfecdc8
Change-Id: I75399055709a3b8260e67214b2017b76795e741e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464040
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2025-11-25 09:10:13 -08:00
Daco Harkes e3882c8a77 [ffi] Address lints in tests
Change-Id: I30b4aa4a6195bac96ebe3f3f8e9c07acdec9b2d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464481
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
2025-11-25 08:03:02 -08:00
Daco Harkes ef30b3cc99 [vm/ffi] Test and Document NativeFinalizer Dart API limitations
Explicitly allow calling `Dart_DeletePersistentHandle` and
`Dart_DeleteWeakPersistentHandle` from `NativeFinalizers`.

And exercise this behavior in tests.

TEST=tests/ffi/vmspecific_native_finalizer_api_calls_test.dart
TEST=tests/ffi/vmspecific_native_finalizer_isolates_test.dart

Closes: https://github.com/dart-lang/sdk/issues/62076
CoreLibraryReviewExempt: VM-only. Doc-only.
Change-Id: I4915092e4b13cc55d0d48e7977149fb32059b854
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64-try,vm-dyn-linux-debug-x64-try,vm-linux-debug-x64-try,vm-ubsan-linux-release-x64-try,vm-tsan-linux-release-x64-try,vm-msan-linux-release-x64-try,vm-asan-linux-release-x64-try,vm-ffi-mac-debug-simarm64_arm64-try,vm-win-debug-x64-try,vm-reload-linux-debug-x64-try,vm-gcc-linux-x64-try,vm-appjit-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-dyn-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464180
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2025-11-25 02:50:47 -08:00
Konstantin Shcheglov ac68dc3969 DeCo. Remove variant with const constructor and block body from language/declaring_constructors/short_syntax/new_test.dart
Const constructors cannot have bodies.

Bug: https://github.com/dart-lang/sdk/issues/61687
Change-Id: I93ecc14c00069ab51341f8f51b70f5a58c54aefa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464121
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-11-24 15:44:23 -08:00
Konstantin Shcheglov a40558b760 DeCo. Remove stray 'const' around enums in language/declaring_constructors/syntax/header_syntax_test.dart
Bug: https://github.com/dart-lang/sdk/issues/61701
Change-Id: If93cfe308aa401ba9b1af66d6a034cf5ff57c7a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464120
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-11-24 15:27:58 -08:00