Commit Graph

50568 Commits

Author SHA1 Message Date
pq 4d1b785239 [productivity] add “current file” launch configs
Bug: https://github.com/dart-lang/sdk/issues/60070
Change-Id: I003a492e6004d2dcaf6c2c52688c733d7f43e53c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408900
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-02-10 14:31:52 -08:00
Konstantin Shcheglov 3672b4e5ac Elements. Migrate NamedTypeResolver.
Change-Id: I310115b805f97bfdb384cb14b2bf9ab7ef0c898f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408920
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-02-10 12:58:04 -08:00
Jake Macdonald e6df5493c9 support renamed parameters when adding super calls
Bug: https://github.com/dart-lang/sdk/issues/59745
Change-Id: I177e4f748954ddfea1b300085800c8c9a87bed3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408840
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-02-10 12:48:10 -08:00
Matthew Nitschke 64e60fedac Fixed 'order' node typo in split_constraints documentation
Closes https://github.com/dart-lang/sdk/pull/60091

GitOrigin-RevId: 3e4a62f56820c02997ea78cfb95ef5b632cc12af
Change-Id: Ie5b0adfdf4bc05435e0d5f07dc6ae36b1d413f76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408881
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2025-02-10 12:04:07 -08:00
Danny Tuppeny 3ded147e2e [analysis_server] Make format of LSP completion tests more consistent
No functional changes here, only formatting/code style:

- Remove additional intending from embedded code in some tests (which didn't match others in this file or the style of other tests in the server)
- Change expression-bodied-tests to block bodies where they're not on a single line

Change-Id: I2c15bbcf7b7accff85f34a4e9ad5afa3e0a0a221
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408820
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-02-10 10:27:40 -08:00
Konstantin Shcheglov a0bc103d64 Elements. Migrate TypePropertyResolver.
Change-Id: Id7d76e4318c429fe8aab2661fa33e618e501200e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408720
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-02-10 09:47:44 -08:00
Johnni Winther a78235cf01 [cfe] Create constructors through fragments
Change-Id: If2a7095c09dcf2d73d326b6ba6d796acfa882c55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408780
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2025-02-10 07:09:07 -08:00
Martin Kustermann 3b750c5545 [dart2wasm] Generate *.support.js feature detection files
The file will contain a JS expression that evaluates to a boolean.
If it (at runtime) evalutes to

  * `true` it means that all required features are supported by the JS
    environment and the dart2wasm-compiled app can be used

  * `false` it means some features were not present in the JS
    environment and the dart2wasm-compiled app shouldn't be used,
    instead a dart2js fallback may be used

We introduce this mechanism to allow users, at compilation time, to tell
dart2wasm to take advantage of new spec features and allow the runtime
to self-detect whether they are available and fallback to dart2js if
not.

The first feature we introduce (already in this PR) is
`--require-js-string-builtin` that will tell dart2wasm it can assume the
`js-string` builtin is available (and emit corresponding `*.support.js`
code to detect it).

If the flag was passed, we take advantage of the `js-string` import
mechanism for string constants that doesn't require emitting them in the
mjs file (which significantly reduces code size and improves startup
time - compared with emitting JS strings in the mjs file).

We enable `--require-js-string-builtin` on one CI configuration for
testing that if we don't use any polyfill, the imports of the builtin
functions as well as magical utf8-encoded wasm imports work.

We also use a template mechanism to generate `*.mjs` as the code
becomes more readable (e.g. to conditionally include the js string
polyfill)

Issue https://github.com/dart-lang/sdk/issues/59951

Change-Id: Ic7e7818a2d5269095935022941352beeb9fed731
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408781
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-02-10 06:17:49 -08:00
Keerti Parthasarathy 0246cc613f [Completion] Show enum constants when completion is in the declaration.
Fixes https://github.com/dart-lang/sdk/issues/56971

Change-Id: Ib33a58e774f5540c426f5d5ffb7a387414dcf9f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2025-02-09 22:41:31 -08:00
Sam Rawlins 093ab49d6f DAS: Correct several broken comment references
Change-Id: Id0e80d5566a5c05296a5941746888a48284c4ae0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407861
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-02-09 08:40:07 -08:00
Sam Rawlins 03c0855f9d DAS: Tidy snippet_producer.dart
While fixing the doc comments for DartSnippetProducer.addImports, I
saw that it references two methods only found in the subclass,
FlutterSnippetProducer ("Adds public imports for any elements fetched
by [getClass] and [getMixin]").

It turns out that the `addImports` method and the `requiredElementImports` are only needed in the subclass,
FlutterSnippetProducer, so I just moved them over. Now the doc
comment references resolve correctly.


Change-Id: Id90e8257b4096308b8cd3ce19b14708ca1b5e365
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-02-09 08:30:03 -08:00
Kevin Moore 143dc05381 [pkg:js] Clarify and improve discontinue message
Add library-level docs duplicating the discontinue message

Related to https://github.com/dart-lang/sdk/issues/59716

Change-Id: Ib414a56c4412db0d9701c3d11f75354295775f9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408642
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Auto-Submit: Kevin Moore <kevmoo@google.com>
2025-02-08 18:34:27 -08:00
Paul Berry 274f5639f7 [Flow analysis] Remove PropertyNotPromoted.staticType.
This field was only used to populate expectation strings in "id"
tests; it did not affect any user-visible behavior of the analyzer or
CFE.

Including information in "id" tests that doesn't affect any
user-visible behavior isn't helpful. Removing this field will enable
some upcoming flow analysis refactoring work (I intend to remove the
`ExpressionInfo._type` field, replacing its remaining usages with a
more reliable mechanism).

Change-Id: Id4c6593fae4ef25b8c21f0625e6c1f9eaa766e17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406403
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-02-08 16:51:15 -08:00
Paul Berry eb5983869c [analyzer] Fix PartElementImpl.enclosingUnit.
`PartElementImpl.enclosingElement3` has static type `Element?`, but in
practice it is always of type `CompilationUnitElementImpl`, due to
this code from `CompilationUnitElementImpl.parts=`:

    set parts(List<PartElementImpl> parts) {
      for (var part in parts) {
        part.enclosingElement3 = this;
        var uri = part.uri;
        if (uri is DirectiveUriWithUnitImpl) {
          uri.unit.enclosingElement3 = this;
        }
      }
      _parts = parts;
    }

Therefore, `PartElementImpl.enclosingUnit` can just cast
`enclosingElement3` to the proper type and return it.

This behavior was untested, so I've added a test in
`part_test.dart`. Without the fix, the test throws a `TypeError`.

Change-Id: I3e6f186826aa92cda9c3887c85c5eddc1fea7f31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408641
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-02-08 08:15:19 -08:00
Konstantin Shcheglov c3a4f56e69 Fine. Return from LibraryContext without logging if the cycle is already loaded.
It writes too much, and with fine grained dependencies this is especially
prominent, we don't do analysis for most of files afterwards.

Change-Id: Idccef82f3b46980b6942c403871f588e21e128c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408680
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-02-07 15:24:49 -08:00
Nicholas Shahan c040cd66e5 [ddc] Pass an empty array when running main
Match the behavior of the ddc module system when running the
applications main method when using the new library bundle format.

This passes an empty JavaScript array to the main method which is
good enough to get the benchmarks that use main method args to run.

The API should be updated in a way that allows you to actually pass
a JavaScript array of Strings when starting the program.

Issue: https://github.com/dart-lang/sdk/issues/35113
Change-Id: I1a9aeb1df7afa5948d7f23517b3ac913aaabb62c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408640
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2025-02-07 14:53:14 -08:00
Konstantin Shcheglov e3d809f1c2 Elements. Migrate PrefixedIdentifierResolver.
Change-Id: Ia9104be728f7ddd08e1eb8591d5fa7ef9027e7ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408501
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-02-07 14:09:30 -08:00
Jake Macdonald da2ffedc50 add test for adding super calls with multiple parameters
Bug:https://github.com/dart-lang/sdk/issues/59745
Change-Id: Ibaf6321f0ea6cf3046f360e91cf58faba7a16cb3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408460
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2025-02-07 13:30:01 -08:00
pq c87b18581a [CQ] rationalize/unify test lint registration
Eliminates duplication and promotes hermetic tests (some were registering and failing to unregister test lints).

Bug: https://github.com/dart-lang/sdk/issues/60036
Change-Id: I9d0fe5fd610b51ce9000decbf75da2338ed87737
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408320
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-02-07 13:09:28 -08:00
Danny Tuppeny a78fb5e47a [analysis_server] Fix semantic tokens for method tear-offs in object patterns
Fixes https://github.com/dart-lang/sdk/issues/59976

Change-Id: I75127a59670522ddfc6526d10bfe9844638fdd99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408001
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-02-07 12:24:25 -08:00
Kenzie Davisson 46a739ce20 Add quick assist for Wrap with ValueListenableBuilder
Change-Id: If4941d867fbdea687a12a043da240ceb981c758f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408401
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-02-07 10:47:31 -08:00
Konstantin Shcheglov 85724ebdaf Elements. Migrate lib/src/summary2/extension_type.dart
Change-Id: I331f0c1db4129deb224cd31f22e97dc028dfdb06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408500
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-02-07 10:45:30 -08:00
Nate Biggs 89af2425f2 [ddc] Append hot restart instruction to hot reload rejection reasons.
By adding this message here, any entrypoint that makes use of this for hot reload (e.g. DartPad, Flutter tools/FE server) will all surface this same message. This probably easier than having each one try to detect errors and append its own message.

Change-Id: I5980d530b66da818e29403cc13407095d8b203dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408380
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-02-07 10:20:53 -08:00
Kallen Tu 89e545c5cc [dot-shorthands][co19] Rename enum-shorthands flag to dot-shorthands (and roll co19 to b14b080)
We've decided to rename enum shorthands to dot shorthands. It describes the entire feature better. It's not only for enum values. We'll update the experiment name before the implementation goes in, that way our users can use a flag that matches the actual feature name.

Additionally, roll co19 to b14b0802e696a60c79b00d0f052e26fb986f0faf so we can avoid an infra failure with co19 using what's now an unknown feature flag (enum-shorthands).

2025-02-06 sgrekhov22@gmail.com Fixes dart-lang/co19#3067. Rename the static access shorthand feature experiment flag (dart-lang/co19#3068)

Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try
Bug: https://github.com/dart-lang/sdk/issues/57037
Change-Id: I031e3bce8166145b24dbb77acf259d78e6e00f0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407603
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2025-02-07 07:38:32 -08:00
Chloe Stefantsova e0b0c33937 [cfe] Remove nullaiblity requirement from shape sufficiency checks
Closes https://github.com/dart-lang/sdk/issues/60076

Change-Id: I294056317cb4d6102d53efc95cadd4992f017339
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408520
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2025-02-07 04:52:02 -08:00
Johnni Winther 2c81261f94 [cfe] Use last token for missing constructor error
Change-Id: I1ae241eac162b9b0048a7e8ecbd9a9ddfe268d12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408560
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2025-02-07 04:40:01 -08:00
Johnni Winther 4c0121f2d3 [cfe] Run ErrorCommentCheck last
This allows seeing the generated AST before failing on error comment discrepancies.

Change-Id: I9d43c37a9b5922818c58928056c194867d378056
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408521
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2025-02-07 03:22:31 -08:00
Konstantin Shcheglov 26b3e61ffe Prepare to publish analyzer 7.3.0 and _fe_analyzer_shared 80.0.0
Change-Id: I5d35f23752d8dadfc118ae92a3f8fcf3928cc60e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408422
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-02-06 18:57:40 -08:00
Sigmund Cherem dd22a358a6 [dart2js] Adding some documentation on split constraints.
We haven't worked on this feature in a couple years, but we have
some documentation that may be useful to existing developers.

This was initially written by Joshua a long time ago, but we never added
it to our repo.

Change-Id: Icf0dbc40978ed8529c2918304b712d0f9d84811d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408342
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2025-02-06 17:42:12 -08:00
Stephen Adams e962350dd6 [dart2js] Simply is-test when type parameters not needed
Sometimes the type expression of a is-test can be widened to one that
does not use type variables:

```dart
void addAll(Iterable<E> items) {
  if (items is List<E>) {
    ... items[i] ...  // code specialized to lists
  }
  ...
}
```

Changing `is List<E>` to `is List` is more efficient, but not possible
at the source level since the explicit type parameter is needed for
type promotion.

This change uses a predicate provided by the Kernel package to widen
an interface type when generating the CFG instructions for the
is-test. This can lead to knock-on optimizations like compiling `is X`
to `instanceof`.



Bug: #54998
Change-Id: I956b9d9b8a31ae40aee86e31def475baa9ab5cfe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408124
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2025-02-06 16:54:50 -08:00
Jaime Wren 7349ef5e11 [analyzer] Fix message for ENUM_WITHOUT_CONSTANTS
This will resolves https://github.com/dart-lang/sdk/issues/60053

Bug: https://github.com/dart-lang/sdk/issues/60053
Change-Id: I245814c60668f045b3fdb01358637bb142989640
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408440
Commit-Queue: Jaime Wren <jwren@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-02-06 14:40:18 -08:00
Jake Macdonald f4cfbf9cdc Update create function fix to create an async function for await expressions
Bug: https://github.com/dart-lang/sdk/issues/59990
Change-Id: I9e89089ca5c60bea190060bc0c8e869c7e78e32e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408361
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-02-06 14:25:39 -08:00
Phil Quitslund 50f96d6e5b Revert "[diagnostics] fix removed_lint reporting"
This reverts commit a9f288a810.

Reason for revert: Flutter roll blocking

Original change's description:
> [diagnostics] fix `removed_lint` reporting
>
> Bug: https://github.com/dart-lang/sdk/issues/59869
> Change-Id: I0b69f4380e0b556f6612294a3c6485cebd5e56fd
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407621
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Phil Quitslund <pquitslund@google.com>

Bug: https://github.com/dart-lang/sdk/issues/59869
Change-Id: I70063e64bd5c5792c57e8194416a4a0d2e6df8ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408400
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2025-02-06 13:42:40 -08:00
FMorschel 7559108945 [DAS] Tests for parameter highlights
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/60046
Change-Id: I5b57109e9459a8583fd543031f239174a71472cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408040
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-02-06 13:08:59 -08:00
Danny Tuppeny 8dab178912 [dds/dap] Remove macro tests
This removes the macro tests but leaves the URI support until it's clearer we won't use this (or that it won't become a fully documented feature of DAP, in which case it would be better to use URIs instead of Paths anyway).

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

Change-Id: I4df448c98eb4cc352558234c8365a5e849deed7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408280
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2025-02-06 12:13:15 -08:00
pq 93847ce649 [productivity] server test launch config and generate task
Bug: https://github.com/dart-lang/sdk/issues/60070
Change-Id: Ia7dea87b6b2ac3c74745bb81807fe7347f1a552a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408340
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-02-06 11:47:14 -08:00
Alexander Markov dd4f341e15 [dart2bytecode] Add API to invoke dart2bytecode programmatically
TEST=ci
Bug: b/394206952
Change-Id: Icd606c83bfed335e45498fceed6add784c465826
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407820
Reviewed-by: Jia Hao Goh <jiahaog@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-02-06 08:44:12 -08:00
Daco Harkes 440593fe9d [gardening] Mark test slow
(Apparently the other test doesn't exist anymore, and normalize
automatically removed it.)

Bug: https://github.com/dart-lang/sdk/issues/56979
Bug: https://github.com/dart-lang/sdk/issues/60067
Change-Id: I934c6dc4041925631de31d1832e4946002b411b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408300
Reviewed-by: Tess Strickland <sstrickl@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2025-02-06 05:19:25 -08:00
Johnni Winther 9f529aefc4 [cfe] Add TypeParameterFragment
This is a step towards only creating NominalParameterBuilders on the Builder.

Change-Id: Ic47ca37e980cfe641180dc03053bb9b45cd3fac3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408022
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2025-02-06 00:15:32 -08:00
Martin Kustermann 72963bf6f0 [dart2wasm] Fix inlining issue after introducing unchecked entrypoints
The dart2wasm compiler has a very crude way of avoiding recursive
inlining: It checks whether the target to be called is currently in the
inlining stack. Though it does so based on [Member]s instead of
[Reference]s or other abstraction.

Make the recursive inlining detection not check when it's about to
consider the body function for inlining, as the recursion detection is
sufficient for the checked/unchecked entry functions.

=> This recovers some regressions accidentally introduced when splitting
functions into checked/unchecked entry functions that call body
functions.

Change-Id: Ic32a8ac93edbda8c8be4eae0c5e416c4ea9bc3fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408181
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2025-02-05 23:56:38 -08:00
Nate Biggs e05a423e04 [dart2wasm] Avoid extra global definitions for int constants that are wasmI32.
In a few places we create IntConstants to represent constant fields that are typed as WasmI32. If these are nested within other constants we end up hitting ConstantCreator.visitIntConstant for them. This always generates a global for a BoxedInt constant, whether it's used or not.

The global we create goes unused because in constant intiailizer for the outer constant we use the wasmI32 value directly.

At -O0 this reduced the wasm binary size by ~24k for a simple Flutter app. Binaryen mostly treeshakes these unused globals but I still see a slight improvement even with binaryen running.

Change-Id: I89b8392138269d7322196fa415e56e3062a46088
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408121
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2025-02-05 19:01:45 -08:00
FMorschel 07b7cfed07 New assist to add/edit hide at import for ambiguous import
Closes https://github.com/dart-lang/sdk/pull/56762

GitOrigin-RevId: af16e245090fa66e6212801cd862d809f5ede640
Change-Id: Ibbc49c36860ba6e58c45dfc40029e2375396c153
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386020
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-02-05 15:49:35 -08:00
Srujan Gaddam 8aa6b413eb [ddc] Update hot reload test suite to use recompile-restart
A new optional suffix to the file names is added: '.restart'.
This allows us to differentiate between hot reload generations
and hot restart generations. All files with the same generation
should either have the suffix or don't. If present, uses the
recompile-request instruction in the frontend server. If not,
uses the recompile instruction. Tests are renamed and a WIP
README is added to document this change.

Change-Id: I2691c5ec0b7336115a76dc0e0369213e74b6ea21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406183
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-02-05 14:51:21 -08:00
Konstantin Shcheglov 3700d33203 Elements. Migrate type_algebra_test.dart
Change-Id: If9c1ef42eb9f0b9f83cad42429c99b4a2a95dd5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408142
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-02-05 14:23:27 -08:00
Konstantin Shcheglov 5f9e3af19c Elements. Migrate BinaryExpressionResolver.
Change-Id: I0dba2a875bb844aff5b8e10ebd879d563909daca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408160
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-02-05 11:52:18 -08:00
Johnni Winther 075bbe9245 [cfe] Create SourceClassBuilder throught ClassDeclaration+Fragment
Change-Id: I9e5c1f6b15ce7d1f0814682904a2281589c3931e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408020
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2025-02-05 05:56:36 -08:00
Martin Kustermann c833c1227c [dart2wasm] Add support for dispatch table calls to unchecked entries
Now that we have support for generating checked & unchecked entrypoints,
we can make dispatch tables also target unchecked entry points.

This is beneficial especially in cases where there's dispatches on
`this` that require covariant checks but we don't know the target method (i.e. we cannot devirtualize it because the method we
dispatch to may beoverriden).

We keep the existing selectors that we have, but a selector will now
have

  * one row if none of the implementations of the selector need to
    perform type checks
    => `SelectorInfo` has a `SelectorTargets _normal`

  * two rows if any of the implementations of the selector need t
    perform
    a type check
    => `SelectorInfo` has a `SelectorTargets _checked`
    => `SelectorInfo` has a `SelectorTargets _unchecked`

Once an unchecked entrypoint is also used in the dispatch table (only
if there's any unchecked calls to that selector) then binaryen can no
longer optimize the signature of the function. It means we may have
perform e.g. downcasts / boxing in the unchecked entry where we
wouldn't do before (because we only had static calls to unchecked entry
before this PR).

So we're going to force-inline calls to unchecked entrypoints. This
avoids sometimes down casts and boxing. It also seems to actually
shrink the binary size.

Change-Id: I3ba4980c42886cc883fb610533f5fac9cce39b65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407740
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-02-05 04:57:00 -08:00
Johnni Winther 7c22f942aa [_fe_analyzer_shared] Remove macro tests and helpers
These are no longer used.

TEST=removed

Change-Id: Ibf5b2de9d1b550c21873b48111161366deb2ddc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407980
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Morgan :) <davidmorgan@google.com>
2025-02-05 03:59:31 -08:00
Jens Johansen ca16a4271c [scanner] Replace KeywordState
As bechmarked with the AOT compiles of `scanner_benchmark.dart`
called with
`pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart --bytes`:

```
    N           Min           Max        Median           Avg        Stddev
x  25     138.56434     144.23326     142.64174     142.51626     1.2207074
+  25     148.45681     157.02163     156.44878     155.88958     1.7051997
Difference at 95.0% confidence
        13.3733 +/- 0.843454
        9.38372% +/- 0.59183%
        (Student's t, pooled s = 1.48287)
```

And compiling the CFE from December with the CFE, statistics on 25 runs
each, run with `--cache --silent` (so 2 x 50 runs each) (in AOT mode):

```
msec task-clock:u: -0.9684% +/- 0.3536% (-58.65 +/- 21.42)
page-faults:u: -0.1051% +/- 0.0818% (-125.36 +/- 97.49)
cycles:u: -1.0001% +/- 0.3225% (-252905081.28 +/- 81554799.59)
instructions:u: -0.5915% +/- 0.0007% (-181426590.44 +/- 209346.28)
seconds time elapsed: -0.9657% +/- 0.3525% (-0.06 +/- 0.02)
seconds user: -1.1336% +/- 0.4333% (-0.07 +/- 0.03)

msec task-clock:u: -1.3115% +/- 0.3364% (-79.48 +/- 20.39)
page-faults:u: -0.1900% +/- 0.0774% (-226.72 +/- 92.37)
L1-icache-load-misses: 0.4990% +/- 0.2072% (2422435.64 +/- 1006075.94)
LLC-loads: -2.3896% +/- 0.1707% (-1179245.64 +/- 84228.28)
LLC-load-misses: -1.9244% +/- 0.2041% (-639169.84 +/- 67791.64)
seconds time elapsed: -1.3128% +/- 0.3374% (-0.08 +/- 0.02)
seconds user: -1.3311% +/- 0.4183% (-0.08 +/- 0.02)
```

Combined the 3 CLs ending here gives this result when compiling
the CFE from December with the CFE, statistics on 25 runs each,
run with `--cache --silent` (so 2 x 50 runs each) (in AOT mode):

```
msec task-clock:u: -1.7681% +/- 0.3034% (-106.37 +/- 18.25)
page-faults:u: -0.1834% +/- 0.0863% (-218.80 +/- 103.00)
cycles:u: -1.8163% +/- 0.2668% (-456090610.64 +/- 66985831.74)
instructions:u: -1.1851% +/- 0.0007% (-365653999.24 +/- 220539.29)
branch-misses:u: -2.8468% +/- 1.0580% (-2611811.72 +/- 970666.69)
seconds time elapsed: -1.7687% +/- 0.3026% (-0.11 +/- 0.02)
seconds user: -1.9723% +/- 0.4480% (-0.11 +/- 0.03)

msec task-clock:u: -1.7787% +/- 0.3042% (-107.07 +/- 18.31)
page-faults:u: -0.2413% +/- 0.1050% (-288.12 +/- 125.39)
L1-icache-load-misses: 0.5218% +/- 0.1599% (2523027.12 +/- 773363.93)
LLC-loads: -2.2917% +/- 0.1613% (-1125147.16 +/- 79181.20)
LLC-load-misses: -2.0256% +/- 0.2667% (-670484.64 +/- 88293.18)
seconds time elapsed: -1.7793% +/- 0.3036% (-0.11 +/- 0.02)
seconds user: -1.7392% +/- 0.3752% (-0.10 +/- 0.02)
```

And for the scanner benchmark, in AOT mode, called with
`pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart --bytes` for bytes per microsecond:

```
    N           Min           Max        Median           Avg        Stddev
x  25     114.87867     117.70322     117.10106        116.85    0.67188864
+  25       153.512     156.99315     156.38671     155.95981    0.98376554
Difference at 95.0% confidence
        39.1098 +/- 0.479146
        33.4701% +/- 0.410053%
        (Student's t, pooled s = 0.842386)
```

Change-Id: Ica6d47d92ab0fb4c3a06aa6686b8c71f52a6aef8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407480
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2025-02-05 03:12:26 -08:00
Jens Johansen 49a9d42cfc [scanner] Ask VM to inline Token._setCommentParent
From the scanner benchmark with --bytes:

```
    N           Min           Max        Median           Avg        Stddev
x  25     135.49248     140.11327     137.90404     137.70731     1.1732525
+  25     135.55161     143.54553     141.81997     141.37336     1.8048844
Difference at 95.0% confidence
        3.66606 +/- 0.865817
        2.66221% +/- 0.628737%
        (Student's t, pooled s = 1.52219)
```

Change-Id: Ia69010d6215f59242b7f4e91d1af295cf4db1775
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407421
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2025-02-05 03:04:50 -08:00