Commit graph

83726 commits

Author SHA1 Message Date
Konstantin Shcheglov 2ad4e8258c Report ENUM_CONSTANT_WITH_TYPE_ARGUMENTS_WITHOUT_ARGUMENTS
Change-Id: I41fa9cb8497671363878d2140dfec2ec3fc0f6ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231844
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-07 19:26:15 +00:00
Konstantin Shcheglov d759c004fa Tests for MEMBER_WITH_CLASS_NAME in enum.
Change-Id: I236a11a51913e705381740b0ea7439e09c44a200
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231842
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-07 19:16:26 +00:00
Nicholas Shahan 72d7e5b0ce [ddc] Cleanup non-nullable experiment flag
Also remove dead code that was a workaround when there were
two forks of the SDK libraries but one version the dart:_runtime.

Change-Id: I1192fcc5238fb84ab1cda533bee8bef63d289a2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231743
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-02-07 19:03:25 +00:00
Ryan Macnak 554e5660b7 [infra] Simply vm filesets.
Listing each possible output directory separately doesn't reduce the amount copied to shards as there are no other files in "out" to skip.

Change-Id: Ie55bb68d3ffe670d48eba5b03af2bc8ce7ce0dcc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231337
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-07 19:02:46 +00:00
Joshua Litt ef4411b2ed [dart2js] Remove some dead code.
Change-Id: Ib7dd4a08dae59ab0dc6b168c4252d7e815e5244b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231537
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-02-07 18:48:36 +00:00
Konstantin Shcheglov 2d14e064f5 Report more enum member conflicts.
Change-Id: I39a59fdd96e91c8172db0d747b05f8eef810a36c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231841
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-07 18:13:05 +00:00
Konstantin Shcheglov 3e8114261a Add HasCompletionData to a few more elements.
Change-Id: I7ea2f0b70cbc5a65584725d2ca662db37651ed1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-07 17:59:55 +00:00
Joshua Litt 85aed03894 [dart2js] Simplify NoSuchMethod* classes.
Change-Id: If41acd2a3835ef4d3db0999fb7b9340c64c98f13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231383
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-02-07 17:20:35 +00:00
Sigurd Meldgaard 7bb6841815 Reland "Remove the pub top-level"
This is a reland of 872ffa85c2

Original change's description:
> Remove the pub top-level
>
> The old pub toplevel interface is still reachable via
>
> ```
>  $ dart __deprecated_pub
> ```
>
> That is what `flutter pub` is using.
>
> Part of https://github.com/dart-lang/sdk/issues/46100
>
> Bug: https://github.com/dart-lang/pub/issues/3292
> Change-Id: I97a14f2458d0f67c7bf98a90664d504cfaba0e98
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229541
> Reviewed-by: Jonas Jensen <jonasfj@google.com>
> Reviewed-by: Michael Thomsen <mit@google.com>
> Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>

Bug: https://github.com/dart-lang/pub/issues/3292
Change-Id: I45b5bf93f30c8abad4558cb15b61289c6c786f65
Cq-Include-Trybots: luci.dart.try:flutter-engine-linux-try,flutter-engine-linux-web_tests-try,flutter-frontend-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231943
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2022-02-07 14:12:57 +00:00
Vyacheslav Egorov 72eb59f32a [vm/compiler] Allow WB elimination for small arrays.
Previously all arrays were excluded from WB elimination pass
to avoid invariant restoration code creating excessive work
for the GC and to avoid dealing with card marking in the
invariant restoration code.

It seems reasonable to enable this for small arrays of up to 8
elements. The cut of point of 8 elements was chosen based on the
cut of point for literal<N> specialisations provided by the
core library for creating small literal arrays.

TEST=vm/cc/IRTest_WriteBarrierElimination_Arrays

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-linux-release-x64-try
Change-Id: I2b3169865f07c3ff95820c1bc6718943e96bd33b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229903
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-02-07 10:47:12 +00:00
Martin Kustermann 68f502cc61 [vm] Check for common case (_Future) before uncommon case (is! Future / 3rd party future)
TEST=ci

