Commit Graph

108094 Commits

Author SHA1 Message Date
Ömer Ağacan bf97e28b6d [dart2wasm] Fix reporting measurements in WasmJSInterop benchmarks
benchmark_harness's `measureFor` returns in microseconds, but we
currently show the numbers with the unit "ns".

Convert the microseconds reported by benchmark_harness to nanoseconds
when reporting.

We could also report in microseconds, but the numbers would be very
small, with a few zeros before fractional digits. So keep reporting in
nanoseconds.

Change-Id: I189190b2139c8e2d39b8bef84159585ab0967980
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436904
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2025-06-25 06:49:29 -07:00
Daco Harkes 2273611355 [dartdev] Organize dart --help commands into categories
This CL organizes the commands in the Dart CLI to categories. It
mirrors the categories used in `flutter --help`: `SDK`, `Project`, and
`Tools`. The available command section will now look as follows in
verbose mode:

```
Available commands:

Project
  build                 Build a Dart application including native assets.
  compile               Compile Dart to various formats.
  create                Create a new Dart project.
  pub                   Work with packages.
  run                   Run a Dart program.
  test                  Run tests for a project.

Source code
  analyze               Analyze Dart code in a directory.
  doc                   Generate API documentation for Dart projects.
  fix                   Apply automated fixes to Dart source code.
  format                Idiomatically format Dart source code.

Tools
  compilation-server    Control resident frontend compilers.
  development-service   Start Dart's development service.
  devtools              Open DevTools (optionally connecting to an existing application).
  info                  Show diagnostic information about the installed tooling.
  language-server       Start Dart's analysis server.
  tooling-daemon        Start Dart's tooling daemon.
```

Bug: https://github.com/dart-lang/sdk/issues/60980
Change-Id: Ic9da297fcdd0f8e85d619632ba8ec30fd2c32666
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436382
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2025-06-25 03:08:50 -07:00
Martin Kustermann 931ec382d4 [io/gardening] Fix client address binding & fix standalone/io/socket_local_port_test
Various changes to the stanalone/io/socket_local_port_test:

  * Make server ports ephemeral: The test is testing client-side
    binding of address & port, the server part can use ephemeral ports.
    => This eliminates the issue of another process using the
       hard-coded port
  * Close sockets normally instead of using `Socket.destroy()`
  * Make dead code alive: There were test in the tests that were
    not invoked by `main()`.
  * Align the individual test helper functions.
  * ...

Then we change the dart:io implementation of `Socket::CreateBindConnect`
to set the `SO_REUSEADDR` socket option. We do this already for the
server side in `Socket::CreateBindListen`, now we do it also for the
client side.
=> This will ensure that one can bind the client side socket to
   specific address/source despite there being an old closed
   socket that's now in `TIME_WAIT` state.
=> This is the same reason we also do it in `Socket::CreateBindListen`.

Fuchsia doesn't implement `Socket::CreateBindConnect` and on Windows
the socket option seemingly has different semantics (we also don't use
`SO_REUSEADDR` on windows for the server socket, but another option).

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

TEST=standalone/io/socket_local_port_test

Change-Id: I7d07becad0cd98c3a9b973ef2f9037730d3f8b19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436902
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2025-06-25 02:56:21 -07:00
Martin Kustermann fecf1b0750 [gardening] Fix standalone/io/named_pipe_operations_test
The test was writing a dart script and then invoking a
subprocess to run that script.

=> The write of the script was asynchronous but not awaited
=> The subprocess can start running before the script is written

We also cleanup the test, it seemingly has some copy&pasted code
from another test that isn't relevant (it doesn't write
anything to the subprocess's `stdin` channel, ...)

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

Change-Id: Iaa1094056cf444a976b2edc373227e54868fae94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436900
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-06-25 02:04:36 -07:00
Nate Biggs c51bc84694 [dart2wasm] Add '--enable-bulk-memory' to set of features used in wasm.
This feature is required to support DataSegments in wasm which we use for large constant arrays:
https://github.com/dart-lang/sdk/blob/main/pkg/dart2wasm/lib/constants.dart#L793

