Commit graph

10715 commits

Author SHA1 Message Date
Kallen Tu 586efdfe59 Add ignores for dynamic calls in html_dart2js sanitizing code.
Avoid removing dynamic invocations in sanitizing code as we don't know what type the element and its attributes may be.

Change-Id: I057d908027befe7fd284bf4ec6c68bd1d0e977f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259108
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-09-14 20:35:04 +00:00
Brian Quinlan fa53fb66d0 Throw an error if an attempt is made to create more than one resource from a ResourceHandle
Change-Id: I629d2b9cfddd8e5f7fe8ae65a03362c7bcce5e2c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257000
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-09-14 18:17:33 +00:00
Aske Simon Christensen 8ae4802e05 [dart2wasm] Dummy isolate patch
Change-Id: Id748ef2f69c09592513ba6a3cffafc37a8450d00
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258921
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-09-14 13:43:52 +00:00
Kallen Tu aad35b490f Remove dynamic invocations in error handling in directory_impl.
Change-Id: Idb1ac4490efd74a2ff98a3d9f0c57a74299ce413
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258512
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-09-14 07:24:53 +00:00
Brian Quinlan 2ead86ab9d Implement anonymous pipes and the ability to transmit them between processes using Unix Domain Sockets.
Change-Id: I9c9f4ec0e99075a29c6f4d97c503e759134eb094
TESTED=Unit tests
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257804
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-09-13 21:16:28 +00:00
Lasse R.H. Nielsen e4ae0cf2ce Make Uri treat \ as / in path and authority.
When using `Uri.parse` or `Uri(path:..)`, a `\` is treated as, and converted to, a `/`.
This avoids a particular problematic difference in behavior between Dart and the browser's `URL` functionality. There are still examples where the two differ in interpretation of the same code, but in those cases, the Dart `Uri` will most likely end up without a host name, which should be easily detected.


Change-Id: I798df6c3c27c6d64fb9fc8dc30d90b06ba5a9004
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258120
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-09-13 11:48:19 +00:00
Alexander Markov c94103ae05 [vm] Initial implementation of record instances
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I82ba571d1935d616fe3d4d6d579e59eb57d65a43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256804
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-09-12 22:41:57 +00:00
Alexander Markov 9a023aeae9 [vm] Initial implementation of record types
TEST=language/record_type_test

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: Ib2100c23513395c9fa9c541320eacbb33a2a119e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256802
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-09-12 22:40:57 +00:00
Emmanuel Pellereau 727e792e77 Revert "[ddc] Add non-null assertions when setting fields"
This reverts commit 27099c121c.

Reason for revert: Breaks google3 (b/246251728)
Original change's description:
> [ddc] Add non-null assertions when setting fields
>
> Fixes: https://github.com/dart-lang/sdk/issues/49918
> Change-Id: I6dddda878afa504bebebb00a80855bac636f8efd
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258220
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Nicholas Shahan <nshahan@google.com>

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

Change-Id: I5e3fb1c151a85e11025135b8fc95c65192b33791
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258780
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2022-09-12 11:21:06 +00:00
Nicholas Shahan 27099c121c [ddc] Add non-null assertions when setting fields
Fixes: https://github.com/dart-lang/sdk/issues/49918
Change-Id: I6dddda878afa504bebebb00a80855bac636f8efd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258220
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-09-09 21:05:25 +00:00
Joshua Litt 014818bf8e [dart2wasm] Implement js_util.instanceof.
Also fixes performanceNow for Chrome.

Change-Id: I1b70610a8a1a44c0f0e3ce7b166f32f9915324c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258504
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-09-09 20:40:34 +00:00
Aske Simon Christensen 9af959c167 [dart2wasm] Coerce types on imports/exports to externref or funcref
Change-Id: Id7fe0775e14b7ed16c925819ffc9c41dea863e4d
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258001
Auto-Submit: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-09-09 18:10:34 +00:00
Kallen Tu 7055da30a7 Remove dynamic invocations from io file classes.
Change-Id: Iaf556ca462b9d962557b627c59220101f384ae51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258380
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2022-09-09 17:45:45 +00:00
Aske Simon Christensen cded056cf1 Move cast and toSet on immutable sets to implementation classes
These methods create new sets, whose implementation must match the
target platform. Thus, they should be specialized for the VM and
dart2wasm instead of being implemented in the shared mixin.

Change-Id: I102a45686e3eb373463f2fcdf84ee861e202ecc0
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258362
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-09-09 14:04:34 +00:00
Aske Simon Christensen f2bc59738c Rename the VM's internal hash set classes
Rename `_CompactLinkedHashSet` to `_InternalLinkedHashSet` and
`_CompactImmutableLinkedHashSet` to `_InternalImmutableLinkedHashSet`
to make the names consistent with the corresponding `Map` class names
and to distinguish them from the non-VM-specific hash maps and sets,
which are generally named starting with `_Compact`.

Tested: ci
Change-Id: Ic1ebc44ba8beba34ceab382a4edddc6624fe3fb3
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258002
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2022-09-09 14:04:34 +00:00
Aske Simon Christensen bab5cfbe74 Add more types to the VM's internal compact hash structures.
This gets rid of some occurrences of `dynamic` and makes the
associated implicit conversions explicit.

Based on https://dart-review.googlesource.com/c/sdk/+/237582

Tested: ci
Change-Id: I7faeffab395c916800b29ea7e56bd3f7d15aac54
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258242
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-09-09 08:38:36 +00:00
Ryan Macnak e5fc6d652b [vm] Don't pass and copy unused category string when recording timeline events.
TEST=ci
Change-Id: I53b60a977c2b33d29a0ca685120044ba208d3ae4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258321
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-09-08 22:02:46 +00:00
Kallen Tu 7e13c388fe Clean up - unused typedef and lint ignore for html.
Change-Id: I50f89a2d59478c8e2a63a81d106e0943b496ad46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257427
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2022-09-08 20:59:24 +00:00
Kallen Tu 10a1ac18ab Eliminate dynamic [] calls from common, directory_impl and link.
Change-Id: I91be3303d957d5c746e33099b6238b51243ba60f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257140
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-09-08 17:17:03 +00:00
Daco Harkes 2cd6fdd100 [doc] Update Uri.queryParameters type
Because the value type is dynamic, I noticed use sites passing in
`Map<String, String?>`. After inspecting the implementation, it looks
like this is by design: `writeParameter` in `_makeQuery` takes a
nullable value.

This CL updates the documented type to reflect this.

Change-Id: I7b6f1c4a59ec44282e5e8b4ada86becafb308d30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258240
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-09-08 14:32:03 +00:00
Joshua Litt 708264289d [dart2wasm] Use WasmExternRef for JS interop.
Change-Id: I01138d48ba9cc67954ef086968af90dae173fda9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257880
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-09-07 20:55:27 +00:00
Joshua Litt eb540194ad [dart2wasm] Implement promiseToFuture.
Change-Id: I265441c5c78933f8bdace53f956d22677442d7fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257803
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-09-07 17:56:17 +00:00
Joshua Litt 2b85e02c5d [dart2wasm] Implement == for JSValue.
Change-Id: I45af5bdabfb0dfa12b6b39094843b9394f4fe510
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257923
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-09-07 16:37:17 +00:00
Kallen Tu 8264bd94d1 Revert "Eliminate dynamic call() in html_dart2js in _EventStreamSubscription."
This reverts commit f630a7c07d.

Reason for revert: Remove the `is` check since it's more costly than removing a dynamic call for web.

Original change's description:
> Eliminate dynamic call() in html_dart2js in _EventStreamSubscription.
>
> Change-Id: Ia4a300c210bc505f71cc3bfb1a1b911c96c1aa53
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256703
> Commit-Queue: Kallen Tu <kallentu@google.com>
> Reviewed-by: Leaf Petersen <leafp@google.com>
> Reviewed-by: Lasse Nielsen <lrn@google.com>

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

Change-Id: I36b2f8cedc5f8b5235832ea29ea5eb40e2e8dc92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257421
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-09-02 18:44:53 +00:00
Kallen Tu f630a7c07d Eliminate dynamic call() in html_dart2js in _EventStreamSubscription.
Change-Id: Ia4a300c210bc505f71cc3bfb1a1b911c96c1aa53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256703
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-09-01 00:27:29 +00:00
Ivan Inozemtsev 12d1e58cbc Revert "Make addStream events be delivered synchronously."
This reverts commit 9292afa710.

Reason for revert: b/244407576

Original change's description:
> Make `addStream` events be delivered synchronously.
>
> The asynchronous stream controllers were forwarding stream events
> from an `addStream` stream through the same path as user-added event,
> which added an extra asynchronous delay that is unnecessary for forwarding existing events.
>
> Change-Id: I8edd1936d0d155d051d3cb8f7f82c577334d5f8e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256560
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>

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

Change-Id: I0e4791f4d32616fee9772a2ab7015bac4e117312
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257080
Auto-Submit: Ivan Inozemtsev <iinozemtsev@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
2022-08-31 15:59:18 +00:00
Ivan Inozemtsev 212d5e3a31 Revert "Fix bug in Completer.complete."
This reverts commit 3688a4723c.

Reason for revert: b/244409289

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>

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

Bug: https://github.com/dart-lang/sdk/issues/48493
Change-Id: I5ed360bebe160868f6152c72c82070c93188858e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257100
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-08-31 15:04:08 +00:00
Kallen Tu e0884c91f1 Eliminate dynamic call of .createElement in html_dart2js.
Change-Id: I76ab0063eee4213f20483172c16f86e651536945
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256740
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2022-08-30 15:48:40 +00:00
Lasse R.H. Nielsen 3688a4723c 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>
2022-08-30 10:52:27 +00:00
Lasse R.H. Nielsen 9292afa710 Make addStream events be delivered synchronously.
The asynchronous stream controllers were forwarding stream events
from an `addStream` stream through the same path as user-added event,
which added an extra asynchronous delay that is unnecessary for forwarding existing events.

Change-Id: I8edd1936d0d155d051d3cb8f7f82c577334d5f8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256560
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-08-30 08:22:27 +00:00
Alexander Aprelev 6abb6e5110 [io/http] Validate method name passed to HttpClient.open/openUrl.
There should be no control characters or delimiters in method name
provided to open/openUrl methods.

Fixes https://github.com/dart-lang/sdk/issues/45744
TEST=http_open_method_validate_test

Change-Id: I0db98f2376c980a054420fb447d4f7ef9321f1a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256429
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-08-29 21:12:27 +00:00
Kallen Tu 2bb03e4344 Eliminate .style and ._initKeyboardEvent from html_dart2js.
Change-Id: I16ea832e8eff2b2aea02fb73e1cf7ee9702923af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256581
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-08-29 20:06:45 +00:00
Kallen Tu bcb9fd28fb Eliminate [] dynamic call in io_resource_info.
Change-Id: I80a30d8c31ecc41f2ebf6f7fc8ac6dd41225ea4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256600
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-08-29 18:53:15 +00:00
Kallen Tu 78a9f52544 Eliminate dynamic calls with file and subscription in stdio.
Change-Id: I3dbdb2c14729fd1c74e733a59234df5035386cfd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256249
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-08-26 20:21:21 +00:00
Alexander Aprelev 33846f3678 [io/file] Add exclusive optional parameter to File.create, createSync.
TEST=standalone/io/file_create_test

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

Change-Id: I0b1bdc889caf5801570d7ac9e7b6694264cd6565
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255482
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2022-08-24 17:09:49 +00:00
Kallen Tu fa7ffc9ac1 Eliminate dynamic calls in SVGElement.
Change-Id: I60c48145fb8ffe5cc5d1c20f86cfa9f067c2705c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256026
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2022-08-23 18:21:40 +00:00
Lasse R.H. Nielsen be70a6dc13 Change : to = for default values in sdk/
Change-Id: I1939b0998343c36eab162a015fcf9eeb7e1dd7bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256123
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2022-08-23 13:53:30 +00:00
Joshua Litt 8009c39d61 [dart2wasm] Implement dynamic naively.
Change-Id: I905a81faead20b4339309521018291d0b4d90dda
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250786
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-08-22 21:33:29 +00:00
Joshua Litt 1d6407fc3f [dart2wasm] Align semantics of jsify / dartify.
Change-Id: If4a5fc90093c35476a58e5f4755ef58ed9d9d889
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255766
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-08-22 19:54:29 +00:00
Ryan Macnak ae57447189 [vm] Simplify creating ByteData from the embedding API.
TEST=ci
Change-Id: I0d5093c0eee6ab477e73a368179aba9a23d9600f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255817
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-22 17:50:45 +00:00
Kallen Tu 64c3ea27da Eliminate dynamic calls to remove and tagName.
Additionally, fixed the template for html_dart2js so the generator would generate the correct code.

Change-Id: I2172bb10db413169b86690faa027365ff72e3d68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255763
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-08-22 17:27:39 +00:00
Aske Simon Christensen a85157e233 [dart2wasm] Convert to/from externref via Wasm instructions
This adds support for the newly added `extern.externalize` and
`extern.internalize` instructions and uses these for converting to/from
`externref` instead of a JS round-trip.

Change-Id: If18d8f44ddf013d4c26bf1597be91bcd0db41c5a
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255462
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-08-19 07:11:18 +00:00
Aske Simon Christensen 02d1255d75 Update d8 to 10.6.166
The API for the JS Promise integration API has changed to be part of
the `new WebAssembly.Function` constructor. This requires parameter
types to be specified explicitly. Apparently, these types currently
must be all `externref`.

Change-Id: Ifae634f65cfa377441be4b2dc0643c34b702fbe7
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255061
Reviewed-by: Stephen Adams <sra@google.com>
2022-08-19 07:11:18 +00:00
Aske Simon Christensen b1c0992199 [dart2wasm] Implement the three-pronged WasmGC type hierarchy.
This splits the type hierarchy into three separate hierarchies with
the top types `any`, `func` and `extern`.

Update d8 to 10.6.91, which switches to the new type hierarchy.

Also, all ref shorthands for abstract heap types are now nullable, so
the type emitter in the `wasm_builder` is updated to follow that scheme.

To reduce confusion about the nullability of abstract reference types,
these now all require the nullability to be specified explicitly.

Change-Id: I4774d08cbed18307e481c466b2e3402a8d8fb6bd
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255060
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-08-19 07:11:18 +00:00
Aske Simon Christensen bde8430b97 [dart2wasm] Initial async/await support based on Promise integration
This implementation has a number of limitations:

- Returning a Future from an async function is not supported.
- Every async call switches to a new stack. A later optimization will
  stay on the same stack if the call is directly awaited.
- Exceptions that cross async boundaries do not receive full stack
  traces including the async suspension points. The stack trace of the
  final exception just reflects the stack trace for the outermost
  async call.

Change-Id: I2a5d5e30d6e955999ba55842c8b2ca3427cbf954
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241010
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-08-19 07:11:18 +00:00
Kallen Tu add88f24c2 Eliminate dynamic calls to firstChild, remove and _innerHtml.
Change-Id: If984af54620727929ea8deb182226ce8d6514bb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255581
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-08-18 21:50:14 +00:00
Joshua Litt 4810c8930b [dart2wasm] Initial regexp support.
Change-Id: Ia461c77979785bbc0510052a31f94bdd83babc01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250582
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-08-18 19:49:34 +00:00
Lasse R.H. Nielsen a5f25ee3ba Add Isolate.run.
Adds static method on `Isolate` to run an asynchronous function
in a separate isolate.

Change-Id: I673373fa02524f1d0b88099027cfaf1b796eb344
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254960
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-08-18 10:42:55 +00:00
Kallen Tu d0e27df1e3 Eliminate dynamic calls when getting the environment.
Statically type String variables to avoid dynamic calls for substring or concatenation.

Change-Id: If485243dc0580fd1f4e53ec4cf69cb3819a57b5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255301
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-08-17 21:00:23 +00:00
Bishwajeet Parhi 0a4c6a5cf4 Docs: Update broken link for Random.secure
Closes https://github.com/dart-lang/sdk/pull/49682

GitOrigin-RevId: 0a049389dd422e646036232282bbb23ea3bc805e
Change-Id: I39da72e4adb8365a608d53117c146d85ab459bcb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255381
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-08-17 13:24:43 +00:00
Lasse R.H. Nielsen 59cd692fb9 Remove documentation for runZoned's onError parameter.
Fixes #49679

Bug: https://dartbug.com/49679
Change-Id: I14d0822f80099ac754db84580a52400a6c249fca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255252
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
2022-08-17 09:32:53 +00:00
Joshua Litt 2c4ee2895f [dart2wasm] Implement toString methods on double using JS interop.
Change-Id: I5843e9cae59b8f152b922a01796eaf05494808a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250681
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-08-17 00:23:52 +00:00
Joshua Litt 591ef06a29 [dart2wasm] Implement unimplemented Uri methods.
Change-Id: I54b8633d39df64d1760a7face5dda38c3aa95d5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251592
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-08-16 22:38:02 +00:00
Joshua Litt 3923013b81 [dart2wasm] Implement some missing members on String.
Change-Id: I37db0a4fa2ebdd0101832e0e4025cb5a38434dc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251720
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-08-16 20:34:54 +00:00
Ilya Yanok d3f30dc3c6 Revert "Reapply "Avoid computing the URI scanner tables at runtime.""
This reverts commit 4c7110332e.

Reason for revert: Still breaks the same tests, see b/242715525

Original change's description:
> Reapply "Avoid computing the URI scanner tables at runtime."
>
> This reverts commit 855e1cd975.
>
> The blocking issue in internal test code is assumed fixed.
>
> Change-Id: I74e0be130d149a45f77dc90c354916308b76b741
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255248
> Commit-Queue: Lasse Nielsen <lrn@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Auto-Submit: Lasse Nielsen <lrn@google.com>

TBR=lrn@google.com,kustermann@google.com

Change-Id: I391d2eb6dd9ae7367f656eaaaa7f9aeb1c31e0f7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255254
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
Reviewed-by: Ilya Yanok <yanok@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-08-16 16:46:28 +00:00
Lasse R.H. Nielsen 4c7110332e Reapply "Avoid computing the URI scanner tables at runtime."
This reverts commit 855e1cd975.

The blocking issue in internal test code is assumed fixed.

Change-Id: I74e0be130d149a45f77dc90c354916308b76b741
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255248
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Auto-Submit: Lasse Nielsen <lrn@google.com>
2022-08-16 14:53:07 +00:00
Alexander Aprelev 0914835773 [vm/inliner] Tweak inlining heuristic, improve List.of inlining.
Builds on top of https://dart-review.googlesource.com/c/sdk/+/228660, introduces vm:vm:always-consider-inlining that tell inliner not to give up inlining of a function.

HashMap constructor got prefer-inline pragma to accommodate shift in inlining away from where it used to be inlined due to large size of inlined HashMap, greater than FLAG_inline_getters_setters_smaller_than heuristic.

Notable performance changes:

JIT (x64)
===
ListCopy.List.of.fixed.100 27.37%
ListCopy.List.of.fixed.2 16.31%

AOT (x64)
===
Empty  -9.978%
InstantiateTypeArgs.Instantiate1  -8.262%
...
ListCopy.List.of.fixed.2 13.73%
ListCopy.spread.num.2 15.51%
ListCopy.List.of.2 15.08%
MapCopy.Map.String.of.Map.100 55.62%
MapCopy.Map.Thing.of.Map.100 56.06%

flutter release
===
flutter_gallery_apk_size (Pixel 2)
-0.0074% (1.0 noise)41809568.00 41812676.00


Addresses https://github.com/dart-lang/sdk/issues/49408

TEST=Inliner_always_consider_inlining, Inliner_List_of_inlined
Change-Id: I7f8fc7cb0ac4a69310c108cf519518c384dc0164
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253740
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-08-15 21:14:36 +00:00
Ryan Macnak c1e67ac84f [vm] Recognize unmodifiable typed data views.
These types now work with Dart_TypedDataAcquireData.

The presence of these types no longer degrades the performance of typed data indexed loads.

The presence of these types degrades the performance of typed data indexed stores much less. The performance of indexed stores is somewhat regressed if these types were not used.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/32028
Bug: https://github.com/dart-lang/sdk/issues/40924
Bug: https://github.com/dart-lang/sdk/issues/42785
Change-Id: Iffad865708501acf96db418985cd5a69bd9afa55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254501
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-11 18:10:48 +00:00
Daco Harkes f592a11e51 [vm/ffi] NativeFieldWrapper FfiNative check receivers for nullptr
Changes `FfiNative` instance methods on `NativeFieldWrapperClass`es
that have `Pointer<Void>` conversion to check for `nullptr`.

If the native field has `0`/`nullptr` a `StateError` is thrown:
"Bad state: Native field is nullptr."

This only makes sense if the first native field is used to point to
the C++ object corresponding to the Dart object. As far as we know
all current use cases do so.

TEST=pkg/vm/testcases/transformations/ffi/ffinative.dart.expect
TEST=tests/ffi/vmspecific_ffi_native_test.dart

Closes: https://github.com/dart-lang/sdk/issues/49620
Change-Id: I92f760c33d391476010722358f9713fa4491ab61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254200
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-08-11 17:39:57 +00:00
Johnni Winther 50ac2500a1 [dart2js] Handle private names correctly in K/J-model
The library wasn't taken into account when handling computing class
members in the K/J-model and not handled correctly when computing
applicable selectors. This made dart2js unable to handle members with
a name private to a different library than the enclosing library.

Fixes #33732
Fixes #49226

Change-Id: I5ba143d87662bbd42e0ff02355054e4a937be8f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252665
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2022-08-11 06:56:32 +00:00
Joshua Litt 90478c34c4 [dart2wasm] Support typed data conversions across JS interop boundary.
Change-Id: Ie8aca2027ac47dafd79636d8ac06f3466817b8d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253841
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2022-08-10 20:23:41 +00:00
Ryan Macnak 10bf1cfe58 Revert "[vm] Recognize unmodifiabled typed data views."
This reverts commit d1112d37bd.

Reason for revert: b/242043014

Original change's description:
> [vm] Recognize unmodifiabled typed data views.
>
> These types now work with Dart_TypedDataAcquireData.
>
> The presence of these types no longer degrades the performance of typed data indexed loads.
>
> The presence of these types degrades the performance of typed data indexed stores much less. The performance of indexed stores is somewhat regressed if these types were not used.
>
> TEST=ci
> Bug: https://github.com/dart-lang/sdk/issues/32028
> Bug: https://github.com/dart-lang/sdk/issues/40924
> Bug: https://github.com/dart-lang/sdk/issues/42785
> Change-Id: I05ac5c9543f6f61ac37533b9efe511254778caed
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253700
> Reviewed-by: Aske Simon Christensen <askesc@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=kustermann@google.com,rmacnak@google.com,askesc@google.com

TEST=ci
Change-Id: I32c1c460fc30c51bc0d42e7cfaafe72bf5630069
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/32028
Bug: https://github.com/dart-lang/sdk/issues/40924
Bug: https://github.com/dart-lang/sdk/issues/42785
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254560
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-10 20:08:22 +00:00
Ryan Macnak d1112d37bd [vm] Recognize unmodifiabled typed data views.
These types now work with Dart_TypedDataAcquireData.

The presence of these types no longer degrades the performance of typed data indexed loads.

The presence of these types degrades the performance of typed data indexed stores much less. The performance of indexed stores is somewhat regressed if these types were not used.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/32028
Bug: https://github.com/dart-lang/sdk/issues/40924
Bug: https://github.com/dart-lang/sdk/issues/42785
Change-Id: I05ac5c9543f6f61ac37533b9efe511254778caed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253700
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-09 20:57:05 +00:00
Nicholas Shahan fa47a0547c [web] Make environment nullable in more places
It appears that the environment was intended to be nullable in
some type constructions.

DDC running in weak mode can fail when null is passed as an argument
that is typed to be non-nullable.

Change-Id: I2c67efacc1166e6053ef8d8d7820de2c022c5e1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253706
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-08-09 18:22:55 +00:00
Michael Thomsen c34b72482e Remove deprecated APIs from dart:convert
Contributes to bug: https://github.com/dart-lang/sdk/issues/34233

Change-Id: I443fa14342680b61bf7357d40347427200fea29b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247741
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2022-08-09 10:21:22 +00:00
Joshua Litt b99140115b [dart2wasm] Fix some js interop related issues.
Change-Id: Id189c53c7a4c536c703b0b9e83265a81d0c14094
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253609
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-08-08 17:29:40 +00:00
Martin Kustermann 4539bf6584 [vm] Make heap snapshot writer also visit isolate stacks as roots
Heap snapshots currently produced don't visit isolate stacks. As such
analyzing such snapshots may lead one to conclude there is a lot of
garbage while objects are actually reachable.

=> This CL makes us visit isolate stacks when building heap snapshots.

Furthermore we add a new `VMInternals.writeHeapSnapshotToFile` helper
that can be used to programmatically write snapshots and can be handy
for internal use at times. (We also use this helper in a test)

TEST=vm/dart{,_2}/heap_snapshot_test

Change-Id: I976544b7f6d20863764af9a40bf1ffb3c319bbce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253785
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-08-06 11:24:28 +00:00
Mark Zhou ad8d2ccb06 [dart2js] Updating runtime allocations to store a JSON-decoded map instead of a JSON string
This was requested by internal teams for easier querying/processing.

Change-Id: I59fea565f79bf92d4cf808cc0466b4e9cfa37fe8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253707
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-08-06 00:02:37 +00:00
Slava Egorov d94a1cd419 Revert "[vm, compiler] Implement unboxed SIMD for RISC-V via lowering."
This reverts commit 460bd7a03a.

Reason for revert: build and layout benchmarks seem to be failing on Golem

Original change's description:
> [vm, compiler] Implement unboxed SIMD for RISC-V via lowering.
>
> TEST=ci
> Change-Id: Ice2ec0847ee43ff9b8c5859ba15dbbeee48ba36e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250943
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>

TBR=vegorov@google.com,rmacnak@google.com,alexmarkov@google.com

Change-Id: I062bc13d0d941fcabf4c67a696fc2be324f0e1c3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253580
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-08-03 10:32:46 +00:00
Srujan Gaddam 409b426cfc [dart:html] Add SharedArrayBuffer constructor and slice
Fixes https://github.com/dart-lang/sdk/issues/35344

Change-Id: I5742adddf1fe01bfe40860a734a4c930091d8472
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253563
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2022-08-03 01:04:25 +00:00
Ryan Macnak 460bd7a03a [vm, compiler] Implement unboxed SIMD for RISC-V via lowering.
TEST=ci
Change-Id: Ice2ec0847ee43ff9b8c5859ba15dbbeee48ba36e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250943
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-08-02 20:24:54 +00:00
Brian Quinlan 0a591de164 Document that Directory.list* returns results in arbitrary order
Bug: https://github.com/dart-lang/sdk/issues/48621
Change-Id: I0f200abf4a5a218cccf79b4b5b71fe85959b16db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253360
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-08-01 23:58:44 +00:00
Sigmund Cherem b62e612dc8 [dart:html] Deprecate custom element registration APIs.
The `registerElement` APIs in `dart:html` are legacy APIs based on a
deprecated Web Components v0.5 specification. These methods don't work
on modern browsers and can only be used with a polyfill.

The latest Web Components specification is supported indirectly via
JSInterop and doesn't have an explicit API in the `dart:html` library.

This change marks these APIs as deprecated. We intend to remove them in
the future (see https://github.com/dart-lang/sdk/issues/49536)

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

Change-Id: I2e96d36e95c9971b59cde80bc4da49b63d12b17c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252840
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2022-07-28 16:07:30 +00:00
Kabo a11c253152 Fix documentation for Object.hashAllUnordered
Closes https://github.com/dart-lang/sdk/pull/49496

GitOrigin-RevId: 60d2f2a8548f51aab9f8d8a782e46240e0255ae5
Change-Id: I6fb3f5c31f73691ac577a4a58898bf49237a2ff7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252400
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-07-28 10:54:00 +00:00
Joshua Litt e1933cd4a0 [dart2wasm] Implement NoSuchMethodError.
Change-Id: I1a799255f93449fef011cb0bc9b92cd63f3437c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250791
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-07-28 01:20:40 +00:00
Aske Simon Christensen e75be087e5 [dart2wasm] Fix handling of null values in some non-nullable contexts
Change-Id: Id25f4899d0898686ee30bf05f7e57a9ef84fb818
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252740
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-07-27 22:47:30 +00:00
Joshua Litt 9683862a4e [dart2wasm] Minor fixes to unblock building Flutter.
Change-Id: I58b9554b94f8a35432a04a27a7bf1b39701f45d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251781
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-07-27 17:31:28 +00:00
Joshua Litt 63a9057f12 [dart2wasm] Implement unimplemented methods in DateTime.
Change-Id: Ia84d2e65ab6207fc70f6f8380c18ba3b89f7400f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251590
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-07-27 00:50:47 +00:00
Joshua Litt fe78a23e9a [js_util] Generalize dartify, and make it more robust.
Change-Id: I3608bcbdf320f6d4da2a52119d48fb02df2ad0e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252565
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-07-26 21:49:27 +00:00
Joshua Litt eeb2212287 [dart2wasm] Implement Stopwatch on top of JS.
Change-Id: Ia9bde1b86fe80c33db4219e08a3ce0180227e104
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251591
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-07-26 20:41:27 +00:00
Joshua Litt 9e83c53c61 [dart2wasm] Implement constant symbols.
Change-Id: I758576a7a35c6ffe127fd02eb394e97719750476
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250776
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-07-26 17:40:07 +00:00
Joshua Litt e45f73dd6d [dart2wasm] Use VM's bigint implementation.
Change-Id: Ie0cfa40ec4497ee9d6eacff07bc479fe7d74537c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250485
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-07-25 17:16:29 +00:00
Ben Konyi 5ef61ff1e5 [ dart:developer ] Update documentation for Metrics
Fixes https://github.com/dart-lang/sdk/issues/49511

Change-Id: I0dae4709ef34d1dd9cf3c8ccebd295df4565fbc3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252620
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2022-07-25 15:32:59 +00:00
Anis Alibegić 40e18905f2 Fixed various typos in a lot of files
Closes https://github.com/dart-lang/sdk/pull/49478

TEST=Manual

GitOrigin-RevId: f4c9c6869dfe73639295e86574a021523b3d374d
Change-Id: I134a97caed4eec59d70e9cbca16b7e9a472cf2c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251902
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Kevin Chisholm <kevinjchisholm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2022-07-25 12:21:59 +00:00
Joshua Litt f6f29df4b5 [dart2wasm] Enable RTI tests for oddball and interface types.
Change-Id: I4b92d4cf30779b78f3eab1acd18193fdd58ab452
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249641
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-07-23 00:56:38 +00:00
Ryan Macnak 2d13b205d7 Reland "[vm] Generate event ids for synchronous begin and end events."
Fix transposed id and timestamp.

TEST=Instruments, ci
Bug: https://github.com/dart-lang/sdk/issues/49178
Change-Id: I2c2650f28050b179d26e1269729727f58201a8a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251581
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-07-22 19:13:47 +00:00
Nicholas Shahan 8d1ad7d13c [ddc] Refactor _checkAndCall
Move the method body out of one giant JS foreign function and into
Dart code with small JS foreign function calls inside.

The generous use of small JS foreign function calls ensures almost
identical compiled output with the exception of indentation, curly
braces on if statements, and single vs double quote differences.

Issue: https://github.com/dart-lang/sdk/issues/46002
Change-Id: Ice039fd096893e4f8869696ca46651b3d2e88add
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252410
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-07-22 16:57:22 +00:00
Tess Strickland 27f6c6d660 Reland "[pkg/native_stack_traces] Support Mach-O dSYM debugging information."
This is a reland of commit 08c13f173c

Fixes test failures on non-x64 architectures, both in the test
harness and due to DWARF5 line number program headers having a
non-backwards compatible format. (We generate DWARF2 in the
ELF snapshot writer, but the assembler used for assembly snapshots
may generate DWARF5.)

TEST=vm/dart{,_2}/use_dwarf_stack_traces_flag

Original change's description:
> [pkg/native_stack_traces] Support Mach-O dSYM debugging information.
>
> TEST=vm/dart{,_2}/use_dwarf_stack_traces_flag
>
> Bug: https://github.com/dart-lang/sdk/issues/43612
> Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-mac-product-x64-try,pkg-mac-release-arm64-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
> Change-Id: Icda21bb14dcc0cf4784cea118e6ba7dd4edd35aa
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250381
> Commit-Queue: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>

Bug: https://github.com/dart-lang/sdk/issues/43612
Change-Id: I8a9cb70e78bc8594bcae004809c5a1be778d691d
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-mac-product-x64-try,pkg-mac-release-arm64-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-nnbd-mac-release-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251464
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-07-22 07:05:26 +00:00
Joshua Litt 047ca385c4 [dart2wasm] Fix infinite loop in createFromCharCodes.
Change-Id: I6d9c92f2b509424c829af4b057c7cebf5a746e00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250446
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-07-21 23:04:36 +00:00
Joshua Litt cf51477ad3 [dart2wasm] Add _DuplicatedFieldInitializerError to core for CFE.
Change-Id: I8b3c594d6fb56437c76e819b45c53d3465f0fdc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250483
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-07-21 23:01:16 +00:00
Aske Simon Christensen bfd2ec2c26 [dart2wasm] Fix return type of _typeArguments
This fixes the breakage of barista3 introduced in
https://dart-review.googlesource.com/c/sdk/+/250480

Change-Id: I5ebca17ab35464e0c452d2fbe1b0f6574e05b6cd
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252381
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Auto-Submit: Aske Simon Christensen <askesc@google.com>
2022-07-21 18:12:25 +00:00
Michael Thomsen e84412af45 Remove unsupported APIs in dart:mirrors
Contributes to bug: https://github.com/dart-lang/sdk/issues/34233
Fixes https://github.com/dart-lang/sdk/issues/32507

Change-Id: Iee72e9f91fc1fc49761e6f5e6e9dba412493c8ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248003
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-07-20 18:28:35 +00:00
Ryan Macnak b25d63043b Document which classes in dart:typed_data cannot be extended or implemented.
Cf. pkg/front_end/lib/src/fasta/denylisted_classes.dart.

Change-Id: Ib2692e763506164a34eca89ab98adc087642dce8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252003
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-20 17:37:19 +00:00
Joshua Litt 1dd12d45c7 [dart2wasm] Add support for stub dart:io.
Change-Id: Ic6c7e7dc230023d5aee35529ff8ab600f1d0ec3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250444
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-07-20 16:51:25 +00:00
Ian Hickson e2b2f56829 Be more explicit about when Futures are used
Closes https://github.com/dart-lang/sdk/pull/48561

GitOrigin-RevId: e8d67d3d54393aa9ddbb996458139b3e76e97450
Change-Id: Ic3fe09ff060f7ace55e08c416fbab925525b44d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237241
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-07-20 13:40:05 +00:00
Nicholas Shahan a9bcff7388 [ddc] Refactor typeName
Move the method body out of one giant JS foreign function and into
Dart code with small JS foreign function calls inside.

Issue: https://github.com/dart-lang/sdk/issues/46002
Change-Id: I978f752c8bb6f09ed3c2ca7d149561f488034509
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251851
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-07-19 19:19:24 +00:00
Ryan Macnak 9b6bda05ec [vm] Remove dead _localTimeZoneAdjustmentInSeconds.
Dead since 6af4987dc6.

TEST=ci
Change-Id: Ib92d2334dcc4c98e203628b4a8d244e6277b6b97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251841
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-07-19 17:29:04 +00:00
Aske Simon Christensen d8d9e06804 [dart2wasm] Support defining, exporting and accessing Wasm tables
Tested: Added tests/web/wasm/table_test.dart
Change-Id: I3971f4432a7a59bd6bc9874fc96202a7a9f2283d
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248586
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-07-19 13:06:54 +00:00
Michael Thomsen e15d639827 Remove deprecated APIs from dart:developer
Contributes to bug: https://github.com/dart-lang/sdk/issues/34233

Change-Id: I18f12b8c8da2ec444911128b96111e93df6c0496
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251767
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-07-19 07:10:03 +00:00
Brian Quinlan 981bcf61c9 Disallow invalid content-length.
Change-Id: I502c80f6d5914683622272cca37b5ba324f9262f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248840
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-07-19 00:44:33 +00:00
Alexander Markov 025bfc858e [vm] Fix yield in async* to check if the stream was canceled while generator was suspended
Previously there was a window between the decision to resume generator
and actually running the micro-task. The stream could be canceled
during that window, making running the generator incorrect.

The solution is to check if the stream was canceled right before
resuming the generator in yield/yield*.

This change also unifies yield and yield* to check if the stream
was canceled even before suspending the generator.

TEST=language/async_star/cancel_while_paused_test,
language/async_star/cancel_while_paused_at_yield_test

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

Change-Id: Ib8ff3a2da9a6a7da8766a7dbf28e2c9d618728f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251562
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-07-15 14:09:20 +00:00
Michael Debertol 357d4a556b Fix documentation of num.remainder
Closes https://github.com/dart-lang/sdk/pull/49378

GitOrigin-RevId: f668688317d9eac62b5e629c5a450be98c830959
Change-Id: I9381e3ec6ea10efdc1f7da4f59cf4b64a0908f73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250400
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-07-15 12:57:19 +00:00
Gary Qian 03e5f9f941 Revert "Reland "[vm] Generate event ids for synchronous begin and end events.""
This reverts commit 05e5664ad6.

Reason for revert: Blocking Flutter engine -> framework roll, https://github.com/flutter/flutter/pull/107653/checks?check_run_id=7341814911

Invalid argument(s): durations is empty!
package:flutter_driver/src/driver/timeline_summary.dart 414:7   TimelineSummary._averageInMillis
package:flutter_driver/src/driver/timeline_summary.dart 72:12   TimelineSummary.computeAverageFrameRasterizerTimeMillis
package:flutter_driver/src/driver/timeline_summary.dart 232:47  TimelineSummary.summaryJson


Original change's description:
> Reland "[vm] Generate event ids for synchronous begin and end events."
>
> TEST=Instruments
> Bug: https://github.com/dart-lang/sdk/issues/49178
> Change-Id: I5ecb76e468d32e120de338e802ec313a7f50a49c
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251144
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=rmacnak@google.com,asiva@google.com

Change-Id: I52fffe00ec141a486241fa8719d4cf12df168384
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/49178
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251561
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-07-14 17:21:25 +00:00
Alexander Markov 2ad557a892 [vm] Cleanup more async-related code
This change continues cleanup of async implementation in the VM.

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: Icdaeab18bcdc0d6974bc45841b630822cd1ac114
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251441
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-07-14 16:04:54 +00:00
Ryan Macnak 05e5664ad6 Reland "[vm] Generate event ids for synchronous begin and end events."
TEST=Instruments
Bug: https://github.com/dart-lang/sdk/issues/49178
Change-Id: I5ecb76e468d32e120de338e802ec313a7f50a49c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251144
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-07-13 21:59:33 +00:00
Ben Konyi a75e9cd3ee Revert "[pkg/native_stack_traces] Support Mach-O dSYM debugging information."
This reverts commit 08c13f173c.

Reason for revert: Causing failures on simarm, simarm64, etc

Original change's description:
> [pkg/native_stack_traces] Support Mach-O dSYM debugging information.
>
> TEST=vm/dart{,_2}/use_dwarf_stack_traces_flag
>
> Bug: https://github.com/dart-lang/sdk/issues/43612
> Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-mac-product-x64-try,pkg-mac-release-arm64-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
> Change-Id: Icda21bb14dcc0cf4784cea118e6ba7dd4edd35aa
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250381
> Commit-Queue: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>

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

Bug: https://github.com/dart-lang/sdk/issues/43612
Change-Id: I020c29f7329e9b53a8fe0f4f4a4de4070fca0ec3
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-mac-product-x64-try,pkg-mac-release-arm64-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251242
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-07-13 16:15:45 +00:00
Ahmed Ashour 99f0fb5b70 Fix typos
Fixes #49364

TEST=ci

Change-Id: Ic643819c9cdd7b56690981b96b854b1e8d622fff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250160
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-12 19:35:22 +00:00
Alexander Markov fb7b291886 [vm] Reduce number of callbacks used in sync* functions
This change introduces separate stubs for suspending sync* functions
at start and at yield/yield*. Suspend stub for yield/yield*
no longer calls Dart callback (in order to make it faster).

Also, ReturnSyncStar stub is removed - sync* functions now directly
return false instead of going through the stub.

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: Iee9a1f48cab2812cf0f9f0e4e6d8e847547e49f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250420
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-07-12 19:30:12 +00:00
Alexander Markov 61caeca47a Reland "[vm] Cleanup old async/async*/sync* implementation from the VM"
This is a reland of commit bc8afad855

On top of the original commit, this change fixes incorrect
propagation of async/async*/sync* modifiers from a function to
its dynamic invocation forwarder.

TEST=ci, runtime/tests/vm/dart/regress_b_238653741_test.dart
Fixes b/238653741
Issue: https://github.com/dart-lang/sdk/issues/48378

Original change's description:
> [vm] Cleanup old async/async*/sync* implementation from the VM
>
> TEST=ci
>
> Issue: https://github.com/dart-lang/sdk/issues/48378
> Change-Id: I089ba4ed5613f30eec29f0db4ac6d5d8fbffd185
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249980
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

Change-Id: Iaad033d974a23fc6c5880a3d7f41818eb117f839
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251300
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-07-12 19:25:32 +00:00
Ben Konyi 4c263d3754 [ dart:developer ] Add deprecation message to MAX_USER_TAGS
Follow up to https://dart-review.googlesource.com/c/sdk/+/251120/

Change-Id: Ib7fa8d1ece6d3301489f70d58793b65e0c1cfe0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251240
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2022-07-12 15:40:12 +00:00
Tess Strickland 08c13f173c [pkg/native_stack_traces] Support Mach-O dSYM debugging information.
TEST=vm/dart{,_2}/use_dwarf_stack_traces_flag

Bug: https://github.com/dart-lang/sdk/issues/43612
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-mac-product-x64-try,pkg-mac-release-arm64-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
Change-Id: Icda21bb14dcc0cf4784cea118e6ba7dd4edd35aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250381
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-07-12 11:10:02 +00:00
Alexander Markov 2f17c118b5 Revert "[vm] Cleanup old async/async*/sync* implementation from the VM"
This reverts commit bc8afad855.

Reason for revert: b/238653741

Original change's description:
> [vm] Cleanup old async/async*/sync* implementation from the VM
>
> TEST=ci
>
> Issue: https://github.com/dart-lang/sdk/issues/48378
> Change-Id: I089ba4ed5613f30eec29f0db4ac6d5d8fbffd185
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249980
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

TBR=vegorov@google.com,kustermann@google.com,alexmarkov@google.com

Change-Id: I6437d2d7d3914eb7fb9fe397472e2a5f7ae0cd9e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Issue: https://github.com/dart-lang/sdk/issues/48378
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251147
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-07-11 21:09:52 +00:00
Ben Konyi 4e75f872a8 [ dart:developer ] Minor cleanup, deprecate MAX_USER_TAGS
Change-Id: I11d087bea7be9c7ceedc8a0aec8bc061a99b63e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251120
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-07-11 19:47:01 +00:00
Alexander Markov bc8afad855 [vm] Cleanup old async/async*/sync* implementation from the VM
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: I089ba4ed5613f30eec29f0db4ac6d5d8fbffd185
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249980
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-07-11 18:46:41 +00:00
Ben Konyi bf19cfc8fe [ dart:developer ] Expose the set of currently registered Metrics
Fixes https://github.com/dart-lang/sdk/issues/49062

Change-Id: I2e12dd51c7e43c3cd33d7ad6716849a010ec57d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251121
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-07-11 15:52:18 +00:00
asiva 08d2a29233 [io] Remove call to FATAL on a socket error event with no error
Remove call to FATAL on a socket error event when we get back a null
error from the call to getsockopt with SO_ERROR, instead we just close
the socket.
(Should address the increased crash reports that apps are seeing after the FATAL call was added to see if we could get a stack trace when this condition happens).

TEST=ci
Change-Id: I39a399a7f60b218c665d30d6c43e7c18173c0e80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250346
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2022-07-07 00:03:44 +00:00
Daco Harkes 1c7a7d0c41 [vm/ffi] Fix reference in comment
The comment was referencing a non-existent function.

TEST=just a comment update

Change-Id: I516debc58addb42d80775223625b0b2088c230d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250740
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-07-06 12:22:50 +00:00
Janice Collins 822cd1cbd5 Remove dartanalyzer from built SDK.
Bug: https://github.com/dart-lang/sdk/issues/48457
Change-Id: Ic0d038299712989b8445859590ff870ce3bdc13a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249662
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-01 17:43:20 +00:00
Zach Anderson d7df61e042 Revert "[vm] Generate event ids for synchronous begin and end events."
This reverts commit 7fe44864d6.

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

Original change's description:
> [vm] Generate event ids for synchronous begin and end events.
>
> os_signposts needs explicit ids to match begin and end events, whereas all other trace systems do this implicitly.
>
> TEST=Instruments
> Bug: https://github.com/dart-lang/sdk/issues/49178
> Change-Id: Ifeeaa1dfe823a0d5668f48b8c584f8bdeef23212
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249951
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=rmacnak@google.com,asiva@google.com

Change-Id: Id86959d08b5352b5446b6f294a8302b88b4fa0c8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/49178
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250403
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2022-07-01 16:08:40 +00:00
Alexander Markov abedfaf62a [vm] Fix soundness issue when awaiting a user-defined Future
TEST=language/async/await_user_defined_future_soundness_test

Issue: https://github.com/dart-lang/sdk/issues/49345
Change-Id: Ieaaa9baace13dad242c770a710d4d459e135af81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250222
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-06-30 22:53:24 +00:00
Ryan Macnak 7fe44864d6 [vm] Generate event ids for synchronous begin and end events.
os_signposts needs explicit ids to match begin and end events, whereas all other trace systems do this implicitly.

TEST=Instruments
Bug: https://github.com/dart-lang/sdk/issues/49178
Change-Id: Ifeeaa1dfe823a0d5668f48b8c584f8bdeef23212
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249951
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-06-30 16:48:36 +00:00
Alexander Aprelev f51149eba3 [embedder] Clean up deprecated secure connection enforcement mechanism.
Addresses https://github.com/flutter/flutter/issues/54448
TEST=ci, flutter

Change-Id: If1ea8044cdfa8d593e0cd5b5201c2fbe71dd08ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248220
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
2022-06-29 16:59:25 +00:00
Daco Harkes a37502c1b8 [misc] Cleanup stale todos
TEST=tests/ffi

Change-Id: Iae97f62b1adb8dbe99ad075dfe750604db0de62c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249301
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2022-06-28 16:02:53 +00:00
Srujan Gaddam fe93b161e0 [dart:html] Add MathMLElement
Fixes b/236721367

Per https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement,
MathMLElement is in the Element type hierarchy. This adds an empty
class so that type-checking against Element can pass.

Change-Id: Ie0c2e33c2236bedd5627ed8624437d24d9fbac2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249945
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-06-27 23:10:12 +00:00
Alexander Markov 77ea9820aa [vm] New implementation of sync* based on suspend/resume stubs
Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: I7f4b6b56d914a617dfd7ac724cd4414532073b4c
TEST=ci
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249141
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-06-27 18:19:12 +00:00
Joshua Litt 51e38cb554 [dart2wasm] Correctly generate type arguments for InterfaceType.
Change-Id: I8b6429827e691f09875df90ea32ba91021ab2418
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245286
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-06-24 20:07:20 +00:00
Lasse R.H. Nielsen a08a5c5d6c Deprecate BidirectionalIterator.
There is only one use of it in the SDK, `RuneIterator`,
one use of it outside, `TreeSet` from `package:quiver`,
and one known use in Google internal code.

There are other bi-directional iteration interfaces,
like `CharacterRange` from `package:characters`,
which can move a cursor in two directions,
but which didn't loke the `movePrevious` name and therefore
are not `BidirectionalIterator`s.
(There is also a Google internal class which mentions explicitly
why they're not `BidirectionalIterator`.)

There is no real need for this "shared" interface.
It doesn't carry its own weight.
We have no abstractions which work on the *interface*,
only code that works on one specific concrete implementation.

I'd recommend:
* `quiver` introduce a `TreeSetIterator` for their use-case
  (the actual class has more public members than `BidirectionalIterator`,
  which cannot be accessed through the declared type.)
* the Google internal code introduces its own interface
  (which is just `Iterable` + `movePrevious`.
* The SDK will just make `RuneIterator` not implement
  `BidirectionalIterator` at some (breaking) point.
  Maybe just when we remove the type.


FLUTTER: Needs to land https://github.com/flutter/flutter/pull/106471 before merging this CL into Flutter.

Change-Id: Iaaa6b0c428d30eb3b68898c077d265ac0a622805
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249486
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-06-24 14:21:29 +00:00
Emmanuel Pellereau fd590c54c2 Revert "Make nullFuture be per-zone."
This reverts commit c97f7b7fad.

Reason for revert: Still breaking google3 (b/236665701)

Original change's description:
> Make `nullFuture` be per-zone.
>
> We introduced a `nullFuture` during the null-safety migration where
> we changed some methods to no longer allow returning `null`,
> and they therefore had to return a `Future`.
> That affected timing, because returning `null` was processed
> synchronously, and that change in timing made some tests fail.
> Rather that fix the fragile tests, we made the function return
> a recognizable future, a canonical `Future<Null>.value(null)`,
> and then recognized it and took a synchronous path for it.
>
> That caused other issues, because the future was created in the
> root zone. (Well, originally, it was created in the first zone
> which needed one, that was worse. Now it's created in the root zone.)
> Some code tries to contain asynchrony inside a custom zone, and
> then the get a `nullFuture` and calls `then` on it, and that
> schedules a microtask in the root zone.
> (It should probably have used the listener's zone, and not store
> a zone in the future at all, but that's how it was first done,
> and now people rely on that behavior too.)
>
> This change creates a `null` future *per zone* (lazily initialized
> when asked for). That should be sufficient because the code recognizing
> a returned `null` future is generally running in the same zone,
> but if any other code gets the `nullFuture`, it will be in the
> expected zone for where it was requested.
>
> This is a reland of commit a247b158d6
>
> Change-Id: Ieec74d6f93c57175c357ec18889144635f5bdca6
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249490
> Commit-Queue: Lasse Nielsen <lrn@google.com>
> Reviewed-by: Erik Ernst <eernst@google.com>

TBR=lrn@google.com,eernst@google.com,nbosch@google.com

Change-Id: I870285b03ec05803c5aaa6b66f9a6e6ea360d732
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249609
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
2022-06-24 14:13:39 +00:00
Lasse R.H. Nielsen c97f7b7fad Make nullFuture be per-zone.
We introduced a `nullFuture` during the null-safety migration where
we changed some methods to no longer allow returning `null`,
and they therefore had to return a `Future`.
That affected timing, because returning `null` was processed
synchronously, and that change in timing made some tests fail.
Rather that fix the fragile tests, we made the function return
a recognizable future, a canonical `Future<Null>.value(null)`,
and then recognized it and took a synchronous path for it.

That caused other issues, because the future was created in the
root zone. (Well, originally, it was created in the first zone
which needed one, that was worse. Now it's created in the root zone.)
Some code tries to contain asynchrony inside a custom zone, and
then the get a `nullFuture` and calls `then` on it, and that
schedules a microtask in the root zone.
(It should probably have used the listener's zone, and not store
a zone in the future at all, but that's how it was first done,
and now people rely on that behavior too.)

This change creates a `null` future *per zone* (lazily initialized
when asked for). That should be sufficient because the code recognizing
a returned `null` future is generally running in the same zone,
but if any other code gets the `nullFuture`, it will be in the
expected zone for where it was requested.

This is a reland of commit a247b158d6

Change-Id: Ieec74d6f93c57175c357ec18889144635f5bdca6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249490
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2022-06-24 11:32:30 +00:00
Emmanuel Pellereau d9d7d30820 Revert "Make nullFuture be per-zone."
This reverts commit 4d750a862d.

Reason for revert: breaks google3 (b/236665701)

Original change's description:
> Make `nullFuture` be per-zone.
>
> We introduced a `nullFuture` during the null-safety migration where
> we changed some methods to no longer allow returning `null`,
> and they therefore had to return a `Future`.
> That affected timing, because returning `null` was processed
> synchronously, and that change in timing made some tests fail.
> Rather that fix the fragile tests, we made the function return
> a recognizable future, a canonical `Future<Null>.value(null)`,
> and then recognized it and took a synchronous path for it.
>
> That caused other issues, because the future was created in the
> root zone. (Well, originally, it was created in the first zone
> which needed one, that was worse. Now it's created in the root zone.)
> Some code tries to contain asynchrony inside a custom zone, and
> then the get a `nullFuture` and calls `then` on it, and that
> schedules a microtask in the root zone.
> (It should probably have used the listener's zone, and not store
> a zone in the future at all, but that's how it was first done,
> and now people rely on that behavior too.)
>
> This change creates a `null` future *per zone* (lazily initialized
> when asked for). That should be sufficient because the code recognizing
> a returned `null` future is generally running in the same zone,
> but if any other code gets the `nullFuture`, it will be in the
> expected zone for where it was requested.
>
> This is a reland of commit a247b158d6
>
> Change-Id: Ia113756de1f6d50af4b1abfec219d6b4dcd5d59b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249488
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>

TBR=lrn@google.com,nbosch@google.com

Change-Id: I02d62d58bae33d6a606a80eb3eee2e8e721a8e20
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249620
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2022-06-24 06:48:49 +00:00
Devon Carew 93951169ba [pkg/js_shared] address a few analysis issues
Change-Id: I9ce9c66fa24bf58172b0fb2545c8bd745bc2fe68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249549
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-06-23 23:34:18 +00:00
Lasse R.H. Nielsen 4d750a862d Make nullFuture be per-zone.
We introduced a `nullFuture` during the null-safety migration where
we changed some methods to no longer allow returning `null`,
and they therefore had to return a `Future`.
That affected timing, because returning `null` was processed
synchronously, and that change in timing made some tests fail.
Rather that fix the fragile tests, we made the function return
a recognizable future, a canonical `Future<Null>.value(null)`,
and then recognized it and took a synchronous path for it.

That caused other issues, because the future was created in the
root zone. (Well, originally, it was created in the first zone
which needed one, that was worse. Now it's created in the root zone.)
Some code tries to contain asynchrony inside a custom zone, and
then the get a `nullFuture` and calls `then` on it, and that
schedules a microtask in the root zone.
(It should probably have used the listener's zone, and not store
a zone in the future at all, but that's how it was first done,
and now people rely on that behavior too.)

This change creates a `null` future *per zone* (lazily initialized
when asked for). That should be sufficient because the code recognizing
a returned `null` future is generally running in the same zone,
but if any other code gets the `nullFuture`, it will be in the
expected zone for where it was requested.

This is a reland of commit a247b158d6

Change-Id: Ia113756de1f6d50af4b1abfec219d6b4dcd5d59b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249488
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-06-23 09:19:45 +00:00
Emmanuel Pellereau 707ade91c9 Revert "Make nullFuture be per-zone."
This reverts commit a247b158d6.

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

Original change's description:
> Make `nullFuture` be per-zone.
>
> We introduced a `nullFuture` during the null-safety migration where
> we changed some methods to no longer allow returning `null`,
> and they therefore had to return a `Future`.
> That affected timing, because returning `null` was processed
> synchronously, and that change in timing made some tests fail.
> Rather that fix the fragile tests, we made the function return
> a recognizable future, a canonical `Future<Null>.value(null)`,
> and then recognized it and took a synchronous path for it.
>
> That caused other issues, because the future was created in the
> root zone. (Well, originally, it was created in the first zone
> which needed one, that was worse. Now it's created in the root zone.)
> Some code tries to contain asynchrony inside a custom zone, and
> then the get a `nullFuture` and calls `then` on it, and that
> schedules a microtask in the root zone.
> (It should probably have used the listener's zone, and not store
> a zone in the future at all, but that's how it was first done,
> and now people rely on that behavior too.)
>
> This change creates a `null` future *per zone* (lazily initialized
> when asked for). That should be sufficient because the code recognizing
> a returned `null` future is generally running in the same zone,
> but if any other code gets the `nullFuture`, it will be in the
> expected zone for where it was requested.
>
> Change-Id: Ibe204eaabe175cbcbcb7822ca1f2bcdda72a478c
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248660
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>

TBR=lrn@google.com,nbosch@google.com

Change-Id: Ic765eb1401dbff4dea6c08c007c0bf9aff186684
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249188
Reviewed-by: Oleh Prypin <oprypin@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
2022-06-21 07:33:23 +00:00
Lasse R.H. Nielsen a247b158d6 Make nullFuture be per-zone.
We introduced a `nullFuture` during the null-safety migration where
we changed some methods to no longer allow returning `null`,
and they therefore had to return a `Future`.
That affected timing, because returning `null` was processed
synchronously, and that change in timing made some tests fail.
Rather that fix the fragile tests, we made the function return
a recognizable future, a canonical `Future<Null>.value(null)`,
and then recognized it and took a synchronous path for it.

That caused other issues, because the future was created in the
root zone. (Well, originally, it was created in the first zone
which needed one, that was worse. Now it's created in the root zone.)
Some code tries to contain asynchrony inside a custom zone, and
then the get a `nullFuture` and calls `then` on it, and that
schedules a microtask in the root zone.
(It should probably have used the listener's zone, and not store
a zone in the future at all, but that's how it was first done,
and now people rely on that behavior too.)

This change creates a `null` future *per zone* (lazily initialized
when asked for). That should be sufficient because the code recognizing
a returned `null` future is generally running in the same zone,
but if any other code gets the `nullFuture`, it will be in the
expected zone for where it was requested.

Change-Id: Ibe204eaabe175cbcbcb7822ca1f2bcdda72a478c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248660
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-06-20 08:00:01 +00:00
Stephen Adams 6dd17d6ec4 [runtime] Avoid SIGSEGV on String.*
Correctness changes:

Fix SEGV by checking for overflow in computing the length of the
repeated string.

Performance changes:

Use unnested loops to fill the string instead of nested loops.

Implement `operator *` for _TwoByteString in the same way.

(The default implementation using StringBuffer causes a lot of
allocations. For example, `"α" * 10000` repeatedly adds the small
string to the StringBuffer, which repeatedly compresses a sequence of
small strings to make a bigger string to stop the list of parts
becoming too large. This compression creates a lot of small strings
with the same contents.)

Bug: 49289
Change-Id: I06c3d91b531d7e4fffc8de9f3bada3eb62ad185f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249122
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-06-19 17:02:41 +00:00
Martin Kustermann 4703d2c54e [vm] Make _CastError.{_url,_line,_column} nullable fields
The ! operator causes _CastErrors to be thrown without the
_CastError.{_url,_line,_column} fields to be set (see
runtime/vm/runtime_entry.cc:NullErrorHelper).

This CL makes the fields nullable. An alternative would be to remove the
fields entirely since the fields are not used and the position of the
failed null check is visible from top frame in the stack frame as well.

Though the fields are visible in the debugger and there are other
situations where they are correctly set (e.g. in type errors that cause
_CastError to be thrown). To avoid changing this behavior, we make them
nullable.

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

TEST=vm/dart{,_2}/regress_49279_test

Change-Id: Ieff9e84819d5afa83c8950ad1f99d684d184340a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248980
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2022-06-17 10:39:28 +00:00
Daco Harkes 2b700003d9 Reland "[vm] Only call .hashCode once when adding to Map and Set"
Relanding after https://dart-review.googlesource.com/c/sdk/+/244200.

Original change's description:
> [vm] Only call `.hashCode` once when adding to `Map` and `Set`
>
> The methods to add to hash maps and hash sets are recursive: if the
> index needs to be rehashed then the same method is called again
> after rehashing.
>
> This CL nests the actual implementation in a private method that takes
> the full hashCode as an extra argument.
>
> No significant code size or run time changes are reported on our
> benchmarks. (Our benchmarks do not contain purposefully slow hashCodes.)
>
> Note that hashCode can be called again later if rehashing of the index
> is required on adding subsequent elements.
>
> Bug: https://github.com/dart-lang/sdk/issues/48948
> Change-Id: Ia3ccff9e592d675b4922ac78c4aa7ee0287ecb50
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243623
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Daco Harkes <dacoharkes@google.com>


Change-Id: I033bd7cc29fc812dccb6dccf0c3dca6e22cae2ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248802
Commit-Queue: Tess Strickland <sstrickl@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2022-06-17 10:05:18 +00:00
Ahmed Ashour b91256e78a [dart:math] fix documentation about Random()
Fixes #49263

Change-Id: I6c81d3ae65993d9ba3bcb2cd7b66a62ddffd2952
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248900
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-06-16 23:00:09 +00:00
Joshua Litt 05dfe9047d [dart2wasm] Build type rules for interface type arguments.
Change-Id: I4017d14ff9b32b2a556592f5074cdd3401c7d961
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243960
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-06-16 18:50:59 +00:00
Alexander Aprelev 6d923dfd99 Revert "Deprecate outdated errors, drop CastError and NullThrownError."
This reverts commit 0f3dea33f9.

Reason for revert: breaks dart->engine roller as flutter still uses NullThrownError, fails analysis step

Original change's description:
> Deprecate outdated errors, drop `CastError` and `NullThrownError`.
>
> Both `CastError` and `NullThrownError` becomes just (deprecated) aliases for `TypeError`.
>
> `FallThroughError` becomes deprecated. Fall-through was made a compile-time error in Dart 2.0, the error should no longer be used.
>
> `CyclicInitializationError` is deprecated. Null safe Dart doesn't specify which error a late initialization error throws. We use internal errors now.
>
> These errors should not be needed in sound null-safe mode (if they are even needed now), and so should be removed in Dart 3.0.
>
> TEST= No new tests, should not change behavior in a significant way.
>
> Bug: https://github.com/dart-lang/sdk/issues/49141
> Change-Id: I636e9a0d0c32021d40bb819a88a1f57db6efc5a9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247384
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Reviewed-by: Brian Quinlan <bquinlan@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>

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

Bug: https://github.com/dart-lang/sdk/issues/49141
Change-Id: I1b2802ec69fe654525e683527ff3554ff972f0c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248741
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-06-16 17:12:19 +00:00
Lasse R.H. Nielsen 330759efc0 Refactor to implement Stream.fromIterator more directly.
The current implementation uses a specialized version of the
pending-event queue used by stream subscriptions to remember
pending events.
That makes the queue polymorphic, and slightly more complicated than
necessary, and that again makes further refactorings of the
Stream implementation harder.

This change moves the logic from the specialized pending-queue
into a simple function instead, so you only pay for it if you
actually use `Stream.fromIterable`.

Also allows `Stream.fromIterable` to be listened to more than once.
(It uses `Stream.multi` for the general async+sync controller API,
and it would cost extra code to make it only work once.)

Change-Id: I44b2010225cd3d32c2bcdb8a315c94881331bdae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248146
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-06-16 11:39:30 +00:00
Lasse R.H. Nielsen 0f3dea33f9 Deprecate outdated errors, drop CastError and NullThrownError.
Both `CastError` and `NullThrownError` becomes just (deprecated) aliases for `TypeError`.

`FallThroughError` becomes deprecated. Fall-through was made a compile-time error in Dart 2.0, the error should no longer be used.

`CyclicInitializationError` is deprecated. Null safe Dart doesn't specify which error a late initialization error throws. We use internal errors now.

These errors should not be needed in sound null-safe mode (if they are even needed now), and so should be removed in Dart 3.0.

TEST= No new tests, should not change behavior in a significant way.

Bug: https://github.com/dart-lang/sdk/issues/49141
Change-Id: I636e9a0d0c32021d40bb819a88a1f57db6efc5a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247384
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-06-15 15:35:58 +00:00
Alexander Markov 058265f4e7 Reland "[vm] More efficient 'await' of not Future and completed _Future"
This is a reland of commit 6b3d1752fa

Fixes b/235734143
TEST=runtime/tests/vm/dart/await_in_custom_zone_test.dart

Original change's description:
> [vm] More efficient 'await' of not Future and completed _Future
>
> When awaiting a value which is not a Future or a completed
> built-in _Future, 'await' implementation can bypass heavyweight
> _Future/_FutureListener machinery and schedule micro-tasks directly.
>
> Benchmarks:
> JIT, x64:
> AsyncLiveVars.* +46-54% (bigger is better)
> Calls.AwaitAsyncCall -46% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -46%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -45%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -45%
> Calls.AwaitFutureOrCall -60%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -60%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -59%
>
> JIT, ia32:
> AsyncLiveVars.* +43-52% (bigger is better)
> Calls.AwaitAsyncCall -42% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -42%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -41%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -39%
> Calls.AwaitFutureOrCall -55%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -54%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -53%
>
> JIT, arm:
> AsyncLiveVars.* +64-71% (bigger is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -51% (less is better)
> Calls.AwaitAsyncCallClosureTargetPolymorphic -47%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -48%
> Calls.AwaitFutureOrCall -64%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -64%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -59%
>
> JIT, arm64:
> AsyncLiveVars.* +65-78% (bigger is better)
> Calls.AwaitAsyncCall -51% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -51%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -50%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -49%
> Calls.AwaitFutureOrCall -69%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -68%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -67%
>
> AOT, x64:
> AsyncLiveVars.* +55-61% (bigger is better)
> Calls.AwaitAsyncCall -47% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -46%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -47%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -46%
> Calls.AwaitFutureOrCall -59%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -59%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -58%
>
> AOT, arm:
> AsyncLiveVars.* 54-66% (bigger is better)
> Calls.AwaitAsyncCall -46-51% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -46-50%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -46-52%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -45-50%
> Calls.AwaitFutureOrCall -63-68%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -63-66%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -63-67%
>
> AOT, arm64:
> AsyncLiveVars.* +53-66% (bigger is better)
> Calls.AwaitAsyncCall -50-51% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -50%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -50-51%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -49-50%
> Calls.AwaitFutureOrCall -66-68%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -66-68%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -63-67%
>
> TEST=ci
> Issue: https://github.com/dart-lang/sdk/issues/48378
>
> Change-Id: I65e3702fcd816ee3fee876ff442b9887c035b1ec
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243102
> Reviewed-by: Lasse Nielsen <lrn@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

Change-Id: I245984ace1c768fdcba58dfdd6aa46e52126be4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248442
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-06-15 15:35:38 +00:00
Ahmed Ashour 85700570f6 Fix typos
Fixes #49241

TEST=ci

Change-Id: I6117bf816fc8c4613cce66927f952fef75632725
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248120
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-15 11:08:28 +00:00
Sigmund Cherem 69249df50b [web] remove top-level scripts for dartdevc and dart2js.
This completes the breaking change that was previously announced in
https://github.com/dart-lang/sdk/issues/46100

Change-Id: Ie81665e7932fe00a8c1fee9f67ee8294cd4c89e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248342
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2022-06-14 18:29:17 +00:00
Joshua Litt 76ccc89a10 [dart2wasm] Fix a number of minor JS interop issues.
This CL fixes a number of minor JS interop issues.
* `dartify` was moved to Dart, so we can control implicit coercion from JS
* All JS types are 'correctly' handled in `dartify` though a few are boxed
  as opaque types that could be exposed.
* The logic to convert a JS array is now driven from the Dart side.
* Function, Number, and Boolean can now make the roundtrip through Dart.
* The wrapper for Dart functions in JS is now a regular JS function.

Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try

Change-Id: Ifcd7a447419bca2adf78070e07750c1b3c5c6a18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247925
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-06-14 17:32:39 +00:00
Alexander Markov 0fd7f0c2a2 Revert "[vm] More efficient 'await' of not Future and completed _Future"
This reverts commit 6b3d1752fa.

Reason for revert: internal test failures b/235734143.

Original change's description:
> [vm] More efficient 'await' of not Future and completed _Future
>
> When awaiting a value which is not a Future or a completed
> built-in _Future, 'await' implementation can bypass heavyweight
> _Future/_FutureListener machinery and schedule micro-tasks directly.
>
> Benchmarks:
> JIT, x64:
> AsyncLiveVars.* +46-54% (bigger is better)
> Calls.AwaitAsyncCall -46% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -46%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -45%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -45%
> Calls.AwaitFutureOrCall -60%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -60%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -59%
>
> JIT, ia32:
> AsyncLiveVars.* +43-52% (bigger is better)
> Calls.AwaitAsyncCall -42% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -42%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -41%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -39%
> Calls.AwaitFutureOrCall -55%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -54%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -53%
>
> JIT, arm:
> AsyncLiveVars.* +64-71% (bigger is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -51% (less is better)
> Calls.AwaitAsyncCallClosureTargetPolymorphic -47%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -48%
> Calls.AwaitFutureOrCall -64%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -64%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -59%
>
> JIT, arm64:
> AsyncLiveVars.* +65-78% (bigger is better)
> Calls.AwaitAsyncCall -51% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -51%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -50%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -49%
> Calls.AwaitFutureOrCall -69%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -68%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -67%
>
> AOT, x64:
> AsyncLiveVars.* +55-61% (bigger is better)
> Calls.AwaitAsyncCall -47% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -46%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -47%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -46%
> Calls.AwaitFutureOrCall -59%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -59%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -58%
>
> AOT, arm:
> AsyncLiveVars.* 54-66% (bigger is better)
> Calls.AwaitAsyncCall -46-51% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -46-50%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -46-52%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -45-50%
> Calls.AwaitFutureOrCall -63-68%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -63-66%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -63-67%
>
> AOT, arm64:
> AsyncLiveVars.* +53-66% (bigger is better)
> Calls.AwaitAsyncCall -50-51% (less is better)
> Calls.AwaitAsyncCallInstanceTargetPolymorphic -50%
> Calls.AwaitAsyncCallClosureTargetPolymorphic -50-51%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -49-50%
> Calls.AwaitFutureOrCall -66-68%
> Calls.AwaitFutureOrCallInstanceTargetPolymorphic -66-68%
> Calls.AwaitFutureOrCallClosureTargetPolymorphic -63-67%
>
> TEST=ci
> Issue: https://github.com/dart-lang/sdk/issues/48378
>
> Change-Id: I65e3702fcd816ee3fee876ff442b9887c035b1ec
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243102
> Reviewed-by: Lasse Nielsen <lrn@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

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

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: I8ed0fca7234dd33f45997029b948a63341991ee1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248353
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-06-14 17:24:37 +00:00
Alexander Markov 6b3d1752fa [vm] More efficient 'await' of not Future and completed _Future
When awaiting a value which is not a Future or a completed
built-in _Future, 'await' implementation can bypass heavyweight
_Future/_FutureListener machinery and schedule micro-tasks directly.

Benchmarks:
JIT, x64:
AsyncLiveVars.* +46-54% (bigger is better)
Calls.AwaitAsyncCall -46% (less is better)
Calls.AwaitAsyncCallInstanceTargetPolymorphic -46%
Calls.AwaitAsyncCallClosureTargetPolymorphic -45%
Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -45%
Calls.AwaitFutureOrCall -60%
Calls.AwaitFutureOrCallInstanceTargetPolymorphic -60%
Calls.AwaitFutureOrCallClosureTargetPolymorphic -59%

JIT, ia32:
AsyncLiveVars.* +43-52% (bigger is better)
Calls.AwaitAsyncCall -42% (less is better)
Calls.AwaitAsyncCallInstanceTargetPolymorphic -42%
Calls.AwaitAsyncCallClosureTargetPolymorphic -41%
Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -39%
Calls.AwaitFutureOrCall -55%
Calls.AwaitFutureOrCallInstanceTargetPolymorphic -54%
Calls.AwaitFutureOrCallClosureTargetPolymorphic -53%

JIT, arm:
AsyncLiveVars.* +64-71% (bigger is better)
Calls.AwaitAsyncCallInstanceTargetPolymorphic -51% (less is better)
Calls.AwaitAsyncCallClosureTargetPolymorphic -47%
Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -48%
Calls.AwaitFutureOrCall -64%
Calls.AwaitFutureOrCallInstanceTargetPolymorphic -64%
Calls.AwaitFutureOrCallClosureTargetPolymorphic -59%

JIT, arm64:
AsyncLiveVars.* +65-78% (bigger is better)
Calls.AwaitAsyncCall -51% (less is better)
Calls.AwaitAsyncCallInstanceTargetPolymorphic -51%
Calls.AwaitAsyncCallClosureTargetPolymorphic -50%
Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -49%
Calls.AwaitFutureOrCall -69%
Calls.AwaitFutureOrCallInstanceTargetPolymorphic -68%
Calls.AwaitFutureOrCallClosureTargetPolymorphic -67%

AOT, x64:
AsyncLiveVars.* +55-61% (bigger is better)
Calls.AwaitAsyncCall -47% (less is better)
Calls.AwaitAsyncCallInstanceTargetPolymorphic -46%
Calls.AwaitAsyncCallClosureTargetPolymorphic -47%
Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -46%
Calls.AwaitFutureOrCall -59%
Calls.AwaitFutureOrCallInstanceTargetPolymorphic -59%
Calls.AwaitFutureOrCallClosureTargetPolymorphic -58%

AOT, arm:
AsyncLiveVars.* 54-66% (bigger is better)
Calls.AwaitAsyncCall -46-51% (less is better)
Calls.AwaitAsyncCallInstanceTargetPolymorphic -46-50%
Calls.AwaitAsyncCallClosureTargetPolymorphic -46-52%
Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -45-50%
Calls.AwaitFutureOrCall -63-68%
Calls.AwaitFutureOrCallInstanceTargetPolymorphic -63-66%
Calls.AwaitFutureOrCallClosureTargetPolymorphic -63-67%

AOT, arm64:
AsyncLiveVars.* +53-66% (bigger is better)
Calls.AwaitAsyncCall -50-51% (less is better)
Calls.AwaitAsyncCallInstanceTargetPolymorphic -50%
Calls.AwaitAsyncCallClosureTargetPolymorphic -50-51%
Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -49-50%
Calls.AwaitFutureOrCall -66-68%
Calls.AwaitFutureOrCallInstanceTargetPolymorphic -66-68%
Calls.AwaitFutureOrCallClosureTargetPolymorphic -63-67%

TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/48378

Change-Id: I65e3702fcd816ee3fee876ff442b9887c035b1ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243102
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-06-10 14:38:28 +00:00
Alexander Markov 213ae5429b [vm] Always complete Future synchronously when returning non-Future value from async functions
From Dart language specification (17.15 Function Invocation):

If execution of the body returns an object, o is completed with that
object. If it completes normally or returns without an object,
o is completed with the null object (17.4), and if it throws
an exception e and stack trace t, o is completed with the error e and
stack trace t. If execution of the body throws before the body suspends
the first time, completion of o happens at some future time after the
invocation has returned. The caller needs time to set up error handling
for the returned future, so the future is not completed with
an error before it has been returned.

So far, implementation of async functions in Dart VM postponed
completion of the Future both with the value and with an error
if execution has not reached the first await. This change modifies
the behavior to compile future with value immediately even if
the first await was not reached. Completion with an error is still
postponed.

This change in behavior will let us improve performance of
async/await in certain cases.

The new behavior still conforms to the Dart language specification.

TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/48378

Change-Id: I0e80a1d0dd0c3cd6acbc640681e7b06bbf81c19c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243101
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-06-10 14:35:14 +00:00
Siva Annamalai 855e1cd975 Revert "Avoid computing the URI scanner tables at runtime."
This reverts commit 5875a9ba9d.

Reason for revert: We seem to have some cbuild failures, logs can be found here 5875a9ba9d

Original change's description:
> Avoid computing the URI scanner tables at runtime.
>
> Precompute the table and store it as a String literal.
>
> Fixes #49108.
>
> Bug: https://dartbug.com/49108
> Change-Id: I33d3e768ad2013ad2edec3558fcd3da39b3f4f32
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247383
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>
> Auto-Submit: Lasse Nielsen <lrn@google.com>

TBR=lrn@google.com,vegorov@google.com,kustermann@google.com

Change-Id: I3c2609aad7944ea9118af14733c3e99db9902297
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://dartbug.com/49108
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247860
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-06-09 20:28:53 +00:00
Siva Annamalai 5cb3b37c74 Revert "Refactor _Future."
This reverts commit 69f32d6ad7.

Reason for revert: We seem to have a number of tests failing with timeouts in CBUILD after this change, please see logs at
69f32d6ad7

Original change's description:
> Refactor `_Future`.
>
> This is a major rewrite of the `_Future` class,
> which is the default implementation of the `Future` interface.
>
> The main goal was to reduce the number of expensive type checks
> in the internal passing around of data.
> Expensive type checks are things like
> * `is _Future<T>` (more expensive than just `is _Future`, the latter
>   can be a single class-ID check.
> * Covariant generic parameter checks (using `T` covariantly in a
>   parameter forces a run-time type check).
>
> Also removed some plain unnecessary casts and turned some
> implicit casts from `dynamic` into `unsafeCast`s.
>
> This seems to be an success, at least on very primitive benchmarks, according to Golem:
> FutureCatchErrorTest    41.22% (1.9 noise)
> FutureValueTest         46.51% (2.8 noise)
> EmptyFutureTest         59.15% (3.1 noise)
> FutureWhenCompleteTest  51.10% (3.2 noise)
>
> A secondary goal was to clean up a very old and messy class,
> and make it clearer for other `dart:async` how to interact
> with the future.
>
> The change has a memory cost: The `_FutureListener<S,T>` class,
> which represents a `then`, `catchError` or `whenComplete`
> call on a `_Future`, now contains a reference to its source future,
> the one which provides the inputs to the callbacks,
> as well as the result future returned by the call.
> That's one extra memory slot per listener.
>
> In return, the `_FutureListener` now does not need to
> get its source future as an argument, which needs a covariant
> generic type check, and the methods of `_Future` can be written
> in a way which ignores the type parameters of both `_Future`
> and `_FutureListener`, which reduces complex type checks
> significantly.
>
> In general, typed code is in `_FutureListener`, which knows both
> the source and target types of the listener callbacks, and which
> contains the futures already at that type, so no extra type checking
> is needed.
> The `_Future` class is mostly untyped, except for its "public"
> API, called by other classes, which checks inputs,
> and code interacting with non-native futures.
> Invariants ensure that only correctly typed values
> are stored in the untyped shared `_resultOrListeners` field
> on `_Future`, as determined by its `_state` integer.
> (This was already partially true, and has simply been made
> more consistent.)
>
> Further, we now throw an error in a situation that was previously
> unhandled: When a `_Future` is completed with *itself*.
> That would ensure that the future would never complete
> (it waits for itself to complete before it can complete),
> and may potentially have caused weird loops in the representation.
> In practice, it probably never happens. Now it makes the error
> fail with an error.
> Currently a private `_FutureCyclicDependencyError` which presents
> as an `UnsupportedError`.
> That avoids code like
> ```dart
> import "dart:async";
> void main() {
>   var c = Completer();
>   c.complete(c.future); // bad.
>   print("well!");
>   var d = Completer();
>   d.complete(c.future);
>   print("shucks!");
> }
> ```
> from hanging the runtime by busily searching for the end of a cycle.
>
> See https://github.com/dart-lang/sdk/issues/48225
> Fixes #48225
>
> TEST= refactoring covered by existing tests, few new tests.
>
> Change-Id: Id9fc5af5fe011deb0af3e1e8a4ea3a91799f9da4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244241
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>

TBR=lrn@google.com,kustermann@google.com,sra@google.com,sigmund@google.com,nshahan@google.com

Change-Id: I455be5a04b4c346df26d4ded0fa7388baccb0f8c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247762
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-06-09 16:51:55 +00:00
Lasse R.H. Nielsen 69f32d6ad7 Refactor _Future.
This is a major rewrite of the `_Future` class,
which is the default implementation of the `Future` interface.

The main goal was to reduce the number of expensive type checks
in the internal passing around of data.
Expensive type checks are things like
* `is _Future<T>` (more expensive than just `is _Future`, the latter
  can be a single class-ID check.
* Covariant generic parameter checks (using `T` covariantly in a
  parameter forces a run-time type check).

Also removed some plain unnecessary casts and turned some
implicit casts from `dynamic` into `unsafeCast`s.

This seems to be an success, at least on very primitive benchmarks, according to Golem:
FutureCatchErrorTest    41.22% (1.9 noise)
FutureValueTest         46.51% (2.8 noise)
EmptyFutureTest         59.15% (3.1 noise)
FutureWhenCompleteTest  51.10% (3.2 noise)

A secondary goal was to clean up a very old and messy class,
and make it clearer for other `dart:async` how to interact
with the future.

The change has a memory cost: The `_FutureListener<S,T>` class,
which represents a `then`, `catchError` or `whenComplete`
call on a `_Future`, now contains a reference to its source future,
the one which provides the inputs to the callbacks,
as well as the result future returned by the call.
That's one extra memory slot per listener.

In return, the `_FutureListener` now does not need to
get its source future as an argument, which needs a covariant
generic type check, and the methods of `_Future` can be written
in a way which ignores the type parameters of both `_Future`
and `_FutureListener`, which reduces complex type checks
significantly.

In general, typed code is in `_FutureListener`, which knows both
the source and target types of the listener callbacks, and which
contains the futures already at that type, so no extra type checking
is needed.
The `_Future` class is mostly untyped, except for its "public"
API, called by other classes, which checks inputs,
and code interacting with non-native futures.
Invariants ensure that only correctly typed values
are stored in the untyped shared `_resultOrListeners` field
on `_Future`, as determined by its `_state` integer.
(This was already partially true, and has simply been made
more consistent.)

Further, we now throw an error in a situation that was previously
unhandled: When a `_Future` is completed with *itself*.
That would ensure that the future would never complete
(it waits for itself to complete before it can complete),
and may potentially have caused weird loops in the representation.
In practice, it probably never happens. Now it makes the error
fail with an error.
Currently a private `_FutureCyclicDependencyError` which presents
as an `UnsupportedError`.
That avoids code like
```dart
import "dart:async";
void main() {
  var c = Completer();
  c.complete(c.future); // bad.
  print("well!");
  var d = Completer();
  d.complete(c.future);
  print("shucks!");
}
```
from hanging the runtime by busily searching for the end of a cycle.

See https://github.com/dart-lang/sdk/issues/48225
Fixes #48225

TEST= refactoring covered by existing tests, few new tests.

Change-Id: Id9fc5af5fe011deb0af3e1e8a4ea3a91799f9da4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244241
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-06-09 15:32:33 +00:00
Lasse R.H. Nielsen 5875a9ba9d Avoid computing the URI scanner tables at runtime.
Precompute the table and store it as a String literal.

Fixes #49108.

Bug: https://dartbug.com/49108
Change-Id: I33d3e768ad2013ad2edec3558fcd3da39b3f4f32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247383
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Auto-Submit: Lasse Nielsen <lrn@google.com>
2022-06-09 15:30:33 +00:00
Brian Quinlan e5af733398 Handle the case where HttpClientRequest.maxRedirects==0
Bug: https://github.com/dart-lang/sdk/issues/49012
Change-Id: Iaec1073b0797564058e99e2dde0d138f1eccbb92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247020
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-06-09 01:02:24 +00:00
Joshua Litt 3fd96e2cb8 [dart2wasm] Wire up stubbed out dart:js on dart2wasm
Change-Id: Ia06db4b1b2f3d07278819936842a4185cc9a45f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247329
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-06-08 20:38:52 +00:00
Devon Carew ca205612d6 [deps] remove the dep on package:charcode
Change-Id: I0880f16db5bf62e6e7c91352c2f8e57f66ad7022
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247500
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-06-08 19:49:22 +00:00
Michael Thomsen da050a2b16 Reland "Remove SCREAMING dart:io networking APIs"
This is a reland of commit abfdc3d50f

Original change's description:
> Remove SCREAMING dart:io networking APIs
>
> Bug: https://github.com/dart-lang/sdk/issues/49140
> Change-Id: I50c6cca26597ee4d469b776fcec412ddfed760e1
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246962
> Reviewed-by: Paul Berry <paulberry@google.com>
> Commit-Queue: Michael Thomsen <mit@google.com>

Bug: https://github.com/dart-lang/sdk/issues/49140
Change-Id: I64a4bdb69909dd864e84efae7dc423fc435e40ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247543
Reviewed-by: Oleh Prypin <oprypin@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2022-06-08 16:57:32 +00:00
Joshua Litt 6bf0e5cd7e [dart2wasm] Make _Function implement Function.
This ensures the TFA doesn't tree shake Function members.

Change-Id: I23374d1bb9aec118906e2b8211d987046a3bbafb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247502
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-06-08 15:03:52 +00:00
Oleh Prypin 159887ff78 Revert "Remove SCREAMING dart:io networking APIs"
This reverts commit abfdc3d50f.

Reason for revert: breaks on internal roll - b/235267735 and others can be fixed in advance of landing this

Original change's description:
> Remove SCREAMING dart:io networking APIs
>
> Bug: https://github.com/dart-lang/sdk/issues/49140
> Change-Id: I50c6cca26597ee4d469b776fcec412ddfed760e1
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246962
> Reviewed-by: Paul Berry <paulberry@google.com>
> Commit-Queue: Michael Thomsen <mit@google.com>

TBR=mit@google.com,paulberry@google.com

Change-Id: I55a43cc1bd7435fe7824f7ca8098575232fdcf2f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/49140
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247389
Commit-Queue: Oleh Prypin <oprypin@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Oleh Prypin <oprypin@google.com>
2022-06-08 07:22:31 +00:00
Michael Thomsen abfdc3d50f Remove SCREAMING dart:io networking APIs
Bug: https://github.com/dart-lang/sdk/issues/49140
Change-Id: I50c6cca26597ee4d469b776fcec412ddfed760e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246962
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2022-06-07 16:00:17 +00:00
Joshua Litt d872e74a6d [js] Support js_util on Dart2wasm.
This CL consists of:
1) Moving most of the contents of `js_util_wasm_patch` to
   `js_util_patch` and `js_helper`.
2) Addressing the inconsistencies between `js_util` and `js_util_wasm`.
3) Fixing a minor bug with nested `allowInterop` in
   `js_util_wasm_optimizer`.
4) Removing hardcoded eval.

Change-Id: Ie43cdc91d344745ef9b40e273192b34af2a84138
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246380
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2022-06-06 18:18:20 +00:00
Nate Bosch 75ed6c01fb Make path argument optional for Uri.http(s)
Closes #49165

The empty string argument can be confusing to read since it is not clear
what it means. Allow omitting the argument entirely to default to an
empty path.

R=lrn@google.com

Change-Id: I05ca432a679a0df751a16d1beb241b14f80d4681
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246988
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-06-03 18:07:27 +00:00
Ryan Macnak 4c82eb5836 Reland "[vm, compiler] Prune dictionaries to only contain elements needed at runtime."
This is a reland of commit 6de162e014

Original change's description:
> [vm, compiler] Prune dictionaries to only contain elements needed at runtime.
>
> flutter_gallery
> Isolate(CodeSize): 2116400 -> 1981238 (-6.28%)
>   Total(CodeSize): 7217938 -> 7082600 (-1.87%)
>
> TEST=ci
> Bug: https://github.com/dart-lang/sdk/issues/48910
> Change-Id: I8cd285ddab3a611cd7a2a91d50414be402f8543a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244303
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/48910
Change-Id: I3d3ecd04369585547963fb3efff1b3ff0723d8f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246990
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-06-03 00:09:25 +00:00
Alexander Markov af4da780be [vm] New async/async* implementation in JIT mode
The new implementation is based on suspend/resume stubs and doesn't
use desugaring of async functions on kernel AST.

Previously, new implementation of async/async* was only supported in
AOT mode. This change adds all necessary bits for the JIT mode:

 * Suspending variable-length frames (for unoptimized code).
 * Handling of Code and pool pointers in Dart stack frames.
 * OSR.
 * Deoptimization.
 * Hot reload.
 * Debugger.

The new implementation is not enabled in JIT mode yet.

Design doc: go/compact-async-await.
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: I477d6684bdce7cbc1edb179ae2271ff598b7dcc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246081
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-06-02 23:39:45 +00:00
Alex Li 0556d0122c Add the missing space for sdk/lib/core/num.dart
This is nit-picking that `sdk/lib/core/num.dart` is missing a single space at the start of the line.

6c210bbc57/sdk/lib/core/num.dart (L147-L153)

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

GitOrigin-RevId: 776499741409a78cb198021fdc6e12fcdf2cb12f
Change-Id: I9117a277a40bd6635d3b8865be1d9f33e251922c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246900
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-06-02 10:11:35 +00:00
Siva Annamalai 1e7bc687a7 Revert "[vm, compiler] Prune dictionaries to only contain elements needed at runtime."
This reverts commit 6de162e014.

Reason for revert: Local testing of a large Flutter app with this change causes the app to crash on startup

Original change's description:
> [vm, compiler] Prune dictionaries to only contain elements needed at runtime.
>
> flutter_gallery
> Isolate(CodeSize): 2116400 -> 1981238 (-6.28%)
>   Total(CodeSize): 7217938 -> 7082600 (-1.87%)
>
> TEST=ci
> Bug: https://github.com/dart-lang/sdk/issues/48910
> Change-Id: I8cd285ddab3a611cd7a2a91d50414be402f8543a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244303
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

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

Bug: https://github.com/dart-lang/sdk/issues/48910
Change-Id: Ie51f004e84970907fa1233e8e7c3ed63e2da1c4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246683
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-06-01 00:58:24 +00:00
Jonas Termansen 83850ac5fa [io] Don't restore terminal state on exit.
This is breaking change #45630.

The Dart VM has until now restored the terminal settings upon exit to
their initial values for stdin, stdout, and stderr. This change removes
that automatic behavior in favor of having the program do the
restoration. Previously the intention was that dart programs can
enable/disable echoing and line buffering and not worry about restoring
the original settings.

However, the VM doing so unconditionally leads to undesirable behavior
e.g. when the program does not care about terminal settings and is
sharing a process group with a program that does care. E.g. if dart's
output is piped into less(1), then there is a race condition where dart
might see the raw terminal settings set by less(1), and if the dart VM
exits after less(1) has exited, then it will restore the raw terminal
settings, leaving the user with a seemingly defective shell with echo
disabled. This race condition can be reproduced using:

    cat > yes.dart << EOF
    main() {
      for (int i = 0; i < 1000000; i++) {
        print("yes");
      }
    }
    EOF
    stty; (sleep 1 && dart yes.dart) | less; stty; stty sane

The user will end up with a shell with echo behavior disabled. The stty
command shows the current terminal settings, where the difference can be
seen, and 'stty sane' fixes the settings before returning to the shell
prompt. The 'stty sane' call can be omitted to see the defective shell
prompt.

This change removes the terminal restoring behavior (added in Dart
2.0.0) and instead asks applications to do the restoration themselves.
The new design matches how programs in other programming languages
implement interactive input that changes terminal settings.

Furthermore the `echoMode` setting now only controls the `echo` local
mode and no longer sets the `echonl` local mode on POSIX systems (which
controls whether newline are echoed even if the regular echo mode is
disabled). The `echonl` local mode is usually turned off in common shell
environments. Programs that wish to control the `echonl` local mode can
use the new `echoNewlineMode` setting. This change is required to
prevent the reoccurence of #30318 when programs manually restore
`echoMode`.

Windows has further considerations: It also saves the console code pages
and restore them if they were not UTF-8. This behavior is retained as it
is useful and needed for Dart's output to function properly. ANSI output
sequences are also turned on via ENABLE_VIRTUAL_TERMINAL_PROCESSING,
which is slightly changed in this change to only rsetore that setting if
it wasn't already on for consistency.

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

TEST=Reproduced with less as above

Change-Id: I2991f9c7f47b97fe475c1ad6edeb769024f8d0db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190484
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-05-31 15:36:33 +00:00
Martin Kustermann e566f9a14b [vm/concurrency] Add IsolateBaseOverhead benchmark
Issue b/190877061

TEST=ci

Change-Id: Ifa570492b440849252a9bd01c7782656bcce7fd2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245984
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-05-30 08:14:52 +00:00
Joshua Litt f6f0cab8bb [js] Make js_util patchable.
Change-Id: I48dbb12cf72c7dee9282c1548a1195e3014f05cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246046
Reviewed-by: Riley Porter <rileyporter@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-05-26 20:20:59 +00:00
Nicholas Shahan 4fc7567c22 [web] Cleanup redundant language version comments
- Files in the SDK are already opted into null safety.
- Files in the packages are already opted into null safety via
  the pubspecs.
- in_sync_test.dart was opted out but required no changes to
  migrate.

Change-Id: Ic9334824de1b22c879e962f488e1fa8021017710
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246058
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-05-26 20:19:09 +00:00
Nicholas Shahan 4d9b28dc08 [ddc] Include shared library for new runtime types
When compiling the Dart SDK with the `--canary` flag DDC will include
the new shared runtime type library in the compiled SDK.

Change-Id: I7a418033fb7397939aa6f4b7fb84820ead99c3be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241690
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
2022-05-25 18:23:29 +00:00
Ryan Macnak 6de162e014 [vm, compiler] Prune dictionaries to only contain elements needed at runtime.
flutter_gallery
Isolate(CodeSize): 2116400 -> 1981238 (-6.28%)
  Total(CodeSize): 7217938 -> 7082600 (-1.87%)

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/48910
Change-Id: I8cd285ddab3a611cd7a2a91d50414be402f8543a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244303
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-05-25 15:55:38 +00:00
Ahmed Ashour a6fcb56901 Fix typos
Fixes #49094

TEST=ci

Change-Id: I23cdcb5ad2fc83e5e91d80e34b66af186c0cb923
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245820
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-05-24 09:10:51 +00:00
Nicholas Shahan 444982f364 [web] Share more runtime code between ddc and dart2js
Creates a new 'dart:_js_shared_embedded_names' library for the names
accessed from the shared 'dart:_rti' library. Migrate all of the shared
symbols and uses to the new location.

Change-Id: Iaa72c4522888ad630782b921b0b70d7a2626d1b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241507
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-05-23 18:04:10 +00:00
Stephen Adams cbb15c3742 [corelib] Fix bug in VM implementation of BigInt.bitLength
Change-Id: I8664013e27c9c43cd71dd9a271c2e61404d37feb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244764
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-05-19 23:29:51 +00:00
Daco Harkes 9411a1d3bd [vm] Fix comment compact hash implementation
The `_CompactIterableImmutable` does not check for concurrent
modifications, because the underlying map is immutable.

The comment was wrong.

Change-Id: I992d841cb6b42d027e8ae5bb853c8345a0f7a69d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245160
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-05-19 08:06:30 +00:00
Nicholas Shahan 58c84272bc [web] Move libraries to a shared location
These libraries will be shared between the dart2js and DDC runtimes.

Also renames the `shared` directory to `synced` to avoid confusion.
Synced directories are copied to be in sync with the compilers and
runtimes.

Change-Id: Ic36076938741d7102792f09413666de0033da3a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238300
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2022-05-18 19:59:33 +00:00
Joshua Litt 5729605e18 [dart2wasm] Implement FunctionType Type.
Change-Id: I65cf6f18ef3ca4892d1940ba8b67ca98ca0395da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243935
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-05-16 21:36:07 +00:00
Joshua Litt c6d5cd043b [js_util] Add dartify and some helpers.
Change-Id: I40822d87a7fef9e4de563ccb73046eee78f34b21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243846
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-05-16 21:31:47 +00:00
Stephen Adams 7ff9b2fb5e [js_runtime] Use Math.clz32
Change-Id: Ibe6598587151d7c5e0595cffde4b35d024f63c15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244861
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-05-16 19:13:15 +00:00
Stim 294f2d24da Fix several typos in sdk/lib/internal/internal.dart
I've fixed a few typos in the mentioned module while flicking through the dart built-in libraries.

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

GitOrigin-RevId: c8660e7932a647bd018a838629a8e1a28b41c90e
Change-Id: I7fae4702f6ee640561f5ebbbf68100f6abe8c360
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244940
Reviewed-by: Michael Thomsen <mit@google.com>
2022-05-16 15:33:26 +00:00
asiva e8290f7f5a [VM/io] - Reland : Set correct file type for files backing unix domain sockets
The file type of file backing unix domain sockets was being incorrectly
set as kDoesNotExist resulting in errors when operations like delete
on the file was done. File::Exists on the other hand returned true.
File rename and copyfile functionality have been fixed too.

TEST=new tests added

Please see https://github.com/dart-lang/sdk/issues/48569 for the original issue.

Change-Id: I28505236fbad2ea86ad65065e753b13fb7ff655a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240300
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2022-05-15 00:40:07 +00:00
Mark Zhou 143c6df41b [ddc] Stubbing package:dart2js_runtime_metrics
This allows the package to be discoverable across web backends

Change-Id: I7d870a7232543d3b719d47de1424017d7f578434
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244261
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2022-05-11 22:31:45 +00:00
Lasse R.H. Nielsen 21378579fe Remove internal classes in zone.dart.
These classes were introduced only because `_ZoneFunction`
could not take a generic type argument at the time.
It can now.

Change-Id: Id8dd75946176ef19350b33df905288a851982d3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244400
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Lasse Nielsen <lrn@google.com>
2022-05-11 15:08:54 +00:00
Aske Simon Christensen 6c7604291c [dart2wasm] Build platform dill and compile dart2wasm to AOT snapshots
This adds a --platform= option to dart2wasm to read the SDK libraries
from that dill file instead of compiling them from source every time.
If the option is not given, the SDK libraries are compiled, like before.

Also adds a "dart2wasm" build target, which will build the dart2wasm
platform dill and compile dart2wasm to two AOT snapshots (with and
without asserts). The dart2wasm scripts in sdk/bin are updated to run
via these snapshots and use this platform dill.

This speeds up test runs for the dart2wasm-hostasserts-linux-x64-d8
configuration by approximately 45x.

Change-Id: If2c7750a6eb39725310745f887792784d0dfc583
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243624
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-05-10 10:06:06 +00:00
Alexander Aprelev 2a12dd3315 [vm/simd] Add Float64x2 clamp simd implementation
Fixes https://github.com/dart-lang/sdk/issues/40427

TEST=ci, float64x2_clamp_test

Change-Id: I12618c37135feecffb115ce4aca02af1ecb03167
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243848
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-05-10 04:56:25 +00:00
Joshua Litt d753b61535 [dart2wasm] Implement runtime type test for FutureOr.
Change-Id: I9ad00f5e9b1ca77f52f03e24115f8f4bae5910b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243166
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-05-09 16:13:22 +00:00
Leaf Petersen 240719eb86 Tighten types on error stream handler to avoid dynamic calls.
Make a private field typed to avoid an unnecessary dynamic call in the error handler for a stream.  Also remove an unused private member found in passing.

Change-Id: I29ebba5a3818a4c24df436e504d159731fd6531e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241243
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
2022-05-07 00:24:21 +00:00
Daco Harkes efa7439c16 Revert "[vm] Only call .hashCode once when adding to Map and Set"
This reverts commit 438c1ed2ba.

Reason for revert: b/231617607 and b/230945329.
Will reland after b/230945329 is addressed.

Original change's description:
> [vm] Only call `.hashCode` once when adding to `Map` and `Set`
>
> The methods to add to hash maps and hash sets are recursive: if the
> index needs to be rehashed then the same method is called again after
> rehashing.
>
> This CL nests the actual implementation in a private method that takes
> the full hashCode as an extra argument.
>
> No significant code size or run time changes are reported on our
> benchmarks. (Our benchmarks do not contain purposefully slow hashCodes.)
>
> Note that hashCode can be called again later if rehashing of the index
> is required on adding subsequent elements.
>
> Bug: https://github.com/dart-lang/sdk/issues/48948
> Change-Id: Ia3ccff9e592d675b4922ac78c4aa7ee0287ecb50
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243623
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Daco Harkes <dacoharkes@google.com>

TBR=kustermann@google.com,dacoharkes@google.com

Change-Id: I214251b65ea89e7f729564a125e226f2e6d580c0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/48948
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243900
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-05-06 10:24:29 +00:00
Nicholas Shahan 25c3f36d95 [dart2js] Fix return type on rti as methods
Change-Id: Idd96bf55b22d4f9c3072d1371b31ff4c0005afb7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243706
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2022-05-05 17:36:55 +00:00
Devon Carew 69bd8e7c5b [core libs] address ~5 analysis issues in the docs for dart:isolate
Change-Id: Iebe275335fd098419ede97dbb8baff8efaf9dc1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241161
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-05-05 16:58:55 +00:00
Daco Harkes 438c1ed2ba [vm] Only call .hashCode once when adding to Map and Set
The methods to add to hash maps and hash sets are recursive: if the
index needs to be rehashed then the same method is called again after
rehashing.

This CL nests the actual implementation in a private method that takes
the full hashCode as an extra argument.

No significant code size or run time changes are reported on our
benchmarks. (Our benchmarks do not contain purposefully slow hashCodes.)

Note that hashCode can be called again later if rehashing of the index
is required on adding subsequent elements.

Bug: https://github.com/dart-lang/sdk/issues/48948
Change-Id: Ia3ccff9e592d675b4922ac78c4aa7ee0287ecb50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243623
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-05-05 11:48:35 +00:00
Alexander Thomas e04f5885b8 [sdk] Generate a version file for the unpatched SDK
This will be used to analyze the unpatched SDK. The file contains only
the major and minor part of the version number. The patch version will
always be 0. This is sufficient for the analyzer to construct a language
version.

Change-Id: Ief71ce617b279f7c688e9068c425bc31394cbf5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243660
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2022-05-05 10:36:05 +00:00
mnordine 74dd509610 Remove extra word
Closes https://github.com/dart-lang/sdk/pull/48935

GitOrigin-RevId: 97ac4730d36c0fb24152d2bddc67b267e3292af0
Change-Id: I1b0f39f73725167ab016719d587c18aac98d6125
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243340
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2022-05-04 16:22:35 +00:00
Liam Appelbe b6cfea8d8b Remove trailing null char from IOOverrides.fseGetType
This null char is inserted by _toNullTerminatedUtf8Array, and right
below that function is _toStringFromUtf8Array, which does the opposite.
But _toStringFromUtf8Array is currently dead code, so it looks like the
intent was always to use _toStringFromUtf8Array for this, and the fact
that utf8.decode was being used instead is just a mistake.

Bug: https://github.com/dart-lang/sdk/issues/34885
Change-Id: I1404c7783b055902b256176aa61971c0d6969f5e
Fixes: https://github.com/dart-lang/sdk/issues/34885
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243103
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2022-05-02 21:16:20 +00:00
Alexander Markov 4075e8b3f9 [vm] New async*/yield/yield* implementation based on suspend/resume stubs
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: I0c2ca9269b2c8f008a79c139a0ce10231996732d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242923
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-05-02 20:53:01 +00:00
Sigmund Cherem 659459ba13 [dart2js] fix reference to package_config.json in helper script
This will allow to remove the `.packages` file from the bots. See
for reference Jonas change here: https://dart-review.googlesource.com/c/sdk/+/240842

Change-Id: Ic4ec8d6192533756e0c7642240eea918e790f67f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243360
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2022-05-02 16:57:54 +00:00
Aske Simon Christensen 4e4cf39d3e [dart2wasm] Fix override of external method in string_patch
This situation was flagged as invalid by the kernel verifier.

Change-Id: I549e6fbb838e301f2a4c0f6203028ee03caa5c41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243261
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2022-05-02 16:41:00 +00:00
Daco Harkes eeb8b3a343 [vm/doc] Add examples to WeakReference and NativeFinalizer take 2
Change-Id: Iabafdcc45052bf76f4d13e32566149efd8f71adf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243263
Commit-Queue: Michael Thomsen <mit@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
2022-05-02 12:16:39 +00:00
Daco Harkes 8c390e55d5 [vm/ffi] Improve Allocator documentation
Users are getting confused by `allocate` and `call` in the `Allocator`s.

This CL clarifies the behavior by extending the documentation.

Unfortunately, we cannot expose the actual implementation of `call`. All
calls to `sizeOf<T>()` must have `T` as compile-time constants. So,
instead of `call` having a body in Dart, all call-sites get the behavior
inlined  (`x.call<Int32>(3)` is transformed to
`x.allocate<Int32>(sizeOf<Int32>() * 3)`).

Change-Id: Ife169095d1648e9a353f3a4b75c9aff954bc04a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242800
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-05-02 12:13:19 +00:00
Daco Harkes 9dfeb36c96 [vm/doc] Add examples to WeakReference and NativeFinalizer
Add an example to `WeakReference` and `NativeFinalizer`. `Finalizer`
already contained an example.

Cross-link between `Finalizer` and `NativeFinalizer`.

Make the examples pass all the checks and enable syntax highlight in
VS Code again (https://github.com/dart-lang/sdk/issues/48926).

Change-Id: I54cc213fa3bbe7bf8f872ccfee9770fb36b96ab4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242873
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-05-02 10:36:09 +00:00
Joshua Litt 6055226a21 [dart2wasm] Initial scaffolding for runtime type checking.
Change-Id: I6ae0cadf5d626ebd22e6613f0d790b5fff6d0f38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241401
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-04-30 01:18:41 +00:00
Mark Zhou a0b35de326 [dart2js] Moving runtime allocations to pkg:dart2js_runtime_metrics
* Stores runtime information on `$runtimeMetrics` instead of `$__dart_deferred_initializers__`
* Keys each app's runtime allocations onto self.runtimeMetrics.$currentScript

Change-Id: I6612fd2a5ac792bfcb7580ffe91d5391b80d5965
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242507
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2022-04-29 21:48:41 +00:00
Aske Simon Christensen c6a061f41d [dart2wasm] Implement set literals in the backend
Change-Id: I678a6c16248bfafce2e39c6c3e39505109250f35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242861
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2022-04-29 15:02:51 +00:00
Alexander Markov bf4bb95308 [vm] New async/await implementation in the VM, part 2 - vm
The new implementation moves away from desugaring of async
functions on kernel AST, state machine generated in the flow graph and
capturing all local variables in the context.

Instead, async/await is implemented using a few stubs
(InitSuspendableFunction, Suspend, Resume, Return and
AsyncExceptionHandler). The stubs are implemented in a
platform-independent way using (macro-)assembler helpers.
When suspending a function, its frame is copied into a SuspendState
object, and when resuming a function it is copied back onto the stack.
No extra code is generated for accessing local variables.
Callback closures are created lazily on the first await.

Design doc: go/compact-async-await.

Part 1 (kernel): https://dart-review.googlesource.com/c/sdk/+/241842

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: Ibad757035b7cc438ebdff80b460728b1d3eff1f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242000
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-04-29 01:03:50 +00:00
Stephen Adams c50157e099 Support invoking JS operators through dart:js_util.
Some JS functionality is only exposed through operators, such as
implicit type conversions and BigInt arithmetic. Other than requiring
some minor additions for the exponentiation (`**`) operator, supporting
these through `dart:js_util` is trivial.

Change-Id: I010674303e4f99b42d43b73095de69b8ddcdeb47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242680
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-04-28 21:18:40 +00:00
Aleksey Kulikov edb7fb4b1e docs(finalizer): fix typo
Closes https://github.com/dart-lang/sdk/pull/48916

GitOrigin-RevId: c95211d23ddbec8d807a026b699ab0a09713a6fd
Change-Id: Ic44b2bf80f4bb21056b5a671b6d047381928c87e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242900
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2022-04-28 15:18:41 +00:00
Ahmed Ashour 1586ac81a0 Fix typos
TEST=comment only change

Fixes #48853

Change-Id: I1fd47b8f186514af95a49ef253170045c584f970
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241963
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-04-28 12:53:43 +00:00
Fritz Ammon ca52d23a58 fix typo in zone documentation
fixing a typo; should be "or" as opposed to "of"

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

GitOrigin-RevId: 72b612a080475c6280f9c4926bb330fb157cf54f
Change-Id: I048b416f1484e6390b71cab12a2d62307d3e8b8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242782
Reviewed-by: Alexander Thomas <athom@google.com>
2022-04-28 11:28:17 +00:00
Aaron Clarke 904303f8a1 Made HashMap.update faster by reducing it to one lookup.
fixes https://github.com/dart-lang/sdk/issues/48866

Test=ci and golem

Change-Id: Ia56bd5b5de83dc8f7263eeda27e7abd3af42851e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242120
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-04-27 18:30:14 +00:00
Martin Kustermann efdffab8b7 Reland "[vm] Fix some async* semantics issues: Only run generator if there's active subscription (not paused/cancelled)"
This fixes an issue where VM would run the async* generator after a
`yield` / `yield*` even though the subscription may be paused or
cancelled.

Furthermore this fixes an issue where `StackTrace.current` used
in async* generator crashes VM and/or produces truncated stack
trace.

This fixes the following existing tests that were failing before:

  * co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t08
  * co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t09
  * co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t10
  * language/async_star/async_star_cancel_test
  * language/async_star/pause_test

New in reland: Allow the generator to to cause cancelling it's own consumer.
This addresses the issue of original revert
  -> see https://github.com/flutter/flutter/issues/101514

Issue https://github.com/flutter/flutter/issues/100441
Issue https://github.com/dart-lang/sdk/issues/48695
Issue https://github.com/dart-lang/sdk/issues/34775

TEST=vm/dart{,_2}/causal_stacks/flutter_regress_100441_test

Change-Id: I091b7159d59ea15fc31162b4b6b17260d523d7cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242400
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-04-26 12:01:34 +00:00
Dan Field fe30c3f235 [vm] Expose whether extension stream has listeners, guard postEvent
This avoids json encoding that was otherwise happening even in product mode. JSON encoding shows up CPU profiling as taking significant time, particularly on low end devices.

TEST=runtime/observatory/tests/service/developer_extension_test.dart

Bug: https://github.com/dart-lang/sdk/issues/48860
Change-Id: I2cf4d949e85c0b23de01ec2033b04527d40c76fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242081
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Dan Field <dnfield@google.com>
2022-04-26 07:53:43 +00:00
Aaron Clarke cd8ceb0a99 Updated the DynamicLibrary docstring to specifically call out static
libraries and to avoid confusion between "DynamicLibrary" and "dynamic
library".

fixes: https://github.com/dart-lang/sdk/issues/44126

Change-Id: I7aab94e94b4e31ccffea047dcaaffc6fb6447662
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242242
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-04-25 18:19:52 +00:00
Devon Carew eec99f4f0b [core libs] add dart:developer, dart:js_util, and dart:wasm to the set of validated libraries
Change-Id: Id54af09f7b7559c5eb751db822aba8cd6b413559
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241160
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-04-25 15:53:32 +00:00
Lasse R.H. Nielsen 0f0f045128 Fix bug in Duration.toString.
The `toString` used the sign of `hours` to get a leading `-`
when the duration is negative. However, a negative duration of
less than one hour would therefore miss out on the sign,
because `-0` is not an integer.
Now handles sign explicitly.

Fixes #48841.

Change-Id: I0ab6d451faf1c76b838fc35a692f07c5b035d2a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241748
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-04-25 14:37:42 +00:00
Sigmund Cherem e5f4b85066 [dart2js] Fix deferred load URI when baseUrl has a single path segment
This fixes https://github.com/dart-lang/sdk/issues/48848

When the base URI is just a filename, then base was empty, and we accidentally
added a / in the first position.  This made the deferred URI absolute by
mistake.

Change-Id: I4d6a773f6ef8bfefbbf61417bfe7c005aa5e63ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241990
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2022-04-22 21:33:10 +00:00
Mayank Patke 091559359e Reland "[dart2js] Lower late field checks during SSA."
This reverts commit 45c1e51bb3.

Reason for revert: Reland

Original change's description:
> Revert "[dart2js] Lower late field checks during SSA."
>
> This reverts commit 7187b2efe9.
>
> Reason for revert: Broke flutter roll
>
> Original change's description:
> > [dart2js] Lower late field checks during SSA.
> >
> > Change-Id: I80e7a30c6f2a461e46b4f52ebf7eb7a13fbc6227
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240501
> > Reviewed-by: Stephen Adams <sra@google.com>
> > Commit-Queue: Mayank Patke <fishythefish@google.com>
>
> TBR=sra@google.com,fishythefish@google.com
>
> Change-Id: Idf4eff95425db4d770137d589d4bb5484fc6e187
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241806
> Reviewed-by: Mayank Patke <fishythefish@google.com>
> Reviewed-by: Nate Biggs <natebiggs@google.com>
> Commit-Queue: Mayank Patke <fishythefish@google.com>


Change-Id: Iccba8947a5778f5310e194d814b398dc46465fbb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241807
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2022-04-21 21:10:58 +00:00
Joshua Litt 8e6fa91711 [dart2wasm] Add support for calling Dart functions from JS.
Change-Id: I83cb295ce61b266b86e9efa194dcbc61fc2c8d31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239200
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-04-21 16:30:18 +00:00
Mayank Patke 45c1e51bb3 Revert "[dart2js] Lower late field checks during SSA."
This reverts commit 7187b2efe9.

Reason for revert: Broke flutter roll

Original change's description:
> [dart2js] Lower late field checks during SSA.
>
> Change-Id: I80e7a30c6f2a461e46b4f52ebf7eb7a13fbc6227
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240501
> Reviewed-by: Stephen Adams <sra@google.com>
> Commit-Queue: Mayank Patke <fishythefish@google.com>

TBR=sra@google.com,fishythefish@google.com

Change-Id: Idf4eff95425db4d770137d589d4bb5484fc6e187
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241806
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2022-04-20 18:37:18 +00:00
Joshua Litt 84497e41ca [package:js] Add @trustTypes annotation.
Adds an experimental `@trustTypes` annotation which can be used during
migration to static interop to preserve the older semantics for JS interop.

Change-Id: Ic00a6c968b15f8c8f5d0840b82db5a6670eaf0eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241362
Reviewed-by: Riley Porter <rileyporter@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-04-20 15:24:18 +00:00
Mayank Patke 7187b2efe9 [dart2js] Lower late field checks during SSA.
Change-Id: I80e7a30c6f2a461e46b4f52ebf7eb7a13fbc6227
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240501
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2022-04-19 19:01:27 +00:00
Aske Simon Christensen fec466e3fe [dart2wasm] Add Wasm function references and more Wasm ref conversions
Having first-class Wasm function references makes it possible to call
JS function objects directly from Dart, and to call some Dart functions
(static functions with no optional parameters and no type parameters)
from JS as function objects.

Change-Id: I1c788338d418c8857493ec76560d74fdd17d5dd2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241001
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2022-04-19 09:40:17 +00:00
Lasse R.H. Nielsen af39b6b9ca Fix error in DartDoc, add missing Since annotation.
Apaprently the landing of the previous DartDoc introduced an error
in the DartDoc process.
Removing the entire comment doesn't change that, so I'm not sure
where the actual error is.
Anyway, this fixes the links that weren't working,
and it adds a missing `Since` annotation at the same time.

Change-Id: I92ac23a32ccc9ddbaf9a708b21fe3521c4103513
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241011
Commit-Queue: Lasse Nielsen <lrn@google.com>
Auto-Submit: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2022-04-13 17:44:33 +00:00
Halil İbrahim Durmuş 0b2b5aaa9a Fix documentation for operators << and >>.
I couldn't understand what `shiftIndex` is referring to while reading the docs for operators `<<` and `>>`.
I think `shiftIndex` should be replaced with `shiftAmount`.

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

GitOrigin-RevId: b2dcaf22f5a3db8a19ffabafe772d4a0971cb810
Change-Id: I0e5c1e183df90cf0bc36920e8dc27b01947384b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241045
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-04-13 09:15:55 +00:00
Lasse R.H. Nielsen 0ee6ee405c Improve documentation of Error.stackTrace.
It's been described as "thoroughly incomprehensible".
Hopefully the incomprehensivity is now mostly superficial.

Change-Id: Id46fa20934ad340db8f485f138fb895b9dee176a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241003
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-04-13 07:55:32 +00:00
Joshua Litt bdbecf318e [dart2wasm] Add support for anonymous JS interop classes.
Change-Id: Ib0645b4e3b0bd410188be9e39755be5e4c02bb44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240323
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-04-12 22:51:02 +00:00
Joshua Litt d06fd8d081 [js_util] Add globalThis getter.
Change-Id: I325f3ea7f5aad84dff9e08c6a958b478d6926cb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240962
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-04-12 20:12:02 +00:00
Joshua Litt f6af76eaf8 [dart2wasm] Basic support for js interop annotations.
Change-Id: Ibb66415ec77a45e436d4058c5d9873c5918b68a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239009
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-04-12 18:26:02 +00:00
Parker Lougheed 03fd724529 Minor fixes to file_system_entity docs
Bug: https://github.com/dart-lang/site-www/issues/3946
Change-Id: I1e706abad40846e90b0ddc092e72f788d9e5d7ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239180
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-04-12 16:01:16 +00:00
Daco Harkes 5ca6eec782 [vm/ffi] Add Since annotations to dart:ffi
Closes: https://github.com/dart-lang/sdk/issues/48711

Change-Id: Iac0bcecdf81b02bcb2feb746aa94a1bef6caf600
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240045
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-04-12 11:06:21 +00:00
Siva Annamalai 94bc01240c Revert "[vm] Fix some async* semantics issues: Only run generator if there's active subscription (not paused/cancelled)"
This reverts commit 837ee17b43.

Reason for revert: Please see https://github.com/flutter/flutter/issues/101514

Original change's description:
> [vm] Fix some async* semantics issues: Only run generator if there's active subscription (not paused/cancelled)
>
> This fixes an issue where VM would run the async* generator after a
> `yield` / `yield*` even though the subscription may be paused or
> cancelled.
>
> Furthermore this fixes an issue where `StackTrace.current` used
> in async* generator crashes VM and/or produces truncated stack
> trace.
>
> This fixes the following existing tests that were failing before:
>
>   * co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t08
>   * co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t09
>   * co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t10
>   * language/async_star/async_star_cancel_test
>   * language/async_star/pause_test
>
> Issue https://github.com/flutter/flutter/issues/100441
> Issue https://github.com/dart-lang/sdk/issues/48695
> Issue https://github.com/dart-lang/sdk/issues/34775
>
> TEST=vm/dart{,_2}/causal_stacks/flutter_regress_100441_test
>
> Change-Id: I73f7d0b70937a3e3766b992740fa6fe6e6d57cec
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239421
> Reviewed-by: Lasse Nielsen <lrn@google.com>
> Commit-Queue: Martin Kustermann <kustermann@google.com>

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

Change-Id: Ic3d9c0508310a33a2aaee67860c0bb2ec83bab4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240506
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2022-04-07 21:46:38 +00:00
Aske Simon Christensen d162c637d6 [dart2wasm] Support casting to and calling Function
Also fix parameter type of ClassID.getID

These changes are necessary to support the hash implementation changes
in https://dart-review.googlesource.com/c/sdk/+/237582

Change-Id: Ic7448fae647be57a55f9e1d08b3ece780e60fd3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240402
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2022-04-07 10:46:01 +00:00
Chris Terefinko ecbf11b8d8 [dart2js] Add missing connectionState and onConnectionStateChange to RTCPeerConnection.
Closes https://github.com/dart-lang/sdk/issues/48735

Change-Id: I04f263afa4dee1b868ad254cb54ad7c398435e03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240240
Reviewed-by: Riley Porter <rileyporter@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2022-04-06 22:34:07 +00:00
Martin Kustermann 837ee17b43 [vm] Fix some async* semantics issues: Only run generator if there's active subscription (not paused/cancelled)
This fixes an issue where VM would run the async* generator after a
`yield` / `yield*` even though the subscription may be paused or
cancelled.

Furthermore this fixes an issue where `StackTrace.current` used
in async* generator crashes VM and/or produces truncated stack
trace.

This fixes the following existing tests that were failing before:

  * co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t08
  * co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t09
  * co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t10
  * language/async_star/async_star_cancel_test
  * language/async_star/pause_test

Issue https://github.com/flutter/flutter/issues/100441
Issue https://github.com/dart-lang/sdk/issues/48695
Issue https://github.com/dart-lang/sdk/issues/34775

TEST=vm/dart{,_2}/causal_stacks/flutter_regress_100441_test

Change-Id: I73f7d0b70937a3e3766b992740fa6fe6e6d57cec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239421
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-04-06 10:44:34 +00:00
Emmanuel Pellereau 23c7f68fd9 Allow null in assertInterop().
Change-Id: I806767e85edb8cb11183602ac7db55cdbaffc1c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240040
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
2022-04-06 06:50:24 +00:00
Ben Konyi eb92439a80 [ Service ] Fix cast error in _decodeAssets return value
Change-Id: I03da2a2e37582e3ec2cd4c2233d5e7cbca0071f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240303
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-04-06 00:24:13 +00:00
Joshua Litt 8a7d75b6ee [dart2js] Go directly to WorldImpact from Kernel.
Removes the ResolutionImpact, this should be significantly more
efficient in addition to making it much clearer how `ImpactData`
is actually used.

Change-Id: I8f12508469c784ec480ea351a34cf1477d33cf74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235481
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-04-05 16:46:43 +00:00
Siva Annamalai ac6f72205a Revert "[VM/io] - Set correct file type for files backing unix domain sockets"
This reverts commit dbe6d1d574.

Reason for revert: One of the new tests spawns a process and runs the script from source and so this test will fail on all AOT configurations, In addition it is failing on mac builds and needs investigation.

Original change's description:
> [VM/io] - Set correct file type for files backing unix domain sockets
>
> The file type of file backing unix domain sockets was being incorrectly
> set as kDoesNotExist resulting in errors when operations like delete
> on the file was done. File::Exists on the other hand returned true.
> File rename and copyfile functionality have been fixed too.
>
> TEST=new tests added
>
> Please see https://github.com/dart-lang/sdk/issues/48569 for the original issue.
> Change-Id: Ie9c716c84b1d818c906ecdb622ba930125f9ee30
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237745
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>

TBR=rmacnak@google.com,asiva@google.com

Change-Id: I517896fb90b013af1ce9a6754442a922e2b7cda5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240149
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2022-04-04 23:30:02 +00:00
asiva dbe6d1d574 [VM/io] - Set correct file type for files backing unix domain sockets
The file type of file backing unix domain sockets was being incorrectly
set as kDoesNotExist resulting in errors when operations like delete
on the file was done. File::Exists on the other hand returned true.
File rename and copyfile functionality have been fixed too.

TEST=new tests added

Please see https://github.com/dart-lang/sdk/issues/48569 for the original issue.
Change-Id: Ie9c716c84b1d818c906ecdb622ba930125f9ee30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237745
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2022-04-04 22:17:42 +00:00
asiva 4f76b9535d [VM / IO] Assert When a socket exception is being thrown with an error code of 0.
TEST=ci

Change-Id: Ie0ea5329dfe0307f47fc04db693dae4e352d0f64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239846
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2022-04-04 21:34:21 +00:00
Joshua Litt df512fefe9 [dart2wasm] Implement as check.
Change-Id: Iadf187ccc4d243a1b46491fbf99c2f740db9c6fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239920
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-04-04 19:17:52 +00:00
Ben Konyi d94de5895f [ Service ] Fix assets getter being non-nullable when null is a valid
result

Fixes https://github.com/flutter/flutter/issues/101242

Change-Id: I13f24b96a36af607aa0273f17177722a730edc2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240120
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-04-04 17:58:31 +00:00
Stephen Adams 6155b8459c [dart2js] JSArray.clear does not need to check length
Calls to non-inlined method are slightly more compact.
The error message is better, citing the'clear' method.
The argument for `length` does not need to be checked.

Change-Id: Ic6341675eba9d851e8003411093a8a90d37baafa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235485
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-04-04 01:17:51 +00:00
Mark Zhou 471fcee079 [ddc] Adding support for static setters of const fields
Fixes #48717

Change-Id: I45145bc992bb129d54962b1ed9cfebbdbac41f92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239730
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2022-04-01 23:51:15 +00:00
Ben Konyi 23ea9f3da4 [ VM Service ] Remove dynamic callsites from VM service
Fixes https://github.com/dart-lang/sdk/issues/48405

TEST=N/A

Change-Id: I975d713d27fac6221e3a06dce0cddaf1f5019b7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239583
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-04-01 17:54:46 +00:00
Mark Zhou db513ecc8f Moving ReleaseARM64 earlier in candidate search order
Fixes some issues with resolving SDK build dirs on M1 Macs, as some of our tooling implicitly builds DebugX64.

Change-Id: Ia890bbe2b552be5eaa6207fc5f930c0b0e7c4ffa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239731
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2022-04-01 15:56:56 +00:00
Slava Egorov 4c0387461c Revert "[VM / IO] - Reland : Assert when an OSError exception is reported with no error"
This reverts commit dc8002cc42.

Reason for revert: crashes internally (b/227727791) and externally (dartbug.com/48721)

Original change's description:
> [VM / IO] - Reland : Assert when an OSError exception is reported with no error
>
> 1. Add a Fatal assert when an OSError is reported with no error code (0).
> This is to ensure we get a coredum pwhen this happens so we can analyze
> it. (Please see https://github.com/flutter/flutter/issues/90921 for more
> details)
>
> TEST=ci
>
> Change-Id: I7146ac69ef8b1833f28bed8a23f0c27a2ece4bbf
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239726
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>

TBR=aam@google.com,asiva@google.com

Change-Id: Ic9302e7922b0ce2ea5ab81357804c3cd822a8052
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239664
Reviewed-by: Slava Egorov <vegorov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-04-01 10:14:37 +00:00
asiva dc8002cc42 [VM / IO] - Reland : Assert when an OSError exception is reported with no error
1. Add a Fatal assert when an OSError is reported with no error code (0).
This is to ensure we get a coredum pwhen this happens so we can analyze
it. (Please see https://github.com/flutter/flutter/issues/90921 for more
details)

TEST=ci

Change-Id: I7146ac69ef8b1833f28bed8a23f0c27a2ece4bbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239726
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2022-03-31 22:18:15 +00:00
Lasse R.H. Nielsen d063ac3233 Revert Isolate.run.
The current VM closure serialization makes this function a foot-gun.
Revert until the supporting features are improved, so as to not give
users a bad experience.

Change-Id: I83b6b453ce5ab00d49ffbf36a5763119a6435352
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237940
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-03-31 09:42:34 +00:00
Brian Quinlan c286b76c2d Allow sockets to enable TLS renegotiation.
TESTED=unit + manually tested user issue.
Bug: https://github.com/dart-lang/sdk/issues/47841
Change-Id: Iad13899135fd34f15abba3a499132d88e7f597dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234821
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-03-31 06:40:51 +00:00