Change-Id: Iac123e20a889d8b3152bd3934c12ed012aebd8d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231944
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-02-07 10:06:41 +00:00
Alexander Thomas c9f223c5bd [release] Add release date for 2.16.0
Fixes: https://github.com/dart-lang/sdk/issues/48328
Change-Id: Ic1c2a0e0fc2f256257aa6c0b84dc1d72e5347a44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231942
Reviewed-by: Michael Thomsen <mit@google.com>
2022-02-07 09:55:04 +00:00
Devon Carew 150df0637f [analyzer] remove the dep on package:cli_util
Change-Id: Ie5b0c29ae443588c501dd2012e645618aff17ca4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231846
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-02-06 05:26:40 +00:00
Daco Harkes 3156c5629d [cfe/ffi] Implement Finalizable
This CL implements `Finalizable` by means of a CFE transform.
The transform is implemented in the existing FFI transform to avoid the
overhead of traversing the AST an extra time. The FFI transform slows
down ~15-30% on Flutter Gallery. For more info see the design doc.

TEST=`dart pkg/vm/test/transformations/ffi_test.dart`

Design doc: go/dart-vm-finalizable

Bug: https://github.com/dart-lang/sdk/issues/47777

Change-Id: I0bf9dead90a61631b7f215dc19fbaa9e40e63c8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/227501
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-02-05 11:54:59 +00:00
Stephen Adams 3a8be9394d [dart2js] Share more CallStructures
Change-Id: I90a2fe027a61a7bb4235b54ab90c14a5f9049192
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177020
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-02-05 03:08:23 +00:00
Stephen Adams 5d02bc0a0a [dart2js] Handle x as E specially when x has type E?
This is implemented in dart2js rather than using a Kernel transform
because dart2js has additional context about the 'as dynamic' trick.

Change-Id: I4f7abe6bb95cff8209a683406cfaf2d82b3245ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231745
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-02-05 02:17:49 +00:00
Konstantin Shcheglov c99e3af906 Report duplicate declarations for enums.
Change-Id: I2bda7ea3116a4ea8c65024c8ec4b5981e7d93c19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231746
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-05 02:07:30 +00:00
Ben Konyi ad4d10a42c [ package:vm_service ] Migrate Observatory service tests to package:vm_service (Pt 2)
See https://github.com/dart-lang/sdk/issues/45037

TEST=pkg/vm_service/test/*

Change-Id: I0632744fdea0da63a47d64299cbd1f96f45dcb3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186742
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-02-05 00:12:29 +00:00
Konstantin Shcheglov 1b204a9c85 Extract diagnostics tests from class tests.
Change-Id: Ib3fcdf07fd7ebdbc68654cf9ee2d82ff6d2d2b48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231747
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-04 23:23:59 +00:00
Konstantin Shcheglov 52290eba28 Add CompletionSuggestion.libraryUri, keep isNotImported.
Change-Id: I1bce246c2d8eaa968a47ae6ba82114592b991a47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231040
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-04 22:49:10 +00:00
Martin Kustermann 4eaacc3df9 [vm] Improve async performance by taking advantage of static types of returned values
In general any async function can return X or Future<X>. Though the
future implementation has to do different things depending on which case
we're in. It does so by using a `<obj> is Future<T>` test. This test is very
expensive if many different classes flow into `<obj>`.

Though most functions do not return `Future` objects from async
functions. We can determine that statically by looking if any returned
expression could be a future. If not, we can bypass the `is Future<T>`
test entirely.

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

TEST=pkg/front_end/testcases/general/async_function_returns_future_or.dart

Change-Id: If655bdbdddc214dd7b12be9905b3c788252547d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230662
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-02-04 22:06:59 +00:00
Konstantin Shcheglov 0962b173d6 Replace 'enumeration' with 'enum' in messages.yaml
Change-Id: I62d389bb9462a15f2b08d2fb313fc1a3fca74379
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231742
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-04 22:00:41 +00:00
Jake Macdonald 5a99031028 Updates to the macro type instantiation apis based on feedback.
In general this moves in the direction of dealing more with Identifier instances instead of TypeAnnotation instances.

This ended up being a larger refactor than I had hoped, but at a high level it does the following:

- Adds the TypeAnnotationCode/NamedTypeAnnotationCode/FunctionTypeAnnotationCode classes
- Change the TypeResolver api to have a single 'resolve' method, which takes a TypeAnnotationCode argument
- Makes ParameterCode/TypeParameterCode take more structured arguments
- Update the CFE code to be able to resolve NamedTypeAnnotationCode instances instead of TypeAnnotation instances
- Also deletes some unnecessary Code classes.

Note that supporting FunctionTypeAnnotationCode instances looks like it will be some more work in the CFE.

Change-Id: I84712aa1c29634cd0a93d245171b3591f69be927
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231327
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2022-02-04 21:54:59 +00:00
Ben Konyi c58e5b3fc7 [ SDK ] Minor null-safety refactor in Timer
Follow-up to https://dart-review.googlesource.com/c/sdk/+/171628

Change-Id: I9110997c32a8d5e5ae566e190ce2e677a0b89850
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231744
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2022-02-04 21:52:39 +00:00
Helin Shiah 43d124c212 Fix Java code generation for lookup URI methods
The java generation for type `(string|Null)[]` was creating `@return one of <code>List<String></code> or <code>ElementList<Null></code>`

see example:
```
@SuppressWarnings({"WeakerAccess", "unused"})
public class UriList extends Response {

  public UriList(JsonObject json) {
    super(json);
  }

  /**
   * A list of URIs.
   *
   * @return one of <code>List<String></code> or <code>ElementList<Null></code>
   */
  public Object getUris() {
    final JsonObject elem = (JsonObject)json.get("uris");
    if (elem == null) return null;

    if (elem.get("type").getAsString().equals("String")) return new String(elem);
    if (elem.get("type").getAsString().equals("Null")) return new Null(elem);
    return null;
  }