Change-Id: Icda6745860da6d3f24632fc589b1796491819179
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436743
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-06-25 00:25:10 -07:00
Martin Kustermann 2ec25a9ad0 [dart2wasm] Roll binaryen to same version as g3 (~3 months forward)
Change-Id: I3f892ab8493095e8c348b2ed9ee77f8d3f37c958
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436621
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2025-06-25 00:10:54 -07:00
Fedor Shcheglov ade10f4afb Deprecate 'Element.library2', use 'library' instead.
Deprecate `LibraryElement.loadLibraryFunction2`, use `loadLibraryFunction` instead.


Change-Id: I117fb182e6bb62c1a76b3d578c0a6d4b6f32b9c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435920
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-24 17:23:11 -07:00
Jake Macdonald 3160b3b4a6 Bump ai to 5f9c50fc93c978e059a3ab2a071faeca6f81fd68 and tools to 1e110fcf8da4fbd423e22ae7d14f04c908d7c139
Changes to ai:
```
> git log --format="%C(auto) %h %s" 12ac0a4..5f9c50f
 https://dart.googlesource.com/ai.git/+/5f9c50f add analytics support to the Dart MCP server (174)
```

Changes to tools:

```
> git log --format="%C(auto) %h %s" 72e6cc8..1e110fc
1e110fcf Fix status badge (#2116)
9b35b98e Add events for dart mcp server tool invocations (#2112)
1d55ee1d remove flutter_markdown integration test (#2114)
```

Diff for ai: https://dart.googlesource.com/ai.git/+/12ac0a4099baf6c9b9567ffedb2b7c368938bca4..5f9c50fc93c978e059a3ab2a071faeca6f81fd68/

Diff for tools:
https://dart.googlesource.com/tools.git/+/72e6cc871a0dcb7e6b92c01a96503d1b6aebb5e3..1e110fcf8da4fbd423e22ae7d14f04c908d7c139/

Change-Id: If1ba678601b3aa1b1b79a3f58d603dfd29fe39d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436780
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2025-06-24 15:03:41 -07:00
Nicholas Shahan 559b8552a8 [ddc,frontend_server] Fix expression compilation after recompile
Update the last known good component after a recompile reject back to
the expected state before the recompile.

Adds tests for expression compilation after recompile accept and
recompile reject cases with `--target=dartdevc`. Similar to existing
tests for the VM.

Removes calls to `_generator.accept()` and
`component.computeCanonicalNames()` from `compileExpressionToJs()`.
These were added very early in the prototype implementation and it is no
longer clear why they would be needed.

Added some additional test cases for expression compilation involving
import resolution because the change that originally added the
`component.computeCanonicalNames()` call implies it was needed for that
reason. See: https://dart-review.googlesource.com/c/sdk/+/138010

TEST=pkg/frontend_server/test/frontend_server_test.dart,pkg/dev_compiler/test/expression_compiler/expression_compiler_test.dart

Change-Id: I9c04bd46e56b33dc654d00fb330de29c3c643a5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434522
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2025-06-24 14:14:42 -07:00
Konstantin Shcheglov e389ceeb85 Elements. Migrate ConstructorElementToInfer to ConstructorElementMixin2 only.
Change-Id: I4a7f1dea4abbdb439dedb9e2019c42732b798e58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436720
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-06-24 12:43:40 -07:00
Fedor Shcheglov c913e9dd6f Add test and implementation for replacing final with var in for loops.
Change-Id: If32b0f77cae3f1e3d3b8880b70d161fc22a973b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436541
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-06-24 12:35:50 -07:00
Konstantin Shcheglov 05026eb7d2 Elements. Stop implementing V1 interfaces in MethodMember and PropertyAccessorMember.
Change-Id: I93e5d7b12c8f830cbeaf0dc15c8c6b31d044b9ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436681
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-06-24 12:35:37 -07:00
Konstantin Shcheglov 9773f56b6e Elements. Move 'redirectedConstructor' property into 'ConstructorElementImpl'.
Change-Id: I9e39d5ae78c14d184bbdb22fe979b5c419d78c62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436660
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-06-24 12:27:12 -07:00
Ryan Macnak 42d796f7c1 [dart:io, mac] Don't create a thread pool per secure socket.
TEST=ci
Bug: https://github.com/flutter/flutter/issues/170723
Change-Id: I381c0dac8f7e308830c8bba472e11fb20939708e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436501
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-06-24 12:17:24 -07:00
Nate Biggs 886624cbf9 [dart2js] Add helper to detect csp in web tests and use it to set expectations for some tests.
Fixes these: https://dart-ci.firebaseapp.com/#showLatestFailures=true&configurations=dart2js-minified-csp-linux-chrome

