Commit graph

90312 commits

Author SHA1 Message Date
Stephen Adams c768f80a96 [dart2js] Implement @pragma('dart2js:resource-identifier')
Calls to methods annotated with `@pragma('dart2js:resource-identifier')` are tracked, with their primitive constant arguments, through to the `.js` file which contains the call.

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

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

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

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

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


TODO:

- Annotate const constructors
- Add golden-style tests

Change-Id: Iea77550e22ee98f81dca61dfd713c09f734583d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284492
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-02-28 03:00:18 +00:00
Konstantin Shcheglov d1559a99b6 CONSTANT_PATTERN_NEVER_MATCHES_VALUE_TYPE: allow int vs int, expand checks for generic types.
Change-Id: If360cdcba68b934d84fab816ef280598f8038624
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285081
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-02-28 02:53:11 +00:00
pq 8041daf7b0 + pubspec diagnostic doc
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>
2023-02-28 02:45:08 +00:00
Konstantin Shcheglov ffdd04f7e4 Use extual dumps to test Search.unresolvedMemberReferences().
Change-Id: I29288108c0fa95680ad346ab87b22f9bd74932fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285703
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-02-28 01:41:48 +00:00
Robert Nystrom 51bc545135 Switch cases are no longer const contexts with patterns.
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>
2023-02-28 01:34:26 +00:00
Stephen Adams 3af33c1ffb [dart2js] Avoid treatAsRawType for constant collections
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>
2023-02-28 01:13:17 +00:00
Jake Macdonald 89e9f1ea9b opt out static interop inheritance test until classes can be marked as mixin classes
Change-Id: I006f7ea206da64c30acd070e2ed83ec786def1fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285802
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-02-28 00:25:49 +00:00
Alexander Markov e7af7ea88f [vm/compiler] Avoid undefined evaluation order in IL deserialization
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>
2023-02-28 00:24:39 +00:00
Mark Zhou 36ee2f3adb [ddc] Using fully qualified import URIs for deferred load caching
Change-Id: Ibd4b9e1d37aeb9b2df3414eb52a01400e86c0f42
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281562
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2023-02-28 00:12:33 +00:00
Jake Macdonald 41bc0b4d07 opt assignable_expression_test into 2.19
opt switch related tests back to 2.19
opt map/set hashCode override tests back to 2.19

Change-Id: Ib5c44fc17de43eaf9bcad71d7a326c5fcbff02bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285800
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-02-27 22:48:51 +00:00
Konstantin Shcheglov a4687a0e2b Issue 50502. Fix a couple of analyzer unit tests.
Bug: https://github.com/dart-lang/sdk/issues/50502
Change-Id: I1299a4fadaffae9b319ca0db1d2629a27a4775b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285702
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-02-27 22:45:40 +00:00
Ryan Macnak 854dc20416 [vm, compiler] Use ARMv8.1 AMOs in the write barrier stub on Mac.
Cf. 1af37bd92a.

TEST=ci
Change-Id: I61186646ef2aab69d8ffac36073829d5cc865408
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284547
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-02-27 22:26:36 +00:00
Konstantin Shcheglov 4487154430 Use better helpers to find elements in SearchTest.
Change-Id: I5b0be691462465dc93a297592f4b6d0049298b1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285101
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-02-27 22:15:09 +00:00
Danny Tuppeny ae47cbfb5d [analysis_server] Support patterns in element references search
Change-Id: I303260c865c70691e0c7723b92c2ee7f09038310
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282664
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-02-27 22:14:46 +00:00
Konstantin Shcheglov 8c72cb409b Remove assert() from convertPatternToSpace()
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>
2023-02-27 21:59:37 +00:00
Danny Tuppeny eb038ce4a4 [analysis_server] Match VS Code behaviour when sorting/applying LSP edits in tests
Change-Id: If246069eee11eb8ed17fe21910840e4bd35a631a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285740
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-02-27 21:54:51 +00:00
Derek Xu 14af4fac49 [VM] Implement GetCurrentThreadName() on Android
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>
2023-02-27 21:24:47 +00:00
Derek Xu 67f3e1f4a0 [VM/Service] Add support for class modifiers
TEST=CI

