Calls to methods annotated with `@pragma('dart2js:resource-identifier')` are tracked, with their primitive constant arguments, through to the `.js` file which contains the call.
- JavaScript annotations are attached to the JavaScript AST node for
the call.
- At the time of `.js` file printing, the JavaScript annotations are
collected and attributed to the file. This allows the construction
of a map from `.js` files to the 'resource identifiers' contained in
the file.
- Alongside the `main.js` file the resource identifiers are emitted in
a file called `main.js.resources.json`. This is controlled by the
`--write-resources` command line option.
- Serialization of JavaScript ASTs now serializes the attached
JavaScript annotations.
- The internal method used to implement deferred library loading is
annotated, to allow analysis of which deferred library parts load
other libraries.
pkg/js_ast was tweaked to make the pkg/js_ast was tweaked to make the
- pkg/js_ast was tweaked to make propagating the JavaScript annotations through the async transforms easier.
TODO:
- Annotate const constructors
- Add golden-style tests
Change-Id: Iea77550e22ee98f81dca61dfd713c09f734583d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284492
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This doc lives internally (@ go/analyzer-pub-diagnostics) but Jonas suggested it might better serve in the analyzer docs, so here it is! :)
Change-Id: Iec50c263c6621fe15d05282cfcac2eafea5a420e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285884
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
But there is a new "const expression" pattern syntax that does
introduce a const context, so test that here instead.
Change-Id: Iaf615093c3d2fb32065fa8647bf3663118b0c274
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285761
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
dart2js incorrectly canonicalized `const <dynamic>[]` and
`const <Object?>[]` to the same const object.
The incorrect canonicalization showed up in tests for the Patterns
feature.
This is not a complete fix for problems with `treatAsRawType`. See
http://dartbug.com/51534 for more details.
Bug: 49754
Bug: 51534
Change-Id: Ib4bb8529320ed240ab16ae35d4161834dd32b28a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285540
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
IL deserialization should not read 2 components of pair Location
via 2 sub-expressions as they can be swapped due to a different
evaluation order.
TEST=language/records/simple/constants_and_field_access_test/1
(on Windows)
Fixes https://github.com/dart-lang/sdk/issues/51548
Change-Id: I7f97dbb5ed10b700d4cdcea6fa5ebb873ca789c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285860
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
It fails in analyzer tests that cover invalid code.
Change-Id: Iae7d2cab6ee8a86eaf8bc861b38f0e1924dda9d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285820
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
TEST=I recorded a trace using the Perfetto recorder on an Android device and ensured that the "DartDev Runner" track name was correct.
Change-Id: I87ef31ff5b4d7817e77536430cf474cf34c22678
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279200
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Revisions updated by `dart tools/rev_sdk_deps.dart`.
cli_util (fd38b5f..3851652):
3851652 2023-02-24 Kevin Moore Move to dart_flutter_team_lints, require Dart 2.19 (#77)
705bb29 2023-02-24 Kevin Moore blast_repo fixes (#76)
crypto (03eb2c9..9efb888):
9efb888 2023-02-23 Kevin Moore move to pkg:dart_flutter_team_lints, require Dart 2.19 (#141)
test (2cc4144..1307cc5):
1307cc59 2023-02-23 Nate Bosch Add ComparableChecks extension (#1960)
66f2985c 2023-02-24 Pascal Welsch Fix isNotEmpty rejection (#1959)
cf10dc5b 2023-02-23 Nate Bosch Condition must have dynamic generic in deepEquals (#1958)
6fc48d03 2023-02-23 Nate Bosch Fix timeouts when a predicate throws instead (#1957)
vector_math (920e9b6..1e4d000):
1e4d000 2023-02-23 Kevin Moore Move to latest team lints, require Dart 2.19 (#281)
webdev (1e7f9b7..deb801b):
deb801b 2023-02-24 Devon Carew contribute issue templates and pull request labeling (#1979)
74a6520 2023-02-24 Elliott Brooks (she/her) [MV3 Debug Extension] Use new Dart Debug Extension bug template (#1992)
c1f325c 2023-02-24 Elliott Brooks (she/her) [MV3 Debug Extension] Bolt debugging: can reload the page and continue to debug (#1991)
057f598 2023-02-23 Elliott Brooks (she/her) [MV3 Debug Extension] Small fixes for building the extension (#1990)
28a090e 2023-02-23 Anna Gringauze Run dwds tests in a copy of the sdk directory (#1989)
b58d3eb 2023-02-23 Anna Gringauze Run webdev tests in a copy of the sdk directory (#1987)
Change-Id: Iaad67eec68cf3cfeba832abbeb42728043e15b22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285760
Auto-Submit: Devon Carew <devoncarew@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Change-Id: Iafe32528a4516817d6770e5e87686c97bd58da8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285160
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This CL adds the `TimelineEventPerfettoFileRecorder` class, which is a
timeline recorder that writes a trace to file in Perfetto's proto
format. This CL supports the recording of all types of timeline events
except flow events. Support for flow events will be added in a future
CL.
TEST=Recorded traces with the Perfetto file recorder and explored them
in Perfetto's trace viewer, CI
Change-Id: Iaa2051e536589a473c5e15f9de9bb9c251f13d38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278942
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
- Use the currently-unused ReceivePort.handler field instead of a second map.
- Recognize ReceivePort's fields instead of using natives.
This also has the effect that if one discovers that a port handler is holding onto a large amount of memory via its context, the receive port along with its debug name will appear in the retaining path.
TEST=ci
Change-Id: I4b8d0764a41729a3b397b85bc4603e4d6b0ca9a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285403
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This change improves the fallback exhaustiveness algorithm so that it
also takes advantage of the old, pre-patterns exhaustiveness logic for
enums. This ensures that the fallback exhaustiveness algorithm won't
seem like a regression to users who are used to the old pre-patterns
behaviour. This required extending the old algorithm to handle
new-style switch statements (which have a different representation
from classic switch statements in the CFE) as well as switch
expressions.
We also turn on the fallback exhaustiveness algorithm by default.
Unit tests can still disable it by temporarily setting the global
variable `useFallbackExhaustivenessAlgorithm` to `false`.
The hope is that this algorithm will be short-lived; we are just using
it so that if we decide to enable pattern support in the near future,
users will experience something that is sound. That is, it may
require `default` or `_` cases more often than is strictly necessary,
but it shouldn't ever allow a non-exhaustive switch in a place where
an exhaustive switch is required.
Change-Id: I4a8b7f996b109c4ee8832f286c3b3bf3b216fe8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284840
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Before this CL, the kernel_service was recursing one level up to find
a `.dart_tool/native_assets.yaml` due to a typo.
This tests adds a unit test to cover the discovery.
TEST=pkg/vm/test/kernel_service_test.dart
This CL also undoes a spurious change in another test.
Change-Id: Ie7440a2768f8cd6c1195cf31863c8a7fff29e394
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285681
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
According to the language specification:
1) When 'break' is executed in the 'await for' loop (in 'main'),
the underlying stream subscription is canceled.
2) When async* function ('consume') has stopped at 'yield' or 'yield*',
and the stream is canceled, the 'yield' / 'yield*' statement returns
without an object. It also means that code in 'consume()' after
the loop is not executed and it doesn't append ")" to the log.
So the test expectations are fixed to avoid expecting trailing ")"
at the log when there is a 'break' out of the 'await for' loop.
Fixes https://github.com/dart-lang/sdk/issues/51097
Change-Id: Ia59e87ef84dcb8a0c06a47f497cc97d4c6635d27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285343
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This adds explicit handling of the remaining patterns in exhaustiveness.
All these patterns are handled trivially but with TODOs for where we might
want to improve handling.
Asserts are added to flag if a pattern is unhandled.
Change-Id: I82bfccda396316c718685b4d810f259c25771f00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285321
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
This adds support for union directly in the exhaustiveness algorithm
meaning that we can support deeply nested or-patterns without having
to eagerly expand the patterns.
For instance, without support for unions,
case (true || false, true || false):
would have to be expanded to
case (true, true):
case (true, false):
case (false, true):
case (false, false):
before performing exhaustiveness.
Now, we instead perform the expansion in-place and only we need to.
That is, when filtering by subtype `true` of `bool`, we only consider
the row
(true, true || false)
as remaining, because the row
(false, true || false)
won't match anyway.
Change-Id: I1a6402bd21b81bf40924ac0048b683936ce9f608
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285263
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
This reverts commit 32b093379b.
Reason for revert: various test failures across the board.
Original change's description:
> [vm/compiler] Split ParallelMove codegen into scheduling and emission
>
> This CL does not contain any changes to behaviour, but simply moves
> ParallelMoveResolver to a separate file. Additionally instead of
> immediately generating code we produce a move schedule which is
> attached to the ParallelMoveInstr and later converted to the
> native code.
>
> This refactoring prepares the code for subsequent improvements, e.g.
> we want to rework how temporaries used by move resolution are
> allocated: instead of pushing/poping them around every move that needs
> them we will allocate space for them in spill area.
>
> Having ParallelMove scheduling separated from code emission also
> allows to unit test it.
>
> TEST=ci
>
> Change-Id: If3f7a88836037a9812a85c1cfc2ef21a7fe15747
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284222
> Commit-Queue: Slava Egorov <vegorov@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
Change-Id: I82952d024816327ca5f084a2185fa1ab566cfa82
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285560
Auto-Submit: Slava Egorov <vegorov@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
While testing "Move to File" I found the file header was being inserted at the bottom of the document in VS Code, despite the tests working correctly.
This turned out to be because we were sending edits in the same order as server generates (which are designed to be applied sequentially, so they are essentially reversed) on the assumption that order doesn't matter to LSP. This is not correct for inserts with the same offset - those are expected to appear in-order.
Because our tests also just applied the edits in reverse-order, they passed but didn't match the behaviour in VS Code.
This change reverses the order of edits when mapping to LSP (so same-offset inserts are back in "forwards order") and also updates the tests to re-sort in an order that matches VS Code's behaviour.
Change-Id: I40d6be6899e4f13dbff52f39fefb3bbd2caa3521
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285500
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This CL does not contain any changes to behaviour, but simply moves
ParallelMoveResolver to a separate file. Additionally instead of
immediately generating code we produce a move schedule which is
attached to the ParallelMoveInstr and later converted to the
native code.
This refactoring prepares the code for subsequent improvements, e.g.
we want to rework how temporaries used by move resolution are
allocated: instead of pushing/poping them around every move that needs
them we will allocate space for them in spill area.
Having ParallelMove scheduling separated from code emission also
allows to unit test it.
TEST=ci
Change-Id: If3f7a88836037a9812a85c1cfc2ef21a7fe15747
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284222
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
- Skip test in product mode as the feature is not
supported
- Account for GCType::kEvacuate by moving state to
Heap::kSecondScavenge
TEST=ci
Change-Id: Iee3a07121d8c3121cdac4521958048c662ab5b5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285421
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
SP-based loads and stores have compressed instructions for more source/destination registers and offsets than FP-based loads and stores.
dart2js.aot.rv64 27835216 -> 27311240 (-1.88%)
dart2js.aot.rv32 26917472 -> 26344120 (-2.13%)
TEST=ci
Change-Id: I2aa9c30eead5737dd36b831d287fac778fc2eced
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242922
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This change makes `self.window` refer to `self` if undefined.
This makes @JS-interop access to properties of `window` work as expected for benchmarks derived from web apps.
To make feature-detection for the timer easier, a new property, `self.dartUseDateNowForTicks` can be set to force the runtime to use Date.now() over performance.now().
Change-Id: Ie3d68d466ccad6e8804014ee8099cea235b173c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285220
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
We only tested a handful of native signatures for `@Native`s and
`@FfiNative`s. This CL duplicates the generated FFI call tests which
cover a lot of signatures to also run for `@Native`s.
Bug: https://github.com/dart-lang/sdk/issues/47625
Change-Id: I475f028c79e13470c2ea4e24040209a915631779
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-win-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284901
Reviewed-by: Martin Kustermann <kustermann@google.com>
This reverts commit 1f6d4ae1a8.
Reason for revert: Broke Flutter with dart2wasm
Original change's description:
> [dart:js_interop] Add literal constructors for inline classes
>
> Adds @ObjectLiteral annotation to denote object literal constructors,
> and implements it in all the backends. For dart2js, this involves
> modifying the SSA and for dart2wasm, we create a one-per-shape
> forwarding procedure to a specialized JS method that returns the
> literal. This also modifies @anonymous semantics in dart2wasm to
> be consistent with the other backends.
>
> CoreLibraryReviewExempt: Backend-specific, just adding annotation.
> Change-Id: I4d7a9ea9ed097f4f378709b40f8bd74f02e26b23
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283922
> Commit-Queue: Srujan Gaddam <srujzs@google.com>
> Reviewed-by: Joshua Litt <joshualitt@google.com>
Change-Id: Ifce611e1150d8aa275f9e312743bded56a572176
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285342
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>