Commit graph

88841 commits

Author SHA1 Message Date
Ömer Sinan Ağacan
a1a942f960 [kernel] Remove references to DispatchCategory
DispatchCategory was removed in 74cf86cb.

Change-Id: Id5fa7710d7cd68d6004360bee90ac342c5f90583
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273400
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-12-02 18:19:36 +00:00
Ryan Macnak
393451a37a [test_runner] Extend the --rr option to include run_vm_tests and gen_snapshot.
Change-Id: I3e1a950e9fb9d25bbade60c9fe3577e5dbcd6f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272862
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-12-02 18:16:12 +00:00
Brian Wilkerson
edb66fe3bb Capture the prefix for references in the search index, take 2
Change-Id: I600dd7c064ce9779251d043305becd4a8203bbc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271802
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-12-02 18:00:59 +00:00
Konstantin Shcheglov
46bffdabb1 Test logical-and in variable declaration, report REFUTABLE_PATTERN_IN_IRREFUTABLE_CONTEXT.
Change-Id: I7fcffea3b591fbe3a181a8bb8a8a461d18ec3d64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273340
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-12-02 17:53:19 +00:00
Konstantin Shcheglov
cdf5aa216e Fix rewrite tests after issue 50591 fixed.
Change-Id: Ic730d69ea5f6f309aa27e785b52d5f42d1186041
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273461
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-12-02 17:52:56 +00:00
Sam Rawlins
987c7503d1 Move DAS tutorial dir, and add light mode icons
The tutorial doc was mistakenly _not_ in the doc/ directory.

The icons show up as way too big, so I use inline HTML to specify
their width, so that they look good inline.

I add light mode icons, and use GitHub (and dartdoc)'s support for
switching between light mode and dark mode images.
https://www.stefanjudis.com/notes/how-to-define-dark-light-mode-images-in-github-markdown/

Change-Id: I1a368bfc6628adf941ba5e7a752317f9757d2538
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273460
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-12-02 17:16:08 +00:00
Ryan Macnak
16149782ef [test] Make less memory be gated by finalization in splay_dart_finalizer_test.dart.
When the heap limit is reached, directly unreachable objects are reclaimed but objects that will be unreachable after a finalization are not, and there needs to be enough headroom between opportunities for finalizers to run (returning to the event loop).

So only do the finalization thing with the upper, high-mutation part of the splay tree and remove it from the lower, write-once part. The high-mutation part is what's more interesting for GC stress testing.

Bug: https://github.com/dart-lang/sdk/issues/50597
Change-Id: Id02b38b0ac1e9bb640954ef1b686ce3eef8370af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273300
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-12-02 17:04:38 +00:00
Paul Berry
e9a1248fc2 Add parser support for patterns in for-in statements and collection elements.
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I9eda03c1501cf3164cfb09cf9084576a5d1141cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273122
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-02 15:22:38 +00:00
Jens Johansen
ff87b5ea8e [CFE] Replace 'first' with 'roots'
Before we could get into a situation where we didn't produce the entire
class hierarchy when we loaded from dill even though we set up the
entry points correctly.
This might not be perfect, but seems better.

Change-Id: Ifc56930da7ccad52e96ae32d6a8ab509421b37b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273381
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-12-02 15:18:27 +00:00
Paul Berry
c381425bd3 Parser: additional fixes to mayParseFunctionExpressions for patterns.
Expressions can also occur in patterns, either after an equality or
relational operator (e.g. `== e`), or after `const` (though what's
allowed after `const` is heavily restricted).  We need to make sure
that the expression parser doesn't greedily treat `=>` as introducing
a function expression when parsing these constructs inside a switch
expression.

But it's ok to allow function expressions inside list patterns, map
patterns, parenthesized patterns, and in the argument part of object
patterns.  (These will be rejected by a later stage of analysis
because expressions inside of patterns must be const, and a function
expression can't be const.  But the parser should still accept them so
that we can give useful error messages).

Fixes #50591.

Bug: https://github.com/dart-lang/sdk/issues/50591
Change-Id: I828555782f5bc8cb8aae8a3948849b7a75bdec57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273286
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-02 15:04:09 +00:00
Paul Berry
882941caf4 _fe_analyzer_shared: add support for rest patterns with subpatterns in maps.
The parser now handles maps that contain rest patterns with
subpatterns (e.g. `{'foo': _, ...var rest}`).  Even though this is
invalid Dart, it still makes sense for the parser to handle it so that
we can generate higher quality error messages.