Fixes https://github.com/dart-lang/sdk/issues/50742
Fixes https://github.com/dart-lang/sdk/issues/50743
Fixes https://github.com/dart-lang/sdk/issues/51296
Fixes https://github.com/dart-lang/sdk/issues/51297
Change-Id: I52de34219883ca8680b1a8968ac9f4183fc5e970
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285360
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-02-27 21:07:41 +00:00
Devon Carew cf60e70356 [deps] rev cli_util, crypto, test, vector_math, webdev
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>
2023-02-27 21:07:29 +00:00
Ryan Macnak 1d0146984c [infra] Add configurations to migrate Linux ARM64 to NNBD.
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>
2023-02-27 18:40:28 +00:00
Derek Xu 7424295ce9 [VM] Begin supporting Perfetto file recorder
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>
2023-02-27 18:37:48 +00:00
Jake Macdonald 0ac2d98e29 prep dart_fuzz for Dart 3.0
see https://github.com/dart-lang/language/blob/master/accepted/future-releases/0546-patterns/feature-specification.md#breaking-existing-switches

Change-Id: I008c280e0b2c453d704dfad7db4c18d39af745f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285720
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-02-27 18:19:28 +00:00
Ryan Macnak 7c0a694668 [vm] Avoid a second map lookup when dispatching isolate messages.
- Use the currently-unused ReceivePort.handler field instead of a second map.
 - Recognize ReceivePort's fields instead of using natives.

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

TEST=ci
Change-Id: I4b8d0764a41729a3b397b85bc4603e4d6b0ca9a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285403
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-02-27 18:08:25 +00:00
Paul Berry 7e5297e5f8 Enable the fallback exhaustiveness algorithm (with improvements).
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>
2023-02-27 17:36:02 +00:00
Paul Berry c9d4861104 dev_compiler: prep for enabling patterns feature.
Change-Id: I08f2cc23ffd518e23cf8d395884c5e51db26a811
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285340
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2023-02-27 17:17:42 +00:00
Derek Xu 9a6c8ed50b [VM/Service] Fix accessors of fields of simple types in generated Java classes
TEST=Modified VmServiceTest.java locally to make it exercise
BoundField.getName()

Fixes https://github.com/dart-lang/sdk/issues/51514
Change-Id: I232d98a2efffbaf82a0101a20405f48fe4ba03d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285700
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-02-27 16:51:26 +00:00
Daco Harkes ba2baa5e55 [vm/kernel_service] Fix native_assets.yaml discovery
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>
2023-02-27 16:49:25 +00:00
Danny Tuppeny 88d277a534 [analysis_server] Split InlayHints up for type arguments
This allows each type to be hovered (to see dartdocs) or used for navigation individually.

Fixes https://github.com/Dart-Code/Dart-Code/issues/4406.

Change-Id: I93f520a49e05eb59074215dd9c0773cd50415cfe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285625
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-02-27 16:27:15 +00:00
Alexander Markov b285115893 [tests] Fix expectations in language/async_star/async_star_await_for_test
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>
2023-02-27 16:25:50 +00:00
Johnni Winther 3c4ca52b2f [_fe_shared_analyzer] Handle remaining patterns in exhaustiveness
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>
2023-02-27 14:51:50 +00:00
Johnni Winther b38b33681b [_fe_analyzer_shared] Support null check pattern in exhaustiveness
Change-Id: I6e50510f046d8df8f1c987d44dd33c0e4db39d7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285300
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-02-27 11:41:56 +00:00
Johnni Winther 5e8fd90520 [_fe_analyzer_shared] Support unions in exhaustiveness algorithm
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>
2023-02-27 09:28:33 +00:00
Johnni Winther 3c7fe84e05 [cfe] Add MapPatternRestEntry
This replaces the `restMapPatternEntry` sentinel value.

