Commit Graph

103197 Commits

Author SHA1 Message Date
Nicholas Shahan 39bcea7e76 [ddc] Cleanup use of dart library name
Avoid hard coded uses of the name for the SDK runtime library. This
unblocks a more consistent name/rename logic for all dart libraries
when they are imported.

Change-Id: I4599006569ecae81a0526686467e06da9b335fc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385188
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-09-25 21:49:39 +00:00
Graciliano Monteiro Passos c2b99d21c1 _IndexAssembler.assemble: optimize using toList(growable: false)
Closes https://github.com/dart-lang/sdk/pull/56544

GitOrigin-RevId: 7b342c4b8c90465b4c858ccfb2ef6ed99d8d9830
Change-Id: Id2d58f23344e525b80dd87112bc3d04a4cfc3c43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381780
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2024-09-25 21:43:16 +00:00
pq a6714ffdff a few new formatter migrations
See: https://github.com/dart-lang/sdk/issues/56685


Change-Id: Ifa7fbbc7aff7c5fd96b02cafe0da76b22a33b1e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386824
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-25 21:12:17 +00:00
FMorschel dbf87d8644 Improving string conversion
Closes https://github.com/dart-lang/sdk/pull/56723

GitOrigin-RevId: 802fda7efeace66f33a82fa939a3efac11064390
Change-Id: I6d4d3931e62b89265eb1d324856bed5b9febfe8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384962
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-09-25 21:11:17 +00:00
Konstantin Shcheglov 5e5cf385ee Parts. Report AMBIGUOUS_EXPORT in parts.
Change-Id: If900bd4b254c5c89719af61368c9160c2e6ac7ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386684
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-09-25 21:04:09 +00:00
FMorschel a0374dd70c Fix create method/function inside conditional operator
Closes https://github.com/dart-lang/sdk/pull/56722

GitOrigin-RevId: 9a861d4078b326754b8855e833c52ede03f0e28d
Change-Id: Ia7535ff48c16836b0e7d3a32005051c7defc3766
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384941
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-09-25 20:51:54 +00:00
Martin Kustermann 5ede6d466c [deps] Roll dart-lang/native to new version
We rename the Dart CI specific environment variables we use for testing
dart-lang/native code on Dart CI to make it clear they are for testing
only.

Change-Id: Idb7c016df5b6fd3aee7a2952be06752a8343f02e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386804
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2024-09-25 20:45:11 +00:00
Ryan Macnak 1c48e59c51 [vm, reload] Reverse expectations of IsolateReload_LibraryLookup.
This test expects that a library no longer being reachable along the import graph causes the library to be removed from the isolate's library list. The incremental kernel files used during reload don't really have a way to express this. The expected semantics also are a bit unsatisfactory. If a library is "deleted" this way, there may still be instances from library floating around, and re-importing the library would be treated like the addition of a new, unreleated library instead of modified the old library kept alive by those instances. Also, if an island of "deleted" libraries have static calls among themselves, those calls stop working because reresolving their targets fails because the "deleted" libraries aren't in the top-level namespace. The mistake of a global namespace continues to inflict damage.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/56785
Change-Id: I743f74d59fd9f017276a118531a58c85ac142ad0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386821
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-09-25 18:29:23 +00:00
Derek Xu 6121c396ee [VM/Service] Expose Service ID zone APIs in service.md and package:vm_service
TEST=pkg/vm_service/test/id_zones_test.dart, CI

Issue: https://github.com/dart-lang/sdk/issues/55869
CoreLibraryReviewExempt: This CL does not include any core library API
changes, only VM Service implementation changes in
sdk/lib/vmservice/running_isolates.dart.
Change-Id: Id63180fd08a88865064435b056fa3269835cd476
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381400
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-09-25 17:28:44 +00:00
Alexander Markov c0e5b7e75d [vm] Correct typo in a comment
Follow-up to https://github.com/dart-lang/sdk/commit/ab19361e87a0248ade1e883f638542163f9100d1#r147196426

TEST=ci