The shared type analyzer now generates an error,
`restPatternWithSubPatternInMap`, if it encounters this error
condition.

Change-Id: I7f447bde28e646593aa432e3e5ad1f5e415bdd30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273283
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-12-02 13:50:38 +00:00
Johnni Winther
999c9b5e19 [cfe] Add (rudimentary) subtype implementation for ViewType
Change-Id: I7b102de842a828bb2c49b347d045d5919a4a5ae5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273241
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-02 11:17:34 +00:00
Jens Johansen
8cc984cd45 [analyzer] More timings and keep track of number of invocations
Before we might get something that looks like this:
```
(name: request, elapsed: 0:00:00.732983, elapsedSelf: 0:00:00.002428)
  (name: requireResolvedUnit, elapsed: 0:00:00.037635, elapsedSelf: 0:00:00.037635)
  (name: _getImplementations, elapsed: 0:00:00.692920, elapsedSelf: 0:00:00.000135)
    (name: searchAllSubtypes, elapsed: 0:00:00.691494, elapsedSelf: 0:00:00.691494)
    (name: filter and get location, elapsed: 0:00:00.001291, elapsedSelf: 0:00:00.001291)
```

With this CL we get this:
```
(name: request, count: 1, elapsed: 0:00:00.739592, elapsedSelf: 0:00:00.008764)
  (name: requireResolvedUnit, count: 1, elapsed: 0:00:00.104381, elapsedSelf: 0:00:00.104381)
  (name: _getImplementations, count: 1, elapsed: 0:00:00.626447, elapsedSelf: 0:00:00.000350)
    (name: searchAllSubtypes, count: 1, elapsed: 0:00:00.624650, elapsedSelf: 0:00:00.001226)
      (name: _searchDirectSubtypes, count: 428, elapsed: 0:00:00.623424, elapsedSelf: 0:00:00.023618)
        (name: discoverAvailableFiles, count: 8, elapsed: 0:00:00.000422, elapsedSelf: 0:00:00.000422)
        (name: subTypes, count: 3424, elapsed: 0:00:00.599384, elapsedSelf: 0:00:00.599384)
    (name: filter and get location, count: 1, elapsed: 0:00:00.001447, elapsedSelf: 0:00:00.001447)
```

Change-Id: Ia6ff3a55d7d0467b41a036ecdfb86f7e7b436b55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272622
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-12-02 08:58:23 +00:00
Johnni Winther
8bda08227d [cfe] Handle access to 'this' and parameters in view instance methods
Change-Id: I033ba603cb9f289e3ab4b39977b68e0c4641c61b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273182
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-02 08:40:26 +00:00
Sam Rawlins
14d553ad9d Add a tutorial for collecting instrumentation, and analyzer diagnostics
Change-Id: Icdf8480cf9954b6181bed320ccc1764055bd6640
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273301
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-12-02 07:31:18 +00:00
Nate Biggs
e48df2f7f3 [dart2js] Carry library load priorty through to script tag creation.
Change-Id: Ie05b5ffe0f2e1638faf8b784a2e8c5535ec0d76a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272760
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-12-02 05:19:53 +00:00
Konstantin Shcheglov
73721f7654 Report PATTERN_TYPE_MISMATCH_IN_IRREFUTABLE_CONTEXT
Mostly to don't crash when running co19 tests.

Change-Id: I62838d04872642b2e3a9ed01a1be120aec1c0608
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273081
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-12-02 02:58:16 +00:00
Nate Biggs
3daee0282b [dart2js] Fix inferrer bug in handling exit conditions in try/catch/finally.
This is showing up in places like here where we are inferring `JSObject.toString` to return `String?`:
https://github.com/dart-lang/sdk/blob/main/sdk/lib/_internal/js_runtime/lib/js_patch.dart#L204

Change-Id: Ie15c6a06cd1e0f9ead87b4a9ceaa949bdcbce989
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269040
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-12-01 22:16:35 +00:00
Oleh Prypin
328c261397 Expand RemoveReturnedValue fix to turn => null into {}
This is targeted at the lint `avoid_returning_null_for_void` which already complains about expression function bodies but the fix doesn't do anything for them.

