Commit graph

97138 commits

Author SHA1 Message Date
Derek Xu 06d644196a Reland "[analyzer] Make KernelCompilationService use AOT frontend_server snapshot"
This is a reland of commit 21743361b0

Original change's description:
> [analyzer] Make KernelCompilationService use AOT frontend_server snapshot
>
> TEST=pkg/analyzer/test/src/summary/macro_test
>
> Change-Id: I28a37c7648de3e9b3c98b93fea1244234854e439
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322424
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Commit-Queue: Derek Xu <derekx@google.com>

Change-Id: I4be432d7afbff60ef3ee4d0221c1275edd9ef65b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323881
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-09-07 16:08:49 +00:00
Ryan Macnak fcda00866c [build] Export all symbols for the sanitizers.
This lets the sanitizers intercept any symbol. It's not worth trying to track which symbols the sanitizers are interested in. The sanitizer builds are not distributed so concerns about incompatibility, access to internals or size do not apply.

TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/53440
Change-Id: I59d137f4c15863cd27af857bfca4c53d847f2b90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324566
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-09-07 15:03:08 +00:00
Tess Strickland 3bbe27eadf [vm/compiler] Perform word-sized copies in MemoryMove when possible.
When copying elements that are smaller than words on non-X86
architectures, only copy element by element until the remaining elements
can be copied in word-sized chunks, and then do so.

TEST=vm/cc/IRTest_Memory, co19{,_2}/LibTest/typed_data,
     lib{,_2}/typed_data, corelib{,_2}/list_test

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

Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-simriscv64-try,vm-linux-debug-simriscv64-try,vm-mac-debug-arm64-try,vm-aot-linux-release-simarm64-try,vm-aot-linux-release-simarm_x64-try,vm-aot-mac-release-arm64-try,vm-ffi-qemu-linux-release-riscv64-try,vm-ffi-qemu-linux-release-arm-try,vm-linux-release-simarm-try,vm-linux-release-simarm64-try,vm-mac-release-arm64-try,vm-aot-android-release-arm64c-try,vm-ffi-android-debug-arm64c-try
Change-Id: I61eab310b92a6bc5ebd88fa63d562103d887cb74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324280
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-09-07 14:11:19 +00:00
Johnni Winther 622f407f16 [cfe] Handle all type parameters in TypeBuilderComputer
Closes #53427

Change-Id: Ie4bf17b54db82416d77e3bbc063d0e628a4d6c24
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324500
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-09-07 13:26:49 +00:00
Aske Simon Christensen 27d321e86c [wasm_builder] Fix --watch option to work with instructions
The `--watch` debug option to print the stack trace leading to a
particular byte in the output Wasm file didn't work for instructions
after the instruction encoder was changed to produce intermediate
instruction objects.

This is fixed by keeping a map from instruction objects to stack
traces in the instructions builder and registering those stack traces
when serializing the instructions.

Change-Id: I90d665753813452d07783c7f47e1e6bf63a3a18e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324681
Reviewed-by: Jess Lally <jessicalally@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-09-07 10:43:49 +00:00
Jess Lally 5a4b252252 [dart2wasm] Replace struct.new_default with struct.new for object
allocation.