Change-Id: I2939e3ce1fdee45d570d038f2f4382747cd617dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436140
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2025-06-24 12:06:22 -07:00
Konstantin Shcheglov 9425a79b06 Elements. Move superConstructor property into ConstructorElementImpl.
Use ConstructorElementMixin2 as its type.

All resolution is always base on element, so here we stop using fragments, and stop storing this information in fragments.

Change-Id: Ide073eb3f5efd3fa1afaac855beb092c114e304f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436162
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-06-24 10:30:06 -07:00
Alexander Aprelev 54d80f6341 [gardening] Add optional typename to fix flutter build.
Follow-up to https://dart.googlesource.com/sdk/+/74846b96c394e78c37060d8be7c350fa8c1b6a6d

TEST=flutter ci

Change-Id: I31cdfe067d65f7cc39912c58ab62e0f9a8157e32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436640
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2025-06-24 09:38:34 -07:00
Johnni Winther 2c7fcb1fab [cfe] Update addSyntheticImport
This changes the implementation of addSyntheticImport from mimicking
syntactical imports to directly providing the data needed. This avoids
the reliance on CanonicalName and Uri.toString and instead directly
uses the importUri already available.

Change-Id: I62447ab3c7c9f54597101704be3bdad0a4d2557c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436622
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2025-06-24 09:12:32 -07:00
Danny Tuppeny 2285b68ae6 [analyzer] Exclude nested analysis roots from their parents contexts
Fixes https://github.com/Dart-Code/Dart-Code/issues/5548

Change-Id: Ifb6eb52bf6589ebb5d7d60a8a3d4910d06e5be88
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435161
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-06-24 07:57:37 -07:00
Fedor Shcheglov 318aeb322b Deprecate DartType.element3, use element instead.
Change-Id: Idef9da09c565a05fa84869f7433df3c24c6fbb5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435521
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-06-24 07:23:11 -07:00
Martin Kustermann 0ff6daa3dd [dart2wasm] Enable specific binaryen features and not blindly enable all features
We should not blindly use `--all-features` as that will tell
binaryen that it may use any features in the resulting wasm file
(even features not even finalized yet).

The default dart2wasm (without extra opt-in by the user into more
wasm features) should only enable wasm features that we require
and are available in browsers at the point when they shipped
WasmGC.

Change-Id: Ifdcc31d938e29048b50be3fd5692693dc80ecbd3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436604
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2025-06-24 06:50:33 -07:00
Chloe Stefantsova be5dc4fc18 [cfe] Remove obsolete nnbd_api.md
This document was created during the early stages of the NNBD
development. The goal was to aid the migration to the new model. The
document has served its purpose and is not maintained for some time
now, so it can be deleted.

Change-Id: I398331cc41a0070e28cf3d1f94da958dd2d3ecfa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436602
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2025-06-24 06:08:23 -07:00
Alexander Markov 43830ab2ea Test interpreter directly on the VM, without dynamic_module_runner
Also, run pkg/vm_service/ tests against interpreter.

TEST=ci

Change-Id: Ib9c7fc1ed33c5721288e3ba1a3d4999c3e234350
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436500
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-06-24 06:00:45 -07:00
Alexander Markov 05c2f3b0b1 [vm,dyn_modules] Hook interpreter to the standalone VM
When dynamic modules are enabled, standalone VM can now run bytecode
binaries directly. Also, if --interpreter flag is specified, Dart
source is compiled to bytecode and interpreter is used to run it.

