Commit graph

11160 commits

Author SHA1 Message Date
Aske Simon Christensen d1d232776a [dart2wasm] Rename the dart:wasm library to dart:_wasm.
This is an internal library not meant to be used in application code.

CoreLibraryReviewExempt: Changes only Wasm specific libraries.
Change-Id: I2f5b463382d35a442e782067ef7d9063183fe5e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292021
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-04-04 11:52:18 +00:00
Lasse R.H. Nielsen 2f7213342b Add record-related wait extensions on Future tuples.
With the addition of records, it now makes sense to create an API
for parallelizing of futures of different types, like `Future.wait`
does for collections of same-typed futures.

The `wait` getters here apply to tuples of 2-9 futures of distinct types, which should be enough for most reasonable uses.

Planned addition for Dart 3.0.



CoreLibraryReviewExempt: Everybody's on vacation, everybody everywhere.
Change-Id: Iaa814e02e2274082bb8a29b9a18b4930bcc953bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288903
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2023-04-04 11:39:49 +00:00
Lasse R.H. Nielsen 67797ef46f Add more class modifiers to dart:collection.
Pure interfaces made `interface`s
implementation classes which cannot/should not be extended made `final`.

A class like `HasHMap` which provides the `Map` interface,
and no implementation except factory constructors
for internal implementations, is made `final`.

Unified {List,Set,Map}{Base,Mixin} into their `Base` class.
Deprecations are retained in comments for now, to be landed
separately. Search for '// TODO: @Deprecated'.

Tested: No new test, only adding restrictions on use.
CoreLibraryReviewExempt: Everybody's on vacation, everybody everywhere.
Change-Id: Ia83b8a3bb20b5b214546b328d4492de6658253db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288240
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2023-04-04 10:39:48 +00:00
Devon Carew 93f7e368f7 [SDK docs] update the SDK's API doc readme file
Closes https://github.com/dart-lang/sdk/pull/51934

GitOrigin-RevId: 7b1fa57387341cdd3a50592cda0cfe5df1608259
Change-Id: Ib5abf6faef205e02b7a1d42fd6cc11ec4488040b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/293001
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2023-04-04 00:25:44 +00:00
Brian Quinlan 6f1d0e5afa Explain that Complete.future must be handled if it is an error.
Change-Id: I31d2e97d7df875607e30023f20c649680d9feaba
CoreLibraryReviewExempt: documentation-only change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292286
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-04-03 23:55:02 +00:00
Brian Quinlan 17ea08c10c Document that IPv4 are preferred in socket.connect.
Bug: https://github.com/dart-lang/sdk/issues/50868
Change-Id: I8186d95d1a24c77c4cfade533af26695c7a13b24
CoreLibraryReviewExempt: documentation-only change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/293020
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-04-03 23:48:13 +00:00
Brian Quinlan 592c486b58 [doc/io] Clarify why not to modify data after IOSink.add
Bug:https://github.com/dart-lang/sdk/issues/31710
Change-Id: Ibd5903aa6c2ed268729ee860973195113596ca6e
CoreLibraryReviewExempt: documentation-only change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279263
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-04-03 19:15:51 +00:00
Srujan Gaddam e95b84ed41 [dart2js] Fix native null assertions for Dart 3
Allows the following semantics:
- If the disable flag is passed, never check
- If we're in non-sound mode, never check to avoid a breaking
change (this was the behavior before)
- If the enable flag was passed and we're in sound mode,
always check
- If we're in sound mode and with >= -03, don't check

Discussion in https://github.com/dart-lang/sdk/issues/50710

Change-Id: If83aaebb2745e4c8bcaa3f5a38ff41d79a869b8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289451
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-04-03 18:05:28 +00:00
Brian Quinlan 69bddeeca1 Make FileSystemEvent and its subclasses final with public constructors.
Bug: https://github.com/dart-lang/sdk/issues/51912
Change-Id: I05f7884e619e3014339f7642c1eeacc8b617155a
Tested: existing unit tests
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292220
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2023-04-03 17:03:16 +00:00
Lasse R.H. Nielsen 51cbaed621 Reland "Fix bug in Completer.complete."
This is a reland of commit 3688a4723c

Original change's description:
> Fix bug in Completer.complete.
>
> When given a completed `_Future`, it would complete its own future synchronously.
>
> Fixes #48493.
>
> Bug: https://github.com/dart-lang/sdk/issues/48493
> Change-Id: Ic4a68389b5a009ef52b3875bf03a3bafb493f79a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234981
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>

CoreLibraryReviewExempt: Bugfix.
Bug: https://github.com/dart-lang/sdk/issues/48493
Change-Id: If3a240b5b6eb016e8abe9a2c7551bfcaeea0da4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278920
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2023-04-03 14:22:26 +00:00
Martin Kustermann e1c2192110 [vm] Make writeHeapSnapshotToFile() API public in dart:developer
This API can be used by app developers that want to diagnose high
memory consumption by dumping state of Dart VM heap at specific
points in their apps code and later analyzing those dumps offline
(e.g. using the tool in `<sdk>/runtime/tools/heapsnapshot`).

TEST=Existing test suite.

Change-Id: I04de6ba564f7b9eaf8b59d41fc4b3ec35ce8d2e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279972
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Jacob Richman <jacobr@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-04-03 12:25:55 +00:00
Lasse R.H. Nielsen f0e099ec5b Add DateTime.timestamp() constructor for "now as UTC".
Change-Id: I497f335b1f1eb0f691c2d44557c50f0f55358426
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292003
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Auto-Submit: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-03-31 20:52:31 +00:00
Srujan Gaddam 8ebed3d806 [dart:html] Add webkitSpeechRecognition to SpeechRecognition class
In Safari, the prototype of a SpeechRecognition object returns a
webkitSpeechRecognition prototype. This name is different than the
one in the @Native annotation, so dart2js fails to recognize it. We
should it to the annotation so we properly intercept it.

CoreLibraryReviewExempt: Changing bindings of dart:html, no change to API.
Change-Id: Ic533e1208dd28e521403998e43009e0f651e2dfa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291961
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-03-31 17:32:54 +00:00
Daco Harkes 3de5d25429 [vm] Class modifiers for NativeFieldWrapper subtypes
Split off https://dart-review.googlesource.com/c/sdk/+/291761.
Landing separately, so that the breaking change itself is a smaller
CL.

TEST=ci build (see touched _test files)

bug: https://github.com/dart-lang/sdk/issues/51896
Change-Id: Ic8d218845ccb6a277689e911b2c34c44639e13cf
Cq-Include-Trybots: luci.dart.try:flutter-linux-try,vm-aot-linux-debug-x64c-try,vm-ffi-android-debug-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292000
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-03-31 13:20:19 +00:00
Aske Simon Christensen 85dfcd8601 [dart2wasm] Compute instance method parameter types from Wasm types.
This improves the precision of the Wasm types for Dart function types
in instance method signatures.

It could in principle also improve the precision of the receiver
parameter from the LUB of the representation types to the LUB of the
actual structs for the classes implementing the member. However,
if at a call site the receiver parameter type is more precise than the
representation type of the receiver, the call site will need to cast
the receiver to the more precise type. This gives rise to more casts
in practice than the ones saved inside the methods by the more precise
receiver parameter type. For this reason, the receiver parameter type
is kept at the LUB of the representation types of the classes
implementing the member.

This change is also a stepping stone towards not having `ClassInfo`
for the special Wasm types.

CoreLibraryReviewExempt: Only affects Wasm-specific libraries.
Change-Id: I81ca5aa1107f1c04ed7729a758e983698492a106
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288400
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-03-31 07:25:08 +00:00
Stephen Adams 482b4e485c [js_runtime] Use marker interface to signal trusted .runtimeType overrides
Use the `TrustedGetRuntimeType` interface to mark implementation
classes that have a `get runtimeType` that should be used for
reporting the types of instances in errors and `Record.runtimeType`.

Streamline the various more general `get runtimeType` implementations
by specializing them to the context. By explictly implementing
`Closure.runtimeType` we avoid the need to test for closures in the
'ordinary' object path. This should help the Flutter pattern of
testing `a.runtimeType == b.runtimeType`.

Change-Id: Ib49a6d89ff23e752beed8753aafceff40457433d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291741
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-03-31 04:05:08 +00:00
Mayank Patke 10912d6c84 [dart2js] Add Rti specializer for is FutureOr<T>.
In particular, this fixes some type tests involving records.
`(1, true) as FutureOr<(int, bool)>` was failing because the Rti for the
record literal was _Record_2 rather than +(int, bool). We want to avoid
constructing the full record Rti, so instead we can have the specializer
for FutureOr directly delegate to its union components.

Fixes: #51910
Change-Id: I3716882aab0a519ab35803d87fabe570b7e27655
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292242
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2023-03-31 02:14:46 +00:00
Joshua Litt 4cd53dbb2e [js_util] Fix patch file inconsistency
Change-Id: I183c163084f53d8d8853bdb3aeccbc9e4f028193
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292122
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-03-30 23:25:56 +00:00
Lasse R.H. Nielsen 9e76983782 Reland "Add more interface and final modifiers to dart:core."
This is another reland of 4f8333e80e.
Third time is the charm.

CoreLibraryReviewExempt: Reland of accepted CL.
Change-Id: I4ea8326af91c168b044d252162571d3fe697e4b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289826
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-03-30 20:34:09 +00:00
Aske Simon Christensen eca8a9a3ee [dart2wasm] Support commandline arguments to Wasm program
Change-Id: Id44fe9b2faf52071c18c81e9be53a4c04eae1735
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291086
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-03-30 16:20:27 +00:00
Lasse R.H. Nielsen d274ef0a4a Fix bug in Duration.toString.
On the web, some inputs to `Duration` would make -0.0
occur in positions where the code assumed an integer
with a reasonable `toString`.

Adds `+ 0` and using `0 - x` instead of `-x` to
avoid ever ending up with a `-0.0`.

Fixes #51584

CoreLibraryReviewExempt: Bugfix, no API changes.
Change-Id: Idecfaf049f2ae5677792387ce24e95add99596cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291280
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2023-03-30 14:02:38 +00:00
Lasse R.H. Nielsen f6ac970290 Reland "Add class modifiers to dart:convert." again.
This is a reland of commit 608934e330

Can be landed when Flutter with https://github.com/flutter/flutter/pull/123211
has been rolled into internal repository.



Original change's description:
> Reland "Add class modifiers to `dart:convert`."
>
> This is a reland of commit b2f4cf3e01
>
> Commented out deprecation for now.
>
> Original change's description:
> > Add class modifiers to `dart:convert`.
> >
> > The usual approach:
> > Pure interfaces marked `interface`.
> > Pure implementation classes marked `final`.
> > Base classes marked `base` or nothing, and `mixin class` if reasonable.
> > Combined X/XBase/XMixin where possible.
> >
> > CoreLibraryReviewExempt: Aske is away
> > Change-Id: I927f9bd488fb385ff9c17c8fc94920a1f5076347
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289200
> > Reviewed-by: Stephen Adams <sra@google.com>
> > Reviewed-by: Slava Egorov <vegorov@google.com>
> > Reviewed-by: Nate Bosch <nbosch@google.com>
> > Commit-Queue: Lasse Nielsen <lrn@google.com>
>
> CoreLibraryReviewExempt: Approved in original.
> Change-Id: I1bc14f99b742567e2634dcfcbc52f332dbcc5364
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290521
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>

CoreLibraryReviewExempt: Approved in original.
Change-Id: If157e1ef2339d7a06e99a1e402f2f8ac93550b83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290960
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2023-03-29 16:54:23 +00:00
Nicholas Shahan 7c0e4d67c7 [dart2js] Prevent unsound compiles
- Remove unsound platform .dill files from the packaged SDK.
- Throw and error referencing the sound null safety requirements of
  Dart 3 when compiling with `--no-sound-null-safety` and an unsound
  platform .dill file is not found.

Change-Id: I703a446e3e92c76a6b48168577fc0161eea83854
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289280
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-03-28 21:31:27 +00:00
Parker Lougheed 34f864b92e Update website links and text on API docs homepage
Change-Id: Iddf769b1975228d0edfbd7dca98c16406584d63a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290480
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Marya Belanger <mbelanger@google.com>
2023-03-28 21:23:23 +00:00
Brian Quinlan d884d1a76e [io] Do delayed IPv6 lookups on all platforms.
Bug: https://github.com/dart-lang/sdk/issues/50868
Change-Id: I5ad57f4634287b4299fbf74fde075d518154bf08
Tested: unit
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288621
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-03-28 18:17:54 +00:00
Martin Kustermann 0012890cc8 [vm] Add class modifiers to dart:isolate
SendPort/ReceivePort/RawReceivePort become interface classes as there
are existing implementations of those classes (e.g. `package:isolate`
has `Multiplex*Port` classes those).

Since Capability is implemented by SendPort it also becomes an interface
class.

All remaining classes become final - we can always be less restrictive
in the future if needed.

It seems good practice to also add modifiers to private classes (one
reason is that private classes can be exported via e.g. typdef).

TEST=ci

CoreLibraryReviewExempt: No API changes except for modifiers, vm-only library.
Change-Id: I5edf04624a5dc588ac5f49bb898f29b5bc121d5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288201
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-03-28 12:36:45 +00:00
Alexander Aprelev 67683c3973 [vm/isolates] Introduce 'vm:isolate-unsendable' pragma.
Decorate Zone, Future, Completer, Timer and Stream with newly-introduced pragma to make sure that message verification stops earlier, produces shorter retaining path for the user.

BUG=https://github.com/dart-lang/sdk/issues/51722
TEST=send_unsupported_objects_test,isolate_exit_unsendable_test.dart
CoreLibraryReviewExempt: vm-specific pragmas
Change-Id: I499eea542d228ac9cf0797a682664f93f360dc80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289027
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-03-27 20:54:11 +00:00
Zach Anderson fa0c81efe1 Revert "Reland "[ Observatory ] Disable serving Observatory by default""
This reverts commit fb1516c4ea.

Reason for revert: https://github.com/flutter/flutter/issues/123516

Original change's description:
> Reland "[ Observatory ] Disable serving Observatory by default"
>
> This reverts commit 5a8ddc0756.
>
> Reason for reland: fix for failing Flutter test landed upstream
> in https://github.com/flutter/flutter/pull/122419
>
> TEST=pkg/dartdev/test/commands/run_test.dart
>
> Change-Id: I1152296828428e118ccba11025f25f6b1dbbb0f3
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290921
> Reviewed-by: Zach Anderson <zra@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>

Change-Id: I4e35f93ef4ac46c6dbd905903496a27107eb8329
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291180
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-03-27 14:42:01 +00:00
Ivan Inozemtsev 22f6200fb0 Convert TLS exceptions to HTTP exceptions
Bug: b/270438568
Change-Id: I57af86e42d3dd258186250ff0d6ea45cc51a176d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291067
Auto-Submit: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-03-24 17:41:18 +00:00
Ben Konyi fb1516c4ea Reland "[ Observatory ] Disable serving Observatory by default"
This reverts commit 5a8ddc0756.

Reason for reland: fix for failing Flutter test landed upstream
in https://github.com/flutter/flutter/pull/122419

TEST=pkg/dartdev/test/commands/run_test.dart

Change-Id: I1152296828428e118ccba11025f25f6b1dbbb0f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290921
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-03-24 13:25:30 +00:00
Devon Carew e6ee09e23b [pkg/js_*] use package:lints/recommended.yaml for analysis for pkg/js_shared and pkg/js_runtime
Update the pkg/pkg.dart script to also include information about the size of the pkg/ packages (so we know ~how much code is on older analysis options sets).

Change-Id: Ief1b9a868752a01aef5dd95a4ce1c74795315bc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290615
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2023-03-24 01:10:09 +00:00
Joshua Litt 2ca521c64c [js] Add sources js_types and js_annotations for analysis reasons.
Change-Id: If05f8a1b924a00616d5f616ff4a534e9237a6c82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290916
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-03-24 00:39:57 +00:00
Emmanuel Pellereau d0556f9c27 Revert "Reland "Add class modifiers to dart:convert.""
This reverts commit 608934e330.

Reason for revert: breaks google3. See b/274843808.

Original change's description:
> Reland "Add class modifiers to `dart:convert`."
>
> This is a reland of commit b2f4cf3e01
>
> Commented out deprecation for now.
>
> Original change's description:
> > Add class modifiers to `dart:convert`.
> >
> > The usual approach:
> > Pure interfaces marked `interface`.
> > Pure implementation classes marked `final`.
> > Base classes marked `base` or nothing, and `mixin class` if reasonable.
> > Combined X/XBase/XMixin where possible.
> >
> > CoreLibraryReviewExempt: Aske is away
> > Change-Id: I927f9bd488fb385ff9c17c8fc94920a1f5076347
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289200
> > Reviewed-by: Stephen Adams <sra@google.com>
> > Reviewed-by: Slava Egorov <vegorov@google.com>
> > Reviewed-by: Nate Bosch <nbosch@google.com>
> > Commit-Queue: Lasse Nielsen <lrn@google.com>
>
> CoreLibraryReviewExempt: Approved in original.
> Change-Id: I1bc14f99b742567e2634dcfcbc52f332dbcc5364
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290521
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>

