Commit graph

11067 commits

Author SHA1 Message Date
Srujan Gaddam 5b3a57908d [dart:js_interop] Remove ObjectLiteral
This annotation is unneeded as named arg external constructors
is enough to determine if an object literal is created. The one
exception is an empty object literal, but our guidance is to use
utility functions to create one instead. This is a better fit for
that purpose too as an interface for an empty object literal is
more uncommon.

CoreLibraryReviewExempt: Backend-specific library.
Change-Id: I10cf891601b28ff7e56129842d099ea28863626d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307506
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-06-06 20:50:36 +00:00
Nicholas Shahan 09df4e5200 [ddc] Fix dynamic calls of generic methods with new types
- Use the correct name/symbol when looking up the default type 
  arguments.
- Copy default type arguments signatures when applying a mixin.

Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: Ided28aeac931e3d9ac71759db85d89bf57456cb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306915
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-06-05 18:00:09 +00:00
Nicholas Shahan 00d63e7bf9 [ddc] Fix covariant bound checks with new types
Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: I7a5d9c412696ea038af8320734790456d4e2880a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306914
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2023-06-02 21:56:07 +00:00
Derek Xu 475240d234 Reland "[VM/Timeline] Make timestamp1_or_id variables more understandable"
This is a reland of commit 46e70a7c07

It turns out that flow events do need to be associated with IDs in
Chrome's trace format, so the diff between patchset 1 and 6 contains the
changes required to document that.

TEST=Checked that duration events still looked correct in traces written
by the Perfetto file recorder. Checked that events still looked correct
in traces recorded to the MacOS recorder. Checked that flow events still
looked correct in Observatory. Ran the
vm/cc/DartAPI_TimelineEvents_Serialization test in debug mode, and with
ASAN and TSAN.

CoreLibraryReviewExempt: Does not change any APIs, just stops passing a
value that will never be read. Specifically, we do not need to pass a
flow ID on the end side of track events.
Change-Id: I6b8bb3236339dbe54378b2e9dea06faf22b964a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306664
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-06-01 19:50:38 +00:00
Joshua Litt e316fb84a1 [js] Add inlining hints to js patch files.
Change-Id: Ic9f9b7887b2d710b39ec1dfc2f4909aa3327932b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305820
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-06-01 17:21:18 +00:00
Ryan Macnak 52791b4e0d [build] Decide in one place between using app-jit and kernel for the SDK snapshots.
Change-Id: Id642c635979b96f09780aba49ffcb1b9f215878d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306666
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-06-01 15:20:58 +00:00
Nicholas Shahan b803bbbb12 [ddc] Fix for record types with new type system
- Fix result of calling `getReifiedType()` on a Record value.
- Fix type of an empty record with no values.

Change-Id: I8f8bdf1649738174bdce86b30c8225a62b81af02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306121
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
2023-05-31 19:21:21 +00:00
asiva 54dea888a5 [dart cli] Remove need for dartdev.dill file from sdk
The bulid rules generate an appjit snapshot or a kernel file under
dartdev.dart.snapshot depending on whether the target_cpu is the same as
the host_cpu.
Generation of the additional dartdev.dill file is not needed because of
this, the logic to start the dartdev isolate tries to load
dartdev.dart.snapshot as an appjit snapshot first and if that fails it
tries it as a kernel file.

TEST=ci

Change-Id: I1c985bdf543d3eb5e17d968378053cc558fd8a0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306134
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2023-05-30 21:42:39 +00:00
Alexander Markov 466bbd2545 Reland "Reland "[vm] Unify hash codes in type objects""
This is a reland of commit f96d179ae4

Original change's description:
> Reland "[vm] Unify hash codes in type objects"
>
> This is a reland of commit e82a2230fd
>
> Original change's description:
> > [vm] Unify hash codes in type objects
> >
> > TEST=ci
> >
> > Change-Id: I53d2268c3aab6fc4583c3201051b68f8fc05d56d
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305361
> > Commit-Queue: Alexander Markov <alexmarkov@google.com>
> > Reviewed-by: Ryan Macnak <rmacnak@google.com>
>
> TEST=ci
> Change-Id: I333ed4297ad4af97000c98dfe4547b4cab6cb313
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305780
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