Change-Id: I14f3d7659301edae08482d9ffa6b72b483737e59
Bug: https://github.com/dart-lang/sdk/issues/45920
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Oleh Prypin <oprypin@google.com>
Commit-Queue: Oleh Prypin <oprypin@google.com>
2022-12-01 22:04:48 +00:00
Paul Berry
599911d197 Add parser support for for (var pattern = expression; ...; ...)
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I5f07b848ba06be403e56538a4cc64f6de51bd668
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273005
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-01 21:49:47 +00:00
Paul Berry
9221f34648 Update analyzer and CFE unit tests to use && and || in patterns.
In a follow-up CL I'll remove support for logical-and and logical-or
patterns using `&` and `|`.

Bug: https://github.com/dart-lang/language/issues/2501
Change-Id: I2627cd9999ac703dd0ab63cd6be3d0d883860674
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272920
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-12-01 19:41:43 +00:00
Paul Berry
b0c705e4bd Set mayParseFunctionExpressions properly during switch expression parsing.
We need to prohibit function expressions during guard clauses in
switch expressions, otherwise the `=>` might be misinterpreted.

Fixes #50591.

Bug: https://github.com/dart-lang/sdk/issues/50591, https://github.com/dart-lang/language/issues/2672
Change-Id: Ie5703ac7049557798b19778281429e8a591cf09f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273020
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-01 18:57:33 +00:00
Konstantin Shcheglov
1f42c2a6f3 Remove 'final' from pattern variables fields.
Bug: https://buganizer.corp.google.com/issues/260986270
Change-Id: I0afc38a49a6714b42304a51cbb7869caff278d86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273260
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-12-01 18:28:28 +00:00
Mark Zhou
4a5eff63d7 [ddc] Emitting nullability wrappers for records
Change-Id: I032e5cf915a70b44559a8269e22ab2dbedb9726a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272740
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2022-12-01 18:04:18 +00:00
Devon Carew
99026df0f8 [deps] update package:webdriver
Change-Id: Iaa875c46f1425160063b5cc5f44e87a60c5e61dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273003
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2022-12-01 17:42:21 +00:00
Danny Tuppeny
a7baf9309f [analysis_server] Ensure plugin protocol classes only use types valid for Isolate.send()
Fixes https://github.com/dart-lang/sdk/issues/50594.

Change-Id: I5550239dbce4a1ed7fbd844dd53642989289c899
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-12-01 16:57:56 +00:00
Tess Strickland
5fd3d4b810 [gardening] Fix debug build for ARM64C.
4-byte ldar zero extends, so can just use kObjectBytes here.

TEST=ci

Change-Id: I3b3aa792350100fd24c474c85d8ea1613c9f197b
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273242
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-12-01 16:55:52 +00:00
Ömer Sinan Ağacan
ddbc111067 [dart2wasm] Fix range checks in codeUnitAt methods
New passing tests:

- co19/LibTest/core/String/codeUnitAt_A02_t01
- co19/LibTest/core/String/operator_subscript_A02_t01
- corelib/string_codeunits_test
- language/optimize/string_charat_test
- language/string/charcode_test

Change-Id: I27fe1bc080be8d70d4a33763cbfb737e6c837a50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273143
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-12-01 16:19:10 +00:00
Sigurd Meldgaard
258598eeb6 Bump pub to 21aa23f148a428ae4dd97a27ecc70b08c1328089
Changes:
```
> git log --format="%C(auto) %h %s" 4fd2051..21aa23f
 https://dart.googlesource.com/pub.git/+/21aa23f1 Revert "Create output folder if it doesn't exist in the precompiler (#3676)" (#3677)
 https://dart.googlesource.com/pub.git/+/04f7bce8 Don't consider resolution outdated in dev-releases (#3678)
 https://dart.googlesource.com/pub.git/+/74473e12 Create output folder if it doesn't exist in the precompiler (#3676)
 https://dart.googlesource.com/pub.git/+/5bfd68b1 Avoid .incremental.dill.incremental.dill in temporary file name (#3675)
 https://dart.googlesource.com/pub.git/+/c3870bc1 Unskip test (#3671)

```

Diff: https://dart.googlesource.com/pub.git/+/4fd2051bb8060ea2f2e02b13dfeb2f793d197994..21aa23f148a428ae4dd97a27ecc70b08c1328089/
Change-Id: Ie5060563cc3f96b0bc52e542f7a7b19d17fefd8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273223
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2022-12-01 16:13:50 +00:00
Ilya Yanok
9378d5ca21 Add hints for Angular constructor arguments
The rules are:

1. Arguments annotated with `@Optional` must be nullable (that part
   worked before this change).