Change-Id: I46b05a62125e95c732f7f6ecfd3f2c1ed8292af3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285620
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-02-27 09:14:37 +00:00
Chloe Stefantsova 574e12d0f5 [cfe] Support pattern entry-to-element conversion in type inference
Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: I5a227763225eda6a8154591fa35aa7cc66c0050a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285320
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-02-26 22:15:38 +00:00
Chloe Stefantsova c8f07e6387 [cfe] Remove outdated null check to allow for-in pattern entries
Part of https://github.com/dart-lang/sdk/issues/49749

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

Change-Id: I1e598f8742a271e63023f95122d8166204721aeb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284920
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-02-26 19:13:08 +00:00
Slava Egorov e5ea38a757 Revert "[vm/compiler] Split ParallelMove codegen into scheduling and emission"
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>
2023-02-25 22:03:08 +00:00
Danny Tuppeny 12b606e9e9 [analysis_server] Fix ordering of edits that include multiple inserts at the same location
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>
2023-02-25 18:48:30 +00:00
Vyacheslav Egorov 32b093379b [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>
2023-02-25 16:54:05 +00:00
asiva ba1d8bdbc0 [Runtime/VM] - Fix reachability test issues
- 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>
2023-02-25 01:08:48 +00:00
Ryan Macnak 9b080cfddd [vm, compiler] Access spill slots on RISC-V using SP instead of FP.
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>
2023-02-25 00:53:54 +00:00
asiva a346af7b7a [VM/Runtime] - Fix ubsan warning.
TEST=ci

Change-Id: I9881db82771c51a1df8fe930fe2216ddf87f5746
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285345
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-02-24 23:01:28 +00:00
Konstantin Shcheglov c90821350e Issue 50672. Update flatten()
Bug: https://github.com/dart-lang/sdk/issues/50672
Change-Id: I2747b9c071aa0074f2b26cea33b8d0f11ac61e33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274734
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-02-24 22:55:17 +00:00
Stephen Adams fd9e7cbbdb [js_runtime] Preambles: ensure self.window exists
This change makes `self.window` refer to `self` if undefined.
This makes @JS-interop access to properties of `window` work as expected for benchmarks derived from web apps.

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

Change-Id: Ie3d68d466ccad6e8804014ee8099cea235b173c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285220
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-02-24 22:01:24 +00:00
Daco Harkes 579d964406 [test/ffi] Beef up @Native testing
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>
2023-02-24 21:16:50 +00:00
Ahmed Ashour 39e1edfbcd [analysis_server] DataDriven replacedBy to replace an instance getter with a method
Fixes #50699

Change-Id: Ib0bfb1f3ce70f66fe4b2a46c3112ce8bf9fcd891
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276060
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-02-24 20:59:30 +00:00
Srujan Gaddam 49f85335d5 Revert "[dart:js_interop] Add literal constructors for inline classes"
This reverts commit 1f6d4ae1a8.

Reason for revert: Broke Flutter with dart2wasm

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

Change-Id: Ifce611e1150d8aa275f9e312743bded56a572176
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285342
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-02-24 20:42:14 +00:00
Ryan Macnak 4b1efeb7aa [vm, compiler] Make more use of sh{1,2,3}add.
Cf. 138a69a150.

TEST=ci, local qemu
Change-Id: Ibb3de443058e6e935b536aa328d9e143d75350b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285102
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-02-24 20:33:08 +00:00
Ben Konyi a569f4a540 [ CLI ] Lockdown --no-sound-null-safety in dart compile subcommands
Related to https://github.com/dart-lang/sdk/issues/51513

Change-Id: Ie798af562133b933a76351b9e7244870ea49e6dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285380
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-02-24 20:27:03 +00:00
Derek Xu 35e9a34c3f [VM/Service] Fix SERVICE_PROTOCOL_MINOR_VERSION
TEST=CI

Change-Id: I1e67c0a8f4148aac0f70f777eb8211cbb64044b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285401
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-02-24 19:05:01 +00:00
Ahmed Ashour d6ceee805e [observatory] remove dead code
Bug: #51401

TEST=ci

Change-Id: Idc680edc71bc0e6842f4539a9de2ed283ce7f0ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283362
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-02-24 18:42:30 +00:00