TEST=ci
Change-Id: Ib38656b32ead96b77d7f80665b93a623431f5594
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306001
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-05-26 20:13:17 +00:00
Alexander Markov c57f889d43 Revert "Reland "[vm] Unify hash codes in type objects""
This reverts commit f96d179ae4.

Reason for revert: failures on Flutter Windows bots (https://github.com/flutter/flutter/issues/127666)

Original change's description:
> Reland "[vm] Unify hash codes in type objects"
>
> This is a reland of commit e82a2230fd
>
> Original change's description:
> > [vm] Unify hash codes in type objects
> >
> > TEST=ci
> >
> > Change-Id: I53d2268c3aab6fc4583c3201051b68f8fc05d56d
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305361
> > Commit-Queue: Alexander Markov <alexmarkov@google.com>
> > Reviewed-by: Ryan Macnak <rmacnak@google.com>
>
> TEST=ci
> Change-Id: I333ed4297ad4af97000c98dfe4547b4cab6cb313
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305780
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

Change-Id: I1a933e39b81e99e732db56e616b24d6ec604f01b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306000
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2023-05-26 14:36:14 +00:00
Daco Harkes 706f6b2ca4 [vm/ffi] Cleanup old RTEs
The cleanup isn't symmetrical in all files:
- 1x `Ffi_loadStruct` wasn't referenced from the Dart patch file.
- 4x `Unaligned` loads and stores were never runtime entries.
This sums up to a 4 - 1 = 3 diff between the diffs of the .h files.

TEST=ffi test suite

Change-Id: I0a4ab023b7eb116f87cf9bc10a970e6a531c5319
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64c-try,vm-aot-linux-debug-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-reload-rollback-linux-debug-x64-try,vm-reload-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305942
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
2023-05-26 13:43:28 +00:00
Derek Xu 41cceb1d80 [VM/Timeline] Fix flow events reported through dart:developer
Flow events must be enclosed within the start and end of another event
in Chrome's tracing format.

CoreLibraryReviewExempt: Does not change any APIs, just swaps the order
of two function calls
Change-Id: I0bea036368f84c5582f23c913ac17beca1cc83a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305800
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-05-26 13:08:27 +00:00
Mark Zhou 44b5ca76a9 [ddc] Extending record type 'is' checks to dispatch through its fields' types.
Fixes #52480

Change-Id: I01fed52dc553ecd51a3b7e074bead6aaa6a65628
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305560
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2023-05-25 23:45:25 +00:00
Alexander Markov f96d179ae4 Reland "[vm] Unify hash codes in type objects"
This is a reland of commit e82a2230fd

Original change's description:
> [vm] Unify hash codes in type objects
>
> TEST=ci
>
> Change-Id: I53d2268c3aab6fc4583c3201051b68f8fc05d56d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305361
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

TEST=ci
Change-Id: I333ed4297ad4af97000c98dfe4547b4cab6cb313
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305780
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-05-25 21:55:24 +00:00
Michael Thomsen 192d601521 Fix dart:developer API docs
Fixes a formatting issue with a code block not being terminated
correctly.

https://api.dart.dev/be/3da16e93a94fe30337049bda853d3f8690adf32d/dart-developer/dart-developer-library.html

CoreLibraryReviewExempt: Documentation only.
Change-Id: I5213015a0b7687f82e003bae6bc3378eaa90c4a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305660
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Auto-Submit: Michael Thomsen <mit@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-05-25 09:58:41 +00:00
Alexander Markov ee36a2dcef Revert "[vm] Unify hash codes in type objects"
This reverts commit e82a2230fd.

Reason for revert: g3 failures

Original change's description:
> [vm] Unify hash codes in type objects
>
> TEST=ci
>
> Change-Id: I53d2268c3aab6fc4583c3201051b68f8fc05d56d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305361
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

Change-Id: If22c8ed05cd23eb5c62c7a431311827a480263a6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305540
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2023-05-24 21:43:06 +00:00
Alexander Markov e82a2230fd [vm] Unify hash codes in type objects
TEST=ci

Change-Id: I53d2268c3aab6fc4583c3201051b68f8fc05d56d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305361
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-05-24 20:40:49 +00:00
Brian Quinlan 95509b2b34 Add tests to ensure that \n is not translated to the platform line ending and document that behavior.
Change-Id: I52668a87507dfdc560fd7c1ec20e86114c1199b7
CoreLibraryReviewExempt: documentation and test-only change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303421
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-05-24 18:50:29 +00:00
mnordine f3b418e7bc Fix typo
Closes https://github.com/dart-lang/sdk/pull/52502

GitOrigin-RevId: a68af62ca8f6846960111d75a0292675ce9c1fcd
Change-Id: I946bb39e8dfffbb749e31e2387697e2d32abe139
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305300
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2023-05-24 16:44:58 +00:00
Lasse R.H. Nielsen 7e56658645 Add interface to a few classes which had missed it.
Breaking change request: https://dartbug.com/52334

Four abstract pure-interface classes in `stream.dart` have
been missed, and not made into `interface` declarations
like other similar abstract interface-only classes.
They should be marked `interface`, for consistency,
and to express intent.

The classes are:
* `StreamConsumer`
* `StreamIterator`
* `StreamTransformer`
* `MultiStreamController`

All are abstract classes with only abstract instance members.

Only `StreamConsumer` has uses where it is extended.
Most of those are inside the SDK, and are fixed here.
Two more are in packages (`http_server` and `streams`).
The former is discontinued and archived, and will never have a 3.0
release. The latter is internally developed and easy to fix.

Hope to cherry pick this for 3.0.3

Tested: Modified affected tests. Only adding restrictions.
CoreLibraryReviewExempt: Adding modifiers only.
Change-Id: I41aa47e48eaf769b7bd9d3206c1079a16ef3d476
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302204
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2023-05-24 14:04:27 +00:00
Michael Thomsen fa5e8e2e0d Explain what dart:developer is for
CoreLibraryReviewExempt: Documentation only.
Change-Id: Ic1cc81f47beb3a6dc8e387f040fcc3e000d6bb03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215422
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-05-24 12:33:12 +00:00
Johnni Winther 70d537ca22 [cfe] Handle extension in merged scopes
This includes the extension scope in the merging of origin and
augmentation scopes.

TEST=tests/ffi/vmspecific_native_finalizer_*

Change-Id: I1211851611e97d04c0d39e6d7dee7768c94e0132
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305200
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-05-24 11:25:57 +00:00
Ömer Sinan Ağacan 0358d35db0 [dart2wasm] Fix completer type in async functions when the return type is FutureOr
New passing test: language/await/await_test

Change-Id: I44ac5a8d100e6b299cb9ebdc825e1e0562e15ba7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304920
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-05-24 08:49:29 +00:00
Nicholas Shahan 15903b76fe [dart:html] Delete unused private methods
The outdated custom element support has already been removed so these
methods are no longer needed.

Removes an access of `.__proto__`.

Issue: https://github.com/dart-lang/sdk/issues/52372
CoreLibraryReviewExempt: Change in web only library
Change-Id: Ia55c3be7f6c19433234c02b90981424e973866aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304781
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-05-23 21:40:32 +00:00
Siva Annamalai 0fae0f373a Revert "Some work on the issue #40614 now that we have soundness"
This reverts commit e43939dd5d.

Reason for revert: It causes issues when applications are run with the --no-sound-null-safety flag.

Original change's description:
> Some work on the issue #40614 now that we have soundness
>
> Closes https://github.com/dart-lang/sdk/pull/52383
>
> GitOrigin-RevId: 70014d0575d1623c1f777fab479cfa93088efa2a
> Change-Id: Ibf4ad3d862b07873317785389799ee8dfc80290f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303161
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Michael Thomsen <mit@google.com>

Change-Id: I9c928f6c6756c4aad22f1b98e86e9b04af999e7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305040
Commit-Queue: Siva Annamalai <asiva@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-05-23 17:35:57 +00:00
Nicholas Shahan 2d1ae4a024 [ddc] Remove .__proto__ use from signatures
Issue: https://github.com/dart-lang/sdk/issues/52372
Change-Id: I13e674aceaa88c40709846c1a5fda138b91fe0de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304285
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-05-23 05:10:18 +00:00
Brian Quinlan 14cb98e874 Do not throw during InternetAddress.tryParse
Bug:https://github.com/dart-lang/sdk/issues/52423
Change-Id: I3574cf9a33bd72d02a619afcf20a8a6eec835438
Tested: covered by existing tests
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304827
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-05-22 23:47:00 +00:00
Brian Quinlan c3e815bc7a [io] Make FileSystemEvent sealed
Bug: https://github.com/dart-lang/sdk/issues/52027, https://github.com/dart-lang/sdk/issues/51912
Change-Id: I154ffe5901e4248f48400e6c84568c9fe6dbcd83
CoreLibraryReviewExempt: aske on holiday
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302452
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-05-22 23:37:31 +00:00
Ryan Macnak c747a25d66 [vm] Add arch-specific bits for Android RISCV64.
TEST=local AOSP build
Bug: https://github.com/flutter/flutter/issues/117973
CoreLibraryReviewExempt: VM-only
Change-Id: I9417e86f025bebee359d8ba50ee6b5c8589c2744
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303011
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-05-22 16:43:04 +00:00
Alexander Markov 6d466bcb41 [vm/aot/tfa] Conditional data flow
This change improves type flow analysis by adding conditional data
flow. Now each statement in the data flow summary can have an optional
condition. If a condition is present, then the statement is applied
only if its condition is not a 'false' constant. The condition may
become false as a result of whole-program type and constant
propagation (constant value is an optional property of a concrete
type).

Conditions in the data flow summary are populated from conditions in
the 'if' statements and conditional expressions. Conditions are
propagated down the control flow while building the summary.
For example:

  if (x) { return foo(); }
  bar();

Call 'foo()' is guarded by condition 'x' and 'bar()' is guarded by
condition '!x'.

Also, a bunch of unary and binary operations are added in order to
represent logical expressions, comparisons with null, 'is' tests and
conditional moves.

This change makes TFA much more sensitive to the control flow.

In order to offset increase in the compilation time due to the
additional condition and operations in the data flow summary,
the following is done:
* Types corresponding to bool constants are canonicalized; condition
  checking and logical operations are performed using fast identical
  checks.
* Fast identical checks are also added to union and intersection of
  types.
* Added more sophisticated simplifications of Join statements.

Along with reduced analysis due to skipped data flow statements with
false conditions, these improvements result in the slightly reduced
compilation time.

AOT compilation time on large Flutter apps (only AOT step 2 / TFA):
App 1: Before: 65.448s After: 62.893s (-3.9%)
App 2: Before: 55.067s After: 52.192s (-5.2%)

AOT snapshot size of large Flutter apps (Flutter release mode, arm64):
App 1: Before: 32910316 After: 32599936 (-0.9%)
App 2: Before: 34464544 After: 34092907 (-1.0%)
Flutter gallery: -1.9%

Performance on micro-benchmark from https://github.com/dart-lang/sdk/issues/51630 in AOT mode:
Before: 0.405839
After: 0.172886 (2.3x faster than before, still slower than JIT)

TEST=pkg/vm/testcases/transformations/type_flow/transformer/regress_47509.dart
TEST=pkg/vm/testcases/transformations/type_flow/transformer/regress_51630.dart

Issue: https://github.com/dart-lang/sdk/issues/51630
Fixes https://github.com/dart-lang/sdk/issues/48154
Fixes https://github.com/dart-lang/sdk/issues/47509

Change-Id: I29baf2933972adf83fd58be5ec25be8c30665c01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/300700
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-05-22 16:20:47 +00:00
Ömer Sinan Ağacan c74387a3a2 [dart2wasm] New async implementation
This CL re-implements the async function compilation without using JSPI
or any other platform features.

This implementation is faster than the JSPI-based one in all benchmarks,
in some cases up to 200x (benchmark results at the end). So we remove
the JSPI-based implementation as there's no point in maintaining a much
slower implementation and supporting two implementations at the same
time (which is tricky because these implementations need different
libraries, all scripts need to support two modes etc.) that also
requires experimental platform features.

# Main changes

- A new pass `AwaitTransformer` transforms `await` expressions to
  top-level statements in form `var <fresh variable> = await <simple
  expr>`, where `<simple expr>` is an expression without `await`.

  After this pass all `await` expressions have the simple continuation
  of "assign the value of the awaited future to this variable and
  continue with the next statement". This simplifies `await`
  compilation.

- A new code generator `AsyncCodeGenerator` (inherits from
  `CodeGenerator`) compiles `async` functions. The `_YieldFinder` class
  is copied from `sync*` code generator but modified to handle `async`
  expressions.

- Mentions to the V8 flag `--experimental-wasm-stack-switching` is
  removed from all scripts and documents.

# Future work

- Control flow handling in `AsyncCodeGenerator` needs to be implemented
  in a similar way in `SyncStarCodeGenerator`. Doing this without
  duplicating a lot of code will require some refactoring.

# New passing tests

- co19/Language/Statements/Yield_and_Yield_Each/Yield/execution_async_A05_t01
- co19/Language/Statements/For/Asynchronous_For_in/execution_A02_t02
- language/regress/regress23996_test
- language/sync_star/dcall_type_test

# Benchmarks

Current implementation:

```
AsyncLiveVars.LiveObj1(RunTime): 1586000.0 us.
AsyncLiveVars.LiveObj2(RunTime): 2114000.0 us.
AsyncLiveVars.LiveObj4(RunTime): 1972500.0 us.
AsyncLiveVars.LiveObj8(RunTime): 2212000.0 us.
AsyncLiveVars.LiveObj16(RunTime): 2238000.0 us.
AsyncLiveVars.LiveInt1(RunTime): 2362000.0 us.
AsyncLiveVars.LiveInt4(RunTime): 2470000.0 us.
AsyncLiveVars.LiveObj2Int2(RunTime): 2575000.0 us.
AsyncLiveVars.LiveObj4Int4(RunTime): 2820000.0 us.
Calls.AwaitAsyncCall(RunTimeRaw): 35676.15658362989 ns.
Calls.AwaitAsyncCallClosureTargetPolymorphic(RunTimeRaw): 38934.108527131786 ns.
Calls.AwaitAsyncCallInstanceTargetPolymorphic(RunTimeRaw): 42617.02127659575 ns.
Calls.AwaitFutureCall(RunTimeRaw): 2832.058906825262 ns.
Calls.AwaitFutureCallClosureTargetPolymorphic(RunTimeRaw): 3665.8125915080527 ns.
Calls.AwaitFutureCallInstanceTargetPolymorphic(RunTimeRaw): 4420.449537241076 ns.
Calls.AwaitFutureOrCall(RunTimeRaw): 3692.7621861152143 ns.
Calls.AwaitFutureOrCallClosureTargetPolymorphic(RunTimeRaw): 4625.346901017576 ns.
Calls.AwaitFutureOrCallInstanceTargetPolymorphic(RunTimeRaw): 4514.6726862302485 ns.
Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits(RunTimeRaw): 345172.4137931034 ns.
Calls.AwaitForAsyncStarStreamPolymorphic(RunTimeRaw): 697000.0 ns.
Calls.AwaitForAsyncStarStreamPolymorphicManyYields(RunTimeRaw): 704666.6666666666 ns.
Calls.AwaitForManualStreamPolymorphic(RunTimeRaw): 11010.989010989011 ns.
Calls.SyncCall(RunTimeRaw): 0.40275240996973316 ns.
Calls.SyncCallClosureTarget(RunTimeRaw): 0.3989591156672242 ns.
Calls.SyncCallInstanceTargetPolymorphic(RunTimeRaw): 3.2632549336335526 ns.
Calls.IterableSyncStarIterablePolymorphic(RunTimeRaw): 353.3980582524272 ns.
Calls.IterableManualIterablePolymorphic(RunTimeRaw): 332.1161825726141 ns.
Calls.IterableManualIterablePolymorphicManyYields(RunTimeRaw): 354.28067078552516 ns.
```

New implementation:

```
AsyncLiveVars.LiveObj1(RunTime): 11327.683615819209 us.
AsyncLiveVars.LiveObj2(RunTime): 10923.91304347826 us.
AsyncLiveVars.LiveObj4(RunTime): 10956.284153005465 us.
AsyncLiveVars.LiveObj8(RunTime): 11286.516853932584 us.
AsyncLiveVars.LiveObj16(RunTime): 11445.714285714286 us.
AsyncLiveVars.LiveInt1(RunTime): 11016.483516483517 us.
AsyncLiveVars.LiveInt4(RunTime): 11327.683615819209 us.
AsyncLiveVars.LiveObj2Int2(RunTime): 10918.478260869566 us.
AsyncLiveVars.LiveObj4Int4(RunTime): 10737.967914438503 us.
Calls.AwaitAsyncCall(RunTimeRaw): 1082.2510822510822 ns.
Calls.AwaitAsyncCallClosureTargetPolymorphic(RunTimeRaw): 1056.4124234100993 ns.
Calls.AwaitAsyncCallInstanceTargetPolymorphic(RunTimeRaw): 1134.1726210729273 ns.
Calls.AwaitFutureCall(RunTimeRaw): 865.6509695290858 ns.
Calls.AwaitFutureCallClosureTargetPolymorphic(RunTimeRaw): 841.3967185527977 ns.
Calls.AwaitFutureCallInstanceTargetPolymorphic(RunTimeRaw): 839.066957543212 ns.
Calls.AwaitFutureOrCall(RunTimeRaw): 397.9941096871766 ns.
Calls.AwaitFutureOrCallClosureTargetPolymorphic(RunTimeRaw): 406.17384240454913 ns.
Calls.AwaitFutureOrCallInstanceTargetPolymorphic(RunTimeRaw): 393.7472929873607 ns.
Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits(RunTimeRaw): 1095.0503723171266 ns.
Calls.AwaitForAsyncStarStreamPolymorphic(RunTimeRaw): 6643.426294820717 ns.
Calls.AwaitForAsyncStarStreamPolymorphicManyYields(RunTimeRaw): 7178.750897343863 ns.
Calls.AwaitForManualStreamPolymorphic(RunTimeRaw): 1456.23998835008 ns.
Calls.SyncCall(RunTimeRaw): 0.3919935321067202 ns.
Calls.SyncCallClosureTarget(RunTimeRaw): 0.3906669661780074 ns.
Calls.SyncCallInstanceTargetPolymorphic(RunTimeRaw): 3.1676143112814583 ns.
Calls.IterableSyncStarIterablePolymorphic(RunTimeRaw): 104.4932079414838 ns.
Calls.IterableManualIterablePolymorphic(RunTimeRaw): 104.57516339869281 ns.
Calls.IterableManualIterablePolymorphicManyYields(RunTimeRaw): 116.92487576731949 ns.
```

TEST=ci
CoreLibraryReviewExempt: Added entry-point pragmas.
Change-Id: I02fbd08141f51c00fb37b6fa0304dc25d6afdb71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301020
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-05-22 08:32:12 +00:00
Nicholas Shahan 041a8ef3ee [ddc] Remove use of .__proto__ from classes.dart
Issue: https://github.com/dart-lang/sdk/issues/52372

Change-Id: I3f8bf641511bc202a100a9b07de8cb5428fe3c93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304367
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-05-20 00:38:43 +00:00
Nicholas Shahan fdc2a2bd8a [ddc] Remove use of .__proto__ from js_patch.dart
Issue: https://github.com/dart-lang/sdk/issues/52372

Change-Id: Idc3020ddf18e05392154bf8f48b56524ce0a881c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304366
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-05-19 21:12:01 +00:00
Nicholas Shahan 1abf78b361 [ddc] Remove use of .__proto__ from polyfill
Issue: https://github.com/dart-lang/sdk/issues/52372

Change-Id: Ib4f7329c913abfde398dc44ecec07ce318b7d44a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304365
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-05-19 20:40:01 +00:00
Nate Bosch 17c626f8b3 Remove some getters for final fields
These were original getters without any fields. After adding fields
to cache the values instead of rereading them on each access the
forwarding public getters became redundant but were not removed.

Make the fields public, remove the getters, and move the docs from the
getters to the fields.

Change-Id: Ie078f5b85cf85f8f86642ac6fe8d36f4107602ee
CoreLibraryReviewExempt: Only impacts VM platform.
Tested:No behavior changes expected. Confirmed updated fields can be read on VM.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304324
Reviewed-by: Siva Annamalai <asiva@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2023-05-19 00:52:57 +00:00
Brian Quinlan ee0b9ea0f8 Deprecate the Platform constructor
Bug:https://github.com/dart-lang/sdk/issues/52138
Change-Id: I9137ffe7caa1a1e9441d48b030342a528d99e8f6
CoreLibraryReviewExempt: deprecation, aske on holiday
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303086
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-05-18 21:08:24 +00:00
Brian Quinlan a75e857df5 Add a Platform.lineTerminator static method
Bug: https://github.com/dart-lang/sdk/issues/52379
Change-Id: Ic3a7f06252f8a69dcfdb29c00f16557c34529652
CoreLibraryReviewExempt: Aske is on holiday
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297260
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-05-18 19:57:58 +00:00
Christian Findlay e43939dd5d Some work on the issue #40614 now that we have soundness
Closes https://github.com/dart-lang/sdk/pull/52383

GitOrigin-RevId: 70014d0575d1623c1f777fab479cfa93088efa2a
Change-Id: Ibf4ad3d862b07873317785389799ee8dfc80290f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303161
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2023-05-17 18:25:11 +00:00
Lasse R.H. Nielsen 066106d19a Make Uri.base see IOOverrides changes to current directory.
Fixes #39796.

Tested: Case added to `io_overrides_test.dart`.
Bug: https://dartbug.com/39796
Change-Id: Id72f75f972f59f4f9b7d17e79b4bcffd6d79f2c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304006
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2023-05-17 17:27:13 +00:00
Tim Sneath 578dd70fae Tighten introductory text
Closes https://github.com/dart-lang/sdk/pull/52065

GitOrigin-RevId: f1b58633b1069f129d8c88ac7fca1bc9a48f3beb
Change-Id: I4af2e3b69711e4a393c154a98b4a4e5a26e8a03e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295700
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2023-05-16 13:55:23 +00:00
mnordine 2369a3be0f Fix bool.parse() examples
Closes https://github.com/dart-lang/sdk/pull/52389

GitOrigin-RevId: 4987894e85a28e18b183eb45a111d47444d305db
Change-Id: Ib68581d7966c0fb24ccd9070054ea9aaadd2e17d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303221
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-05-16 11:16:16 +00:00
Srujan Gaddam 5225b3d408 [ddc] Remove @staticInterop runtime type in favor of erasure
While we can't modify the kernel ASTs due to modular compilations, we
can change the type we emit instead of using a runtime @staticInterop
type. This CL refactors the erasure so that DDC can use it to emit
JavaScriptObject instead of StaticInteropType.

Change-Id: I9cbeaa2127e50702d2bdf6aeedb2744b7ece33c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295392
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-05-16 01:37:28 +00:00
Nicholas Shahan dd6257a2d3 [ddc] Support dynamic calls of generic functions
Adds the ability to call functions/methods/tearoffs with
generic type arguments when running with the new type system.

Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: I28b8cdad56d614a6b9904995634c0cef67d88ebc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296960
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
2023-05-16 01:12:54 +00:00
Nicholas Shahan adc2935ff4 [ddc] Remove __proto__ use from records.dart
Issue: https://github.com/dart-lang/sdk/issues/52372
Change-Id: I05806656ac9ce2c1ddee233ec836b0a8d0aed464
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303143
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-05-16 00:32:56 +00:00
Nicholas Shahan e61a6175ee [dart2js][ddc] Remove __proto__ use from dart:_rti
Issue: https://github.com/dart-lang/sdk/issues/52372
Change-Id: I86c5545c7e4c7d6c3636a849e8d67066f8155662
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303443
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-05-15 23:47:08 +00:00
Nicholas Shahan 334a552d96 [ddc] Remove use of __proto__ from subtype check
Issue: https://github.com/dart-lang/sdk/issues/52372
Change-Id: I2aed1970164be1e2d4ee525891eaa452e59cd6f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303142
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-05-15 23:46:06 +00:00
Nicholas Shahan f0c14f5b9a [ddc] Remove __proto__ use from debugger.dart
Issue: https://github.com/dart-lang/sdk/issues/52372
Change-Id: I1caa35917ab0b7f0db06da08f70ddffb7bb5653b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303141
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-05-15 22:49:06 +00:00
Nicholas Shahan 3b0e3b98af [ddc] Remove __proto__ use from operations.dart
Issue: https://github.com/dart-lang/sdk/issues/52372
Change-Id: Idc1d64243438d8cd289c64c7df8e9293ab45a548
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303140
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-05-15 20:22:22 +00:00
Nicholas Shahan 4adf002b1d [ddc] Remove __proto__ use from js_array.dart
Issue: https://github.com/dart-lang/sdk/issues/52372
Change-Id: I65ddae15e31ea85a431a62c8b4454710503fd30f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303085
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-05-15 18:57:43 +00:00
Daco Harkes d360edf2f3 [pkg][vm] Native Assets builder
This package contains the logic for building native assets.

This package is the backend that invokes toplevel `build.dart` scripts.
For more info on these scripts see https://github.com/dart-lang/native.

This is a separate package so that dartdev and flutter_tools can reuse
the same logic without flutter_tools having to import dartdev.

Some design decisions:

* We don't yet have `build_dependencies`, so we use the ordinary
  dependency graph for ordering of native assets builds. (If there is
  a cycle we refuse to run.)
  Bug: https://github.com/dart-lang/pub/issues/3794
* Builds are cached based on all the configuration provided by the
  caller. Environment variables are ignored in caching. This CL also
  contains a unit test that invokes the build by not passing through
  environment variables. However, for Windows we need to pass through
  at least `SYSTEMROOT` for MSVC to run correctly. So we might need
  to further explore if we can/want to lock env variables down.
  Bug: https://github.com/dart-lang/native/issues/32
  Bug: https://github.com/dart-lang/native/issues/33

Run tests:
```
dart tools/generate_package_config.dart && \
tools/test.py -n unittest-asserts-release-linux pkg/native_assets_builder
```

Bug: https://github.com/dart-lang/sdk/issues/50565
Change-Id: I133052d7195373e87d20924d61e1e96e3d34ce8f
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/300203
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Hossein Yousefi <yousefi@google.com>
2023-05-15 13:49:30 +00:00