2. Arguments annotated with `@Attribute` must be nullable if it's
   a constructor of a component (`@Attribute` can also appear on
   arguments of directives constructors, it doesn't provide any signal
   in the latter case).
3. Arguments of constructors of components or `@Injectable` classes,
   that have neither `@Optional` nor `@Attribute`, must be non-nullable.

Tested:
  Added new test cases to `api_test.dart`
Change-Id: I0f06a128e0f6ec49d39cc6bf025fe1796938f1f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272900
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
2022-12-01 15:37:33 +00:00
Vyacheslav Egorov
c704e11ee2 [vm/api] Introduce Dart_WriteHeapSnapshot API
Allows embedders to programmatically request heap snapshot from a
running isolate group instead of relying on a vm-service or hidden
internal Dart APIs

Additionally we allow to include snapshot writing functionality into
PRODUCT builds using DART_ENABLE_HEAP_SNAPSHOT_WRITER define.

TEST=vm/cc/DartAPI_WriteHeapSnapshot

Bug: b/259115846
Change-Id: Ic3ef76e5fb9adcf8f23a1959f5238742b64ecde2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273181
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-12-01 14:38:44 +00:00
Michael Thomsen
7ebe699d85 [co19] Roll co19_2 to 9f28a5f173bd39c9b97a691e7abcba6fdf80b47b
2022-12-01 sgrekhov22@gmail.com Fixes dart-lang/co19#1565. FallThroughError tests removed (dart-lang/co19#1567)
2022-11-14 sgrekhov22@gmail.com dart-lang/co19#1540. Tests error expectations updated (dart-lang/co19#1544)

Change-Id: I4f4904e3c1e002230f4c47c5236fe0f93b18fc8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273220
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2022-12-01 14:35:25 +00:00
Kevin Chisholm
3e968e5fc4 update changelog on main to include dart 2.18.5 hotfix notes.
Change-Id: Ic3cfe61db296d2ed1500fc0756ee3f6f29832f07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272880
Commit-Queue: Kevin Chisholm <kevinjchisholm@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2022-12-01 13:54:43 +00:00
Jens Johansen
89b6ba91ba [vm] tools/heapsnapshot has download util
Change-Id: I11e8a750a3a40d3fbc2733f4120c50b25194cc82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273183
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-12-01 13:25:47 +00:00
Johnni Winther
05c0f5ca9a [cfe] Add synthesized this to view instance methods
+ generate getters.

Change-Id: Id873e8e6c3f8d64a845b211f18616d807302f180
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273180
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-01 11:53:17 +00:00
Daco Harkes
55b4542dab [pkg/vm] Native assets validator and synthesizer
Validates a yaml format encoding a native asset mapping, and
synthesizes a component containing a pragma with this information.

Yaml example:

```
format-version: [1,0,0]
native-assets:
  linux_x64:
    'package:foo/foo.dart': ['absolute', '/path/to/libfoo.so']
```

Generated format example:

```
@pragma('vm:ffi:native-assets': {
  'linux_x64' : {
     'package:foo/foo.dart': ['absolute', '/path/to/libfoo.so']
  }
})
library;
```

TEST=pkg/vm/test/native_assets/synthesizer_test.dart
TEST=pkg/vm/test/native_assets/validator_test.dart

In a follow-up CL, we will consume the yaml from `gen_kernel`
and consume the pragma in the VM for `@FfiNative`s.

Bug: https://github.com/dart-lang/sdk/issues/49803
Change-Id: Ie8d93b38ff4406ef7485e5513807e89b2772164b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272660
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-12-01 11:33:27 +00:00
Martin Kustermann
e7bd696ce0 [vm] Update CPU register comments on runtime/vm/constants_<arch>.h
TEST=ci

Change-Id: Ibc2225314a18818ac14c8b3047c369017e524210
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273140
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2022-12-01 10:24:05 +00:00
Tess Strickland
49f998dc31 [vm/compiler] Handle hash caches in the InstantiateTypeArguments stubs.
Lower the threshold for converting from a linear to a hash-based cache
on most architectures from 500 to 10.

Due to register pressure, the InstantiateTypeArguments stub on IA32
continues to go to the runtime for hash caches, and so we do not
lower the threshold for converting to a hash-based cache there.

The following are benchmark results for those benchmark that use enough
Instantiations to trigger the use of hash-based caches. In the following
tables, "Results 1" denotes the benchmark results from only this change,
whereas "Results 2" include from comparing to the results prior to
4f925105cf, when only linear caches were used.