This will allow us to test VM service capabilities including
debugging and hot reload against the interpreter.

TEST=manual

Change-Id: Ibb5a67f4844485c4ed90b8a7568dc42fa552fcac
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436421
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-06-24 05:59:21 -07:00
Martin Kustermann 0ba978160e [dart2wasm] Use hash of library import uri for private Symbol name mangling
This should make private symbol names more stable and
fix a fuzzer report about it.

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

Change-Id: If57efcf805e6308da6ef94cc8aadb23a68f6252d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436623
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-06-24 05:35:41 -07:00
Martin Kustermann 2e8a93ce1f [dart2wasm] Print debugging info (e.g. in --print-kernel) before generating code
By first printing the debugging information before generating code,
any crash in the code generator will have it prefixed with the
debugging information.

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

Change-Id: I4e69e7003c1e0e7c078cbc1d94ae22ae69e302ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436601
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2025-06-24 03:50:07 -07:00
Jens Johansen ae791fb163 [analyzer] Fix windows test expectation in assist_processor.dart
Change-Id: Ic4665af3e28f5ce467c75c8a772c872f0ddf05df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436600
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2025-06-24 03:12:13 -07:00
Martin Kustermann 320cc28d63 [tests] Remove unnecessary status file suppressions for tests
Change-Id: Ide81ada6931575da049d2ef3e88c9426b7e25ee4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436243
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-06-24 01:26:33 -07:00
Martin Kustermann 76548a7ab9 [tests] Rewrite various tests to not depend on <obj>.runtimeType.toString()
In dart2wasm applications are by default deployed in `-O2` mode which
implies `--minify`.

Given this is the default configuration for customers, we want good
testing of this configuration and not large numbers of approved failures.

=> Rewrite various tests to not depend on `<obj>.runtimeType.toString()`

Change-Id: I1108b28c63b8bec6ad94df0d7b878b3339776df9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436281
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-06-24 01:16:24 -07:00
Jens Johansen b79056a0bb [analyzer] Don't calculate add-late assists for other files
The "add late" assist was broadened in
https://dart-review.googlesource.com/c/sdk/+/176900 with a link to
https://github.com/dart-lang/sdk/issues/44440 where the example is
adding `late` to a field in the same class the user is currently editing
the constructor for.

That makes sense.

The code could also add the `late` keyword to other files which is - I
think - bad for at least two reasons:

  1) It's confusing being given the option to "add late" to something,
     then when trying it nothing seemingly happen, except something does
     happen: another - possibly not open - file has changed.
  2) It requests the resolved unit for another - possibly not open -
     file, which is slow. This means that, at least in VSCode, just
     moving the cursor over something can send requests that takes a
     long time. In practise I've experienced up to ~1.5 seconds, and in
     benchmarks I can make this arbitrarily large by increasing the
     size of the file. Shown below, having 16,000 small classes takes
     around 4 seconds (vs less than 10 ms with this CL).

This CL restricts this to the same file, adds a few tests and updates
a few existing tests.

Note that the existing tests that verified the behavior of adding `late`
to other files was added in
https://dart-review.googlesource.com/c/sdk/+/180087 with a link to
https://github.com/dart-lang/sdk/issues/44534
where the issue discusses a bug where it is applied in the wrong file
and says that it should either be applied to the right file or be
disallowed. The option of allowing it was picked in that instance,
but now at least there's data to show that it comes at a cost.

For an ad-hoc test where I programmatically asks for assists at every
position in `pkg/front_end/lib/src/kernel/body_builder.dart` I go from
1875 positions that takes >= 100 ms to answer to 0 such positions.

For the added benchmark I get this data:

Before this CL:

```
size 1000:
Initial analysis: 0.188291
Action call on 4:11 : 0.308514
Action call on 4:12 : 0.319540
Action call on 4:13 : 0.274678
peak virtual memory size: 2363 MB
total program size (virtual): 2292 MB
peak resident set size ("high water mark"): 258 MB
size of memory portions (rss): 244 MB

size 2000:
Initial analysis: 0.387643
Action call on 4:11 : 0.649877
Action call on 4:12 : 0.550778
Action call on 4:13 : 0.474030
peak virtual memory size: 2325 MB
total program size (virtual): 2325 MB
peak resident set size ("high water mark"): 279 MB
size of memory portions (rss): 277 MB

size 4000:
Initial analysis: 0.753913
Action call on 4:11 : 1.086648
Action call on 4:12 : 1.015921
Action call on 4:13 : 0.915511
peak virtual memory size: 2335 MB
total program size (virtual): 2304 MB
peak resident set size ("high water mark"): 363 MB
size of memory portions (rss): 334 MB

size 8000:
Initial analysis: 1.235531
Action call on 4:11 : 1.880335
Action call on 4:12 : 1.824658
Action call on 4:13 : 1.771081
peak virtual memory size: 2414 MB
total program size (virtual): 2386 MB
peak resident set size ("high water mark"): 436 MB
size of memory portions (rss): 411 MB

size 16000:
Initial analysis: 2.618666
Action call on 4:11 : 3.991542
Action call on 4:12 : 3.775863
Action call on 4:13 : 4.094692
peak virtual memory size: 2576 MB
total program size (virtual): 2516 MB
peak resident set size ("high water mark"): 667 MB
size of memory portions (rss): 611 MB
```

With this CL:

```
size 1000:
Initial analysis: 0.202665
Action call on 4:11 : 0.005730
Action call on 4:12 : 0.003086
Action call on 4:13 : 0.002743
peak virtual memory size: 2174 MB
total program size (virtual): 2170 MB
peak resident set size ("high water mark"): 256 MB
size of memory portions (rss): 247 MB

size 2000:
Initial analysis: 0.433420
Action call on 4:11 : 0.005353
Action call on 4:12 : 0.002116
Action call on 4:13 : 0.002156
peak virtual memory size: 2226 MB
total program size (virtual): 2226 MB
peak resident set size ("high water mark"): 290 MB
size of memory portions (rss): 240 MB

size 4000:
Initial analysis: 0.674376
Action call on 4:11 : 0.004219
Action call on 4:12 : 0.002138
Action call on 4:13 : 0.001625
peak virtual memory size: 2392 MB
total program size (virtual): 2328 MB
peak resident set size ("high water mark"): 306 MB
size of memory portions (rss): 286 MB

size 8000:
Initial analysis: 1.244688
Action call on 4:11 : 0.005225
Action call on 4:12 : 0.002104
Action call on 4:13 : 0.002729
peak virtual memory size: 2349 MB
total program size (virtual): 2338 MB
peak resident set size ("high water mark"): 385 MB
size of memory portions (rss): 366 MB

size 16000:
Initial analysis: 2.776680
Action call on 4:11 : 0.008848
Action call on 4:12 : 0.002854
Action call on 4:13 : 0.002327
peak virtual memory size: 2423 MB
total program size (virtual): 2405 MB
peak resident set size ("high water mark"): 505 MB
size of memory portions (rss): 489 MB
```

It's interesting how the action calls for sizes >= 4000 was slower than
the initial analysis, but I haven't looked into it.

Change-Id: Icefe02073cdf1ad442a37de2030fd7e53f5013b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436280
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2025-06-24 00:43:29 -07:00
Johnni Winther 6c7e3a6049 [cfe] Remove use of Fragment in _Declaration
This removes the use of Fragment from _Declaration. Constructors and
properties are fully handled through their *Declaration objects. The
remaining declarations uses _StandardDeclaration which still uses
Fragment.

This is a step towards normalize builder creating between user
declarations and synthetic declarations.

Change-Id: Icb95ea42213248702f25a99e8c6f6b562d839bfa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435821
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2025-06-24 00:14:15 -07:00
Alexander Aprelev 74846b96c3 [vm] Introduce ReentrantMonitor.
Existing Monitor is not reentrable, doesn't support acquiring it if it is already acquired by this thread.

TEST=ReentrantMonitorAllowsReentrance