Change-Id: Ie438531e9b97658c86e242fabddbb8a2919f634b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290763
Reviewed-by: Alexander Thomas <athom@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Oleh Prypin <oprypin@google.com>
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
2023-03-23 12:19:33 +00:00
Srujan Gaddam 9231c6182c [dart:html] Remove duplicate switch case
Fixes https://github.com/dart-lang/sdk/issues/51754

META and WIN_KEY_LEFT have the same value. The switch case for the
second value is never triggered, so we should remove it.

CoreLibraryReviewExempt: No functional change, just silencing warnings.
Change-Id: I51afe53a3d41e2c2fa820c2bb16e1bdea4583fac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290702
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-03-23 00:57:57 +00:00
Joshua Litt 884f42a4f4 [js_util] Make callMethod take an Object method.
CoreLibraryReviewExempt: Minor refactor of web only library.
Change-Id: I7afc4a00501ac12c1aa0248305001a978f2e9f8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288641
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-03-23 00:23:00 +00:00
Stephen Adams cbe7075b7a [js_runtime] Safe-print records in Error messages
The js_runtime implementation of `Error.safeToString` now understands
Records.

`ArgumentError.value((1, 2))` now prints as

    Invalid argument: Record (1, 2)

instead of the old way:

    Invalid argument: Instance of '_Record_2'

I don't think `Record` is necessary, but this is consistent with the
VM error messages.

Bug: 49718
Change-Id: Icde50f12a3956aa8954ee083307c1e5b13871e41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290349
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-03-22 19:41:38 +00:00
Ben Konyi 7767f9d9a6 [ dart:developer ] Apply class modifiers to dart:developer classes
None of the classes in dart:developer should be implemented or extended
as most functionality requires native calls into the VM.

TEST=N/A

CoreLibraryReviewExempt: No functional changes to implementations.
Change-Id: I6a8b819e8c9c771954009ffbb2e31f6d0f368c57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288823
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-03-22 15:34:59 +00:00
Lasse R.H. Nielsen 608934e330 Reland "Add class modifiers to dart:convert."
This is a reland of commit b2f4cf3e01

Commented out deprecation for now.

Original change's description:
> Add class modifiers to `dart:convert`.
>
> The usual approach:
> Pure interfaces marked `interface`.
> Pure implementation classes marked `final`.
> Base classes marked `base` or nothing, and `mixin class` if reasonable.
> Combined X/XBase/XMixin where possible.
>
> CoreLibraryReviewExempt: Aske is away
> Change-Id: I927f9bd488fb385ff9c17c8fc94920a1f5076347
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289200
> Reviewed-by: Stephen Adams <sra@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>

CoreLibraryReviewExempt: Approved in original.
Change-Id: I1bc14f99b742567e2634dcfcbc52f332dbcc5364
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290521
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2023-03-22 15:34:38 +00:00
Alexander Aprelev f59e7d3aaa Revert "Add class modifiers to dart:convert."
This reverts commit b2f4cf3e01 because it breaks flutter analyze.

BUG=https://github.com/flutter/flutter/issues/123157

Original change's description:
> Add class modifiers to `dart:convert`.
>
> The usual approach:
> Pure interfaces marked `interface`.
> Pure implementation classes marked `final`.
> Base classes marked `base` or nothing, and `mixin class` if reasonable.
> Combined X/XBase/XMixin where possible.
>
> CoreLibraryReviewExempt: Aske is away
> Change-Id: I927f9bd488fb385ff9c17c8fc94920a1f5076347
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289200
> Reviewed-by: Stephen Adams <sra@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>

Change-Id: Ia79b9572e623a47ddbefd66efe270a6e3bbaa5e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290340
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2023-03-21 22:29:58 +00:00
Brian Quinlan 8384a13ec0 [doc] Document some limitations of Isolate.spawn.
Bug: https://github.com/dart-lang/sdk/issues/51594
Change-Id: Ib1aa733fd0f6641b53c32e9097f5b6e400226fa0
CoreLibraryReviewExempt: documentation only
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290262
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-03-21 22:08:03 +00:00
Daco Harkes 92e5746494 Reland "[vm/ffi] Add class modifiers"
This is a reland of commit 1755f89092

Can land after (or with) the Flutter PR:
https://github.com/flutter/engine/pull/40434

Original change's description:
> [vm/ffi] Add class modifiers
>
> Adds class modifiers to `dart:ffi`.
>
> Migrates all user-defined subclasses of `Struct`, `Union`, `Opaque`,
> and `AbiSpecificInteger` to be `final class`es.
>
> Does not remove the manual error checking, so some errors will show up
> twice now in language version 3.0. In language version <3.0, only the
> FFI-specific error will show up.
>
> In a follow-up CL, we will try to make the language-errors to show up
> also <3.0 so that we can remove the FFI-specific errors.
>
> Examples of duplicated errors:
> pkg/analyzer/test/src/diagnostics/subtype_of_ffi_class_test.dart
>
> TEST=pkg/analyzer/test/ (for the analyzer)
> TEST=pkg/front_end/testcases/ (for the CFE)
> TEST=test/ffi/ (for the VM)
>
> CoreLibraryReviewExempt: No need for dart2js to review.
> Bug: https://github.com/dart-lang/sdk/issues/51683
> Change-Id: I2964ceccb7db59fbdaf6be5319f5e4ec2dabe0f3
> Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-win-release-try,pkg-mac-release-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-reload-rollback-linux-debug-x64-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289223
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Devon Carew <devoncarew@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Jackson Gardner <jacksongardner@google.com>
> Reviewed-by: Lasse Nielsen <lrn@google.com>
> Commit-Queue: Daco Harkes <dacoharkes@google.com>

TEST=pkg/analyzer/test/ (for the analyzer)
TEST=pkg/front_end/testcases/ (for the CFE)
TEST=test/ffi/ (for the VM)
CoreLibraryReviewExempt: No need for dart2js to review.
Bug: https://github.com/dart-lang/sdk/issues/51683
Change-Id: I2ee3f0ac31d4162068a2346a06320029b2263ee2
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-win-release-try,pkg-mac-release-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-reload-rollback-linux-debug-x64-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289781
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-03-21 15:25:10 +00:00
Martin Kustermann 845c937c0b Revert "[vm] Mark _registerServiceExtension entrypoint conditional on being non-product mode"
This reverts commit 171744589a.

Reason for revert:

Flutter engine hasn't rolled into g3 yet. We need to wait
for it to roll into g3 to bring [0] in -  after which
running flutter from source in g3 no longer tries to
use this _registerServiceExtension entrypoint.

[0] e07fb9b5dd

Original change's description:
> [vm] Mark _registerServiceExtension entrypoint conditional on being non-product mode
>
> The runtime should only call this in non-product mode, we should be able
> to tree shake it in product mode.
>
> TEST=ci
>
> Change-Id: Ic8628b1e239f123894efc5a79253b8d6a9b56a73
> CoreLibraryReviewExempt: Doesn't change API
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289780
> Commit-Queue: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Daco Harkes <dacoharkes@google.com>

Change-Id: If1342a51f2491cf81cd69fbc1de0b4549b1d8b98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290067
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-03-21 13:02:29 +00:00
William Hesse 20449a1ebc Revert "Reland "[io] Improve the performance of the IOSink returned by openWrite by writing eagerly and accumulating small writes.""
This reverts commit e34165c543.
Also reverts commit 39ecf5f9d2

Reason for revert: breaks internal testing: b/274563167

Original change's description:
> Reland "[io] Improve the performance of the IOSink returned by `openWrite` by writing eagerly and accumulating small writes."
>
> This is a reland of commit c2bdda63f5
>
> Original change's description:
> > [io] Improve the performance of the IOSink returned by `openWrite` by writing eagerly and accumulating small writes.

Bug: b/274563167
Change-Id: I551c92a5fe121c85999f8a6ec513f83481ae2dbd
CoreLibraryReviewExempt: Revert
Tested: Revert
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290064
Auto-Submit: William Hesse <whesse@google.com>
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
2023-03-21 09:53:02 +00:00
Brian Quinlan d7c3ede476 Document the perils of closures with Isolate.run.
Bug: https://github.com/dart-lang/sdk/issues/51594
Change-Id: I71bfa4df139c185424e2d71da4f606eef062ffff
CoreLibraryReviewExempt: documentation-only change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288140
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-03-21 01:11:35 +00:00
Ryan Macnak 2cc96bfa0b [vm] Add an ABI for Fuchsia RISC-V.
https://fuchsia.dev/fuchsia-src/contribute/governance/rfcs/0211_fuchsia_on_risc-v

TEST=./tools/build.py -mrelease -asimriscv64 gen_snapshot_fuchsia gen_snapshot_product_fuchsia
CoreLibraryReviewExempt: VM-only
Change-Id: Ie62addda6c15a5b44e814c49b543319aef4fc5e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281869
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-03-20 20:46:27 +00:00
Srujan Gaddam 65e0bd3fca Reland "[dart:js_interop] Add literal constructors for inline classes"
This reverts commit 49f85335d5.

Reason for revert: Fixes the original breakage by adding an explicit
cast for the map function that's used to compute positional args
of the stub. Adds refactoring to better separate out the logic
between procedure-level and invocation-level lowering configs.

Also refactors optional argument functions so that they can use the
invocation-level lowering configs created in this CL. Also fixes
a small issue where object literal constructors wouldn't work in
dart2js if the surrounding library didn't have a @JS annotation.

Original change's description:
> Revert "[dart:js_interop] Add literal constructors for inline classes"
>
> This reverts commit 1f6d4ae1a8.
>
> Reason for revert: Broke Flutter with dart2wasm
>
> Original change's description:
> > [dart:js_interop] Add literal constructors for inline classes
> >
> > Adds @ObjectLiteral annotation to denote object literal constructors,
> > and implements it in all the backends. For dart2js, this involves
> > modifying the SSA and for dart2wasm, we create a one-per-shape
> > forwarding procedure to a specialized JS method that returns the
> > literal. This also modifies @anonymous semantics in dart2wasm to
> > be consistent with the other backends.
> >
> > CoreLibraryReviewExempt: Backend-specific, just adding annotation.
> > Change-Id: I4d7a9ea9ed097f4f378709b40f8bd74f02e26b23
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283922
> > Commit-Queue: Srujan Gaddam <srujzs@google.com>
> > Reviewed-by: Joshua Litt <joshualitt@google.com>
>
> Change-Id: Ifce611e1150d8aa275f9e312743bded56a572176
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285342
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Reviewed-by: Joshua Litt <joshualitt@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>

CoreLibraryReviewExempt: Reland.
Change-Id: Iac52e9ff152dc06788d78b7b18549c7005921b74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285346
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-03-20 17:41:49 +00:00
Devon Carew d9fdec8129 [sdk] no longer generate <sdk>/lib/_internal/strong.sum
Change-Id: I54d9e8751508db2602a142d0977c4e3b9381ac33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289443
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2023-03-20 17:25:43 +00:00
William Hesse 39ecf5f9d2 [io] Calling flush after close on File.open's IOSync should not throw an exception
The documentation of IOSync states that calling flush on a closed IOSink may have no effect:
https://github.com/dart-lang/sdk/blob/main/sdk/lib/io/io_sink.dart#L109
The future returned by close in the new implementation does not complete until after
a call to flush has completed.
The previous implementation of File.open did not throw when calling flush after close.

CoreLibraryReviewExempt: IO only, restoring previous semantics
Bug: b/274405250
Change-Id: I56bbe02e886085cc8156e60264f5b77593c8a075
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289823
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
2023-03-20 15:33:04 +00:00
Lasse R.H. Nielsen b2f4cf3e01 Add class modifiers to dart:convert.
The usual approach:
Pure interfaces marked `interface`.
Pure implementation classes marked `final`.
Base classes marked `base` or nothing, and `mixin class` if reasonable.
Combined X/XBase/XMixin where possible.

CoreLibraryReviewExempt: Aske is away
Change-Id: I927f9bd488fb385ff9c17c8fc94920a1f5076347
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289200
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2023-03-20 13:27:17 +00:00
Lasse R.H. Nielsen 82d91ea541 Add class modifiers to dart:_internal.
The only exported type is `BytesBuilder`, which is a pure `interface`.

CoreLibraryReviewExempt: Aske is away
Change-Id: I1756e066689192ac4ea8485c3e1259d79473c583
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289320
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2023-03-20 13:16:06 +00:00
Lasse R.H. Nielsen 162ff41b0e Add class modifiers to dart:async.
* Pure interfaces marked `interface`. That's most public classes.
* `Stream` made `mixin class`, as a proper skeleton/base implementation.
* `Zone` classes made all `final`.

Added some `<void>` to raw `Future` types.

CoreLibraryReviewExempt: Aske is away.
Tested: No functionality change, only added restrictions.
Change-Id: I91d09fbcdba7d0dfdff3887bc7c9d54364c88b05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289221
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-03-20 12:12:46 +00:00
Zach Anderson 7471994270 Revert "[vm/ffi] Add class modifiers"
This reverts commit 1755f89092.

Reason for revert: This is a breaking change and is blocking the Dart -> Flutter roll. See https://ci.chromium.org/ui/p/flutter/builders/try/Mac%20Unopt/26896/overview.

Original change's description:
> [vm/ffi] Add class modifiers
>
> Adds class modifiers to `dart:ffi`.
>
> Migrates all user-defined subclasses of `Struct`, `Union`, `Opaque`,
> and `AbiSpecificInteger` to be `final class`es.
>
> Does not remove the manual error checking, so some errors will show up
> twice now in language version 3.0. In language version <3.0, only the
> FFI-specific error will show up.
>
> In a follow-up CL, we will try to make the language-errors to show up
> also <3.0 so that we can remove the FFI-specific errors.
>
> Examples of duplicated errors:
> pkg/analyzer/test/src/diagnostics/subtype_of_ffi_class_test.dart
>
> TEST=pkg/analyzer/test/ (for the analyzer)
> TEST=pkg/front_end/testcases/ (for the CFE)
> TEST=test/ffi/ (for the VM)
>
> CoreLibraryReviewExempt: No need for dart2js to review.
> Bug: https://github.com/dart-lang/sdk/issues/51683
> Change-Id: I2964ceccb7db59fbdaf6be5319f5e4ec2dabe0f3
> Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-win-release-try,pkg-mac-release-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-reload-rollback-linux-debug-x64-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289223
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Devon Carew <devoncarew@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Jackson Gardner <jacksongardner@google.com>
> Reviewed-by: Lasse Nielsen <lrn@google.com>
> Commit-Queue: Daco Harkes <dacoharkes@google.com>

Bug: https://github.com/dart-lang/sdk/issues/51683
Change-Id: Ie5b8a08aea6d64b1991ace4814322b21ffb670c7
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-win-release-try,pkg-mac-release-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-reload-rollback-linux-debug-x64-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289640
Commit-Queue: Slava Egorov <vegorov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-03-20 11:15:59 +00:00
Martin Kustermann 171744589a [vm] Mark _registerServiceExtension entrypoint conditional on being non-product mode
The runtime should only call this in non-product mode, we should be able
to tree shake it in product mode.

TEST=ci

Change-Id: Ic8628b1e239f123894efc5a79253b8d6a9b56a73
CoreLibraryReviewExempt: Doesn't change API
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289780
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-03-20 11:00:53 +00:00
Mayank Patke 62e3c47e45 [dart2js] Don't rely on == null promoting to Null in rti.dart.
Although the true branch of `x != null` and the false branch of `x ==
null` promote `x` to non-nullable, the opposing branches do not promote
`x` to `Null` in the current flow analysis spec, which applies to the
CFE.

When switching from the dart2js static type computation to the CFE
static type computation, attempting to use `x` in these branches may
generate an unintended type check, which can overflow the stack if this
occurs in code responsible for performing type checks. The fix is fairly
straightforward - we can simply use an unchecked cast (via `JS`) instead.

See https://github.com/dart-lang/language/issues/1505 for discussion on
why the expected promotion does not (yet) occur.

Change-Id: Ia9cca4e1aa8e9c67b42c60189f0d3811afb61360
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289061
Reviewed-by: Stephen Adams <sra@google.com>
2023-03-17 19:44:34 +00:00
Daco Harkes 1755f89092 [vm/ffi] Add class modifiers
Adds class modifiers to `dart:ffi`.

Migrates all user-defined subclasses of `Struct`, `Union`, `Opaque`,
and `AbiSpecificInteger` to be `final class`es.

Does not remove the manual error checking, so some errors will show up
twice now in language version 3.0. In language version <3.0, only the
FFI-specific error will show up.

In a follow-up CL, we will try to make the language-errors to show up
also <3.0 so that we can remove the FFI-specific errors.

Examples of duplicated errors:
pkg/analyzer/test/src/diagnostics/subtype_of_ffi_class_test.dart

TEST=pkg/analyzer/test/ (for the analyzer)
TEST=pkg/front_end/testcases/ (for the CFE)
TEST=test/ffi/ (for the VM)