Dart AOT:

* InstantiateTypeArguments.Instantiate100

Arch   | CPU            | Results 1 | Results 2
-------|----------------|-----------------------
ARM    | Odroid-C2      |   382.8%  |   381.5%
ARM    | Raspberry Pi 4 |   486.7%  |   449.2%
ARM64  | Odroid-C2      |   328.1%  |   372.8%
ARM64  | Raspberry Pi 4 |  1283%    |  1281%
ARM64C | Raspberry Pi 4 |  2353%    |  2811%
X64    | Intel Xeon     |   568.7%  |   584.9%

* InstantiateTypeArguments.Instantiate1000

Arch   | CPU            | Results 1  | Results 2
-------|----------------|------------------------
ARM    | Odroid-C2      |   743.7%   |  3821%
ARM    | Raspberry Pi 4 |   486.7%   |  3218%
ARM64  | Odroid-C2      |   584.7%   |  3222%
ARM64  | Raspberry Pi 4 |   430.7%   |  8172%
ARM64C | Raspberry Pi 4 |   491.4%   | 16699%
X64    | Intel Xeon     |   954.1%   |  5528%


Dart JIT:

* InstantiateTypeArguments.Instantiate100

Arch   | CPU            | Results 1 | Results 2
-------|----------------|-----------------------
ARM    | Raspberry Pi 4 |   315.7%  |   295.1%
ARM64  | Raspberry Pi 4 |  1070%    |  1058%
ARM64C | Raspberry Pi 4 |  1769%    |  2095%
X64    | Intel Xeon     |   507.4%  |   496.2%

* InstantiateTypeArguments.Instantiate1000

Arch   | CPU            | Results 1 | Results 2
-------|----------------|-----------------------
ARM    | Raspberry Pi 4 |   565.2%  |  2550%
ARM64  | Raspberry Pi 4 |   406.8%  |  7375%
ARM64C | Raspberry Pi 4 |   379.6%  | 12996%
X64    | Intel Xeon     |   807.9%  |  4459%

During work on this change, an issue was found where cache lookups
in the stub on ARM64C always failed and went to runtime, even with
the old linear-only caches, hence the much larger performance gains
in those rows above.

TEST=vm/cc/TypeArguments_Cache_{Some,Many}Instantiations

Fixes: https://github.com/dart-lang/sdk/issues/48344
Change-Id: I3d29566ba0582502954c9fc59626ceb8fd40317a
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-nnbd-linux-release-simarm_x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try,vm-kernel-precomp-nnbd-linux-debug-simriscv64-try,vm-kernel-precomp-tsan-linux-release-x64-try,vm-kernel-tsan-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-nnbd-linux-debug-simriscv64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-linux-release-ia32-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-ia32-try,vm-kernel-nnbd-mac-release-arm64-try,vm-kernel-linux-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270702
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-12-01 10:15:58 +00:00
Johnni Winther
5994c04ef4 [cfe] Initial support for view methods
TEST=pkg/front_end/testcases/views/procedures.dart

Change-Id: I62c26183d8160a3841b74381a256d0a4b5bb9365
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272624
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-01 09:54:40 +00:00
Johnni Winther
b7aa26710a [cfe] Remove the need for transform/visitChildren on internal nodes
These were previously only needed to support calling 'replaceWith' on
TypeAliasedConstructorInvocation, TypeAliasedFactoryInvocation and
FactoryConstructorInvocation. Instead of calling 'replaceWith' on the
nodes themselves, we call 'replaceChild' on the parent, if present.

The 'replaceChild' method on the internal node is overridden to be a
no-op. Since all these internal nodes are not supported in the
external AST and therefore must be replaced during inference, these
can only be found in subtrees that have been removed, typically in
erroneous code, and it is therefore safe to make the replacement a
no-op.

Change-Id: I597d955075dfae51b04bce08b1d499c90dd4d673
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272621
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-01 08:09:08 +00:00
Liam Appelbe
32bfc38a20 Revert "[vm] Skip filtered class earlier in source report."
This reverts commit 86233b55bc.

Reason for revert: https://github.com/flutter/flutter/issues/115719