Change-Id: Ic1c67737d5e69f063a4f62fa8c514c0b2d985e98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386682
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-09-25 16:53:52 +00:00
Konstantin Shcheglov edccc388f5 Elements. Use 'formalParameters' and 'typeParameters' names.
Change-Id: I4540f3f23c7b317e54a59037eab6041794c745bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386606
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-25 16:49:31 +00:00
Danny Tuppeny c8adf3da3f [analysis_server] Update color handling for recent Flutter Color class changes
In https://github.com/flutter/engine/pull/54714 the "int value" that was used for storing the color values for a Flutter color was removed and replaced with `double red, double green` etc.

The color computer used the `value` field so this stopped it from computing any colors for previews in LSP clients. No tests broke because the tests here use a mock version of the Color class that still had `value`.

This change updates the mock Color class to match the new Flutter implementation, and updates the computer to use the red/green/blue doubles instead of parsing from an int.

It also adds support for the new `Color.from()` constructor that was also recently added.

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

Change-Id: I3ff20bda0cc848e028822cfcb5a14e6a8f6934d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386802
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-09-25 16:27:51 +00:00
Jessy Yameogo ef5295d050 [dtd] Use secure random number generator to generate URI auth code (path) and secret
Change-Id: Ibde6afaaf5d3f83f8f8aea1bca38bffc75a20e36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386280
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Commit-Queue: Jessy Yameogo <yjessy@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-09-25 15:41:52 +00:00
Alexander Markov ab19361e87 [vm] Masquerade VM internal types more consistently
VM has been hiding certain internal implementation types by
converting them to user-visible types in Object.runtimeType.

However, types of record fields were not converted,
which caused inconsistent hashCode of record types.

This change fixes this bug by applying the same type conversion to
types of record fields.

TEST=tests/language/records/type_equality_and_hash_code_test.dart
Fixes https://github.com/dart-lang/sdk/issues/56771

Change-Id: Ie02e76368de0026620d6ab278f49c14e06fd6eda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386542
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-09-25 13:46:40 +00:00
Sigurd Meldgaard 92ed87daae Bump pub to 23e3d4f4a761867b1e3eded9a92a4290a01daadb
Changes:
```
> git log --format="%C(auto) %h %s" 31fa75b..23e3d4f
 https://dart.googlesource.com/pub.git/+/23e3d4f4 Split out directDependencies and devDependencies in `pub deps` (4383)
 https://dart.googlesource.com/pub.git/+/1892c46f Consider sdk packages immutable (4394)
 https://dart.googlesource.com/pub.git/+/3894534b Better error for duplicate workspace entries (4385)
 https://dart.googlesource.com/pub.git/+/65c42eb6 Fix windows paths in `workspace list` tests (4386)
 https://dart.googlesource.com/pub.git/+/be207acb New command `workspace list` (4378)
 https://dart.googlesource.com/pub.git/+/2a1f61c2 Dont print exceptions thrown by getExecutableForCommand (4377)
 https://dart.googlesource.com/pub.git/+/bfbc6bc3 Validate git is clean when publishing (4373)
 https://dart.googlesource.com/pub.git/+/e9ad2bcf `pub bump` command (4361)
 https://dart.googlesource.com/pub.git/+/20eda057 Commit lockfile (4374)
 https://dart.googlesource.com/pub.git/+/c83975cf Use `-z` for `git ls-files` (4368)
 https://dart.googlesource.com/pub.git/+/6b48f43c Use relative path in package_config.json when PUB_CACHE is relative (4369)
 https://dart.googlesource.com/pub.git/+/9f93040f Add `hook/` to strict dependencies check (4364)
 https://dart.googlesource.com/pub.git/+/d86e3c97 Adhere to lines_longer_than_80_chars lint (4340)
 https://dart.googlesource.com/pub.git/+/8a3d0886 call ensureUpToDate in `pub run` (4358)
 https://dart.googlesource.com/pub.git/+/7a7cbe67 Fix violations of comment_references lint (4348)
 https://dart.googlesource.com/pub.git/+/47d8a60b Avoid reloading credentials file on each getter access (4344)
 https://dart.googlesource.com/pub.git/+/38f2c058 Address old line-splitting TODO (4351)

```