CoreLibraryReviewExempt: No need for dart2js to review.
Bug: https://github.com/dart-lang/sdk/issues/51683
Change-Id: I2964ceccb7db59fbdaf6be5319f5e4ec2dabe0f3
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-win-release-try,pkg-mac-release-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-reload-rollback-linux-debug-x64-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289223
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-03-17 19:29:41 +00:00
Mark Zhou 80c2b02bd0 [ddc] Adding a runtime flag for real deferred loading in DDC
Change-Id: If50f7437c827a32829f5093cb3a14cbc5e55f7a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289340
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
2023-03-17 18:04:48 +00:00
Brian Quinlan e34165c543 Reland "[io] Improve the performance of the IOSink returned by openWrite by writing eagerly and accumulating small writes."
This is a reland of commit c2bdda63f5

Original change's description:
> [io] Improve the performance of the IOSink returned by `openWrite` by writing eagerly and accumulating small writes.
>
> Benchmarks (benchmarks/FileIOSink/dart/FileIOSink.dart):
>
>  @before:
>
>   FileIOSink.Add.ManySmall(RunTime): 2341597.0 us.
>   FileIOSink.Add.OneLarge(RunTime): 111.06925927974774 us.
>   FileIOSink.Add.AlternatingAddSize(RunTime): 105.65958788898234 us.
>
>  @after
>
>   FileIOSink.Add.ManySmall(RunTime): 5007.1125 us.
>   FileIOSink.Add.OneLarge(RunTime): 98.23492468475541 us.
>   FileIOSink.Add.AlternatingAddSize(RunTime): 91.77411527720551 us.
>
> So the relative performance changes are:
>
>  FileIOSink.Add.ManySmall(RunTime): 0.00213x (MUCH faster)
>  FileIOSink.Add.OneLarge(RunTime): 0.884x (slight faster - noise?)
>  FileIOSink.Add.AlternatingAddSize(RunTime): 0.868x (slightly faster - noise?)
>
> https://golem.corp.goog/Revision?repository=dart&revision=102771&patch=17842
>
> Change-Id: Ic73f33299a570096dd05f254982f556767559966
> Bug:https://github.com/dart-lang/sdk/issues/32874
> Tested: unit tests
> CoreLibraryReviewExempt: Performance-only fix for file writes in the VM.
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285420
> Commit-Queue: Brian Quinlan <bquinlan@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>

Bug: https://github.com/dart-lang/sdk/issues/32874
Change-Id: I758f3159e85c837d6ec4a0f3e470b519825ee142
Tested: unit tests
CoreLibraryReviewExempt: Performance-only fix for file writes in the VM.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288545
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2023-03-17 16:13:19 +00:00
Joshua Litt 743caee6f0 [js_types] Migrate Dart2Wasm internal interop classes to JS types.
Change-Id: I0cd2ca8d7b254372818beb5af66662dc276dd29e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288640
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-03-16 22:50:05 +00:00
Devon Carew f910c3d92b [libraries.dart] update and normalize the libraries.dart file
Change-Id: Iee3f9439fd77d2d65b9017b55a552cfeb372685e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289065
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-03-16 16:59:55 +00:00
Devon Carew 2ba4e232be [sdk] remove a duplicate copy of the libraries.dart file
Change-Id: I5a1bef7bb1ae179894ccfc4fb1225a5c3c9c7988
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289064
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2023-03-16 01:06:44 +00:00
Devon Carew 9efc02e741 [doc updates] adjust header level for two core libraries
Change-Id: I8f9de631a5fc33a811b1a4355337a0efd6c1ce00
CoreLibraryReviewExempt: dartdoc comment only changes to core libraries, reviewed by Lasse
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288600
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2023-03-15 17:14:43 +00:00
Devon Carew a548eb9bd2 [sdk docs] update sdk libraries to use triple slash docs
Change-Id: I9ee4d630763042031a06d05fb477f79deb32885b
CoreLibraryReviewExempt: dartdoc only changes, mostly to web libraries (web team reviewed)
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288323
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-03-14 19:10:25 +00:00
Nicholas Shahan 3a584183d4 [ddc] Update record types .toString() output
Printing the `.runtimeType` of a record value no longer includes
the text "RecordType". Now it just includes the types and names
(if any named) of the elements within parenthesis.

Example: `"RecordType(int, double)" -> "(int, double)"`
Change-Id: I99ef333ca54e06d6309a7f547462df6327f83050
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288622
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-03-14 17:52:40 +00:00
Joshua Litt ba07466c2c [js_interop] Make dartify / jsify a bit more efficient.
CoreLibraryReviewExempt: Minor refactor of the implementation of helpers in `js_util`.
Change-Id: I584bd4efbc8f4aff81f3bb62da9029ffdac3eb5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287669
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-03-14 15:39:27 +00:00
Siva Annamalai c17e55a1de Revert "[io] Improve the performance of the IOSink returned by openWrite by writing eagerly and accumulating small writes."
This reverts commit c2bdda63f5.

Reason for revert: We are seeing some windows failures and also 
Bad state: /tmp/file_test_NOYTEV/foo is bound to a stream
** Note that stack traces are truncated. See http://go/dart-chain-stack-traces for information on how to view the full stack trace **
dart:io                                                          _RandomAccessFileIOSync.flush


Original change's description:
> [io] Improve the performance of the IOSink returned by `openWrite` by writing eagerly and accumulating small writes.
>
> Benchmarks (benchmarks/FileIOSink/dart/FileIOSink.dart):
>
>  @before:
>
>   FileIOSink.Add.ManySmall(RunTime): 2341597.0 us.
>   FileIOSink.Add.OneLarge(RunTime): 111.06925927974774 us.
>   FileIOSink.Add.AlternatingAddSize(RunTime): 105.65958788898234 us.
>
>  @after
>
>   FileIOSink.Add.ManySmall(RunTime): 5007.1125 us.
>   FileIOSink.Add.OneLarge(RunTime): 98.23492468475541 us.
>   FileIOSink.Add.AlternatingAddSize(RunTime): 91.77411527720551 us.
>
> So the relative performance changes are:
>
>  FileIOSink.Add.ManySmall(RunTime): 0.00213x (MUCH faster)
>  FileIOSink.Add.OneLarge(RunTime): 0.884x (slight faster - noise?)
>  FileIOSink.Add.AlternatingAddSize(RunTime): 0.868x (slightly faster - noise?)
>
> https://golem.corp.goog/Revision?repository=dart&revision=102771&patch=17842
>
> Change-Id: Ic73f33299a570096dd05f254982f556767559966
> Bug:https://github.com/dart-lang/sdk/issues/32874
> Tested: unit tests
> CoreLibraryReviewExempt: Performance-only fix for file writes in the VM.
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285420
> Commit-Queue: Brian Quinlan <bquinlan@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>

Bug: https://github.com/dart-lang/sdk/issues/32874
Change-Id: I6e16cfb460a9a6b16d7a63cb02d46fab9fc6244d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288606
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-03-14 04:54:17 +00:00
Joshua Litt e4bf05fd47 [js_util] fix Dart2Wasm patch file.
Change-Id: Icc98e6d1fd65ccdc8b9bc2a8b109140d53b18662
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288161
Auto-Submit: Joshua Litt <joshualitt@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-03-14 01:43:50 +00:00
Siva Annamalai 5a8ddc0756 Revert "[ Observatory ] Disable serving Observatory by default"
This reverts commit edead9cfd1.

Reason for revert: We have some flutter framework tests that are breaking, "flutter test should respect --serve-observatory". This will apparently be fixed when https://github.com/flutter/flutter/pull/122419 lands.

Original change's description:
> [ Observatory ] Disable serving Observatory by default
>
> Observatory can still be enabled by providing `--serve-observatory` or
> invoking the `_serveObservatory` private service RPC via web socket or
> HTTP.
>
> Related to https://github.com/dart-lang/sdk/issues/50233
>
> TEST=pkg/dartdev/test/commands/run_test
>
> Change-Id: I89b000e69bb31c91a9a5386fed1ee590cdafa58c
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287821
> Reviewed-by: Michael Thomsen <mit@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

Change-Id: I994c86cbca9d0eb25e1f9adddeede94c227acad9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288601
Commit-Queue: Siva Annamalai <asiva@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Zach Anderson <zra@google.com>
2023-03-14 00:46:59 +00:00
Brian Quinlan c2bdda63f5 [io] Improve the performance of the IOSink returned by openWrite by writing eagerly and accumulating small writes.
Benchmarks (benchmarks/FileIOSink/dart/FileIOSink.dart):

 @before:

  FileIOSink.Add.ManySmall(RunTime): 2341597.0 us.
  FileIOSink.Add.OneLarge(RunTime): 111.06925927974774 us.
  FileIOSink.Add.AlternatingAddSize(RunTime): 105.65958788898234 us.

 @after

  FileIOSink.Add.ManySmall(RunTime): 5007.1125 us.
  FileIOSink.Add.OneLarge(RunTime): 98.23492468475541 us.
  FileIOSink.Add.AlternatingAddSize(RunTime): 91.77411527720551 us.

So the relative performance changes are:

 FileIOSink.Add.ManySmall(RunTime): 0.00213x (MUCH faster)
 FileIOSink.Add.OneLarge(RunTime): 0.884x (slight faster - noise?)
 FileIOSink.Add.AlternatingAddSize(RunTime): 0.868x (slightly faster - noise?)

https://golem.corp.goog/Revision?repository=dart&revision=102771&patch=17842

Change-Id: Ic73f33299a570096dd05f254982f556767559966
Bug:https://github.com/dart-lang/sdk/issues/32874
Tested: unit tests
CoreLibraryReviewExempt: Performance-only fix for file writes in the VM.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285420
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-03-13 22:39:13 +00:00
Ilya Yanok 936cdeeb2f Revert "Reland "Add more interface and final modifiers to dart:core.""
This reverts commit e293eb809d.

Reason for revert: Breaks G3.

Original change's description:
> Reland "Add more `interface` and `final` modifiers to `dart:core`."
>
> This is a reland of commit 4f8333e80e
>
> Blocked on Flutter patch: https://github.com/flutter/engine/pull/40175
>
> Original change's description:
> > Add more `interface` and `final` modifiers to `dart:core`.
> >
> > Make intent explicit for classes which are intended as interfaces,
> > or which are not intended to be subclassed.
> >
> > Mainly classes which are pure interfaces are marked as such,
> > and platform-specific classes not intended for subclassing
> > are made `final`.
> >
> > The `final` classes includes `BigInt`, which is written to assume
> > that arguments inherit its private members
> > (it runs `_ensureSystemBigInt` on arguments).
> >
> > It also includes the `Expando`, `WeakReference` and `Finalizer` classes,
> > which are just intended as stand-alone implementation classes for accessing
> > platform-specific functionality.
> >
> > Change-Id: Ib770c265edff127a289a67fe72d15b9ff0499407
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287180
> > Reviewed-by: Stephen Adams <sra@google.com>
> > Commit-Queue: Lasse Nielsen <lrn@google.com>
> > Reviewed-by: Aske Simon Christensen <askesc@google.com>
> > Reviewed-by: Nate Bosch <nbosch@google.com>
> > Reviewed-by: Martin Kustermann <kustermann@google.com>
>
> CoreLibraryReviewExempt: Accepted in original CL.
> Change-Id: Id713edede4228801bb097a64734be4f2187f51a9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288206
> Reviewed-by: Aske Simon Christensen <askesc@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

Change-Id: I05ff2fe44e5a13f20725eb122963d20243062c7a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288503
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
2023-03-13 16:08:31 +00:00
Lasse R.H. Nielsen e293eb809d Reland "Add more interface and final modifiers to dart:core."
This is a reland of commit 4f8333e80e

Blocked on Flutter patch: https://github.com/flutter/engine/pull/40175

Original change's description:
> Add more `interface` and `final` modifiers to `dart:core`.
>
> Make intent explicit for classes which are intended as interfaces,
> or which are not intended to be subclassed.
>
> Mainly classes which are pure interfaces are marked as such,
> and platform-specific classes not intended for subclassing
> are made `final`.
>
> The `final` classes includes `BigInt`, which is written to assume
> that arguments inherit its private members
> (it runs `_ensureSystemBigInt` on arguments).
>
> It also includes the `Expando`, `WeakReference` and `Finalizer` classes,
> which are just intended as stand-alone implementation classes for accessing
> platform-specific functionality.
>
> Change-Id: Ib770c265edff127a289a67fe72d15b9ff0499407
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287180
> Reviewed-by: Stephen Adams <sra@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>
> Reviewed-by: Aske Simon Christensen <askesc@google.com>
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

CoreLibraryReviewExempt: Accepted in original CL.
Change-Id: Id713edede4228801bb097a64734be4f2187f51a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288206
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-03-13 15:21:30 +00:00
Aske Simon Christensen b686b2e948 [dart2wasm] Support constants and comparison for Wasm numeric types
CoreLibraryReviewExempt: Only modifies Wasm-specific files.
Change-Id: Ibf1d466e37de6d5f0e77c5ce7abde45a1f085617
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287981
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-03-13 14:16:08 +00:00
Lasse R.H. Nielsen 7d4ad1706e Adding class modifiers to dart:math.
Just adds `interface` modifier to `Random`.

Change-Id: I221a97a3c941befb9039a14d6ba827ab095837ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288207
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-03-13 14:01:26 +00:00
Devon Carew d33ed63c11 [js_interop] adjust some dartdoc comments
Change-Id: Icba8e411ba0ec71acc4b7d5a9512f53182943c77
CoreLibraryReviewExempt: dartdoc comments for a web-only library
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288322
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2023-03-10 23:16:13 +00:00
Stephen Adams 1d4654c530 [dart2js] Make Record.runtimeType independent of field's .runtimeType
- Make Record.runtimeType independent of field's .runtimeType

- Display the record type of the irritant in TypeErrors rather than
  the confusing internal representation class name.

Bug: 51609
Change-Id: I95f35ecbaec9dff41f356e0994b2eadd397fbc1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287670
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-03-10 21:31:13 +00:00
Jackson Gardner b890ed4cc3 Reland x3 [dart2wasm] Include wasm-opt in the shipped dart-sdk.
Hide this behind a flag, so that we can disable it when building in the flutter in-tree build.

The flag will be set to false for the in-tree flutter build, see
https://github.com/flutter/engine/pull/40195

Change-Id: I248376985d05bfb248a2eab6fa377cbb01d75654
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288040
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-03-10 18:34:10 +00:00
Ben Konyi f51fedce26 [ dart:developer ] Remove Metrics related classes
Fixes https://github.com/dart-lang/sdk/issues/51668

TEST=CI

CoreLibraryReviewExempt:VM only functionality
Change-Id: I5d41863fca05e50d9c20266402c516b92f8de153
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287820
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-03-10 16:50:10 +00:00
Ben Konyi edead9cfd1 [ Observatory ] Disable serving Observatory by default
Observatory can still be enabled by providing `--serve-observatory` or
invoking the `_serveObservatory` private service RPC via web socket or
HTTP.

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

TEST=pkg/dartdev/test/commands/run_test

Change-Id: I89b000e69bb31c91a9a5386fed1ee590cdafa58c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287821
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-03-10 16:01:41 +00:00
Nicholas Shahan ecd37e5d83 [ddc] Default native null asserts on in sound mode
This does not necessarily enable the native null assertions by default
everywhere but it is a step on the path to get there.

- The calls to the method that reads this value are only generated in
  sound null safety so even if this is true the checks don't happen
  in weak null safety. Added a warning when the option is enabled in
  weak null safety.
- Many DDC integrations will set the flag manually during the bootstrap.
  That setting still overrides the default value being changed here.

Change-Id: I4459fb8e8928424b461eb5519f3a7dc87c578172
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286606
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-03-09 23:43:49 +00:00
Aske Simon Christensen c19720245c [dart2wasm] Categorize and masquerade runtime types by lookup table
This avoids virtual calls for `runtimeType` (unless the user overrides
it) and `_runtimeType` (since the internal categorization is now done
using the table instead), which saves a huge amount of space in the
global dispatch table.

It also fixes record runtime types, which now use the masqueraded
types for its fields, rather than the (possibly user-overridden)
`runtimeType`.

A masquerade case was missing for `Type`, which has been added.

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

Tested: ci + new test for overridden runtimeType
Change-Id: I1909c665ae78eb07b9c0eb22b6e8836e27495d70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285684
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-03-09 22:08:19 +00:00
Lasse R.H. Nielsen c974c70f31 Add boolean parse
Closes https://github.com/dart-lang/sdk/pull/51026

Co-authored-by: Renato Burton <renatoburton96@gmail.com>
GitOrigin-RevId: e85a56ce338476b38eac890fac2b8ca193ca42e8
Change-Id: I60f92c594830ef0438ecd92b4c83cec609054326
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279746
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2023-03-09 15:14:32 +00:00
Oleh Prypin 732d1cc0a4 Revert "Add more interface and final modifiers to dart:core."
This reverts commit 4f8333e80e.

Reason for revert: causes breakages in google3