Original change's description:
> [vm] Skip filtered class earlier in source report.
>
> The main benefit of this is that it avoids cls.EnsureIsFinalized for
> skipped classes. In some cases (eg very small tests with dependencies
> on very large 3rd party packages, such as flutter) this can reduce
> coverage collection time by 20%.
>
> Change-Id: Id756af7f2d2ecdd07a5d1d05a400cea4de7ec408
> Bug: https://github.com/flutter/flutter/issues/100751
> TEST=CI
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266640
> Commit-Queue: Liam Appelbe <liama@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

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

Bug: https://github.com/flutter/flutter/issues/100751
Change-Id: Ie1e9f29fa6e3966f25040aebad8cb1d55b50a745
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273100
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-12-01 02:54:18 +00:00
Konstantin Shcheglov
e89d93f48c Support for 'final' in PatternVariableDeclarationImpl.
Change-Id: I0ea3952e502f5e1ce4bfea412bb9c0a4471da6f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273008
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-12-01 01:59:09 +00:00
Siva Annamalai
be8e94162e Revert "[vm, gc] Assert the whole object is in to-space, not just its beginning."
This reverts commit c870932e45.

Reason for revert: We have a build failure on arm64c
../../third_party/dart/runtime/vm/virtual_memory_compressed.cc:143:35: error: out-of-line definition of 'Contains' does not match any declaration in 'dart::VirtualMemoryCompressedHeap'

TEST=ci

Original change's description:
> [vm, gc] Assert the whole object is in to-space, not just its beginning.
>
> TEST=ci
> Bug: https://github.com/dart-lang/sdk/issues/50564
> Change-Id: I60e7637600a1a7a99d546e8c674901175a119ba5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272863
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

TBR=bkonyi@google.com,rmacnak@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I62c83c8e8fa5b263bdc53d2afcf27b1fdd07c087
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/50564
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273060
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Auto-Submit: Siva Annamalai <asiva@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-12-01 01:35:26 +00:00
Kallen Tu
1c0cb35a87 [cfe] Allow mixin 'on' behaviour for sealed supertypes.
Implements the behaviour discussed in dart-lang/language#2600. All other mixin application or implementing behaviour for sealed families should be unaffected.

Change-Id: I95577d8b2bc69e6c1a365ec43fb156f5d5d9a259
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272461
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-12-01 01:18:40 +00:00
Ryan Macnak
1ac82e6463 [vm] Fix uninitialized tail elements from Array::Grow.
These elements were unintialized in the uncommon case that the new array was large enough to get its own page.

Broken in 188dfbd52b.

TEST=ci
Change-Id: I8b07da992aa11eed9c80b6eac3a7fd6716cb3abc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272961
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-11-30 23:33:31 +00:00
pq
d5c1158b7b pull unrelated_type_equality_checks fix
See: https://github.com/dart-lang/linter/issues/3868

(This should also unblock the fixnum internal roll.)

Change-Id: I9af710b075c6280ee55153c559f91ac6a0b21f3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273007
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-11-30 23:31:45 +00:00
Ryan Macnak
26b9cbe36b [vm, compiler] Factor out PrepareLargeOffset for RISC-V.
Compare ARM64.

TEST=ci
Change-Id: If77e056d31a4f787a2874233910b40f2eb64eeda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273006
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-11-30 23:25:28 +00:00
Paul Berry
43c68f90ed Add parser support for && and || in patterns.
Previously, the implementation used `&` and `|` for logical-and and
logical-or patterns.  That is being changed to `&&` and `||`.

As a first step, we add support for `&&` and `||`, without removing
support for `&` and `|`.  In a follow-up CL I'll update existing
tests, and then after a day or two I'll remove support for `&` and
`|`.  This should avoid conflicts with other patterns work that's in
progress.

Bug: https://github.com/dart-lang/language/issues/2501
Change-Id: I2d5dc158248160d84e9f0889f5de390b999cbc7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272861
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-11-30 23:16:45 +00:00
Kallen Tu
1d9257ad02 [analyzer] Add sealed modifier to ClassOrMixinElementImpl and source visitor.
Add sealed modifier to element builder summaries and to_source_visitor.
Enable sealed_class experiement in tests to test the changes.

Change-Id: I2929a5a38360c73abfcdb26d1e9b786058ea9335
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272351
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-11-30 22:58:58 +00:00
Ryan Macnak
c870932e45 [vm, gc] Assert the whole object is in to-space, not just its beginning.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/50564
Change-Id: I60e7637600a1a7a99d546e8c674901175a119ba5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272863
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-11-30 22:42:16 +00:00