Diff: https://dart.googlesource.com/pub.git/+/31fa75baa5872e7f094a554c0ec7741742889530..23e3d4f4a761867b1e3eded9a92a4290a01daadb/
Change-Id: I80be665b96ebb06f0f449d9094add12037c55e67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386782
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2024-09-25 13:38:20 +00:00
Vyacheslav Egorov 06308f5e6a [vm] Skip bounds checks when accessing characters in JSON parser
After 3eef6652bf the effect of
the pragma is preserved when inlining so we can apply it
specifically to the method which loads characters.

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-release-x64-try
Change-Id: I63d11fbe5b5f7de965f8859c5db7bde82380cdf5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386201
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-09-25 13:09:36 +00:00
Paul Berry 13d4eaf99a Implement matchInferableParameter in MiniAstOperations.
Previously the implementation of this method was a stub.

It turns out that all the necessary infrastructure was in place
already, however the type arguments supplied by MiniAstOperations to
TypeAnalyzerOperationsMixin and TypeAnalyzerOperations needed to be
changed: in the "mini_ast" representation of types, an
InferableParameter is represented by a String, not a
PromotedTypeVariableType. This is because InferableParameter is meant
to represent the declaration of the type parameter
(StructuralParameter for the CFE, TypeParameterElement for the
analyzer), not the type itself. The types used for unit testing in
_fe_analyzer_shared don't have a separate notion of the declaration of
a type parameter, so we just use its name.

Implementing this logic required adding a method
`TypeSystem.matchTypeParameterType`, which checks if a Type is a type
parameter type, and returns the name of the type parameter if so. I
based this on the previously existing `TypeSystem._isTypeVar` method
(which performed the same job but did not return the type parameter
name).

I also took the liberty of fixing a flow analysis test that treated
`T` as a type variable but failed to mark it as a type variable by
calling `addTypeVariable`.

This should help pave the way for unit testing more of the shared
infrastructure for types.

Change-Id: Ia7a9777ec3d90a5886567dcb9f831e388e372f32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386607
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2024-09-25 12:23:01 +00:00
Chloe Stefantsova 95056cd8ba [analyzer][cfe] Add tests for constraint generation using bounds
This is a follow-up to
https://dart-review.googlesource.com/c/sdk/+/364721

Change-Id: I45f7afc410d2265f58c9776aaaeea9058e80ac98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386220
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2024-09-25 10:59:51 +00:00
Chloe Stefantsova f6fe5615c4 [analyzer][cfe] Generate constraints based on type variable bounds
In response to https://github.com/dart-lang/language/issues/3009

Change-Id: I918d392e422f1997736bf2543c8107cb44d3d6f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364721
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2024-09-25 10:59:51 +00:00
Johnni Winther 1bf0bc349a [cfe] Add LibraryProblemReporting
This adds an implementation of ProblemReporting that registers
the reported errors with a Library node.

Change-Id: I5d3f60f9691fe34b54322f9ed788025ff29cca29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386202
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-09-25 10:52:11 +00:00
Jens Johansen a086649e42 [scanner] Support 0-byte in input
Fixes https://github.com/dart-lang/sdk/issues/18090

Change-Id: I9bcd49c9ade7923eb087c5dd617a2f33cc84ee96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386161
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-09-25 09:15:19 +00:00
Johnni Winther a31c6dfc31 [cfe] Remove Builder.parent setter
This also moves some uses from .parent to .declarationBuilder to reduce
the reliance on the Builder.parent getter.

Change-Id: Ie99a7237a0f2bb68016cd1e0643f4e9045600a1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386140
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-09-25 08:34:14 +00:00
Jens Johansen 3dce89fbe0 [scanner] Don't give the Utf8 scanner a 0-terminated byte sequence
Not having to do the read-allocate-copy dance for files to add a 0-byte
at the end results in these changes when using the CFE to compile
(a fixed version of) the CFE:

```
msec task-clock:u: -1.7356% +/- 0.2164% (-73.16 +/- 9.12)
page-faults:u: -2.6957% +/- 0.0111% (-2914.83 +/- 12.00)
cycles:u: -1.7128% +/- 0.2223% (-297927979.70 +/- 38660477.01)
instructions:u: -1.6814% +/- 0.0002% (-361315766.86 +/- 36853.71)
branch-misses:u: -3.3289% +/- 0.9669% (-2153126.00 +/- 625370.97)
seconds time elapsed: -1.7372% +/- 0.2154% (-0.07 +/- 0.01)
seconds user: -1.5998% +/- 0.2740% (-0.06 +/- 0.01)
seconds sys: -4.1451% +/- 2.9801% (-0.01 +/- 0.01)
Scavenge(   new space) goes from 62 to 61
```

TEST=Existing test coverage.

Change-Id: I8e182bcee39839f6ed1e658c30c85c40ecf0b259
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385722
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Morgan :) <davidmorgan@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-25 08:33:48 +00:00
Johnni Winther 6d150d21b3 [cfe] Create PrefixBuilder through fragments
This creates a PrefixFragment during outline building and creates
a PrefixBuilder for each unique prefix during computation of import
scopes.

Change-Id: I0ac7ba22ec7db1aee288f088c60994c36c38f43a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385723
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2024-09-25 07:44:07 +00:00
Jens Johansen c242d3a756 [scanner] Use 'vm:unsafe:no-bounds-checks' and add explicit bounds checks
The (utf8) scanner currently has this thing where you give it a
0-terminated byte-array (i.e. you read the file, then allocate
something that's 1 bigger, copy the data, then give it to the scanner)
to 'avoid bounds checks'.
Dart still has bounds checks though - they're just implicit.

As for the string scanner ut gets a string, then creates a new string
like `string + '\x00'` - so basically the same thing.

This CL uses the 'vm:unsafe:no-bounds-checks' pragma, removing the
implicit bounds checks, adding explicit bounds checks,
saving ~73.6 mio instructions when compiling the CFE in the process:

```
Comparing snapshot #1 with snapshot #2
cycles:u: -0.9983% +/- 0.6563% (-174026333.30 +/- 114410028.98)
instructions:u: -0.3416% +/- 0.0005% (-73659267.00 +/- 108567.20)
branch-misses:u: -4.8952% +/- 2.2612% (-3172939.50 +/- 1465641.18)
```

With the scanner-benchmark with `--bytes` I get this:

```
msec task-clock:u: -1.2251% +/- 0.6355% (-50.64 +/- 26.27)
cycles:u: -1.2376% +/- 0.6385% (-223642830.80 +/- 115393789.68)
instructions:u: -2.8155% +/- 0.0000% (-1153243856.00 +/- 428.11)
seconds time elapsed: -1.2165% +/- 0.6408% (-0.05 +/- 0.03)
seconds user: -1.1539% +/- 0.6495% (-0.05 +/- 0.03)
```

With the scanner-benchmark with `--string` I get this:

```
msec task-clock:u: -7.6439% +/- 0.6628% (-366.08 +/- 31.74)
page-faults:u: -95.0034% +/- 0.0014% (-228023.50 +/- 3.41)
instructions:u: 2.1041% +/- 0.0000% (897941907.60 +/- 2082.79)
branch-misses:u: 3.2994% +/- 1.4675% (3239735.30 +/- 1440940.88)
seconds time elapsed: -7.6595% +/- 0.6610% (-0.37 +/- 0.03)
seconds user: -0.8801% +/- 0.7676% (-0.04 +/- 0.03)
seconds sys: -92.0140% +/- 2.8075% (-0.33 +/- 0.01)
MarkSweep(   old space) goes from 6 to 0
Notice combined GC time goes from 112 ms to 41 ms (notice only 1 run each).
```

Where I'll note that the 'vm:unsafe:no-bounds-checks' pragma doesn't
(yet?) work for `String.codeUnitAt`.
See https://dart-review.googlesource.com/c/sdk/+/384540
(and https://dart-review.googlesource.com/c/sdk/+/385201) for details.
I assume the relatively  big change here is caused by not allocating
a new string with a 0-byte in the end each time.

Note that the read-allocate-copy dance is still performed for the utf8
scanner in this CL as it requires changing all call-sites instead.
It will be done in a follow-up CL where the "end-of-file" int will
likely also be changed to `-1` to (I assume) allow for having the
0-byte in the middle of a file (see also the 10+ year old bug at
https://github.com/dart-lang/sdk/issues/18090)

Note: The pragma (currently?) only has effect in AOT and this change
will (for the utf8 scanner) make the JIT version slower
(probably by the same ~73.6 mio instructions as - at least in AOT -
the implicit check is 6 instructions and the explicit one is 3
instructions). As the pragma doesn't work in the StringScanner anyway
I expect the change to be somewhat equivalent there. Once the
read-allocate-copy dance is also removed from the utf8 scanner I expect
the combined result to be positive all around.

Update: With https://dart-review.googlesource.com/c/sdk/+/385201 landed
I get these changes:

Compiling the CFE:
```
instructions:u: -0.4520% +/- 0.0002% (-98470955.29 +/- 42253.40)
```

Scanner benchmark with `--bytes`:

```
msec task-clock:u: -2.1758% +/- 0.2316% (-92.07 +/- 9.80)
cycles:u: -2.1941% +/- 0.2283% (-405224983.11 +/- 42160655.88)
instructions:u: -3.1049% +/- 0.0000% (-1272360052.95 +/- 706.54)
branch-misses:u: 2.4718% +/- 0.5142% (2371345.23 +/- 493257.76)
seconds time elapsed: -2.1761% +/- 0.2317% (-0.09 +/- 0.01)
seconds user: -2.2071% +/- 0.2308% (-0.09 +/- 0.01)
```

Scanner benchmark with `--string`:

```
msec task-clock:u: -15.0073% +/- 0.2175% (-745.93 +/- 10.81)
page-faults:u: -95.0035% +/- 0.0003% (-228024.25 +/- 0.81)
cycles:u: -7.7986% +/- 0.2329% (-1558985588.99 +/- 46560962.79)
instructions:u: -3.7054% +/- 0.0000% (-1581977447.66 +/- 481.68)
branch-misses:u: -0.6880% +/- 0.5818% (-689453.22 +/- 583101.50)
seconds time elapsed: -15.0198% +/- 0.2170% (-0.75 +/- 0.01)
seconds user: -8.8149% +/- 0.2648% (-0.41 +/- 0.01)
seconds sys: -94.1247% +/- 1.6444% (-0.34 +/- 0.01)
MarkSweep(   old space) goes from 6 to 0
```

Change-Id: I524a21f488da7df5dc9d2cdf40112b84896ad3e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383324
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-09-25 07:33:40 +00:00
Jens Johansen 23f0c0b27b [scanner/paser] Don't use identical on ints
Short explanation: For whatever reason, when using `identical` on `int`s
the ints are first boxed (`BoxInt64`) before being compared
(`StrictCompare`) whereas just doing `==` just does a compare
(`EqualityCompare`).

Results:

With the CFE compiling (a fixed version of) itself I get these results:

```
instructions:u: -0.5756% +/- 0.0003% (-124825401.80 +/- 64013.17)
```

i.e. almost 125 mio instructions saved.

Another run - with 100 iterations each - I get

```
msec task-clock:u: -0.4927% +/- 0.2585% (-20.85 +/- 10.94)
page-faults:u: 0.0174% +/- 0.0139% (18.80 +/- 15.00)
cycles:u: -0.5233% +/- 0.2683% (-91305451.82 +/- 46815747.30)
instructions:u: -0.5754% +/- 0.0002% (-124793061.49 +/- 37426.30)
branch-misses:u: -1.6903% +/- 1.1207% (-1091410.69 +/- 723627.04)
seconds time elapsed: -0.4863% +/- 0.2581% (-0.02 +/- 0.01)
seconds user: -0.4547% +/- 0.3253% (-0.02 +/- 0.01)
```

In the scanner benchmark with `--string` (i.e. using string scanner) I
get these results:

```
msec task-clock:u: -3.7992% +/- 0.3316% (-190.54 +/- 16.63)
cycles:u: -4.1423% +/- 0.3566% (-836808313.28 +/- 72033424.19)
instructions:u: -3.3524% +/- 0.0000% (-1480262370.08 +/- 828.58)
branch-misses:u: -1.7591% +/- 0.9582% (-1781144.28 +/- 970258.82)
seconds time elapsed: -3.7988% +/- 0.3303% (-0.19 +/- 0.02)
seconds user: -4.0211% +/- 0.4161% (-0.19 +/- 0.02)
```

(Just running the benchmark also sees the characters/µs go from ~93 to
~97).

In the scanner benchmark with `--bytes` (i.e. using the utf8 scanner) I
get these results:

```
msec task-clock:u: -4.2872% +/- 0.4467% (-185.64 +/- 19.34)
cycles:u: -4.2972% +/- 0.4382% (-812955454.92 +/- 82892232.23)
instructions:u: -3.4867% +/- 0.0000% (-1479744935.28 +/- 297.12)
seconds time elapsed: -4.2872% +/- 0.4470% (-0.19 +/- 0.02)
seconds user: -4.2204% +/- 0.4730% (-0.18 +/- 0.02)
```

(Just running the benchmark also sees the bytes/µs go from ~108 to ~113).

In both cases we notice how the actual time, cycles and instructions
agree pretty well.

Combining the data for the compile and the benchmark I assume this CL
actually reduces the runtime of the CFE compiling itself by a about
half a percent.

Change-Id: I67d056837240aef61b6707d02507ab4121b31715
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385940
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-25 07:08:56 +00:00
Erik Ernst 465bbbd720 Update the spec parser to support enhanced parts
Change-Id: I6904294f473d1c9a861ad385e14e17bdd79189d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386560
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2024-09-25 06:52:42 +00:00
Jens Johansen 3f24e57422 [scanner] Add scanner benchmark
E.g. we might do this

```
$ out/ReleaseX64/dart-sdk/bin/dart compile aot-snapshot pkg/_fe_analyzer_shared/test/scanner_benchmark.dart
Generated: /usr/local/google/home/jensj/code/dart-sdk/sdk/pkg/_fe_analyzer_shared/test/scanner_benchmark.aot

$ for type in --bytes --bytes0 --string --stringtobytes --count ; do out/ReleaseX64/dart-sdk/bin/dartaotruntime pkg/_fe_analyzer_shared/test/scanner_benchmark.aot pkg/kernel/lib/ast.dart $type; done
Scanned 466534 bytes 1000 times in 0:00:04.413011
Found errors 0 times
That's 105.71784208106438 bytes per microsecond

Scanned 466534 bytes 1000 times in 0:00:04.911947
Found errors 0 times
That's 94.97944501437007 bytes per microsecond

Scanned 466532 string characters 1000 times in 0:00:05.413169
Found errors 0 times
That's 86.18463602374136 string characters per microsecond

Scanned 466532 string characters as bytes 1000 times in 0:00:06.722731
Found errors 0 times
That's 69.39620222793386 string characters as bytes per microsecond

Scanned 466534 bytes 1000 times in 0:00:00.641854
Found errors 0 times
That's 726.8537704836302 bytes per microsecond
```

to see that scanning pre-0-at-the-end'ed bytes scan at ~105 bytes/µs,
doing a copy to add the 0 at then end, then parse bytes scan at ~95,
scanning strings runs at ~86, converting strings to bytes, then scanning
the bytes at ~69 and - for comparision - just running through the bytes
counting linebreaks runs at ~726.

The benchmark is also useful for comparing optimizations.

Change-Id: I67c12850505e7f712660fd353575e8c7a455f112
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385920
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-09-25 06:47:14 +00:00
Konstantin Shcheglov d4b9bd6c38 Elements. Make 'firstFragment' nullable.
Change-Id: I696f5ede22cdd2ca60e9a057d035cfee7e4b93a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386604
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-24 23:14:38 +00:00
Parker Lougheed 59413a24f8 [analyzer/linter] Mark latest diagnostic docs as published
Change-Id: I60af7f164cc0a92e73e9a05605d11d8b2962b2d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386543
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-09-24 23:06:39 +00:00
Parker Lougheed 46cd8b627c [linter] Move old lint details out of source
- Makes way for slowly replacing them with new "why" docs.
- Slightly reduces snapshot size of analysis server
- Colocates docs in the new linter/messages.yaml file.

Change-Id: I8708b8b55455a183ccfa5c9d8c21098ae0655b51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385304
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
2024-09-24 23:06:34 +00:00
Ryan Macnak 0c3606f0ec [vm] Systematically check for failure to start thread.
Improve error message to include the intended thread name and strerror.

TEST=ci
Change-Id: Iba61a40b312f6574e8e352d51a0c3de535f6a0c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386361
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-09-24 22:41:40 +00:00
Mayank Patke 8fda05e2fd [dart2js] Remove redundant clone method from EnumSet.
Change-Id: I5ee35d9d66072a3838113e5686b40b5f7bc1dd02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386605
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2024-09-24 22:21:38 +00:00
MarkZ bbdf1952b4 [reload_test] Enabling all DDC hot reload tests.
Change-Id: I8a6a102f87ff162b1624da0917f3ee8db8f2144c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385120
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2024-09-24 22:03:24 +00:00
Konstantin Shcheglov b07eb3b325 Parts. Report PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER in parts.
This also moves the target to be the import prefix, not the declaration.
This is how the specification describes it, and scope lookup works.

Change-Id: Ic0f60a6b57bd8760589b1a91be8885fafb5c90c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386602
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2024-09-24 21:45:12 +00:00
Hzj_jie 7c9640545f [fuchsia] uprev cpid versions and target_api_level
Also remove a deprecated gn arg.

Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-arm64-try,vm-fuchsia-release-x64-try
Fixed: http://b/366294693
Change-Id: I4e7f73ef03644c4e1289e1f214fb1c0aedae2076
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386603
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-09-24 20:15:06 +00:00
Konstantin Shcheglov e9a7079ee3 Elements. Remove _writeCodeRange(), only fragments have offsets.
Change-Id: Ie0d1467feda42046620e5c24bbed924906696e0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386523
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-24 20:09:59 +00:00
Brian Wilkerson 037f313959 Migrate add_missing_enum_case_clauses
Change-Id: Idef9c7cb952ed11d39082f160713daf9c75c67e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386341
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-09-24 19:25:22 +00:00
Brian Wilkerson a3c6d05697 Migrate one_member_abstracts
Change-Id: I82504402beed3c9ab55099672236f82841d293e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386541
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-09-24 18:57:49 +00:00
Matan Lurey acc66a77fe Forward GN metadata from dart_action and friends.
In the Flutter engine, we plan to expand and start using Dart actions to
rely more on the GN build system, and less on home-grown (Python/Bash)
tooling. To that end, we'll start generating dart_snapshot and dart_test
rules that are invokved the same way locally (via `et`) and on CI, with
a goal of making all of our tests programatically discoverable.

We need the `metadata` field (a standard GN field) in order to tag our
outputs (i.e. `metadata = { action_type = ['dart_executable'] }`);
see https://gn.googlesource.com/gn/+/main/docs/reference.md#var_metadata.

Bug: https://github.com/flutter/flutter/issues/147013
Change-Id: I0e44209b8aade13cec99b944583a90a7c13d3300
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386582
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-09-24 18:51:23 +00:00
Konstantin Shcheglov 26362db2bc Elements. Make ScopeLookupResultImpl constructor use named formal parameters.
Change-Id: Ib408b88e3adc0917a9af66f6f1c839dbaca135bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386600
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-24 17:37:22 +00:00
Sam Rawlins fb1cb0a0d4 lint rules: migrate tests for several rules:
* avoid_dynamic_calls
* combinators_ordering
* package_api_docs
* unnecessary_statements

Change-Id: Ie2e47029b8e81fd40e8abb5ce55d6f0f4bf7ddcb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386120
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-09-24 16:40:04 +00:00
Konstantin Shcheglov d063ceb520 Elements. Store 'element2' in NamedTypeImpl, extract 'element' from it.
This is a step toward the state where we eventually want to be.

Change-Id: I8d3062478c08a5aac0992ccccd7848d2c74589de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-24 15:55:01 +00:00
Nate Biggs 7ba8957b12 [dart2wasm] Add FluteComplex multi-module stress test.
Change-Id: I2b13649d67d5b68211b6c15c745fd194773b9e7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386380
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2024-09-24 15:53:30 +00:00
Alexander Markov 7667df56fd [gardening] Fix regress_56756_il_test on vm-aot-optimization-level-linux-release-x64
Adjust IL test to avoid much more agressive inlining on
vm-aot-optimization-level-linux-release-x64 bot.

TEST=runtime/tests/vm/dart/regress_56756_il_test.dart
Fixes https://github.com/dart-lang/sdk/issues/56776

Change-Id: I225049a93990c80773ff640e4a4a6fb9aad0c0fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386540
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
2024-09-24 15:04:18 +00:00
Erik Ernst 812b03da64 Make augment a built-in identifier
This was done in the feature specification in v1.10, but it wasn't
done in the specification parser at the time. This CL corrects that
omission.

Change-Id: I03d54e8f6a369abd5d2be8fb281e8f3abd2cb85d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386240
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2024-09-24 13:24:02 +00:00
Alexander Thomas c26055ab23 Make analyzer-mac usable on arm64 macs
* Switch analyzer-mac to be an arm64 configuration.
* Remove deprecated analyzer_cli testing.

Bug: https://github.com/dart-lang/sdk/issues/56660
Change-Id: I22f06d3cf50e7f7e6b3fa6146d6393f6e912bdf5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384761
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2024-09-24 13:02:32 +00:00
Ömer Sinan Ağacan f80214eb86 [dart2wasm] Fix Uri.base in d8
Currently when the .wasm file path passed to run_wasm.js is a relative
path, `Uri.base` becomes something like `file://test.wasm`, which is not
a valid file URI, so it causes crashes in `Uri.toFilePath`.

When the file path is relative add a omit `file://` prefix.

`Uri.base` values before and after:

- Before, relative .wasm path: `file://test.wasm` (invalid)
- Before, absolute .wasm path: `file:///home/user/test.wasm`

- After, relative .wasm path: `test.wasm` (fixed)
- After, absolute .wasm path: `file:///home/user/test.wasm` (same as before)

Change-Id: I0d1c43716e07a9ee926e7feeeab514c2c66bac16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385700
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2024-09-24 10:21:52 +00:00
Jens Johansen 3932452322 [VM] Allow pragma to remove bounds checks for String.codeUnitAt
Follow-up to https://dart-review.googlesource.com/c/sdk/+/384540
allowing the removal of bounds checks for `String.codeUnitAt` if the
method it is called from is annotated with
`@pragma('vm:unsafe:no-bounds-checks')`.

Done by the inliner providing the calling function to the flow graph
builder and GenericCheckBound instruction utilizing this information.

TEST=Existing tests; added runtime/tests/vm/dart/no_bound_check_il_test.dart

Change-Id: Ic6144b0b8400ec6532fb58cd5fd9b3dcdb9a2ff9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385201
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-09-24 10:14:49 +00:00
dependabot[bot] ab9a004e3b Bump github/codeql-action from 3.26.6 to 3.26.8
Closes https://github.com/dart-lang/sdk/pull/56768

GitOrigin-RevId: 8c4b3b307ea92bf003f0d81bbe3ff7b7de2f4176
Change-Id: Icb37c868d809043a74bfae04f5784a19c8c20701
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386122
Reviewed-by: Alexander Thomas <athom@google.com>
2024-09-24 08:54:30 +00:00