Original change's description:
> Add more `interface` and `final` modifiers to `dart:core`.
>
> Make intent explicit for classes which are intended as interfaces,
> or which are not intended to be subclassed.
>
> Mainly classes which are pure interfaces are marked as such,
> and platform-specific classes not intended for subclassing
> are made `final`.
>
> The `final` classes includes `BigInt`, which is written to assume
> that arguments inherit its private members
> (it runs `_ensureSystemBigInt` on arguments).
>
> It also includes the `Expando`, `WeakReference` and `Finalizer` classes,
> which are just intended as stand-alone implementation classes for accessing
> platform-specific functionality.
>
> Change-Id: Ib770c265edff127a289a67fe72d15b9ff0499407
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287180
> Reviewed-by: Stephen Adams <sra@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>
> Reviewed-by: Aske Simon Christensen <askesc@google.com>
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

Change-Id: I94ff95f72410a4e1ae80744971c4c920fecc1493
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287760
Reviewed-by: Martin Kustermann <kustermann@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Oleh Prypin <oprypin@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-03-09 13:09:57 +00:00
Lasse R.H. Nielsen 4f8333e80e Add more interface and final modifiers to dart:core.
Make intent explicit for classes which are intended as interfaces,
or which are not intended to be subclassed.

Mainly classes which are pure interfaces are marked as such,
and platform-specific classes not intended for subclassing
are made `final`.

The `final` classes includes `BigInt`, which is written to assume
that arguments inherit its private members
(it runs `_ensureSystemBigInt` on arguments).

It also includes the `Expando`, `WeakReference` and `Finalizer` classes,
which are just intended as stand-alone implementation classes for accessing
platform-specific functionality.

Change-Id: Ib770c265edff127a289a67fe72d15b9ff0499407
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287180
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-03-09 12:31:08 +00:00
Ömer Sinan Ağacan fa90dcc640 [dart2wasm] Fix awaiting non-future values
New passing tests:

- co19/Language/Statements/For/Asynchronous_For_in/execution_A05_t05
- language/async/await_test/02
- language/async/await_test/03
- language/async/await_test/none
- language/await/nonfuture_test
- language/await/started_immediately_test

Change-Id: I5d5e13f846aa2415abb9788ef341b1d86170937c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286921
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-03-08 14:53:40 +00:00
Joshua Litt 25779cc933 [js] Ensure dartify / jsify have inverse semantics.
CoreLibraryReviewExempt: Minor change to the internal of a web backend specific API.
Change-Id: I450e9410af7e006b853e2d8f26dc5ede1d95f4e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245621
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-03-08 00:07:42 +00:00
Lasse R.H. Nielsen cc736dfb65 [flip-modifiers]: Reapply "Enforce current library restrictions."
This reapplies commit 0c05e33836
and reverts the revert 029e0cec71.

Tested: Added few new tests, updated existing. Mainly regression testing.
CoreLibraryReviewExempt: Reviewed in original CL.
Change-Id: Ifcc79ce2f9375f607722643a04957b0961e6c295
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284304
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-03-03 09:37:38 +00:00
Greg Price 8e600908b6 Drop impossible case in negative int.toString
This fast path is never taken, because it's subsumed by the
even-faster path at the top of toString.  When this function
is called, negSmi is always <= -100.

Tested: ci
Change-Id: I687fada0222b7815c41151b84c1ce4b1d312d6e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284260
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-03-03 08:18:44 +00:00
Vyacheslav Egorov 420686f7dc [lib] Annotate exception classes added in 2.19 with @Since("2.19")
CoreLibraryReviewExempt: annotation only change which matches CHANGELOG
Change-Id: Ic818e022a330f5491b268806a5ac11308e3f19b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286343
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-03-01 23:05:24 +00:00
Jason Simmons 9c50105dab [js_runtime. js_dev_runtime] Remove redundant copyright notices
Change-Id: Id6d4c334420220a7008441e6cba139ad9674f9cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286023
Commit-Queue: Jason Simmons <jsimmons@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-03-01 00:28:48 +00:00
Nicholas Shahan 6c0ab515f2 [ddc] Make references to classes explicit
Avoids conflating the type representation with the actual class
in JavaScript. Here the classes are being used.

Change-Id: I6b84d47b6fbc375aac3fa25746505d71ef208fcb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285885
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-02-28 20:19:39 +00:00
Stephen Adams e3c3415436 [js_runtime. js_dev_runtime] Move BigInt to its own file.
Patch files now support part files.  Take advantage of this by moving
the large BigInt implementation to its own file.

Change-Id: Icf21bcaae3c3b8a89b8b5dd1835d1afe5806423a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277200
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-02-28 05:36:58 +00:00
Stephen Adams c768f80a96 [dart2js] Implement @pragma('dart2js:resource-identifier')
Calls to methods annotated with `@pragma('dart2js:resource-identifier')` are tracked, with their primitive constant arguments, through to the `.js` file which contains the call.

- JavaScript annotations are attached to the JavaScript AST node for
  the call.

- At the time of `.js` file printing, the JavaScript annotations are
  collected and attributed to the file. This allows the construction
  of a map from `.js` files to the 'resource identifiers' contained in
  the file.

- Alongside the `main.js` file the resource identifiers are emitted in
  a file called `main.js.resources.json`. This is controlled by the
  `--write-resources` command line option.

- Serialization of JavaScript ASTs now serializes the attached
  JavaScript annotations.

- The internal method used to implement deferred library loading is
  annotated, to allow analysis of which deferred library parts load
  other libraries.
 pkg/js_ast was tweaked to make the pkg/js_ast was tweaked to make the
- pkg/js_ast was tweaked to make propagating the JavaScript annotations through the async transforms easier.


TODO:

- Annotate const constructors
- Add golden-style tests

Change-Id: Iea77550e22ee98f81dca61dfd713c09f734583d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284492
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-02-28 03:00:18 +00:00
Ryan Macnak 7c0a694668 [vm] Avoid a second map lookup when dispatching isolate messages.
- Use the currently-unused ReceivePort.handler field instead of a second map.
 - Recognize ReceivePort's fields instead of using natives.

This also has the effect that if one discovers that a port handler is holding onto a large amount of memory via its context, the receive port along with its debug name will appear in the retaining path.

TEST=ci
Change-Id: I4b8d0764a41729a3b397b85bc4603e4d6b0ca9a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285403
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-02-27 18:08:25 +00:00
Stephen Adams fd9e7cbbdb [js_runtime] Preambles: ensure self.window exists
This change makes `self.window` refer to `self` if undefined.
This makes @JS-interop access to properties of `window` work as expected for benchmarks derived from web apps.

To make feature-detection for the timer easier, a new property, `self.dartUseDateNowForTicks` can be set to force the runtime to use Date.now() over performance.now().

Change-Id: Ie3d68d466ccad6e8804014ee8099cea235b173c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285220
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-02-24 22:01:24 +00:00
Srujan Gaddam 49f85335d5 Revert "[dart:js_interop] Add literal constructors for inline classes"
This reverts commit 1f6d4ae1a8.

Reason for revert: Broke Flutter with dart2wasm

Original change's description:
> [dart:js_interop] Add literal constructors for inline classes
>
> Adds @ObjectLiteral annotation to denote object literal constructors,
> and implements it in all the backends. For dart2js, this involves
> modifying the SSA and for dart2wasm, we create a one-per-shape
> forwarding procedure to a specialized JS method that returns the
> literal. This also modifies @anonymous semantics in dart2wasm to
> be consistent with the other backends.
>
> CoreLibraryReviewExempt: Backend-specific, just adding annotation.
> Change-Id: I4d7a9ea9ed097f4f378709b40f8bd74f02e26b23
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283922
> Commit-Queue: Srujan Gaddam <srujzs@google.com>
> Reviewed-by: Joshua Litt <joshualitt@google.com>

Change-Id: Ifce611e1150d8aa275f9e312743bded56a572176
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285342
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-02-24 20:42:14 +00:00
Srujan Gaddam 1f6d4ae1a8 [dart:js_interop] Add literal constructors for inline classes
Adds @ObjectLiteral annotation to denote object literal constructors,
and implements it in all the backends. For dart2js, this involves
modifying the SSA and for dart2wasm, we create a one-per-shape
forwarding procedure to a specialized JS method that returns the
literal. This also modifies @anonymous semantics in dart2wasm to
be consistent with the other backends.

CoreLibraryReviewExempt: Backend-specific, just adding annotation.
Change-Id: I4d7a9ea9ed097f4f378709b40f8bd74f02e26b23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283922
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-02-23 01:14:39 +00:00
Nate Biggs 5969da51d9 [dart2js] Update build infrastructure to move Dart2JS onto sound null safety.
Change-Id: Id172ab72e5d36899f699bb48f8ceb3609964efbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280221
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-02-22 17:19:43 +00:00
Ömer Sinan Ağacan b13f03dd4d [dart2wasm] Throw NoSuchMethodError in unimplemented external members
New passing tests:

- co19/Language/Functions/External_Functions/not_connected_to_a_body_t01
- co19/LanguageFeatures/Abstract-external-fields/static_analysis_external_A01_t03
- co19/LanguageFeatures/Abstract-external-fields/static_analysis_external_A02_t04
- co19/LanguageFeatures/Abstract-external-fields/static_analysis_external_A03_t03
- co19/LanguageFeatures/Abstract-external-fields/static_analysis_external_A03_t06
- co19/LanguageFeatures/Abstract-external-fields/static_analysis_external_A05_t03
- language/bool/has_environment_not_new_test
- language/constructor/external_constructor_test
- language/external_abstract_fields/external_fields_test
- lib/math/random_secure_unsupported_test

Change-Id: I74a430af37d3f138387a942ef028639224c312d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284622
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-02-22 13:35:34 +00:00
Joshua Litt 5175036306 [js_interop] Add js_interop_sources.gni.
Change-Id: If9f79f0861ffc258f4233cdec420b76d2dfe8218
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284491
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Auto-Submit: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-02-22 00:27:30 +00:00
Ömer Sinan Ağacan 004b400dfb [dart2wasm] Implement type parameter bound checks
New passing tests:

- language/generic_methods/bounds_test/02
- language/covariant/subtyping_test
- language/covariant/type_parameter_test
- language/records/simple/type_checks_test

Fixes #51358

Change-Id: I6854f71cbfc47106f685a00c36a64330cc0a57f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282660
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-02-21 18:56:16 +00:00
Ömer Sinan Ağacan 0892c0f93c [dart2wasm] Check array length in _allocateData
New passing tests:

- co19/LibTest/collection/ListBase/ListBase_class_A01_t01
- co19/LibTest/collection/ListMixin/ListMixin_class_A01_t01
- co19/LibTest/core/List/List_all_t01

Change-Id: I5ee455714e82c4f70df42037db11414832e4f9fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284160
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-02-21 14:28:27 +00:00
Lasse R.H. Nielsen 164f8588d6 Optimize LineSplitter.
Avoid quadratic behavior when multiple chunks fail to
have a line break, and the carry-over string gets repeatedly extended.

In the original chunked conversion code, the chunk handling code retained the trailing, non-line-terminated text of the previous chunk, then eagerly concatenated it with the next chunk in order to continue looking for lines. That's moderately effective when lines are shorter than chunks, and neither are too large.
However, a very long line spread across many chunks would perform repeated string concatenation with quadratic time complexity.

This change gives `LineSplitter` the option of using a `StringBuffer` to collect multiple carry-over line parts.
The buffer is needed whenever a chunk does not contain a line break, and needs to be combined with a previous chunk's carry-over. This avoids ever directly concatenating any more than two strings.
The `StringBuffer` is not allocated until it's first needed, so if lines are generally shorter than chunks, the buffer won't be used. Once allocated, the buffer is retained in case a buffer will be needed again, but cleared when its contents are used.

The code optimizes for the simple case of each chunk having a line break.

Fixes #51167

Bug: https://github.com/dart-lang/sdk/issues/51167
Change-Id: I600a011e02aa9f1ad6f88e45764df5b2e8eccfa3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280100
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-02-21 11:33:24 +00:00
Ilya Yanok 029e0cec71 Revert "Enforce current library restrictions."
This reverts commit 0c05e33836.

Reason for revert: breaks ~10% of G3 smoke suite.

Original change's description:
> Enforce current library restrictions.
>
> Mark all currently unimplementable types as `final`, or `sealed` for `num` and `final` for `Function`.
> Mark all current classes intended as mixins as `mixin class`.
>
> More additions and cleanup will follow,
> but this change should make everything keep working as today
> if we flip the switch.
>
> TEST= No new tests, very little actual change, covered by existing tests with few changes. Will add more tests when adding more modifiers.
>
> Change-Id: I40e724f823e7f88cdef186d2f73874df256e2f43
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281683
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Aske Simon Christensen <askesc@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Kallen Tu <kallentu@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Ib0cb5b7ec1a8c392bbf9bf4af8dc3efc0b27991d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284187
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Ilya Yanok <yanok@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-02-20 15:29:41 +00:00
Joshua Litt 4a2438bdeb [dart2wasm] Minor fix for stopwatch patch.
Bug-Id: #51429
Change-Id: I1b01a7d2e83e2c4808ef01ebfe8212390cd54c03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283500
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Auto-Submit: Joshua Litt <joshualitt@google.com>
2023-02-20 08:31:41 +00:00
Lasse R.H. Nielsen 0c05e33836 Enforce current library restrictions.
Mark all currently unimplementable types as `final`, or `sealed` for `num` and `final` for `Function`.
Mark all current classes intended as mixins as `mixin class`.

More additions and cleanup will follow,
but this change should make everything keep working as today
if we flip the switch.

TEST= No new tests, very little actual change, covered by existing tests with few changes. Will add more tests when adding more modifiers.

Change-Id: I40e724f823e7f88cdef186d2f73874df256e2f43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281683
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
2023-02-18 12:37:40 +00:00
Lasse R.H. Nielsen 61a4fb4f9e Update Future.onError extension method.
Now works better with futures that have been up-cast.

CoreLibraryReviewExempt: Rewrite of existing pure Dart function.
Change-Id: Iefd05b9cfd8ff0cc3e27fc1122a670030e0901ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283680
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2023-02-18 12:01:45 +00:00
Joshua Litt 71cffed55c [js_types] Add Helpers to work with JSUndefined and JSNull.
Before we can reify `JSUndefined` and `JSNull` we need to give users a way to detect these values. Once existing users have migrated to these new helpers, then we can start boxing `JSUndefined` and `JSNull` on Dart2Wasm.

There are a few steps here:
1) Land these helpers, but for now they will just preserve the existing semantics.
2) Deploy JS types to Flutter and `package:test`, i.e. everywhere Dart2Wasm's JS interop is currently being used, and use these helpers instead of `null` checks.
3) Switch the semantics of the helpers to stop conflating on all Web backends, while simultaneously boxing `JSNull` and `JSUndefined` on Dart2Wasm.

CoreLibraryReviewExempt: Refactoring web only libraries + some changes to Wasm's internal libraries.
Change-Id: Idb50b28b3087438751557ffd28505c7b536bf78b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282481
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-02-17 18:20:59 +00:00
Ömer Sinan Ağacan f9abd48ae5 [dart2wasm] Add type parameter defaults to runtime function types
New passing tests:

- language/function/call_generic_test
- language/generic/function_bounds_test/01
- language/generic/function_bounds_test/03

Fixes #50992

Change-Id: I4f5e94a939661f6afb4dd78d74c5f7b0ef129cc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283022
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-02-17 11:57:41 +00:00
Jackson Gardner e3661b7d2f Revert "Reland "Reland "[dart2wasm] Include wasm-opt in the shipped dart-sdk."""
This reverts commit faecf41be1.

Reason for revert: Flutter HHH bots are broken: https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8788949281966049297/+/u/build_host_debug/stdout

Original change's description:
> Reland "Reland "[dart2wasm] Include wasm-opt in the shipped dart-sdk.""
>
> This is a reland of commit b19091385a
>
> Fixed the calculation of the paths of binaryen source files so that they
> work properly when building as a dependency (inside the flutter engine
> repo).
>
> Original change's description:
> > Reland "[dart2wasm] Include wasm-opt in the shipped dart-sdk."
> >
> > This is a reland of commit 6271d26baf
> >
> > The change broke the gcc riscv64 builders, due to a `unused-variable`
> > warning coming from binaryen sources. That warning has now been
> > disabled for binaryen targets.
> >
> > Original change's description:
> > > [dart2wasm] Include wasm-opt in the shipped dart-sdk.
> > >
> > > Change-Id: Ib224f0b92fa28019ad3cf67d7ba2bef5c31b92ef
> > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280840
> > > Reviewed-by: Martin Kustermann <kustermann@google.com>
> > > Commit-Queue: Jackson Gardner <jacksongardner@google.com>
> > > Reviewed-by: Aske Simon Christensen <askesc@google.com>
> >
> > Change-Id: I76bf4ad5d1f6a8116631df4b91cbc5a52cac4f31
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283240
> > Reviewed-by: Martin Kustermann <kustermann@google.com>
> > Commit-Queue: Jackson Gardner <jacksongardner@google.com>
>
> Change-Id: I5cc269daebc5e2068c084bb72b2bd7cb58ba6fbe
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283721
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Jackson Gardner <jacksongardner@google.com>

TBR=kustermann@google.com,askesc@google.com,joshualitt@google.com,jacksongardner@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: If4e864b3dfb5d9ff840846bff0690247256b2762
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283745
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-02-17 09:04:50 +00:00
Jackson Gardner faecf41be1 Reland "Reland "[dart2wasm] Include wasm-opt in the shipped dart-sdk.""
This is a reland of commit b19091385a