When using the `struct.new_default` instruction for object allocation,
fields are always nullable and mutable. By using the `struct.new`
instruction instead, class fields can now have the same mutability and
nullability in Wasm as declared in Dart. In addition, the class ID and
type parameters (which are also stored in an object's struct), can now
be immutable and nonnullable as well.

To do this, object construction is now split into three functions:
(1) Initializer: evaluates initializers for instance fields and
constructor initializers (this constructor before super constructor).
(2) Constructor body: executes the constructor body (super constructor
before this constructor), with `this` pointed to the constructed object.
(3) Constructor allocator: which calls (1), allocates the object using
`struct.new`, then calls (2).

Because fields now have the correct mutability and nullability in Wasm,
this removes unnecessary null checks for nonnullable fields, and may
allow for better optimisations by Binaryen.

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

Change-Id: Ib26046686f772a70509a870301217e9b1c91b77e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315820
Commit-Queue: Jess Lally <jessicalally@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-09-07 09:52:57 +00:00
Jens Johansen 2bbf99351e [analyzer] Less duplicated line starts data with multiple contexts
When having multiple contexts we have duplicates of some things.
For instance line starts data.
This CL deduplicates some of it, and makes use of `Uint16List` and
`Uint32List` as appropriate (some where regular `List<int>`s before),
reducing the heap usage for analyzing `flutter/flutter` (80+ contexts)
when analyzing with an empty cache with about 165 MB.

Details:

```
_GrowableList (dart:core) (bytes):
Difference at 95.0% confidence
   -451040.00 +/- 0.00
   -0.79% +/- 0.00%

_Uint16List (dart:typed_data) (bytes):
Difference at 95.0% confidence
   6558032.00 +/- 0.00
   696.69% +/- 0.00%

_List (dart:core) (bytes):
Difference at 95.0% confidence
   -70840960.00 +/- 231371.19
   -9.58% +/- 0.03%

_Uint32List (dart:typed_data) (bytes):
Difference at 95.0% confidence
   -103560448.00 +/- 2829564.24
   -23.56% +/- 0.64%

heapUsage:
Difference at 95.0% confidence
   -173020528.00 +/- 7787712.50
   -4.78% +/- 0.21%
```
Change-Id: I49e23dde14a2faa7c8af94515b0ad1c669867c78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324501
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-09-07 07:11:42 +00:00
Aske Simon Christensen 36d6676833 [dart2wasm] Use Wasm array for type arguments in interface type
This avoids the overhead of Dart lists in subtype checks. It also
alleviates a potential source of infinite recursion by avoiding some
list operations with implicit type checks inside the type check code
(though there are still more of these).

With this change, we no longer have the const object cycle between
the empty list of `_Type` objects and the interface type object for
`_Type`. In combination with the the `struct.new` optimization, this
enables type argument fields to become non-nullable and immutable.

Change-Id: Ib46ea70a078a0c580713090163fecd63fe363bd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322900
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Jess Lally <jessicalally@google.com>
2023-09-07 05:29:30 +00:00
Aske Simon Christensen 3a72c7a56e [dart2wasm] Support initial value and literals for Wasm object arrays
Change-Id: I6de2c1f507623afac40dab0b1601582569ef1129
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322760
Reviewed-by: Jess Lally <jessicalally@google.com>
2023-09-07 05:29:30 +00:00
Stephen Adams d7048e410b [dart2js] SSA Control flow instructions don't have types
This is a step towards making an [empty] `HInstruction.instructionType` more reliable as an indicator that following instructions are unreachable.

- Make accessing the `.instructionType` of a HControlFlow instruction
  an error.

- Remove `AbstractValueDomain` as a constructor argument for
  `HInstruction` nodes - either it is no longer necessary (for control
  flow) or pass in the AbstractValue.

Change-Id: I642915069015fc1a42bbe46d4aaedd919a9dbdc2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324344
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-09-07 04:22:57 +00:00
Srujan Gaddam 826e970588 Reland "[ddc] Don't emit type args on interop invocations"
This is a reland of commit ebc96ecb83

Angular codegen emits members that are external so DDC's external
checks need to be more specific to only focus on JS interop. This
also modifies some code logic around whether a member is JS interop
to be less permissive. Before, it claimed that any member is JS
interop if it's external and the enclosing library has a @JS
annotation, but this is only true if there is no surrounding class.

Original change's description:
> [ddc] Don't emit type args on interop invocations
>
> DDC passes type args as the first args for a generic function
> invocation, but interop functions should be excluded from doing
> so, as this leads to passing type args to JS functions.
>
> Change-Id: Ia011beca8c7a0ebb3a7e6c81cd960096045c3a06
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323941
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>

Change-Id: Id48337ac4980d9de5de03d895d93cad3ab3a1808
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324542
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-09-07 00:54:57 +00:00
Brian Wilkerson 7dd241361d Change the computation of the completion node
Sorry about the size of the change.

This started as a CL to move the computation of keywords with a record
pattern from the contributor to the pass. In the process of doing so I
realized that the previous computation of the completion node (the node
that's visited) was too aggressive about moving upward in the AST. I
believe the issue happens when we reach a node in a list of similar
nodes (such as a statement in a block).

I changed the computation of the completion node, which necessitated a
lot of changes to existing code. It also resulted in changing several
tests, most for the better I think, but please look carefully for
places where you think the changes aren't reasonable. I'm also
interested in feedback about the change to the computation of the
completion node.

Change-Id: I2c6ac76fe88f672a206c3692d9ff51d2e487ec0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324620
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-09-07 00:53:55 +00:00
pq 2221dc01dc extension type support for avoid_types_as_parameter_names
Fixes: https://github.com/dart-lang/linter/issues/4744

Change-Id: I7db548e484c719450f6608876fa2a325f0a3c784
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324621
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-09-07 00:09:30 +00:00
Nate Biggs 2d82eb76bb [dart2js] Fix regression in Dart2JS phase3 memory usage.
Due to a recent change to improve the dump info task, the `runSequentialPhases` method was reorganized. Part of this involved adding references to the closed world and global inference indices later on in the method (after the emitter task runs) to support serialization. Though this serialization only occurs if certain flags are passed to the compiler, the VM can no longer GC the results of those earlier phases as early since they might be used.

The fix is to reassign those locals earlier on based on the dump info flags. This way the VM will track the new locals separately and can free the original references while only adding a new reference if the relevant flags are passed.

Change-Id: I8f5dbc0f88c77ab43cb3f3bf12a42ecb37c9a803
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324660
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-09-07 00:01:47 +00:00
Elliott Brooks 058669769f Unpin webdev dep now that the breaking changes have been rolled into google3
Bug: https://github.com/dart-lang/webdev/issues/2201
Change-Id: Ib13c572c95676e5a12e835c0696f3721573da2fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324567
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Elliott Brooks <elliottbrooks@google.com>
2023-09-06 22:08:26 +00:00
Ryan Macnak bb464cab79 [vm] Avoid linker warnings for run_vm_tests.
```
ld64.lld: warning: cannot export hidden symbol Dart_ActivationFrameInfo
>>> defined in obj/runtime/vm/run_vm_tests.debugger_api_impl_test.o
```

Namespace the former API functions retained for testing so they don't match the export glob Dart_*.

TEST=build
Change-Id: I4b7ed4125ef25cc33b6d4073399b0824019a1e01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324568
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-09-06 21:46:00 +00:00
Sam Rawlins 14378ed39f Avoid passing a nullable value to Completer<nn-type>.completer.
This is cleanup work required to start enforcing this with static analysis, as
per https://github.com/dart-lang/sdk/issues/53253.

Real quick this issue is that this code is unsafe:

```dart
void f(Completer<int> c, int? i) {
  Future<int>.value(i); // Ouch!
  c.complete(i);        // Ouch!
}
```

Change-Id: I91d7be0a16e62e78b530a70f115117d379259b9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324541
Reviewed-by: Liam Appelbe <liama@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2023-09-06 19:54:00 +00:00
Ryan Macnak ec70ca424e [test] Update the dart_2 copy of flutter_regress_91370_il_test.
Cf. 72e8b555aa.

Bug: https://github.com/dart-lang/sdk/issues/53442
Change-Id: I1a8d09bc64dc51175bb96e92b6a5d17c36398333
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324563
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-09-06 19:22:47 +00:00
Sam Rawlins dfe24f786e [analyzer] Tidy up doc comment code
No functional chages.

* Move doc comment-specific data classes out of ast.dart into their own
  library.
* Make many fields and methods in DocCommentBuilder private, and re-sort.
* Remove a text nit from doc comment warnings.

Change-Id: I2459115c2d688ef7ba4a0fa7d3ff986ace9d3f1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324565
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
2023-09-06 18:55:37 +00:00
asiva f7ef52616a [IO] - Use try/catch in lookupAddresses instead of Future error.
Applying patch from @aam for using try/catch in lookupAddresses instead
of Future error.

This will be cherry picked into the stable branch to ensure we
address the expedient issue in https://github.com/dart-lang/sdk/issues/53334

TEST=new test added.

Change-Id: Ia5375cbd118d8d6437cf6869383f173cab48aa3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323684
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-09-06 18:39:14 +00:00
Ryan Macnak 194951a41f [vm] Remove library lookup caches.
The library name cache is dead.

The library exported name cache is used indirectly through Dart_Invoke etc, and is practically only used for one-shot lookups like `main` or the embedder's startup hooks. The lookups that were worth caching now happen in the Dart frontend instead of the VM.

Cf. b9045af57b

TEST=ci
Change-Id: Ibd8bd30fbba3e9af32e3fbf3c5c4ced51a8d15d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324401
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-09-06 18:11:58 +00:00
Ryan Macnak 428dd41b8c [vm] Don't leak strings when given non-normalized, unrecognized, repeated flags.
TEST=lsan
Bug: https://github.com/dart-lang/sdk/issues/53441
Change-Id: I09630ed20c96b82f0fc908a9fea008b682121424
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324564
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-09-06 18:10:33 +00:00
Jackson Gardner 8001257ed0 [dart2wasm] Support for kernel_worker and unevaluated constants.
Change-Id: Icd92cb870ffd57635962e1e9831d7d777a7b00d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323000
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
2023-09-06 18:02:58 +00:00
Alexander Aprelev 2df8b46b92 [gardening] Do not reset file_modified callback - it was never set.
Attempt to reset it results in diagnostic message returned, leak detected by asan.

BUG=https://github.com/dart-lang/sdk/issues/53443
TEST=ci

Change-Id: I52242d8b45e9891abfbfea27ff2bc97f833ad6dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324562
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-09-06 16:44:58 +00:00
Ryan Macnak b2773528d0 [vm, reload] Mark call to _nativeSetRange as no-rebind.
This is a magical direct call, not a Dart language static call. Don't attempt to re-lookup.

TEST=reload
Bug: https://github.com/dart-lang/sdk/issues/53430
Change-Id: I4b0fd2491f7d41e5f6180970abbd43e871bd18b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324263
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-09-06 16:19:48 +00:00
Sam Rawlins b4309860f9 [linter] Move null_closures tests
Change-Id: I071bb39750c08f05137ba244298b3d13309b5585
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324540
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-09-06 16:11:32 +00:00
Sam Rawlins ee44a1b0f0 [linter] Move unsafe_html tests
Change-Id: I3da2f56e6f5c389e8389c954c1d565c2e1643e4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324561
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-09-06 16:10:28 +00:00
Sam Rawlins 531138a840 [analyzer] Add a few items in the new-language-feature process
Change-Id: I5347867f7c71feb2f4176552118440801cad0029
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-09-06 16:03:29 +00:00
Sam Rawlins d2a47e9cce analyzer: Add YouTube doc directive support
Work towards https://github.com/dart-lang/sdk/issues/52705

Change-Id: I4887304a4029c0279ae67bd45e8ef391a3eae56e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-09-06 15:45:48 +00:00
Ilya Yanok 7b5954ce18 Revert "[ddc] Don't emit type args on interop invocations"
This reverts commit ebc96ecb83.

Reason for revert: breaks G3, b/299279625

Original change's description:
> [ddc] Don't emit type args on interop invocations
>
> DDC passes type args as the first args for a generic function
> invocation, but interop functions should be excluded from doing
> so, as this leads to passing type args to JS functions.
>
> Change-Id: Ia011beca8c7a0ebb3a7e6c81cd960096045c3a06
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323941
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>

Change-Id: Id1af7f71e80b22b48343c1d918b9431afaf6aaf4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324521
Commit-Queue: Ilya Yanok <yanok@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-09-06 15:25:58 +00:00
Aske Simon Christensen 590c9cc08f [dart2wasm] Don't emit name section for benchmarks
Since the `compile_benchmark` script is used for compiling benchmarks
which will eventually be used for binary size tracking, the generated
Wasm file should have its names stripped.

Change-Id: I5db06537e29c0316eb5c15420448c64529bc763d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324520
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Jess Lally <jessicalally@google.com>
2023-09-06 14:58:11 +00:00
Vyacheslav Egorov c121db286a [lib] Improve IndexedIterable performance on VM
* Check against raw `EfficientLengthIterable` instead of specifying
  its type parameter. Both checks are equivalent in this context as
  `EfficientLengthIterable` is an internal marker interface and an
  instance of `Iterable<T>` can never be an instance of
  `EfficientLengthIterable` but not an instance of
  `EfficientLengthIterable<T>`.
  VM compiler is currently not good enough to eliminate the
  `is` check if involves an uninstantiated type
  (see https://dartbug.com/53445).
* Force inlining of `IndexedIterable` factory,
  `IndexedIterable.get iterator` and `IterableExtensions.indexed`.

These changes significantly reduce overhead of for-in-indexed
when compared to baseline classical loop: before these changes
for-in-indexed is 13x slower than classical loop, after these
changes it is only 2.8x slower.

Performance comparison was using the following benchmark kernels:

```dart
final list = List<int>.generate(10000, (i) => i);

// For for-in-indexed
var result = 0;
for (var (i, e) in list.indexed) {
  result ^= (i & e);
}

// For classical loop
var result = 0;
for (var i = 0; i < list.length; i++) {
  result ^= (i & list[i]);
}
```

CoreLibraryReviewExempt: No API changes, VM specific optimisations.
Change-Id: Ic935a2aab2eda0837981184d872ee1eeef89ee7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324461
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-09-06 14:09:11 +00:00
Johnni Winther 952b7232c3 [cfe] Enable inline-class feature by default in testing
Change-Id: I4e0c22e0cb2f568dd2792a8f5a60c60605628d08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324440
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2023-09-06 12:33:44 +00:00
Paul Berry d28631f1e2 Fix field promotion of external fields.
External final fields are equivalent to getters whose implementation
is provided outside of Dart code. As such they're not guaranteed to be
stable, so they shouldn't be promotable.

It turns out that the CFE was already correctly classifying them as
non-promotable (because it de-sugars them into getters prior to
computing promotability). This CL fixes the analyzer.

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

Bug: https://github.com/dart-lang/sdk/issues/53426
Change-Id: Icdd897cdbdf0da0a69ea704a245c0b428070b95e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324340
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-09-06 12:23:17 +00:00
Jess Lally 069793bd02 [dart2wasm] Don't add functions to worklist if they will be inlined.
When `getFunction` is called, the function will be added to the worklist if it has not been previously generated. However, if there is a later call to the code generator `call` helper method, this may decide to inline the function, meaning that the function will be generated twice. By calling `getFunctionType` instead, functions will be generated once by the `call` helper method.

Change-Id: I39a48dca37428b0723d897437fb4687748ad72f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324282
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Jess Lally <jessicalally@google.com>
2023-09-06 11:10:48 +00:00
Jonas Termansen ceaed93e3b [benchmark] Add material_color_utilities for flute.
This dependency is optional and only pulled down if checkout_flute is
set to True in the .gclient file.

Bug: b/274424008
Change-Id: I786325548958458d147ab8fd9da57550f36320b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324441
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
2023-09-06 11:07:46 +00:00
Daco Harkes 69afe5a407 [gardening] Skip exported_symbols_test.dart on sanitizers
Closes: https://github.com/dart-lang/sdk/issues/53438
Change-Id: I6fdb362de688d01b28b600c4aab232a966ef4082
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324283
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-09-06 09:18:32 +00:00
Jens Johansen f28d4a5e1d [analyzer] Slimmer _StringTable
_StringTable had 2 Uint32Lists for offsets and lengths in order to be
able to read strings lazily.
As offsets[x+1] = offsets[x]+length[x] we don't really need the lengths
one though.

Analyzing (82 contexts in) flutter/flutter (without a cache) this
reduces memory load by something like 22-27 MB (see below).

Note that it doesn't actually reduce the heap capacity or the process
RSS in this instance though.

Statistics on 5 runs of each:

```
_Uint32List (dart:typed_data) (bytes):
Difference at 95.0% confidence
   -23842069.33 +/- 986160.19
   -5.15% +/- 0.21%

heapUsage:
Difference at 95.0% confidence
   -28619536.00 +/- 8755493.42
   -0.79% +/- 0.24%
```

Change-Id: Ia71bac2233fcef2d9e930c8b78f1aee58e1af78f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320801
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2023-09-06 07:05:17 +00:00
Sam Rawlins 4bddf8a25f Revert "Revert "linter: Refactor prefer_collection_literals to use context type more""
This reverts commit cbdae14d2f.

In addition, Fix prefer_collection_literals for methods with expression bodies

Original description:

linter: Refactor prefer_collection_literals to use context type more

There is a basic premise in this rule which we cannot satisfy exactly:
we need to disallow `LinkedHashSet()` unless the context type requires
the developer to use `LinkedHashSet`. But the context type is long
gone when the lint rule is run.

This CL adds some logic to try to attempt figuring out the context
type in the cases where users have filed bugs, but it will never be
super accurate.

Fixes https://github.com/dart-lang/linter/issues/4736
Fixes https://github.com/dart-lang/linter/issues/3057
Fixes https://github.com/dart-lang/linter/issues/1649
Fixes https://github.com/dart-lang/linter/issues/2795

Change-Id: I958ba69a56866c18523ce6cbf62645ef8e028f6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324260
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-09-05 23:49:49 +00:00
Ryan Macnak 53fb57ea5e [vm, io] Restore global destructors for normal shutdown path.
Cf. ef4984566b.

TEST=samples/hello_world
Bug: https://github.com/dart-lang/samples/issues/195
Change-Id: I05cac92500a912c5d3e0771f626878decac18a9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324267
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-09-05 22:15:58 +00:00
Ryan Macnak b8ee3a9996 [build] Don't export all symbols to the dynamic table.
We were exporting all symbols to the dynamic table so that they could be looked up using `dladdr` for the profiler and backtracer. The symbols include our statically-linked libcxx, which can create trouble when another DSO has a different version of libcxx. Now we export only the VM embedding API functions (`Dart_*`) and use a specially produced table to do the symbolization.

TEST=runtime/tests/vm/dart/exported_symbols_test.dart
TEST=runtime/tests/vm/dart/symbolized_crash_test.dart
Bug: https://github.com/dart-lang/sdk/issues/53267
Change-Id: I2ee494fba86f67127ba0f6f402622f01a4662207
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323702
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-09-05 21:47:59 +00:00
Srujan Gaddam ebc96ecb83 [ddc] Don't emit type args on interop invocations
DDC passes type args as the first args for a generic function
invocation, but interop functions should be excluded from doing
so, as this leads to passing type args to JS functions.

Change-Id: Ia011beca8c7a0ebb3a7e6c81cd960096045c3a06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323941
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-09-05 20:42:53 +00:00
pq f064b6149b Add changelog entry for TargetKind refactor
See: https://github.com/dart-lang/sdk/issues/53368

Change-Id: I68a8a564db8491def160da27e625779769c81154
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324264
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-09-05 20:42:20 +00:00
Keerti Parthasarathy 8b601a1cd2 Add support for extension types to document symbols.
Change-Id: Ie7fd8fc4812a84e1fbbc9760fb2f4e40c514c29c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324265
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-09-05 20:07:20 +00:00
Ryan Macnak 72e8b555aa [vm, compiler] Add TestRangeInstr.
- Avoid Smi tagging for CID checks.
 - Use one branch for CID range checks.

dart2js.aot.arm64 20744832 -> 20690216 (-54k)

TEST=ci
Change-Id: I0690bd98774ffc2f24758b1a303c605b57da65b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323231
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-09-05 19:56:07 +00:00
Konstantin Shcheglov 675a83240b Remove 'enableGtGtGt' and 'enableNonNullable' from Scanner.
Change-Id: I6dcde16fb67cc2929ab87651f642d51ae9d0c05e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324266
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-09-05 19:51:27 +00:00
Konstantin Shcheglov 5e60f8816a Issue 53429. If a const constructor redirects, don't check the (absent) super constructor.
Bug: https://github.com/dart-lang/sdk/issues/53429
Change-Id: I6a843ade5374c9dbc95afb746e3a0757b425779e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324262
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-09-05 19:30:41 +00:00
Konstantin Shcheglov 32cff8fe00 Extension type. Report WRONG_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE.
Change-Id: I271739af5f152d409a98e3b42cbebdcf4e010d86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324380
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-09-05 18:57:00 +00:00
pq ee2bc9d870 highlight the late token in unnecessary_late reports
Fixes: https://github.com/dart-lang/linter/issues/4742

Change-Id: Ia13a325dc44a49f5aab3d564f3adc0c10e80c4f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-09-05 18:49:26 +00:00
Sam Rawlins cfcd047658 Move prefer_final_parameters tests
Change-Id: Iedf9c03e53b09bd85037f49aa13a10a2d9ed1df2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323945
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-09-05 18:48:57 +00:00