Change-Id: Id74479388a99ca907bca6e379c3a7e08191e841b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436542
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-06-23 21:08:19 -07:00
Ryan Macnak 69f76f1086 [vm] Only include predefined symbols C strings in gen_snapshot.
Saves about 29k of binary size and kNumPredefinedSymbols map lookups at startup.

TEST=ci
Change-Id: I186c17a839ebfc6a800a35f08ca2f2c0776984ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433862
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-06-23 17:00:52 -07:00
Ryan Macnak 67c6da2beb [vm, gc] Shorten extent of the freelist lock during scavenge.
Helps break a cycle for https://dart-review.googlesource.com/c/sdk/+/435241

TEST=ci
Change-Id: I98994a3d2f5e11f0f9bb20e38d3c2b9fa9e48d08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436521
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-06-23 16:31:17 -07:00
Vyacheslav Egorov 077e1be29c [gn] Fix precompile_tools=True (attempt 2)
Turns out that dart compile exe --depfile produces
depfile which does not work with ninja because
it uses absolute path to the output file
instead of using relative path.

So we can't use it directly and need to fix
depfile.

TEST=manually

Change-Id: I1aadfd5079cc38d392933f9afe333f63407bb295
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435680
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2025-06-23 14:54:04 -07:00
Fedor Shcheglov ab004f3bcc Write tests and implementation for conditional expression remove_comparison quickfix.
Change-Id: Ifc3373895b8c96e610e9515e0cae92be85e8d0b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436161
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-23 14:51:30 -07:00
DEPS Autoroller 062af9fd1e Roll Fuchsia SDK from 28.20250618.5.1 to 28.20250621.0.1
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/fuchsia-sdk-dart-sdk
Please CC fuchsia-3p-engprod@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Fuchsia SDK: https://bugs.fuchsia.dev/p/fuchsia/issues/list
To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-x64-try;luci.dart.try:vm-fuchsia-release-arm64-try
Change-Id: I20a34ddee765eb95befe5e4e859c35da63a7a21d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436120
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-06-23 14:30:38 -07:00
Alexander Aprelev cabc717e76 [vm/shared] Ensure shared initial field table is used with shared fields.
Fixes https://github.com/flutter/flutter/issues/170038
TEST=shared_static_final_test

Change-Id: Ia242b5d9c661782e5a6018ba96211a75cc47c1a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436200
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2025-06-23 14:17:40 -07:00
DEPS Autoroller c95dbcd71e Roll gn from 54169531ed6d to 97b68a0bb62b
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/gn-dart-sdk
Please CC dart-ecosystem-gardener@grotations.appspotmail.com,dart-engprod@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in gn: https://bugs.chromium.org/p/gn/issues/list
To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try;luci.dart.try:dart-sdk-mac-try;luci.dart.try:dart-sdk-mac-arm64-try;luci.dart.try:dart-sdk-win-try
Change-Id: I2a3f8026ba994c96427bed4b92f964c5c0619755
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435563
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-06-23 13:56:57 -07:00
Konstantin Shcheglov a868039f59 Elements. Remove PropertyAccessorFragment.variable3 and PropertyInducingFragment.getter2/setter2.
It is getter / setter elements that know that they form a
PropertyInducingElement, and the other way around,
PropertyInducingElement that has getter and setter. Fragments OTOH, just
dangle from the elements.

Change-Id: Ide8ece5cb318c75093b0173c661b01f564d1a55a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435746
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-23 13:31:03 -07:00
Konstantin Shcheglov 4217306f88 Elements. Stop storing V1 ExecutableElementOrMember in InheritanceManager3.
Change-Id: I78cbf2497118364f792b58f7efb9d1c5ce68a6d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436361
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-06-23 13:09:07 -07:00
Sam Rawlins c27ad09258 vm_service: Remove unused categoryName parameter
Change-Id: I2ea111c576a550e2d473e8b55b51b6ac41e687c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436481
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-06-23 13:04:40 -07:00
Fedor Shcheglov 6ba80184f0 Remove PropertyAccessorFragmentImplImplicitGetter, PropertyAccessorFragmentImplImplicitSetter, and FormalParameterFragmentImplOfImplicitSetter, replace with GetterFragmentImpl, and SetterFragmentImpl.
Change-Id: Iaf8066a5f04635616b18a7c7cfb890f6b2d46df8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436100
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-06-23 12:44:35 -07:00
Sam Rawlins 2be548666d vm_service: Tidy nullability and finality in generator
While exploring this code, I saw some easy wins:

* A number of local variables of the form `String? x = a.b.c;` can be
  made non-nullable as `.c` now returns  `String`; no tooling will warn
  the developer of this.
* A number of methods of the form `String? m() {...}` can be made non-
  nullable, as they only return non-null values; no tooling will warn
  the developer of this.
* A number of methods of the form `m(String? p) {...}` can instead
  accept non-nullable Strings, as all of the call sites pass non-null
  Strings.
* `_coerceRefType` accepted a `String?` parameter but immediately null-
  checked it's value. We can use the type system to enforce that this
  function requires non-null values.
* StreamCategory's `_name` and `_events` fields can be made non-nullable
  by using a little factory constructor; this enhancement reveals that
  the fields can be made final (analyzer reports this). Then we have
  unnecessary public getters that expose these final fields; the fields
  can instead be made public, and the getters removed.
* `Api.types` can be made a `List<Type>`.
* Some fields can be made final: `MemberType.types`, `TypeRef.name`,
  `TypeRef.nullable`, `MethodArg.type`, and `MethodArg.name`.
* Some fields can be made non-nullable: `TypeRef.name`,
  `MethodArg.name`, and `EnumValue.name`.

Change-Id: Ia36c1edc4686c6a14d76fd053d70da60b7b4aac6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436420
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-06-23 11:29:41 -07:00
Fedor Shcheglov 22a74f5580 Format analyzer/ and analysis_server/ to dart format.
When running cl upload, I noticed that there were a lot of existing format issues, which this fixes.

Change-Id: I01611562c907dbc4151e28eceee4a1f5a51644dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435522
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-06-23 10:42:23 -07:00
Sam Rawlins 3736a2817b dartdev: flip AOT flag for analysis-server-based commands
Work towards https://github.com/dart-lang/sdk/issues/50498

Work towards https://github.com/dart-lang/sdk/issues/53576

Change-Id: Idc34d6e1f0b0107391d26d0b531329fbc9645a00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435445
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2025-06-23 10:06:24 -07:00
Alexander Markov 36087ec8f7 [vm] Remove unused kernel bytes in case of compile-time errors
In case of compile-time errors kernel service has been serializing kernel AST anyway and has been passing kernel bytes to the VM.
VM does not use those kernel bytes except a few unit tests.

This change removes the unnecessary kernel serialization and freeing
of kernel bytes and cleans up unit tests.

TEST=ci

Change-Id: Ic2464e50f56227bc998df53dd2b594c1abcf9468
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436360
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-06-23 10:01:09 -07:00
Sam Rawlins 66ba0cf14f vm_service: Make SocketProfile.sockets non-late.
We only need to adjust a private constructor to make it non-late
[1] [2].

[1]: https://dart.dev/effective-dart/usage#dont-use-late-when-a-constructor-initializer-list-will-do
[2]: https://dart.dev/effective-dart/design#avoid-public-late-final-fields-without-initializers

Change-Id: Ia063718104027a1cec147ca94d7ce34a661f5efd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435000
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-23 09:58:20 -07:00
Moritz b112bb95cf [record_use] Fix signature parsing bug
Another sign that we should switch to not having to use signature
parsing anymore... Which needs Dart2Js to support named arguments.
See also https://github.com/dart-lang/sdk/issues/60597


Change-Id: I34ca924be7f65021963c00f8eb9b9fda33164573
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436380
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Moritz Sümmermann <mosum@google.com>
2025-06-23 09:53:03 -07:00
Konstantin Shcheglov bc9344870f Elements. Don't include PropertyInducingFragment.getter/setter and PropertyAccessorFragment.variable2 into text expectations.
I'm removing these getters in the next CL.

Change-Id: I17d44db3c6c4242dbeeb35e4bed58662dd5ae900
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435749
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-06-23 09:34:23 -07:00