Fixed the calculation of the paths of binaryen source files so that they
work properly when building as a dependency (inside the flutter engine
repo).

Original change's description:
> Reland "[dart2wasm] Include wasm-opt in the shipped dart-sdk."
>
> This is a reland of commit 6271d26baf
>
> The change broke the gcc riscv64 builders, due to a `unused-variable`
> warning coming from binaryen sources. That warning has now been
> disabled for binaryen targets.
>
> Original change's description:
> > [dart2wasm] Include wasm-opt in the shipped dart-sdk.
> >
> > Change-Id: Ib224f0b92fa28019ad3cf67d7ba2bef5c31b92ef
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280840
> > Reviewed-by: Martin Kustermann <kustermann@google.com>
> > Commit-Queue: Jackson Gardner <jacksongardner@google.com>
> > Reviewed-by: Aske Simon Christensen <askesc@google.com>
>
> Change-Id: I76bf4ad5d1f6a8116631df4b91cbc5a52cac4f31
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283240
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Jackson Gardner <jacksongardner@google.com>

Change-Id: I5cc269daebc5e2068c084bb72b2bd7cb58ba6fbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283721
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
2023-02-16 22:10:18 +00:00
Daco Harkes 97d085c84b Revert "Reland "[dart2wasm] Include wasm-opt in the shipped dart-sdk.""
This reverts commit b19091385a.

Reason for revert: This breaks the Flutter build.
'../../third_party/dart/third_party/dart/third_party/binaryen/src/src/ir/memory-utils.cpp', needed by 'obj/third_party/dart/third_party/dart/third_party/binaryen/src/src/ir/binaryen_sources.memory-utils.o', missing and no known rule to make it

Original change's description:
> Reland "[dart2wasm] Include wasm-opt in the shipped dart-sdk."
>
> This is a reland of commit 6271d26baf
>
> The change broke the gcc riscv64 builders, due to a `unused-variable`
> warning coming from binaryen sources. That warning has now been
> disabled for binaryen targets.
>
> Original change's description:
> > [dart2wasm] Include wasm-opt in the shipped dart-sdk.
> >
> > Change-Id: Ib224f0b92fa28019ad3cf67d7ba2bef5c31b92ef
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280840
> > Reviewed-by: Martin Kustermann <kustermann@google.com>
> > Commit-Queue: Jackson Gardner <jacksongardner@google.com>
> > Reviewed-by: Aske Simon Christensen <askesc@google.com>
>
> Change-Id: I76bf4ad5d1f6a8116631df4b91cbc5a52cac4f31
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283240
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Jackson Gardner <jacksongardner@google.com>

TBR=kustermann@google.com,askesc@google.com,joshualitt@google.com,jacksongardner@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: Iee8e909d701d22abac00d199dee7591bf9bf5f7a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283560
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-02-16 09:07:35 +00:00
Stephen Adams 15b77bb03c [dart2js, js_runtime] Check against expando properties on records
Passing: co19/LanguageFeatures/Records/expandos_A01_t01

Change-Id: I65fbb124dd44cb1dc06089d4f6e7f7f9f9389f64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283243
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-02-15 19:54:17 +00:00
Jackson Gardner b19091385a Reland "[dart2wasm] Include wasm-opt in the shipped dart-sdk."
This is a reland of commit 6271d26baf

The change broke the gcc riscv64 builders, due to a `unused-variable`
warning coming from binaryen sources. That warning has now been
disabled for binaryen targets.

Original change's description:
> [dart2wasm] Include wasm-opt in the shipped dart-sdk.
>
> Change-Id: Ib224f0b92fa28019ad3cf67d7ba2bef5c31b92ef
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280840
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Jackson Gardner <jacksongardner@google.com>
> Reviewed-by: Aske Simon Christensen <askesc@google.com>

Change-Id: I76bf4ad5d1f6a8116631df4b91cbc5a52cac4f31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283240
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
2023-02-15 19:09:07 +00:00
Joshua Litt c9155cc612 [js_types] Add JSPromise and JSVoid.
CoreLibraryReviewExempt: Changes to Web specific libraries.
Change-Id: I71cc720dcf1cea3ca8a219259ccd35912ed00d9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282940
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-02-15 17:03:28 +00:00
Srujan Gaddam c50a40988a [dart:js_interop/pkg:js] Allow interop on typed_data, errors, and Array
Closes https://github.com/dart-lang/sdk/issues/50899

Allows users to interop with types that have been bound to @Native
types on the JS backends, error types that have been bound in DDC,
and the JS Array type.

Change-Id: Ic28a60127e558eb8bb017595ac54a43920a500c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282483
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-02-13 19:47:25 +00:00
Alexander Markov 20acd94a88 [vm] Fix type of _FfiAbiSpecificMapping.nativeTypes
This field was incorrectly typed as List<Object>, but FFI kernel
transformation put a constant of List<Type?> there. With sound
null safety List<Type?> is not assignable to List<Object>, which
was flagged by an assertion during hot reload.

TEST=ci (ffi tests on vm-reload-linux-debug-x64)
Fixes https://github.com/dart-lang/sdk/issues/51216

Change-Id: Ic6060183525036aecba0bfc51cfb7283ed7b1aeb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282760
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-02-13 18:52:40 +00:00
Joshua Litt 92112d046a [js_types] Add js_types to libraries.dart.
Change-Id: I013a1f27a29c29dfacb0c04f5d4b48dbd9ac7be2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282560
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Auto-Submit: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-02-13 18:28:58 +00:00
Ömer Sinan Ağacan c5eda0430f [dart2wasm] Implement records
This generates a class for every record shape in the program. Record
shape classes with the same number of fields share the same Wasm struct.

(Shape is number of positional fields + set of names of the named
fields)

Summary of the changes:

- A new kernel pass runs right before TFA and generates record shape
  classes for every record literal and type in the program, one class
  per shape.

  A class for a record shape has the name `Record_N_a_b_...` where `N`
  is the number of positional fields, and `a_b_...` is the `_` separated
  names of the named fields.

  For example, class for a record `(1, a: 'hi', false)` is:

  ```
  @pragma('wasm:entry-point')
  class Record_2_a {
    @pragma('wasm:entry-point')
    final Object? $1;

    @pragma('wasm:entry-point')
    final Object? $2;

    @pragma('wasm:entry-point')
    final Object? a;

    @pragma('wasm:entry-point')
    Record_2_a(this.$1, this.$2, this.a);

    @pragma('wasm:entry-point')
    _Type get _runtimeType =>
      // Uses of `runtimeType` below will be fixed with #51134
      _RecordType(
        const ["a"],
        [$1.runtimeType, $2.runtimeType, a.runtimeType]);

    @pragma('wasm:entry-point')
    Type get runtimeType => _runtimeType;

    @pragma('wasm:entry-point')
    String toString() => "(" + $1 + ", " + $2 + ", " + "a: " + a + ")";

    @pragma('wasm:entry-point')
    bool operator ==(Object other) {
      if (other is! Record_2_a) return false;
      if ($1 != other.$1) return false;
      if ($2 != other.$2) return false;
      if (a != other.a) return false;
      return true;
    }

    @pragma('wasm:entry-point')
    int hashCode => Object.hash(shapeID, $1, $2, a);
  }
  ```

  `shapeID` in `hashCode` is unique to the class. It's not stored in the
  structs, only used in `hashCode` code.

  Field gets in members (`this.$1` etc.) are compiled to `struct.get`s
  as they're single target.

  `toString` currently does not use a buffer. This will be fixed in a
  separate CL.

  `entry-point` pragmas needed because there are no references from the
  program to these classes, but we want to consider them as potential
  targets.

- When generating class infos, we have a special case for records to use
  the same struct for records with the same number of fields.

- Code generator for record expressions get the record shape from the
  record type, and uses the struct type for the record.

- `ProcedureAttributesMetadata` uses in dispatch table needs a special
  case for records. This is becuase as far as TFA concerned there's no
  connection from the program to the record shape class fields, so the
  it considers record shape class fields as not dynamically called.

Fixes #50014.

Change-Id: Ie8338a0917d51984a9e32e755ccdaa2783a8e2ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280461
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-02-13 14:59:09 +00:00
Joshua Litt 13b24aeedd [js_interop] Change conversion functions to be getters.
CoreLibraryReviewExempt: Internal refactoring of a not yet used library.
Change-Id: Iad62b0d4a7fc4df0c710f6ba0dd7c9b21b6a6fef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281868
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-02-10 20:08:53 +00:00
Tess Strickland 2c0484c720 [pkg/vm] Initial work on constant operating system fields and getters.
* Add an `targetOS` argument to `pkg/vm`'s `compileToKernel`,
  that contains the target operating system's name.

* Add a new `--target-os` command line argument for all binaries
  that use `compileToKernel` for clients to provide the target
  operating system, if known.

* Add a new`"vm:platform:const"` annotation to certain field and
  getters in the Platform class.

  This annotation is used to annotate static getters and fields with
  initializers where the getter body or field initializer must evaluate
  to a constant value if the target operating system is known. This
  annotation may be used outside the Platform class and in user code.

  For example, this annotation can be used on a static `String` field
  that is initialized with one value if `Platform.isWindows` is true
  and to a different value if `Platform.isWindows` is false.

  Note: If the const functions experimental flag is disabled, then
  any annotated static methods can only contain a single expression
  whose value is returned. If it is enabled, then the static method
  is evaluated as if it is a const function with the special
  handling of annotated static fields and getters above.

* Create a VM constant evaluator that evaluates uses of static getters
  and fields marked with the above annotations when a target operating
  system is provided.

* Use the new VM constant evaluator in the unreachable code elimination
  transformer.

TEST=pkg/vm/test/transformations/platform_use_transformer
     pkg/vm/test/transformations/unreachable_code_elimination

Change-Id: Ie381de70486a767fd7b1d515fd9e6bb58c6bf090
Bug: https://github.com/dart-lang/sdk/issues/31969
Cq-Include-Trybots: luci.dart.try:pkg-linux-release-try
CoreLibraryReviewExempt: Just adding vm-specific annotations.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274386
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-02-10 16:29:50 +00:00
Joshua Litt 130903685d [dart2wasm] Avoid implicitly internalizing WasmExternRef.
CoreLibraryReviewExempt: Wasm only changes.
Change-Id: I0e0a6cddffa1c7f2d7c74779f480dd10bf509c1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279268
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-02-10 16:22:47 +00:00
Srujan Gaddam e6e1040afc [dart:js_interop] Expose dart:_js_interop
Types still need to be sealed, so this library is exposed with a
disclaimer that users should not subtype any types.

CoreLibraryReviewExempt: Backend-specific library for JS and Wasm.
Change-Id: I2ed8b0db6b2de60932a551047c6c9eae4a34ce2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281343
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-02-10 01:41:50 +00:00
Michael Thomsen 6194adf8ea Cross-link from Exception to Error
Change-Id: I6179032ac6cfd1057911e7421843475504974850
CoreLibraryReviewExempt: Documentation only.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282024
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2023-02-09 14:15:09 +00:00
Aske Simon Christensen 321f2e9b65 [dart2wasm] Implement sync*
This is an implementation of `sync*` via two main mechanisms:

- The closure context infrastructure is used for preserving local
  state. All local variables in `sync*` functions are implicitly
  captured in the contexts even if they are not captured by a lambda.

- Suspension and resumption of the body is implemented via a state
  machine as a switch in a loop. This allows for an arbitrary control
  flow graph that can be resumed at any point. A subclass of the code
  generator generates control constructs containing any `yield` or
  `yield*` statements as jumps around this CFG while delegating the
  rest of the code generation to the normal member code generator.

This version does not support `switch` or `try` inside a `sync*`
function. Support for these statements will be added later.

Change-Id: Iec8236f64500d823f574aa628ddb0d22fe4ac2d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280166
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-02-09 11:07:01 +00:00
William Hesse a9fe60b1f9 Revert "[dart2wasm] Include wasm-opt in the shipped dart-sdk."
This reverts commit 6271d26baf.

Reason for revert: The build is broken on linux-riscv64 with this change.

Original change's description:
> [dart2wasm] Include wasm-opt in the shipped dart-sdk.
>
> Change-Id: Ib224f0b92fa28019ad3cf67d7ba2bef5c31b92ef
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280840
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Jackson Gardner <jacksongardner@google.com>
> Reviewed-by: Aske Simon Christensen <askesc@google.com>

TBR=kustermann@google.com,askesc@google.com,joshualitt@google.com,jacksongardner@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I520d9be6d43b55551694a58a22c0ae8ae3e7344f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281802
Commit-Queue: William Hesse <whesse@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2023-02-08 19:24:46 +00:00
Jackson Gardner 6271d26baf [dart2wasm] Include wasm-opt in the shipped dart-sdk.
Change-Id: Ib224f0b92fa28019ad3cf67d7ba2bef5c31b92ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280840
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-02-08 18:51:48 +00:00
Joshua Litt bd79be0e19 [js] Move allowInterop functions to dart:js_util.
CoreLibraryReviewExempt: Has core library owners approval.
Change-Id: Iea2f2e707c69c9082e158b48b50dcaf4a7b01067
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279740
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-02-08 17:16:20 +00:00
Ömer Sinan Ağacan 73ee6d53a0 [dart2wasm] Attach stack traces to Error subtypes on throw
This implements this part of the language spec (section 17.10):

> If v is an instance of class Error or a subclass thereof, and it is
> the first time that Error object is thrown, the stack trace t is
> stored on v so that it will be returned by the stackTrace getter
> inherited from Error.

New passing tests:

- co19/Language/Expressions/Throw/stack_trace_t01
- co19/LibTest/core/Error/stackTrace_A01_t01
- co19/LibTest/core/IndexError/stackTrace_A01_t01
- corelib/error_stack_trace_test/none
- corelib/error_stack_trace_test/nullThrown
- language/stack_trace/error_runtime_test

Fixes #50608

Change-Id: I1d7df2337cce1be3ecbab0180def5769b8fe3e68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279966
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-02-08 14:53:36 +00:00
Mayank Patke b028da6407 [dart2js] Add a 'FALSE' JS_GET_FLAG.
There are a few places in our runtime libraries where we have some code
guarded by `if (false)`. This is to ensure that the guarded code is
marked as used and compiled, but not emitted unless rewritten during
SSA. This pattern is somewhat brittle - a kernel
optimization/transformation which eliminates dead code may discard the
code.

Instead, we can write `if (JS_GET_FLAG('FALSE'))`, which will only be
written to `if (false)` and then discarded during SSA.

Change-Id: I8edc2b24e5fbeece1f042ff3d0c87d58e939bf84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271800
Reviewed-by: Stephen Adams <sra@google.com>
2023-02-07 20:07:57 +00:00
Ryan Macnak 09c9301ca0 [vm] Weakly cache all RegExp per isolate group, instead of strongly caching 256 RegExp per isolate.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/51228
Change-Id: Ie2869585ae847ea154460122d7ec5af81ef7697c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280521
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-02-06 21:49:07 +00:00
Daco Harkes 3d02f6debd [vm/ffi] Deprecate FfiNative
Bug: https://github.com/dart-lang/sdk/issues/50097
Change-Id: I8d555e27167d13d21d88a2961a0501155119409b
CoreLibraryReviewExempt: Isn't used in dart2js, is used in dart2wasm.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279514
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-02-06 11:47:43 +00:00
Nicholas Shahan d00acae4ae [ddc] Remove old dwds versions fallback support
The dart:developer APIs `registerExtension()` and `postEvent()` no
longer write directly to the console.

Fixes: https://github.com/dart-lang/sdk/issues/48103
Change-Id: I41ee807eb376abbac87d0f353dde22bebd732faa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279233
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-02-04 04:09:48 +00:00
Joshua Litt 99a9f3d516 [js_types] MVP of JS types.
Change-Id: Ic329146a270ff32fc2cdb32febc6f574bc81792f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280131
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-02-02 21:29:01 +00:00
Dan Chevalier deca6a66e7 Reland "Update HTTP Profiling ids to use Strings"
This is a reland of commit e7d8261f9a




Original change's description:
> Update HTTP Profiling ids to use Strings
>
> The internal Dart Ids can be 64 bit integers, and are passed to Dev Tools as integers. This is causing errors fetching requests as the ids can overflow once they get to dev tools.
>
> Interaction between `getHttpProfile` and `getHttpProfileRequest` are already performed in https://dart-review.googlesource.com/c/sdk/+/279122/3/pkg/vm_service/test/get_http_profile_test.dart
>
> https://github.com/flutter/devtools/issues/2860
>
> TEST=The original tests test the surface of the RPCs that are updated here. Any tests that needed tweaking have also been fixed. https://github.com/flutter/devtools/pull/5127 is being submitted to Devtools and G3, and the regressions have been tested against vm_service:10.0.0 and vm_service:11.0.0
> CoreLibraryReviewExempt: Changes are only to http profiling
> Change-Id: Ie560dde7629f91f4221c1fe18d153cd999691086
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279122
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Dan Chevalier <danchevalier@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