```

My change is the simplest thing I could think of, just making the return type `List<String>` instead and allowing some of the elements to be null. But I'm happy to implement something else if someone has a suggestion for a better type (along with how to get the generate code to produce it)

Closes https://github.com/dart-lang/sdk/pull/48309
https://github.com/dart-lang/sdk/pull/48309

TEST=N/A

GitOrigin-RevId: fa9dddad68219e697998c4a011a82d6860f44bfb
Change-Id: I79cf2aedf0672354a2fd28c8962740f6fcea4f4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231740
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-02-04 21:43:59 +00:00
Martin Kustermann 07a5def205 Reland "[vm] Avoid type parameter check of _Future._asyncComplete() when caller knows its safe"
Currently we have to do a runtime `as FutureOr<T>` check for the
parameter to `_Future<T>.asyncComplete(FutureOr<T> value)`. Although
needed for general cases, for the particular usage in the VM's
async/await transformer, we know that the test is going to suceed.

This CL adds two VM-specific methods on `_Future` that take `dynamic`
and downcast via `unsafeCast<>()` to avoid this rather large runtime
type checking overhead.

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

Change after revert: Replace the
    assert(value is T || value is Future<T>);
with
    assert((value as FutureOr<T>) == value);

The former doesn't allow `null` while the ladder might (depending
on nullability of `T`).

TEST=ci

Change-Id: I2379c625003fea6aa836ac74beb1cd59201b3560
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231704
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-02-04 19:54:19 +00:00
Ben Konyi 250173e60c [ CLI ] dartdev null-safety migration cleanup
Follow-up to https://dart-review.googlesource.com/c/sdk/+/229948

Change-Id: If5624638eeb629ea025ec04b6a11d23144ea43ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231741
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2022-02-04 19:23:40 +00:00
Konstantin Shcheglov 14bead484c Report more enum hierarchy errors for enums.
Change-Id: I9ffc41ce9cbc9a51b059dc8a891e59420232d047
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231536
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-04 18:51:39 +00:00
Jens Johansen b41922f925 [DDC][infra] Shard DDC nnbd differently
Currently:
 * "ddc nnbd weak tests" is split into 5 shards.
 * "ddc nnbd weak co19 tests" is split into 2 shards.
 * "ddc nnbd strong tests" is not spit into shards.
 * "ddc nnbd strong co19 tests" is not spit into shards.

From a recent run taking a total of 45 minutes the timings
were like this:

```
ddc nnbd weak tests shard 1: 02:57
ddc nnbd weak tests shard 2: 01:56
ddc nnbd weak tests shard 3: 02:16
ddc nnbd weak tests shard 4: 01:49
ddc nnbd weak tests shard 5: 02:31
```

(i.e. a combined total time of 11:39 if run one after another)

```
ddc nnbd weak co19 tests shard 1: 08:45
ddc nnbd weak co19 tests shard 2: 09:48
```

(i.e. a combined total time of 18:33 if run one after another)

```
ddc nnbd strong tests: 09:51
```

```
ddc nnbd strong co19 tests: 20:44
```

Here I try to change the sharding "robin hood style" so that
"ddc nnbd weak tests shard" which seems pretty fast gets fewer,
but "ddc nnbd strong co19 tests" gets sharded.

Hopefully the result will be something like

ddc nnbd weak tests shard 1: 06:00
ddc nnbd weak tests shard 2: 06:00
ddc nnbd weak co19 tests shard 1: 09:00
ddc nnbd weak co19 tests shard 2: 09:00
ddc nnbd strong co19 tests shard 1: 7:00
ddc nnbd strong co19 tests shard 2: 7:00
ddc nnbd strong co19 tests shard 3: 7:00
ddc nnbd strong tests: 10:00

Which - with the same number of shards used - would hopefully cut off
~20 minutes (as the shards run concurrently)

Update: Total runtime was ~21 minutes, and runtimes seems pretty
agreeing with the expected.

Change-Id: Ie699e5687ab9a0d49cd197a4064bc8007d1dd806
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231700
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2022-02-04 17:41:59 +00:00
Konstantin Shcheglov f69d1f887f Use CompletionSuggestionBuilder, and HasCompletionData to store location independent data.
Change-Id: I767bfc1c31b5aebc8f4e27267520f705701e7724
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231044
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-04 17:33:19 +00:00
Ilya Yanok cca927be82 Revert "[vm] Avoid type parameter check of _Future._asyncComplete() when caller knows its safe"
This reverts commit 8e0feb9fa9.

Reason for revert: breaks tests in Google3, see b/217919095

Original change's description:
> [vm] Avoid type parameter check of _Future._asyncComplete() when caller knows its safe
>
> Currently we have to do a runtime `as FutureOr<T>` check for the
> parameter to `_Future<T>.asyncComplete(FutureOr<T> value)`. Although
> needed for general cases, for the particular usage in the VM's
> async/await transformer, we know that the test is going to suceed.
>
> This CL adds two VM-specific methods on `_Future` that take `dynamic`
> and downcast via `unsafeCast<>()` to avoid this rather large runtime
> type checking overhead.
>
> Issue https://github.com/dart-lang/sdk/issues/48226
>
> TEST=ci
>
> Change-Id: Ieeffae3ac8e2960f849512cf22c51d41cadb1ecf
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230261
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Reviewed-by: Lasse Nielsen <lrn@google.com>
> Commit-Queue: Martin Kustermann <kustermann@google.com>

TBR=lrn@google.com,vegorov@google.com,kustermann@google.com

Change-Id: I37a07cbb6fb37620e5305dfe1b759b0de1c37653
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231703
Reviewed-by: Ilya Yanok <yanok@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
2022-02-04 17:24:19 +00:00
Martin Kustermann 8e0feb9fa9 [vm] Avoid type parameter check of _Future._asyncComplete() when caller knows its safe
Currently we have to do a runtime `as FutureOr<T>` check for the
parameter to `_Future<T>.asyncComplete(FutureOr<T> value)`. Although
needed for general cases, for the particular usage in the VM's
async/await transformer, we know that the test is going to suceed.

This CL adds two VM-specific methods on `_Future` that take `dynamic`
and downcast via `unsafeCast<>()` to avoid this rather large runtime
type checking overhead.

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

TEST=ci

Change-Id: Ieeffae3ac8e2960f849512cf22c51d41cadb1ecf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230261
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-02-04 16:42:59 +00:00
Jake Macdonald 3b1710506c drop defaultValue and initializer getters
Change-Id: Ifec4928946392b5140adda781a8be1c3a439915f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231525
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2022-02-04 16:33:59 +00:00
Alexander Markov 129304e09b [vm, cfe] Add an option to include extra source files into kernel compilation
This change adds --source option to kernel compilers (front-end server
and gen_kernel). This option instructs compiler to include extra source
files into compilation even if they are not referenced from main
library.

TEST=Added test cases to pkg/frontend_server/test/frontend_server_test.dart
and pkg/vm/test/kernel_front_end_test.dart

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

Change-Id: If3d71538751e9ccfa8c82a5685d810cf811e021c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231334
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-02-04 15:23:39 +00:00
Martin Kustermann ddcd028cde [vm] Avoid expensive runtime function type checks in Future implementation
The `_FutureListener.callback` field is used for multiple purposes
(possibly to save memory by avoiding additional fields) so it cannot
have a specific function type.

This causes the `Function?` typed `_FutureListener.callback` field to be
casted to proper function types such as `T Function(S)`.
=> Those runtime type checks are very expensive.

To avoid introducing more fields we use an `unsafeCast<T>()` for those
casts, since the implementation guarantees they are going to suceed.

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

TEST=ci

Change-Id: I6f0cc87600462c8ca5baceeb511ce8a06c61237e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230240
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-02-04 14:19:22 +00:00
Johnni Winther 860f7c532d [cfe] Add supported for constructors, fields and methods in ClassIntrospector
This adds the initial support for `constructorsOf`, `fieldsOf` and
`methodsOf` in the `ClassIntrospector` implementation. Currently only
source classes are supported.

Change-Id: I586b37b3dc2f93518bc93b908c0468286034b651
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231480
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-02-04 12:48:22 +00:00
Jens Johansen 287ae321a2 [CFE] Experiment with benchmarking
Run as for instance
```
pkg/front_end/tool/fasta -Dbenchmark=true -Diterations=3 compile pkg/compiler/bin/dart2js.dart
```

This will set benchmarking to true, do 3 iterations and eventually print
the benchmarking data as json. That can then be pasted into the attempted
visualizer.

This is a first stab, and might be replaced by something else down the line.

Change-Id: I8cb3a6bcf8717adf089d25a0fb432cb0b286aaa6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231441
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-02-04 12:32:59 +00:00
Joshua Litt efe573401d [dart2js] Merge CommonElementsImpl into CommonElements.
Change-Id: I35fae9cd7e97f3782b8c091b7524a10388d57aff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231531
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-02-04 02:36:06 +00:00
Siva Annamalai 2e731c540a Revert "[tools] Replace the Chromium binary size tool, which no longer works."
This reverts commit e32d98cd06.

Reason for revert: Dart rolls into the engine are failing because there are references to run_binary_size_analysis in the "Upload artifacts android-arm64-release" step of the build

Original change's description:
> [tools] Replace the Chromium binary size tool, which no longer works.
>
> Change-Id: Id84717e21a129a392d3bc4e9b4cce84dfb4771e1
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231066
> Reviewed-by: Ben Konyi <bkonyi@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Ibfbdf1e0a970ad7fae9ec1d39d24722647b38730
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231600
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2022-02-04 02:11:06 +00:00
Jason Simmons 779c28db7a [ DDS ] Fix a null safety error in memory_profile.dart
See https://github.com/flutter/flutter/issues/97588

Bug: 97588
Change-Id: I95fc1b50b936b7d15d674cc7e1c6908975989d47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231533
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-02-04 01:11:46 +00:00
Brian Wilkerson a4b3b8edec Add an assist to convert a normal parameter to a super initializing parameter
Change-Id: Icf5d44a3a155e67f76165eca711094d368cdca64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231520
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-02-04 01:03:36 +00:00
Stephen Adams be5198d524 [benchmarks] Add benchmark for basic collection Iterables
Change-Id: Ic4a85ed10fbb1ac789433a2347688f89c44b1654
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231186
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-02-04 00:30:56 +00:00
Konstantin Shcheglov 206e46a011 Test for enum values evaluation.
Change-Id: Ib4d120530a44d099d90e674930f94e7af08371f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231534
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-04 00:18:56 +00:00
Ryan Macnak 172dad5375 [vm] Fix double and mint to inherit the PostLoad for instances.
Cf. ab3aab760e.

TEST=ci, aot
Change-Id: Ia1d0b5776d9714bde94f3372824f94dd70a7ae23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231532
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-04 00:10:47 +00:00
Konstantin Shcheglov 1e66a8a079 Report more hierarchy diagnostics for enums.
Change-Id: If2c4ef3604fadfaa6d3d5af992f61a6a819a5b01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231528
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-03 23:39:26 +00:00
Konstantin Shcheglov ddff5ac88c Tests for completion in NamedExpression.
Change-Id: I5a7ba57a1279797f7e625890a64c42091708f60e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-03 22:24:16 +00:00
Ryan Macnak 33a1117d62 [vm] Add missing opt-out of C instructions to vm/cc/LoadWordUnsigned_0.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/38587
Change-Id: I15460a970522044b50f98922fad559d26c5813ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231524
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-03 21:52:56 +00:00
Michael Thomsen e69217fe28 Add CVE-2022-0451 to changelog
Change-Id: I6fffab997fbd1b63c54cfc883e10280c97a6366a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231560
Auto-Submit: Michael Thomsen <mit@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-02-03 21:25:39 +00:00
Joshua Litt 58e577da15 [dart2js] Move common_elements.dart to common/elements.dart.
Change-Id: Idaed02bb747670413f63e7f7b0797eb591e12f57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231523
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-02-03 21:21:39 +00:00
Brian Wilkerson 17422f82b2 Remove an unnecessary shared name from a message
Change-Id: I0569bd99620f2b276f9cc1510a4641bbe0cb7182
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231522
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-02-03 21:18:48 +00:00