TEST=The original tests test the surface of the RPCs that are updated here. Any tests that needed tweaking have also been fixed. https://github.com/flutter/devtools/pull/5127 is being submitted to Devtools and G3, and the regressions have been tested against vm_service:10.0.0 and vm_service:11.0.0
CoreLibraryReviewExempt: Changes are only to http profiling
Change-Id: I132f30111ca9c4c53dec377f6038453cacfc6243
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280020
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Dan Chevalier <danchevalier@google.com>
2023-02-02 19:22:49 +00:00
Aske Simon Christensen bc31fe4903 [dart2wasm] Enable values to be returned from void functions.
Since Dart `void` can actually carry values, functions with `void`
return type are translated into Wasm functions returning the Dart
object top type instead of an empty output type list.

Only constructors, setters and imports/exports with void return type
are now given empty output type lists in their Wasm signatures. A new
low-level `WasmVoid` type is added to the internal Wasm types for
specifying explicitly that a Wasm function should have an empty list
of outputs.

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

CoreLibraryReviewExempt: Only changes Wasm-specific libraries.
Change-Id: I9562248f94e75a60142fd1af0136183aa288b98b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279971
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-02-02 12:08:30 +00:00
Ömer Sinan Ağacan da7520e059 [dart2wasm] Tweak toString and runtimeType of Float32x4 types
New passing tests:

- co19/LibTest/typed_data/Float32x4List/join_A01_t01
- co19/LibTest/typed_data/Float32x4List/join_A01_t02
- co19/LibTest/typed_data/Float32x4List/runtimeType_A01_t01

Change-Id: Ia826a9337ff55efa8cc21cad101c0da9e10086e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280162
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-02-01 17:07:40 +00:00
Anna Gringauze 6387f7345a Fix incorrect record types
- Access record elements starting from 1 when creating record type.
- Add record tests for the expression compiler.

Closes: https://github.com/dart-lang/sdk/issues/51197
Change-Id: I02af94a1f09cbcb9801b6b3a5b0effdfd33aab2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280204
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2023-02-01 01:56:38 +00:00
Stephen Adams 18cee8078a [dart2js] Implement get runtimeType for records.
Change-Id: I5befb8a499e0bfc9acd884189317f4da19fab750
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280046
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2023-01-31 19:44:48 +00:00
Brian Quinlan 252015b30b [io] Fix a bug where large reads would return partial data.
Bug: https://github.com/dart-lang/sdk/issues/51071
Change-Id: Ia64d803c9709b106e52a1c671c1c3288c051bd85
Tested: ci + new test
CoreLibraryReviewExempt: bug fix only for vm
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279204
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-01-31 18:41:39 +00:00
Aske Simon Christensen 2791714592 [dart2wasm] Share date_patch with the VM
Tested: ci
Change-Id: I0ef65dee7a8c8a352df0168c77b78d78db6a930b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280096
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-01-31 17:46:53 +00:00
Aske Simon Christensen bc1e3c3bf9 [dart2wasm] Share string_buffer_patch with VM
Tested: ci
Change-Id: I6852668c2f668a1a26142c364e727db1ee70b283
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280092
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-01-31 17:46:53 +00:00
Ömer Sinan Ağacan 225651db91 [dart2wasm] Tweak closure toString member
New passing tests:

- language/function/local3_test
- language/function/local_function_test

Change-Id: I3906cf666d82a8f6aeabcbdcab3eb15323cf2e2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280116
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-01-31 17:23:41 +00:00
Ömer Sinan Ağacan 27aeca0106 [dart2wasm] Tweak _FunctionType.toString
New passing tests:

- co19/LanguageFeatures/Constructor-tear-offs/summary_A03_t04
- corelib/type_tostring_test
- language/generic/closure_test/01
- language/generic/function_bounds_test/02
- language/generic/function_dcall_test/01
- language/private/method_tearoff_test
- language/regress/regress34034_test
- language/type_object/literal_type_literal_test
- language/type_object/runtime_type_function_test

Change-Id: Ief7832a7393fbcc0e56ec0319ad1d4e2e66c71b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280113
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-01-31 17:15:53 +00:00
Srujan Gaddam 821d85e661 [dart:_js_interop] Expose a interop type for JS objects
Moves JSObject to dart:_js_helper, so that JavaScript objects
can be used with that type in the JS backends. The type then
gets reexported in dart:_js_interop with a typedef.

This is purely for experimentation. This class needs to be sealed
before we can publish this library.

Change-Id: I16093165deaa5bc5d7940eb0cb98da32c36e485a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278894
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-01-30 20:01:37 +00:00
Josh Soref 77978889eb Spelling
Closes https://github.com/dart-lang/sdk/pull/51143

GitOrigin-RevId: 9e21c99a222d588e4fc95980725a2f8c9784965c
Change-Id: If0870e8936c7649935dce7e23cd783d62aa5610c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279916
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-01-30 18:29:59 +00:00
Ahmed Ashour 63180b95ed Remove superfluous words.
Fixes #51095

TEST=ci

CoreLibraryReviewExempt: There are no API changes, just removal of superfluous words in the comments.
Change-Id: Ib1020c62fe6baed5ca68f0074323f025cc90e9f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279500
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-01-30 15:58:38 +00:00
Aske Simon Christensen 531b2afcb5 [dart2wasm] Implement weak APIs via delegation to JS
Implement `Expando`, `Finalizer` and `WeakReference` via delegation to
the JS `WeakMap`, `FinalizationRegistry` and `WeakRef`, respectively.

The tests don't check that the finalizer callback is actually called,
since this is nondeterministic. I've manually verified that the
callback can be triggered by allocating a lot.

Change-Id: If6c440a0d52aaf7afca34238f843fd10b202c143
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279718
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-01-30 11:12:04 +00:00
Lasse R.H. Nielsen bee7ab2b32 Make record positional field getters start at $1.
An update for co19 is available at https://github.com/dart-lang/co19/pull/1759

TEST=Existing tests run after change, two new tests for edge cases.

Change-Id: I408e398d532ba2c2e8e60777bb4f7bd0057e27fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278912
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-01-30 08:14:28 +00:00
Stephen Adams a7d87375a3 [dart2js] Implement is-tests on records.
A `RecordsCodegen` class collects the instantiated classes for
representing records of various shapes in the codegen queue.  Later,
this is used to emit functions that test a record type by checking the
shape (using `instanceof`) and then testing the field values.

Future work will consider how to make this work with deferred loading.

Change-Id: I497a80b0db3a10129f15838eaa72c3a2320632b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279759
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2023-01-27 20:24:20 +00:00
Brian Quinlan 357caf6697 [io] Remove obsolete TODO comment in Abi.values
Bug:https://github.com/dart-lang/sdk/issues/51103
Change-Id: I737c17e06a346bba138133e78871a2919f8073ea
CoreLibraryReviewExempt: Documentation-only change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279462
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-01-27 19:53:33 +00:00
Alexander Aprelev bb63927fed [vm/regexp] Follow-up to RegExp sharing change 438b81c4f2.
Avoid ZoneHandles unless needed, use field initializer, few more nits.

This is based on feedback on https://dart-review.googlesource.com/c/sdk/+/279747.
TEST=ci

Change-Id: I59b462ca70a912b270b089fb114d6029b7fa5856
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279903
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-01-27 00:43:59 +00:00
Nicholas Shahan d56b9b3988 [ddc] Remove unsound .dill files from SDK
Dart 3 requires all code to be null safe.

Compiling with --no-sound-null safety requires manually passing
an unsound SDK outline. This is no longer provided by default
and is not packaged with the SDK at all.

Fixes: https://github.com/dart-lang/sdk/issues/50700
Change-Id: Ic4bd7dc5e96b42c7c10a29f273371c6a680936f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278999
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-01-26 22:34:38 +00:00
Joshua Litt a64b34d3f3 [dart2wasm] Use static interop to implement regexp helpers.
This CL also adds changes how static interop objects are interpreted at the interop boundary. Previously, static interop objects were dartified / jsified like everything else. Now, they are simply boxed.

With this approach, users can now use `Object` when they want conversions and static interop objects when they don't(assuming these objects originate in JS, Dart objects are always fully converted).

Change-Id: I40b31bfb826e4963a34eaa373574c136e13b9009
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279451
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-01-26 17:03:40 +00:00
Oleh Prypin 74849bae46 Revert "Update HTTP Profiling ids to use Strings"
This reverts commit e7d8261f9a.

Reason for revert: will not be able to roll devtools_app (at least in google3) with this backwards-incompatible change

Original change's description:
> Update HTTP Profiling ids to use Strings
>
> The internal Dart Ids can be 64 bit integers, and are passed to Dev Tools as integers. This is causing errors fetching requests as the ids can overflow once they get to dev tools.
>
> Interaction between `getHttpProfile` and `getHttpProfileRequest` are already performed in https://dart-review.googlesource.com/c/sdk/+/279122/3/pkg/vm_service/test/get_http_profile_test.dart
>
> https://github.com/flutter/devtools/issues/2860
>
> TEST=The original tests test the surface of the RPCs that are updated here. Any tests that needed tweaking have also been fixed
> CoreLibraryReviewExempt: Changes are only to http profiling
> Change-Id: Ie560dde7629f91f4221c1fe18d153cd999691086
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279122
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Dan Chevalier <danchevalier@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

TBR=bkonyi@google.com,asiva@google.com,sigmund@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com,danchevalier@google.com

Change-Id: I9b6c9ec1cb00cca56816959fc83a70ec35ac9b21
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279980
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Auto-Submit: Oleh Prypin <oprypin@google.com>
2023-01-26 16:42:26 +00:00
Aske Simon Christensen 2e16241998 [dart2wasm] Specialized Map and Set for default equals and hashCode
Change-Id: I52ca1e6d5859af4f84b7990ed85d9680aaaca33d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279164
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-01-26 15:35:18 +00:00
Dan Chevalier e7d8261f9a Update HTTP Profiling ids to use Strings
The internal Dart Ids can be 64 bit integers, and are passed to Dev Tools as integers. This is causing errors fetching requests as the ids can overflow once they get to dev tools.

Interaction between `getHttpProfile` and `getHttpProfileRequest` are already performed in https://dart-review.googlesource.com/c/sdk/+/279122/3/pkg/vm_service/test/get_http_profile_test.dart

https://github.com/flutter/devtools/issues/2860

TEST=The original tests test the surface of the RPCs that are updated here. Any tests that needed tweaking have also been fixed
CoreLibraryReviewExempt: Changes are only to http profiling
Change-Id: Ie560dde7629f91f4221c1fe18d153cd999691086
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279122
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Dan Chevalier <danchevalier@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-01-26 15:08:56 +00:00
Vyacheslav Egorov 4482709d45 [vm] Mark ListMixin.iterator with prefer-inline
This helps to improve the code quality in for-in loops
where iterable has a known List type.

Closes https://github.com/dart-lang/sdk/issues/48433

Tested: tests updated due to line number changes in list.dart
CoreLibraryReviewExempt: no public API changes
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-product-x64-try
Change-Id: Ia5d815009a699061961c331cf43e68d2c96fc58b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279518
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-01-26 10:16:51 +00:00
Josh Soref 01b28894e7 Spelling pkg dev compiler
Closes https://github.com/dart-lang/sdk/pull/50861

GitOrigin-RevId: 71005e6f5bf5a151cb5c1aefb6a2a300fc40f592
Change-Id: Iadfafb5787a62e9a379437f6a3763d31f99ba7c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277743
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-01-26 09:12:41 +00:00
Joshua Litt 8a7dd221ad [dart2wasm] Generate the bulk of the JS runtime at compile time.
Change-Id: Ib5f9bdedcda4a4ba305d7eea2e6c127f815582ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279640
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-01-25 20:19:08 +00:00
Josh Soref ef42a0b110 Spelling pkg analyzer lib
Closes https://github.com/dart-lang/sdk/pull/50860

GitOrigin-RevId: b27066c37f93c8c6d1123d6ebd6a4c0afcf59844
Change-Id: I15fa4aea1dad45daf168e34d1c4450320ec9b40a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277742
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-01-25 14:08:27 +00:00
Joshua Litt d568a20906 [dart2wasm] Support tree shaking the JS runtime.
Change-Id: I1a2cd7aa384a1ead55888323987d218857f0e8fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279062
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-01-24 21:43:10 +00:00
Chris Evans 0b8ab17feb Fix analyze_snapshot tests and build configuration
Updated strictness on build configuration for analyze_snapshot
Will run only under Linux/Android 64 bit arm, arm64c, simarm64,
simarm64c and x64 architectures.

analyze_snapshot just has a single target that links into product precompiled programatically

Testing suite updated to comply with null-safety requirements and
fix for simulated platform failing to use gen_snapshot with assembly.
TEST=ci
Change-Id: I3d58400db2e26a441a40fe7197b22510a52732b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279391
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Chris Evans <cmevans@google.com>
2023-01-24 14:07:26 +00:00
Joshua Litt b89568f77c [dart2wasm] Add inline JS helper.
Change-Id: I65531038fd691ea64dc2ea47929b7ac9ead2f4e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274140
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-01-23 19:33:34 +00:00
Josh Soref ba15a61271 Spelling build
Closes https://github.com/dart-lang/sdk/pull/50859

GitOrigin-RevId: 7b056018c2925745701bdecdd7da325d9458204d
Change-Id: Iff037d773713bf73efde6951599becfd7297b921
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277740
Reviewed-by: Alexander Thomas <athom@google.com>
2023-01-23 08:56:14 +00:00
Alexander Thomas b9b6511ca6 Spelling sdk
Closes https://github.com/dart-lang/sdk/pull/50918

Co-authored-by: Josh Soref <jsoref@gmail.com>
GitOrigin-RevId: 1fd275051c561b63d374fb47e76a22424c4a12a9
Change-Id: I97790d9c79ff659f2c1fa2d2d46d041fe67957cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278530
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2023-01-20 12:37:49 +00:00
Beesafe a675b7e005 Doc: Fix typo in comments
Closes https://github.com/dart-lang/sdk/pull/51077

GitOrigin-RevId: cf43719c3f5aa6b551b2906994797c9e79fe2bf8
Change-Id: I45d5864703e5a68d635a5b9aa8881060d6b2bb12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279330
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-01-20 12:03:58 +00:00
Daco Harkes 6ef57b86c1 [vm/ffi] Support varargs
This CL introduces `VarArgs` to `NativeFunction` signatures. The
`VarArgs` type takes a single type argument. This type argument is a
subtype of `NativeType` if there is a single variadic argument, and a
record with native types if there are multiple variadic arguments.
For example:
`NativeFunction<Void Function(Pointer<Char>, VarArgs<(Int32,Int32)>)>`
for calling refering to a `printf` binding with two `int32_t` arguments
passed as variadic arguments.

The logic of the native calling conventions are detailed in
https://dart-review.googlesource.com/c/sdk/+/278342.
Here we explain how this influences the FFI pipeline.

First, now that `VarArgs` is part of signatures, we have to unwrap
that when with the C types in the CFE transform and checking (analyzer
is in a separate CL), and also in the marshaller when looking up the
C type of arguments.

Second, we have to deal with `BothNativeLocations`. On windows x64,
floating point arguments must be passed both in FPU _and_ CPU
registers. For FFI calls, we solve this in the argument moves by just
copying to both locations. For FFI callbacks, we just take the FPU
register location (which avoids an extra bitcast).

Third, on System-V, we have to pass an upper bound of the number of
XMM registers used in AL. This means we instead RAX, we use R13 for the
target address. For variadic calls, we always pass 8 in AL as the valid
upper bound. We could consider passing the actual number of XMM
registers used.
We keep using RAX as default register for the function address on non-
variadic calls, because changing to R13 (the first free) register
creates more spilling in leaf calls. R13 is callee-saved while RAX is
not, so using R13 instead of RAX causes us to have to spill the value
from RAX on leaf calls.

Fourth, on both x64 and RISC-V, we pass floats in integer locations.
`EmitNativeMove` has been modified to deal with this, so that we do not
have to insert more `BitCastInstr`s.

The tests are generated by a test generator: `tests/ffi/generator/`.

The formatter doesn't support records yet, so the tests are not properly
formatted.
Bug: https://github.com/dart-lang/sdk/issues/50798

TEST=tests/ffi/*_varargs_*

Closes: https://github.com/dart-lang/sdk/issues/38578
Closes: https://github.com/dart-lang/sdk/issues/49460
Closes: https://github.com/dart-lang/sdk/issues/50858

Change-Id: I6a6296fe972527f8a54ac75a630131769e3cc540
Cq-Include-Trybots: luci.dart.try:vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-win-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-nnbd-win-release-ia32-try,vm-kernel-nnbd-win-debug-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-kernel-precomp-android-release-arm64c-try,vm-kernel-precomp-android-release-arm_x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,app-kernel-linux-debug-x64-try,vm-kernel-mac-release-arm64-try,vm-kernel-nnbd-mac-debug-arm64-try,vm-kernel-nnbd-mac-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276921
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-01-20 10:30:41 +00:00
Joshua Litt d844eee251 [dart2wasm] Specialize callback wrappers.
Change-Id: I25dd953af21b14f64d9a61fbf51095a74a800e33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273080
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-01-20 01:08:51 +00:00
Ryan Macnak e210ee3577 [vm] Internal-only String.intern.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/50648
Change-Id: I02e89c0def9913f12bf7fdd2ef8f3ff6cba231e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278808
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-01-19 17:49:08 +00:00
Daco Harkes 68ee427e60 [vm/ffi] Undeprecate FfiNative
Removing the @Deprecated annotation for now so we get a chance to
migrate Flutter without its build failing due to analysis errors.

Bug: https://github.com/flutter/flutter/issues/118794

Change-Id: I8ddf2b0ec9dc59ee22e281b38d705f294be211d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279358
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-01-19 16:36:40 +00:00
Riley Porter 329cb2088a [js_util] Add unsignedRightSift operator to js_util
Change-Id: Ibbf10bc5428e01e9f2bca24cf99489b186c7ba9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278995
Commit-Queue: Riley Porter <rileyporter@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-01-19 03:16:33 +00:00
Daco Harkes d2ef97258c [vm/ffi] Replace FfiNative with Native
See API design discussion in bugs below.

TEST=tests/ffi/native_assets/*

Design doc: http://go/dart-native-assets

Bug: https://github.com/dart-lang/sdk/issues/49803
Bug: https://github.com/dart-lang/sdk/issues/50097

Change-Id: Id6e6eb94c6eb39ccaaa637448583a40ab6110d12
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-debug-x64c-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265084
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-01-18 21:08:38 +00:00
Danny Tuppeny 4fdbe1b47d [dds] Pass existing DDS URI in existingDdsInstance exception
Work towards a better fix for https://github.com/flutter/flutter/issues/118609.

Change-Id: I7db8bd74cc272a2bb1df3a04e6f1d7b82b877ddb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279175
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-01-18 20:36:07 +00:00
Aske Simon Christensen 46f3efb8eb [dart2wasm] Inlined and optimized some int and double operations.
In particular functions that will benefit from the subsequent unboxing
and value propagation by Binaryen are marked for inlining.

Change-Id: Id131de47b42af11f17e227003ee828eb02c5d3cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279097
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-01-18 13:37:22 +00:00
Ömer Sinan Ağacan 15c1801eb2 [dart2wasm] Check typed array lengths on allocation
Change-Id: Ie141665b87a4e6923fc799cab97391c10e83230b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279088
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-01-18 11:49:26 +00:00
Ömer Sinan Ağacan 5037cc9536 [dart2wasm] Remove duplicate RangeError.checkValidRange implementation
Change-Id: Iaaa969ad21fa70a83b880f43421f381eb1113298
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279160
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-01-18 10:01:46 +00:00
Ömer Sinan Ağacan 1294fef2bb [dart2wasm] Fix toString of _NaiveInt32x4
Change-Id: I7f091a729c41b94dcf1dc16b643af38c14eab12d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279098
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-01-18 09:04:27 +00:00
Ömer Sinan Ağacan a74dc549cb [dart2wasm] Add more runtime type overrides to typed data lists
Change-Id: I58337c28b8b2ec8767b11952c18c28060573f608
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279090
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-01-18 09:00:38 +00:00
Nicholas Shahan 1b2ecbda40 [ddc] Cleanup JavaScript files in packaged SDK
- Removes all versions of `dart_sdk.js` and `dart_sdk.js.map` from the
  packaged SDK. All supported build systems compile their own versions
  of these files.
- Removes `dart-sdk/lib/dev_compiler/kernel/common/run.js`.
  No supported build system uses the "common" module system.
- Moves `dart-sdk/lib/dev_compiler/kernel/amd/require.js` to
  `dart-sdk/lib/dev_compiler/amd/require.js` cleaning up the
  unnecessary `kernel/` sub-directory.

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

Change-Id: Id4173ddec31a6c0260009924bf1e1ae3d3f32abf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275482
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-01-18 01:34:57 +00:00
Nicholas Shahan c140324e1e [ddc] Rename .dill files
- Makes the names consistent with dart2js and dart2wasm.
- Prepares for the upcoming removal of the weak null safety .dill file.

Change-Id: Idcf694b27cd4731db8f7ed6f0fdab7766ced08a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277183
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2023-01-18 01:34:57 +00:00
Brian Quinlan 3ee9c0b792 Document that Socket.addError throws.
Bug:https://github.com/dart-lang/sdk/issues/31504
Change-Id: Ib9f9b0fb2844b92fe5375da9b843b1d9777a936a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278947
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-01-17 23:22:35 +00:00
Aske Simon Christensen 5d77ea8cfe [dart2wasm] Use #ClosureBase as representation type for Function.
Also renamed the `_Function` class to `_Closure` and fixed the name of
closure structs so they aren't all called `#ClosureBase`.

Change-Id: I6b55cb9827fdffac751dfc3043f3a36e7a18f225
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279091
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-01-17 11:58:16 +00:00
Srujan Gaddam 572d545c72 [dart:_js_interop] Add dart:_js_interop
Adds dart:_js_interop for use in the web backends. This library
only exports dart:_js_annotations' @JS for now. In the future,
we'll add more to this library and mark it public. Also refactors
some tests to use dart:_js_interop.

Change-Id: I7b60c950a39038a586756b7c9c10c6e31f1ab4cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278694
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-01-16 22:31:33 +00:00
Srujan Gaddam b9002bfe55 [ddc] Inline js_util transformation methods
There are a number of js_util methods that we use for transformations e.g.
_getPropertyTrustType. In order to avoid unnecessary method calls, we inline
them directly in DDC here. This includes:

- _getPropertyTrustType
- _setPropertyUnchecked
- _callMethodUnchecked*
- _callConstructorUnchecked*

Change-Id: I7f6905ec1daadcf5228eafde4fda5d435d6c8b23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277661
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-01-16 22:31:33 +00:00
Ömer Sinan Ağacan 215df346bb [dart2wasm] Implement Function.apply
Fixes #50925

Change-Id: Ica2ad021c2617317fd56bf7c2f0bf6da713697bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278749
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-01-16 17:10:09 +00:00
Ömer Sinan Ağacan c1d75a63ab [dart2wasm] Override runtime types of typed data lists
Change-Id: I96b156311c974966af6a69ebdbe5f19e80abd9bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279083
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-01-16 14:00:11 +00:00
Brian Quinlan 3571b97b24 [win/io] Fix a bug where RawDataSocket would send truncated data on Windows.
Bug:https://github.com/dart-lang/sdk/issues/31873
Change-Id: I8856bad941330f24671fc2c61af736fc54cd9459
Tested: unit tests
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278981
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-01-13 20:36:55 +00:00
Joshua Litt 9447b6cc51 [dart2wasm] Remove static dart2wasm JS runtime.
Change-Id: Id1f656a90f09ab28b99ab637f80c025521eeae74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278695
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-01-13 01:19:18 +00:00
Ben Konyi a1f64f41f5 [ VM Service ] Add _serveObservatory private RPC
Allows for VM service clients to tell the service to serve Observatory
at runtime. This will enable `flutter attach` to enable Observatory when
connecting to an existing Flutter application that is not serving
Observatory.

TEST=run_test.dart

Change-Id: Iae20b603c15bdb1d3f6d4b9b07d98638abfe2d00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278941
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-01-12 19:38:02 +00:00
Aske Simon Christensen b8f0fda3dd [dart2wasm] Switch to the new WasmGC test/cast instructions
Also implements various related changes to the WasmGC spec:
- Remove `dataref` and add `structref` and `arrayref`.
- Use new encoding for `array.len` without immediate.

Change-Id: Ic1ba67fad694c453fbdae277f5a7e4c94695977f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266200
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-01-12 14:08:56 +00:00
Ömer Sinan Ağacan f4200fed2b [dart2wasm] Implement vtable entries for dynamic calls
This adds a new vtable entry for dynamic applications.

This entry point has two use cases:

- Implemented in this CL: dynamic closure applications.
- Not implemented in this CL: `Function.apply`.

The entry point type is defined in `dynamicCallVtableEntryFunctionType`.
It takes 4 arguments:

- The closure
- Dart lists for type, positional, and named arguments

The lists have the same type and format (name, value pairs for named
arguments) as dynamic forwarder arguments.

The entry point needs to have a known offset, so it's now the first
element in vtables.

New library functions `_checkClosureShape` and `_checkClosureType` are
added for shape and type checks before calling the dynamic call entries.
Dynamic call entries assume that the lists have expected number of
arguments, with expected types.

Other changes:

- Dispatch table code updated to avoid creating tear-off getters for
  operators. Somehow the "has tear-off uses" metadata can be true for
  operators like `[]=`, even though it's not possible to tear-off
  operators (there's no syntax for it). This is probably a bug in
  front-end.

- Delayed closure trampoline generation code is generalized to allow
  generating dynamic call entries.

  The loop in `Translator.translate` moved to the work list loop as
  generating an entry can add more functions to the work list, and a
  work list element can add more delayed dynamic call entries.

- `CodeGenerator.makeList` moved to `Translator` to allow using it when
  generating type lists in instantiation closure dynamic call entries.

Compile-time crash in language/unsorted/cyclic_default_values_test
fixed. The test now fails with missing `Function.apply` implementation.

`Function.apply` implemented in
https://dart-review.googlesource.com/c/sdk/+/278749 using the vtable
entries implemented in this CL.

Fixes #50661
Fixes #50307

Change-Id: I645e4e9af4eebbffe1db3bca711b1b0e39d3bb73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278505
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-01-12 13:09:29 +00:00
Stephen Adams ef6ce1e88a [dart2js] Basic records
Records can be constructed, returned, and field accessed in non-dynamic code. Type checks don't work, so records cannot be added to generic collections like `List<(int,int>)`.

- Add runtime for base classes for records of various arities.

- Use impacts to collect record static types used.

- Create record classes for each record shape. Record classes have
  extra metadata properties on the prototype. This allows slower,
  general operations at the root of the hierarchy that can be
  overridden with specialized operations lower in the hierarchy.



Change-Id: Ic1b38a5076c2d05f2ecff0a9ed3255b43645386e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278699
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2023-01-12 04:44:16 +00:00
Ben Konyi ab5b7d7ad1 [ DDS / VM Service ] Simplify DevTools URI construction
DevTools no longer expects a fragment (i.e., '#') in its path, which was
causing issues when attempting to redirect to an external DevTools
instance.

Also removes unnecessary query parameter encoding.

TEST=Existing tests

Change-Id: Ifbeba62c173141a754951527f44ab337318a21d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278669
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-01-11 21:22:50 +00:00
Alexander Aprelev 8b6efb8dc1 [api/docs] Emphasize simple-values constraint for Isolate ping and addOnExitListener responses objects.
Fixes https://github.com/dart-lang/sdk/issues/50916
TEST=docs

Change-Id: Iffcf7532674367aafc711628ddefe01ae1d539c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278668
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-01-11 17:18:51 +00:00
Aske Simon Christensen 86a8551101 [dart2wasm] Fix some range checks in SIMD lists
Change-Id: Ia901bce28f89539e9f4d19f9184a92e4d6667572
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278751
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-01-11 16:15:39 +00:00
Joshua Litt 20a07e8073 [dart2wasm] 'Fix' hashCode for JSValue.
Change-Id: I2b071a24be8b2254ed2a696f901a5aacb034a4b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278813
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-01-11 02:27:43 +00:00
Ben Konyi 76097a9e47 [ Service ] Don't redirect HTTP VM service requests when Observatory is not being served
Users should still be able to make direct HTTP requests to the VM
service, even if Observatory is disabled. For example:

GET http://127.0.0.1:58606/1aeHA80oCk8=/getVM

TEST=pkg/dartdev/test/commands/run_test.dart

Change-Id: I5cb7962cc23f9c2bf4209ee0acd51c44ee56083b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278670
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-01-10 20:47:50 +00:00
Jackson Gardner 94475e05f3 [dart2wasm] Emit a generic error for non-dart exceptions coming from JS.
Change-Id: I1a3cb5f5c264c6a8ea1d68da480f7672cf399251
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278371
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-01-10 20:36:28 +00:00
Brian Quinlan 266c90346c [io] Fix a where HttpClient was not correctly tracking pending
connections when an error occurs.

Bug:https://github.com/dart-lang/sdk/issues/50054
Change-Id: I940236a259f8826b790d9189789287981350659a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278644
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-01-10 20:01:29 +00:00
Joshua Litt 2248e04f8d [dart2wasm] Fix minor bug in run_dart2wasm_d8.
Change-Id: I2e6b45d206ea5c60adefe05203dca1579991d6ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278801
Auto-Submit: Joshua Litt <joshualitt@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-01-10 17:50:12 +00:00
Brian Quinlan c7eb34d6aa [doc/io] Add a RawDatagramSocket example.
Bug: https://github.com/dart-lang/sdk/issues/33721
Change-Id: I503c910f4a854dea0561687a06c760ad11ffc5dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277663
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2023-01-10 17:28:04 +00:00
Ömer Sinan Ağacan 8db3be7557 [dart2wasm] Fix invocation forwarder named argument adjustment
Invocation forwarders currently cannot distinguish a named parameter not
passed from passed as `null`.

Refactor `getNamedParameter` to return nullable index. When the index is
not null it means that the named parameter is present, and its value may
be `null`.

This doesn't fix any of the existing tests so I added a regression test.

(Bug originally discovered and fixed in
https://dart-review.googlesource.com/c/sdk/+/278505)

Change-Id: I960c674073b3d25c37e79f9836647882acaff08b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278745
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-01-10 13:37:33 +00:00
Joshua Litt 6d0237a79b [dart2wasm] Generate js runtime at compile time.
This is necessary so we can start specializing JS method trampolines. Specializing JS methods will help reduce polymorphic behavior in JS trampolines for JS interop methods.

In the follow on CL we will start injecting specialized JS method trampolines directly into the runtime.

Change-Id: Ib12fb286f54cfb8a64c9f84e238433e8da2eeaa0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272441
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-01-10 13:16:29 +00:00
Brian Quinlan 6d37a3cddb [doc/io] Add a note about the use of relative paths for Process.(start|run)
Bug:https://github.com/dart-lang/sdk/issues/38974
Change-Id: I0d9bfd5726f8ad2c901e5d42f2bc79b636b9841b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278480
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-01-09 23:01:46 +00:00
Brian Quinlan f502427120 [io] Fix a bug with HttpRequest.requestedUri with absolute urls
Bug:https://github.com/dart-lang/sdk/issues/50704
Change-Id: I1139f3ab720960d4d2e4d350f0b00f6afd2ed2cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278481
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-01-09 22:11:29 +00:00
Joshua Litt a49849c656 [dart2wasm] Stub out deferred loading.
Change-Id: If5ad3a783beb91bd11068b755974aa078530ac6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275743
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-01-09 21:50:33 +00:00
Joshua Litt 1b59349e61 [dart2wasm] Fix for RegExp error handling.
Change-Id: I9bac9edc4ff35da069767c1576cded9e0b10813e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275784
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-01-09 21:13:14 +00:00
Josh Soref aee77b9a33 Spelling tools
Closes https://github.com/dart-lang/sdk/pull/50880

TEST=ci

GitOrigin-RevId: ea8ecf4b7b921de0549df325be1a1f7879e86b72
Change-Id: I39315609a8390b012196a08c9ce4a9a6a50b1558
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278061
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
2023-01-09 15:48:57 +00:00
Josh Soref be43ba609b spelling: favorites
Closes https://github.com/dart-lang/sdk/pull/50806

GitOrigin-RevId: 797ea37d9d727ff9db80733e4f5ce2807ace611e
Change-Id: Iee4885232d0874ff7949b96779634943ced3ea35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276773
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-01-09 13:22:09 +00:00
Lasse R.H. Nielsen 8a891ba869 Deprecate HasNextIterator.
Bug: https://dartbug.com/50883
Change-Id: I983e07072052a0538e4c04cc66e7fd2ad2bc1242
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278121
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2023-01-09 12:14:33 +00:00
William Hesse e8283b0839 [io] Improve scheduling of IO worker threads
The allocation of the at most 32 IO worker threads to IO requests
includes an inefficient check that a thread is free, when a request
completes.

A server application was taking 5% of its time running this check,
which is a .contains call on HashMap.values.

This CL replaces it with a use count on each IO thread, which is
checked against 0.

Bug: https://github.com/dart-lang/sdk/issues/50907
Change-Id: I6d13f9c62d36c34f165b2b4e32a48caeb6f9a77b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278503
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: William Hesse <whesse@google.com>
2023-01-06 15:47:57 +00:00
Josh Soref 50b94ef9fc Spelling runtime bin
TEST=build VM

Closes: https://github.com/dart-lang/sdk/pull/50862

GitOrigin-RevId: ae54b37666f70f670ee3af11c984c7e9a7e9da26
Change-Id: I459fda0439a1cd368f488a70d84ee6bb915e60bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277761
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-01-06 07:48:22 +00:00
Josh Soref 1ab011a2a7 Spelling tests web
Closes https://github.com/dart-lang/sdk/pull/50879

TEST=only changes to spelling to comments and internal string messages
GitOrigin-RevId: 3fa4104fa17054ea2247118a1b6213c62f2749e0
Change-Id: I776120bb2492c662dd32612dd2f6a670b5891e42
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278060
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-01-05 01:26:52 +00:00
Daco Harkes 5d0325d3f1 [vm/ffi] Optimize struct copies
Replace the `_memCopy` implementation in Dart with `MemoryCopyInstr`.

Speeds up copying from and to `Pointer`s by up to a 100x for large
structs.

TEST=tests/ffi/function_callbacks_structs_by_value_test.dart

BENCHMARK=benchmarks/FfiStructCopy/dart/FfiStructCopy.dart

Before (x64 JIT):

FfiStructCopy.Copy1Bytes(RunTimeRaw): 86.26189953740506 ns.
FfiStructCopy.Copy16Bytes(RunTimeRaw): 14.006969563521945 ns.
FfiStructCopy.Copy1024Bytes(RunTimeRaw): 8.567228629242734 ns.
FfiStructCopy.Copy65536Bytes(RunTimeRaw): 8.469047080663412 ns.

After (x64 JIT):

FfiStructCopy.Copy1Bytes(RunTimeRaw): 56.79513144264321 ns.
FfiStructCopy.Copy16Bytes(RunTimeRaw): 3.562479879234367 ns.
FfiStructCopy.Copy1024Bytes(RunTimeRaw): 0.10771875669750132 ns.
FfiStructCopy.Copy65536Bytes(RunTimeRaw): 0.02758346614218262 ns.

Bug: https://github.com/dart-lang/sdk/issues/43967
Change-Id: I5d51c39a13b8c9522ee88d81bba7365caef70a27
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-nnbd-mac-debug-arm64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277523
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-01-02 17:56:19 +00:00
Lasse R.H. Nielsen 81b137d8fe [3.0 alpha] Remove deprecated BidirectionalIterator.
Requires releasing `package:quiver` 3.2.0 so Flutter can upgrade to that.


Change-Id: Ibd9acc5fa11a67ca50d06172dfe0f9175b240522
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276741
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-01-02 16:14:08 +00:00
Lasse R.H. Nielsen ece7da8009 Make final parameter of SystemHash.hashX not be optional.
Issue https://github.com/dart-lang/sdk/issues/50693

Change-Id: Ib587b70bcb57cbd2d16319b7814e2569c7e41213
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276161
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-01-02 12:44:23 +00:00
Vyacheslav Egorov 157641dc3d [sdk] Followup to 13978f85fd
Address remaining comments from Lasse for `SendPort.send`.

Change-Id: I7fead8aeea9af16cc252b5ddc1bc8cb4d2ffae3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276526
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-01-02 12:24:16 +00:00
Ryan Macnak cb478b21f4 Don't mutate argument to dart:developer's postEvent.
Bug: https://github.com/dart-lang/sdk/issues/50713
Change-Id: Iadc3eb0b4306d7500a03bd77b8b6dc3c19227200
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275984
Commit-Queue: Dan Chevalier <danchevalier@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-12-22 23:10:13 +00:00
Jackson Gardner ce741bb017 [dart2wasm] Emit closures and contexts for subexpressions of asserts.
Change-Id: Ibe0741d360caa4747ad4a3eea888b1a9661af111
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277050
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
2022-12-22 16:27:39 +00:00
Ömer Sinan Ağacan d86531aff6 [dart2wasm] Add _Function.call member
New passing test: language/call/method_function_typed_value_test/08

Change-Id: If959ce05c48658407011044f5ff3df9076f04bdc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276900
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-12-21 20:09:11 +00:00
Jackson Gardner 061a9fbefb [dart2wasm] Add --enable-asserts flag.
Change-Id: I4cc9a55673374926e8b19cccf2be9888f166553d
Bug: https://github.com/dart-lang/sdk/issues/50801
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276772
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-12-21 19:53:14 +00:00
Ömer Sinan Ağacan 105a444f6f [vm] Refactor VM Function.apply
- Make _apply args non-nullable
- Use null-aware operators instead of conditionals
- apply uses mutable and immutable locals, mark immutable ones as
  `final`
- Remove uses of `new` keyword

Change-Id: Ia6f40b6bee5f873a1814a4989375e46b2f8b99eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276642
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-12-21 19:44:29 +00:00
Srujan Gaddam 27b4e28495 [dart:html] Rename emitters and regenerate dart:html
emitter is a module name, so we use a different name here to avoid
a collision when using the module name. This CL regenerates dart:html
after accounting for https://dart-review.googlesource.com/c/sdk/+/276560.

Change-Id: I1c9d3a54a5f37a5e42cd5b79bbc3d635b98c198e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276763
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2022-12-21 17:26:48 +00:00
Ömer Sinan Ağacan 2dffe31edd [dart2wasm] Override _BoxedBool runtime type
Continuation of 181c996. Overriding `_BoxedBool` runtime type turned out
to be a bit tricky, as explained in comments.

New passing tests:

- co19/Language/Expressions/Booleans/runtime_type_t01
- co19/LanguageFeatures/Enhanced-Enum/semantics_A07_t01
- language/type_object/first_class_types_literals_runtime_1_test
- language/type_object/first_class_types_literals_runtime_2_test
- language/type_object/first_class_types_literals_runtime_test

Change-Id: Icdd3eb61989298f70bfd6dca42a029fcc1ae9ec2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276502
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2022-12-21 11:09:22 +00:00
Brian Quinlan e7c4784594 [doc/io] Add a warning about process blocking behavior
Bug:https://github.com/dart-lang/sdk/issues/50674
Change-Id: I770527b41260250f1badba3a4387029bb68888af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276621
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-12-21 01:33:57 +00:00
Brian Quinlan 9b2b9df09e [io] Remove incorrect docs that listSupport is not available on Android.
Bug:https://github.com/dart-lang/sdk/issues/47894
Change-Id: Id79a37f5ba6a8118a30d2297c95cff5a7ca1a03f
TEST=unit
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276660
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-12-21 00:23:02 +00:00
Alexander Markov 3675fd25f4 [vm] Packed representation of record shape
The representation of record shape in record instances and record
types is changed from a pair

  int num_fields
  Array field_names

to a single integer - packed bitfield

  int num_fields(16)
  int field_names_index(kSmiBits-16)

where field names index is an index in the array available from
ObjectStore.

With the new representation of record shapes:
1) Size of record instances is reduced.
2) Number of comparisons for a shape test reduced from 2 to 1
(shape test is used during type checks).
3) A few operations removed from Record.hashCode.
4) Type testing stubs (TTS) are now supported for record types with
named fields. Previously it was not possible to check shape of records
with named fields in TTS as TTS cannot access object pool and cannot
load field names array).

TEST=existing

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

Change-Id: I7cdcbb53938aba5d561cd24dc99530395dbbea7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276201
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-12-20 20:11:48 +00:00
Nate Biggs 398d47cd10 [dart2js] Add priority to dartDeferredLibraryLoader hook.
Change-Id: Ib77b20fc56aa67b4f3318f9dcd8fa65b62c56509
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275800
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-12-20 15:39:09 +00:00
Ömer Sinan Ağacan 181c9962b1 [dart2wasm] Override runtime types of internal types
Runtime types of String, int, and double implementations are expected to
be `String`, `int`, and `double`, respectively.

Change-Id: I8f84ee2e8405c820a686d54449d3eb2db18eb52a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276643
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-12-20 14:27:56 +00:00
Lasse R.H. Nielsen 882e3ff2b3 State that MapEntry should not be implemented or extended.
Plan is to make the class `final` with class modifiers,
assuming they do not affect lagacy code,
and change the declaration to an `inline class` on a record pair when possible.

Very few existing classes implement `MapEntry`, and they probably shouldn't.
It seem like they can safely be changed to not do so.

Change-Id: I97b94b3048c6fde205439bd7b1061de0cf34bc66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276521
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-12-20 10:15:14 +00:00
Ömer Sinan Ağacan 29ea94227b [dart2wasm] Remove redundant null check in throw expressions
Change-Id: I90ddbc675b2caf24853ac4270099587281b6fd4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276420
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-12-20 07:43:32 +00:00
Alexander Aprelev 438b81c4f2 [vm/regexp] Share RegExp objects between isolates, keep isolate-specific state in static members.
Revert "[vm/regexp] Copy, rather than share RegExp objects between isolates." is in patchset 1.

Isolate RegEx-sharing benchmarks show 24-100x improvements.

Bug: https://github.com/dart-lang/sdk/issues/50639
TEST=ci
Change-Id: I87943c9b9928869f7a20052cb0dc71d24ad36087
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276240
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-12-20 02:28:04 +00:00
Lasse R.H. Nielsen 8ad766159f Make web DateTime.difference not assume platform implementation.
Changes `other._value` to `other.millisecondsSinceEpoch`,
which prevents crashing if provided with a different implementation
of `DateTime`.

Exposed by #58750.

Bug: https://dartbug.com/50750
Change-Id: I1dfc0bb4e8a44ef0df432c9a916a6620691e0547
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276523
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-12-20 01:07:40 +00:00
Abitofevrything bc8606c34e [io/websocket] Cancel ping timer when WebSocket closes
Closes https://github.com/dart-lang/sdk/issues/50517

Change-Id: I04ea0f1b79e49aeab6c5fd049460335f0d02253e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274544
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-12-20 01:01:16 +00:00
Josh Soref df895a8a57 Spelling sdk
Closes https://github.com/dart-lang/sdk/pull/50772

GitOrigin-RevId: 0a34e77a33fce02c14a9c0fb87ac274e32cd1bec
Change-Id: I7ab24ba4e9f0844c2cc7e9cee03abd6c859445c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276540
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2022-12-19 22:31:18 +00:00
Vyacheslav Egorov 13978f85fd [lib] Update SendPort.send documentation
Try to make it more clear that you can only send default
implementations of List, Map, Set, etc.

Add CHANGELOG.md entry that documents a8fe399c79

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

Change-Id: Ib0cf9d389b91cc5ab72b8bab5461ee91037baf25
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273185
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-12-19 16:03:46 +00:00
Riley Porter b6388f2ea0 [JS interop] Expose more JavaScript operators in js_util
Exposes helper functions in js_util to access the JavaScript operators
`delete`, `||`, `&&`, `!`, `!!`, and `typeof`.
Change-Id: I0676b143aa004c7b4ed1c6b695b8d1e78a60778d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276028
Commit-Queue: Riley Porter <rileyporter@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2022-12-17 00:31:27 +00:00
Nicholas Shahan 352ba74453 [3.0 alpha][core] Delete NullThrownError
TESTED=Ran CQ dryrun and approved failures for co19 tests that will be updated soon.

Change-Id: Ic0dc5fc084b1d0f3fce80dd88062f879abd7b556
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275840
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2022-12-16 17:46:48 +00:00
Daco Harkes 2435f0b398 [vm/ffi] Make elementAt an extension method
The CFE rewrite for structs, unions, and abi-specific integers is now
done on the extension methods.
The other native types are implemented in the extension methods
directly.

TEST=test/ffi

Closes: https://github.com/dart-lang/sdk/issues/50714
Change-Id: I578325733e3cd66200e80949d47ff12a13115b99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276102
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-12-16 16:33:12 +00:00
Nicholas Shahan c39ac36ed3 [3.0 alpha][dart2js] Remove use of NullThrownError
It is being removed in Dart 3.0 and a `TypeError` should be used
instead. This is true in legacy code as well and all test
expectations will be updated.

Change-Id: I021fa4ecb1a9bbc404598113c65349e17926cd91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275782
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-12-15 21:36:56 +00:00
Ömer Sinan Ağacan 0a1e05acab [dart2wasm] Tweak setRange error checking
Error checking copied from VM.

New passing test: corelib/list_set_range_test

Change-Id: Iaac3be44037bac5646498a733828ee1f71f0eeb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275861
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2022-12-15 21:36:22 +00:00
Nate Bosch ca03588d2b Run extension handlers in the registering zone
Towards https://github.com/flutter/flutter/issues/93676

Flutter uses an extension for hot reloads, and the app ends up running
in the root zone after a hot reload because that is the zone that the
handler gets called in.

Always run extension handler callbacks in the zone from which they were
registered for more predictable behavior.

Change-Id: Ia921489a6ada802c8e53a0ccc650a8bce218ba01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275842
Commit-Queue: Ben Konyi <bkonyi@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-12-15 15:05:17 +00:00
Michael Thomsen bcbf24ec3d [3.0 alpha] Remove deprecated CastError and FallThroughError dart:core errors
TEST=ci

Bug: https://github.com/dart-lang/sdk/issues/49529
Change-Id: I52495d3e5319f0555714f4f8247149afc06128a1
Cq-Include-Trybots: luci.dart.try:vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,vm-kernel-nnbd-mac-debug-arm64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,dart-sdk-linux-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259041
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-12-15 13:38:47 +00:00
Michael Thomsen e4cc3c98e5 [3.0 alpha] Remove deprecated dart:core List() constructor.
TEST=ci

Bug: Contributes to https://github.com/dart-lang/sdk/issues/49529
Change-Id: Ic129ef2d89f625d9ec6a7a1c301cffddd60b2ff7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258920
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-12-15 11:36:22 +00:00
Alexander Markov 7ebd4dd61c [3.0 alpha] Remove deprecated public class CyclicInitializationError
This deprecated class cannot be removed just yet because
we still need to throw something in case of cyclic initialization
in Dart legacy libraries (which are still supported).

Class CyclicInitializationError is copied for each implementation
(VM, dart2js and DDC) and made private. Each implementation now has
an independent private class which can be removed separately.

TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/49529
Change-Id: I8100bbe16636c12c4cbabbb5fe770f4c648c4249
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275120
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-12-15 11:20:58 +00:00
Nicholas Shahan 022ca53db3 [ddc] Remove use of NullThrownError
Throw a `TypeError` with the same message, 'Throw of null.'
instead of a `NullThrownError`.

Fixes: https://github.com/dart-lang/sdk/issues/50598
Change-Id: Ic13d6bc29a49c405ef3d3d0eb4f7fd781aefbc6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273281
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2022-12-15 00:10:59 +00:00
Dan Chevalier fd6fa010ec [ VM Service / DDS ] Add custom service stream support (Revised)
NOTES:
Original CL: https://dart-review.googlesource.com/c/sdk/+/274061
Revert CL: https://dart-review.googlesource.com/c/sdk/+/274802

Regression tests that failed after merging Original CL:
- https://ci.chromium.org/ui/p/dart/builders/ci.sandbox/pkg-mac-release/24046/overview
- https://ci.chromium.org/ui/p/dart/builders/ci.sandbox/pkg-mac-release-arm64/5999/overview

----------
DESCRIPTION:
Setting the `stream` parameter on `developer.postEvent` will now forward those events to a custom stream inside DDS.


The first use of this will be for widget inspection. A navigation event will be posted to a custom stream. Our IDE DAP can listen for the Event and react to it by navigating to the desired location in the code.

TEST=Made sure that regression from original PR could be reproduced, and then resolved by applying this change. Updated observatory tests. Created new developer test to check assertions. Added DDS tests for new custom stream behaviour. Manually tested the postEvent and StreamListen with multiple clients

https://github.com/flutter/devtools/issues/4533

Change-Id: I2b04a84b4daf11dd9d72f899928b5e1f62a5ae02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275121
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-12-13 16:31:37 +00:00
Derek Xu 53d859f6b9 Revert "[VM/CLI] Remove dartdev.dill"
This reverts commit c09f790d37.

Reason for revert: CI failures

Original change's description:
> [VM/CLI] Remove dartdev.dill
>
> Incompatible VM flags will no longer break the CLI when running from an
> AppJIT snapshot, so the fallback logic is no longer required. This CL
> thus removes dartdev.dill and the fallback logic.
>
> Relevant past CLs: https://dart-review.googlesource.com/c/sdk/+/157601
> and https://dart-review.googlesource.com/c/sdk/+/178300
>
> Fixes https://github.com/dart-lang/sdk/issues/50504
>
> TEST=I tried running `out/ReleaseX64/dart --observe --sound-null-safety test.dart`
> and `out/ReleaseX64/dart --observe --no-sound-null-safety test.dart` and
> both worked.
>
> Change-Id: I5cdcfbccf71ec557964014fdb80733b4a7c76b4d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274520
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Derek Xu <derekx@google.com>

TBR=bkonyi@google.com,derekx@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I5117f990dfabf93f5a9bae56098831280845e84e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275181
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2022-12-13 15:28:19 +00:00
Joshua Litt 220bb44c55 [dart2wasm] Implement leaking Expando.
Change-Id: I14b92315c32eb9930fa852a424646fc2d0f0c0a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274820
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-12-13 00:27:59 +00:00
Nicholas Shahan 0b3533aa95 [ddc] Fix unsound await expressions
Some expressions have a static type that can lead to a possible
soundness issue when awaited. For those expressions an additional
runtime check is performed.

Issue: https://github.com/dart-lang/sdk/issues/49396
Fixes: https://github.com/dart-lang/sdk/issues/50602
Change-Id: Ief25fbe8c38330cca0c17be4d411780a20ab87a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274729
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-12-12 19:43:55 +00:00
Nate Bosch c58297b756 More consistently use parent in zone.fork doc
The doc refers to the `this` as "this", "parent", "current zone", and
"forking zone". Fix a typo "current's zone" -> "parent zone's".

Change-Id: I6d61ad5c69c2cc415ce7271831c7a364715b0652
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274280
Reviewed-by: Lasse Nielsen <lrn@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-12-12 18:13:53 +00:00