Commit graph

91262 commits

Author SHA1 Message Date
Daco Harkes 4cb4d5d036 [pkgs/native] MacOS support + CI
Pulls in a new versions of https://github.com/dart-lang/native with
support for MacOS and enables the tests for these on the MacOS pkg
bots.

Fixes the clang paths in pkg/test_runner/lib/src/options.dart for
mac and win.

Since a relatively recent XCode is available on the bots, use XCode
to build rather than the clang from DEPS.

test/native_toolchain/recognizer_test was refactored to only
run tests for tools installed on the host. So it's unskipped.

Bug: https://github.com/dart-lang/sdk/issues/50565
Change-Id: I3804b01da7a4e74d3e49a1b2ba3c8425132417d7
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296180
Reviewed-by: Liam Appelbe <liama@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-04-20 14:17:39 +00:00
Alexander Thomas 4e8b58ceb9 [infra] Update checked-in SDKs to 3.0.0-417.2.beta
Change-Id: Ic8667dd0be2a03c8bb57424904c545b4ec335ccc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296540
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Commit-Queue: William Hesse <whesse@google.com>
Auto-Submit: Alexander Thomas <athom@google.com>
2023-04-20 09:20:10 +00:00
Konstantin Shcheglov 1df4267a7e Issue 47562. Suggest only *.dart files in 'package:' URIs.
Bug: https://github.com/dart-lang/sdk/issues/47562
Change-Id: I4f575bca1377b8f5065d4c4ff95f326b6a2a168b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296442
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-04-20 01:28:53 +00:00
Brian Wilkerson 2da2520bd6 Stop suggesting methods in object patterns
Fixes: 52058
Change-Id: I031fcd2b48975729cca48f640c3d86f5d2cfc0b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296420
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-04-20 00:52:20 +00:00
Sam Rawlins 398a3d377c Bump linter to 82e7147cee2a62b881bcf9cc26f06e531510a92d
This bump brings in two false-negative fixes:

* 4c2af04303
* 82e7147cee

These have been tested in google3 and are clean.

Change-Id: I8cba338b91b4b5a383506216b7362352132b48f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296382
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-04-20 00:40:17 +00:00
Stephen Adams b3fbb59d60 [dart2js] Construct _SyncStarIterator outside of transformed code
In the old scheme, sync* generators would have an entry and a
body. The entry contained typed checks and the body had injected code
to call a 'factory' helper method to construct the _SyncStarIterable.
It was necessary to pass the element type to the body to be passed to
the factory.

    int foo(T a, T b) sync* {yield f(a); yield f(b);}

is compiled to something like

    foo(a, b) {
      T._as(a); T._as(b);
      return foo$body(a, b, type$.int);
    }
    foo$body(a, b, R) {
      return _syncStarFactory(function(){BODY}, R);
    }

When type checks were disabled (`-O3`), it was often possible to
generate a single function by merging these as there were no checks.

The new scheme keeps the entry and body separate, and constructs the
_SyncStarIterable in the entry:

    foo(a, b) {
      T._as(a); T._as(b);
      return _syncStarFactory(foo$body(a, b), type$.int);
    }
    foo$body(a, b) {
      return function(){BODY};
    }

This keeps the typed Dart 'level' distinct from the untyped JavaScript
level.

The new scheme is a bit more verbose but has the advantage that the
call to `_syncStarFactory` can be inlined and optimized.

Change-Id: I13802d9c9eefd9323841670d059b75a81569d6cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296140
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-04-20 00:38:10 +00:00
pq 76f76b05bb use existing CorrectionUtils instance
Change-Id: Ia9c20fb70cd665b6c4a024c2f83d6e7ca5b0220a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296422
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-04-20 00:05:02 +00:00
Robert Nystrom 27ef9f0762 Migrate "r" directory language tests off @compile-error.
The "@compile-error" comment is an old not-great way of defining static
error tests.

See: https://github.com/dart-lang/sdk/issues/45634
Change-Id: I5dd012381390ef2c00d674308db3fe099ecc6a4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296423
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2023-04-19 23:35:16 +00:00
Konstantin Shcheglov 6dcca7824a Produce InvertIfStatement only when both then/else branches are Block(s).
Other cases are outliers and nobody actually want it there.
Specifically, the way it works for if-then-elseIf does not make sense.

Change-Id: I8d16e689e057fa79ecfaa2c3155086cf36f1954c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296406
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-04-19 23:21:36 +00:00
Robert Nystrom c305279e0d Migrate "g" - "i" directory language tests off @compile-error.
The "@compile-error" comment is an old not-great way of defining static
error tests.

See: https://github.com/dart-lang/sdk/issues/45634
Change-Id: I65c446e00b25239960d421489e6cf87a88d875d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296408
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2023-04-19 22:09:18 +00:00
Konstantin Shcheglov 1d718fc7e9 Issue 52051. Fix a crash, add a branch for RecordLiteral in _argumentListContext()
Bug: https://github.com/dart-lang/sdk/issues/52051
Change-Id: I2c8c2271cc51fbe1c013c6ac324052c347dd379b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296361
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-04-19 22:07:59 +00:00
Konstantin Shcheglov 6a50756f98 Remove 'Introduce new local with tested type' assist.
If the type checked expression is a local variable, it is useless.
The variable is already type promoted.

If the type checked expression is not a local variable, it produces
code that has a compile-time error because of downcard, which does
not work anymore with null safety.

Even generating `final x = expression as MyType` would be bad IMHO.
Unproven type casts are dangerous.
What the user should do, it to extract into a local variable, and
type check it. Or use patterns. But this is a different story.

Change-Id: Ifd3dc71894d17c5a07b7f1389a8143363697eda2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296384
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-04-19 21:53:09 +00:00
DEPS Autoroller 4a4163f703 Roll gn from ffeea1b1fd07 to 5a004f9427a0
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/gn-dart-sdk
Please CC dart-ecosystem-gardener@grotations.appspotmail.com,dart-engprod@google.com on the revert to ensure that a human
is aware of the problem.

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

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

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

Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try;luci.dart.try:dart-sdk-mac-try;luci.dart.try:dart-sdk-mac-arm64-try;luci.dart.try:dart-sdk-win-try
Change-Id: Ib61c36726ad2d0b1c3557df99dc7d446c18e0be2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296240
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-04-19 21:39:47 +00:00
Nicholas Shahan 2a56d8ba84 [ddc] Fix RecordImpl instanceof test
The `instanceof` operator needs a reference to the JavaScript class
instead of the Dart Type. This avoids an issue when changing the
type representation in the new runtime type system where the two
are no longer interchangeable.

Update the parameter name for `_jsInstanceof()` which which was
probably the remnants of a copy paste.

Change-Id: I1d3fcf1915fb3e189ad7f3e130e101009ee50381
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296341
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-04-19 21:32:33 +00:00
Stephen Adams 0698c194ae [dart2js] Fix impact test by adding @dart=2.19
Rerun with `-g` to update stale impacts.

Change-Id: I6aa8140c41d4478fa12c006e94f6a3618bfb3d17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296404
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-04-19 21:09:57 +00:00
Srujan Gaddam 91f2d6a621 [dart:js_interop] InlineExtensionIndex should handle multiple libraries
Since we no longer only do lowerings at the declaration site, the
InlineExtensionIndex class needs to handle libraries besides the
current library. This is because when lowering at the invocation
site, the target might not be in the current library.

Change-Id: Ifcf6cc63ce7e6f86b3408c9830e1244215598bf6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296381
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-04-19 20:18:47 +00:00
pq 4451d5d9f5 follow ups from https://dart-review.googlesource.com/c/sdk/+/296066
(The last change was prematurely merged.)

Change-Id: Idc161ef596fa43927cf7eda223635a798d3292af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296402
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-04-19 20:13:03 +00:00
Konstantin Shcheglov d84f9dca32 Ensure that ExecutableMember.returnType uses the same type parameters.
Change-Id: I72d900da7e0d6b791e7801af72961cf4c23c4fc3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296340
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-04-19 19:01:57 +00:00
pq 45ec8be7aa reference rewriting for destructured object pattern variables
I'll do some tidying up and restructuring when I add similar support for records...

Change-Id: I4124cdc5e6ecb12e54ab4570636e1f8cc9afa6c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296066
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-04-19 18:59:59 +00:00
Alexander Markov cf3e602869 [test harness] Handle non-zero exit code of a test as a test failure, not infra failure
Sometimes failing tests crash or terminate with arbitrary exit codes.
For example, MSAN can abort a test with exit code 1.
This should not be treated as an infra failure by the test harness,
and should not prevent running other tests.

Change-Id: I97450d9cfb1e117451c35ab8a8cd01074fbef8db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291304
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-04-19 17:49:22 +00:00
Lasse R.H. Nielsen b0260187e7 Remove base from StreamView.
It's not *needed* for safety or soundness, and it forces
subclasses to be `base` whether they want to or not.

Bug: https://github.com/dart-lang/async/issues/238
CoreLibraryReviewExempt: Removes a modifier, no implementation effect.
Change-Id: I72ec1ddb3b05b746c08437b0b8173c9e71673fc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296280
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2023-04-19 17:41:29 +00:00
Alexander Markov 7247a1b3b7 Reland "[vm] Avoid expanding/flattening type arguments vectors in Type objects"
This is a reland of commit 135443706b

Original change's description:
> [vm] Avoid expanding/flattening type arguments vectors in Type objects
>
> Previously, vectors of type arguments were expanded to include type
> arguments corresponding to superclasses both in the instances of
> generic classes and in Type objects (after type finalization).
> As a result, Type objects after finalization could be recursive and
> need to use extra TypeRef objects to break loops. The finalization of
> types was very complex and sometimes slow.
>
> This change simplifies the representation of Type objects: now they
> always have short type argument vectors, corresponding only to
> the type parameters of their own classes (both before and after
> finalization). Vectors of type arguments in the instances of generic
> classes are still expanded/flattened.
>
> This greatly simplifies type finalization, makes Type objects
> non-recursive and removes the need to create and handle excessive
> TypeRefs for type arguments corresponding to superclasses,
> as those type arguments are no longer included into types.
> The only remaining use of TypeRefs is for bounds of type parameters.
>
> In order to expand/flatten type arguments, new methods Type::GetInstanceTypeArguments / Class::GetInstanceTypeArguments
> are introduced. They build canonical declaration type arguments
> once (for each class), and then instantiate them as needed.
>
> There are also simple helper methods to shrink type arguments (TypeArguments::FromInstanceTypeArguments) and expand type arguments without filling type arguments corresponding to superclasses (TypeArguments::ToInstantiatorTypeArguments).
>
> Time of edge case 'regress_51960_test' 15min -> 300ms.
>
> TEST=ci, runtime/tests/vm/dart/regress_51960_test.dart
>
> Fixes https://github.com/dart-lang/sdk/issues/52022
> Fixes https://github.com/dart-lang/sdk/issues/51960
>
> Change-Id: I75b466b74698a33c0bb5e1dcbd29542e413812a1
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295060
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

TEST=runtime/tests/vm/dart/regress_b_278841863_test.dart
Fixes b/278841863.

Change-Id: Ib1e20055bfb26e1df0a077300c69f0bec7152480
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296300
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-04-19 17:25:31 +00:00
Konstantin Shcheglov ac1bdebff7 Support for converting 'if' statements with bool conditions into patterns.
Bug: https://github.com/dart-lang/sdk/issues/52068
Change-Id: I187b3e3cad66eff7a266478df0c09ffb3d642e34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296067
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-04-19 17:24:54 +00:00
Konstantin Shcheglov dc34fe9f86 Deprecate IfElement/IfStatement.condition, use 'expression'.
Change-Id: If43b4b71a21fd256ce8d1367d4b233e1cff764b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296122
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-04-19 17:17:28 +00:00
Konstantin Shcheglov ad30add7a3 Don't use PubWorkspace for 'third_party/dart' locations.
These should be treated as BlazeWorkspace.

Bug: https://buganizer.corp.google.com/issues/273584249
Change-Id: Id7bf03d14d3304eb062be0d539cfac0c282ecec6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296320
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-04-19 17:16:51 +00:00
Konstantin Shcheglov 7880fd4ce5 Remove UnwrapIfBody assist.
After using DAS with it for a few days, I find it more distracting
than useful.

Change-Id: I20da35e06958c79a6d458546937b616d45b0c909
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296281
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-04-19 16:56:43 +00:00
Joshua Litt 8158de08b2 [dart2wasm] Cleanup js interop logic a bit more.
Change-Id: Ibb814b3312c877a62351ec6f26412c84380b8359
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294700
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-04-19 16:54:15 +00:00
Daco Harkes 2847541a74 [infra] owners for third_party/pkg status files
Change-Id: I5baa813a75181f371636b44ee0b98141b641226f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296202
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-04-19 16:44:59 +00:00
Stephen Adams a6162d1ff0 [dart2js] Fix missing source location on null-check in async method
Change-Id: Idd2530b3cae582819a823132c9777086035e386a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296027
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-04-19 16:31:22 +00:00
Ryan Macnak 8a5c3d9e3d [infra] Add configurations to migrate obfuscate and stripped modes.
Change-Id: I62581c6874b211c57da61639f460685790acb40d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296021
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-04-19 16:26:59 +00:00
Robert Nystrom 105a0f30d6 Migrate standalone tests off @compile-error.
The "@compile-error" comment is an old not-great way of defining static
error tests.

Note that the behavior of the code under test here had changed
significantly, but the test didn't catch it at all because
"@compile-error" is too coarse-grained.

See: https://github.com/dart-lang/sdk/issues/45634
Change-Id: I4b6c4e1fd36770e13f7b5ca100b42b0b8b2983ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296121
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2023-04-19 14:17:39 +00:00
Danny Tuppeny 363a61d72b [dds/dap] Ignore SentinelExceptions while configuring isolates
I'm unable to reproduce this, but there are probably many reasons an isolate could go away while we're doing this async work (such as the app shutting down or a restart). If it does, we should never throw because the results of configuring an isolate are not important if the isolate has gone.

Fixes https://github.com/flutter/flutter/issues/125064

Change-Id: Idb8972a5e77109783799fed70dd8b64e3f702bf5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296201
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-04-19 14:10:57 +00:00
Alexander Markov 9cf26fc3cd [vm] Fix handling of exceptions thrown from Iterable.iterator during yield*
TEST=language/sync_star/sync_star_exception_iterator_test
Fixes https://github.com/dart-lang/sdk/issues/52083

Change-Id: I6f26189b5d5df1c1804cd6cd7a64f72bdbe55f94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295922
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-04-19 13:50:19 +00:00
Ilya Yanok 3e2d3bc77f Revert "[vm] Avoid expanding/flattening type arguments vectors in Type objects"
This reverts commit 135443706b.

Reason for revert: breaks many targets in G3, see b/278841863

Original change's description:
> [vm] Avoid expanding/flattening type arguments vectors in Type objects
>
> Previously, vectors of type arguments were expanded to include type
> arguments corresponding to superclasses both in the instances of
> generic classes and in Type objects (after type finalization).
> As a result, Type objects after finalization could be recursive and
> need to use extra TypeRef objects to break loops. The finalization of
> types was very complex and sometimes slow.
>
> This change simplifies the representation of Type objects: now they
> always have short type argument vectors, corresponding only to
> the type parameters of their own classes (both before and after
> finalization). Vectors of type arguments in the instances of generic
> classes are still expanded/flattened.
>
> This greatly simplifies type finalization, makes Type objects
> non-recursive and removes the need to create and handle excessive
> TypeRefs for type arguments corresponding to superclasses,
> as those type arguments are no longer included into types.
> The only remaining use of TypeRefs is for bounds of type parameters.
>
> In order to expand/flatten type arguments, new methods Type::GetInstanceTypeArguments / Class::GetInstanceTypeArguments
> are introduced. They build canonical declaration type arguments
> once (for each class), and then instantiate them as needed.
>
> There are also simple helper methods to shrink type arguments (TypeArguments::FromInstanceTypeArguments) and expand type arguments without filling type arguments corresponding to superclasses (TypeArguments::ToInstantiatorTypeArguments).
>
> Time of edge case 'regress_51960_test' 15min -> 300ms.
>
> TEST=ci, runtime/tests/vm/dart/regress_51960_test.dart
>
> Fixes https://github.com/dart-lang/sdk/issues/52022
> Fixes https://github.com/dart-lang/sdk/issues/51960
>
> Change-Id: I75b466b74698a33c0bb5e1dcbd29542e413812a1
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295060
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

Change-Id: If0b2077305620593b8f03ebf6c135375c4086b1a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296182
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
2023-04-19 10:51:37 +00:00
Daco Harkes 4de9396992 [gardening] Skip test printing type names in obfuscate
Closes: https://github.com/dart-lang/sdk/issues/52094
Change-Id: Iff3120ae1a2c4575958cd9699bc11510f595cc5e
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-obfuscate-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296181
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2023-04-19 10:07:39 +00:00
Martin Kustermann 779e51efc1 [vm] Remove Thread::{Enter,Exit}IsolateAsHelper
For every isolate there should be only one mutator with
a unique [Thread] object.

We change existing tests that use this functionality to instead use
`Thread::{Enter,Exit}IsolateGroupAsHelper`. It also results in a net
removal of code.

TEST=ci

Change-Id: Ic326e868a98ddedbab5b8c429252d38ea71bbf04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295940
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-04-19 09:36:41 +00:00
Martin Kustermann fb43937e20 [vm] Make Thread::IsAtSafepoint() only be true if thread is blocked at a "safe" point
During safepoint we can distinguish between

  * owner of the safepoint operation (which is running code)
  * everyone else (which are all blocked

Currently `Thread::IsAtSafepoint()` will return true for both. Since the
thread owning the safepoint operation is running, it's not actually
guaranteed that it's at "safe" point (e.g. to GC or to deopt) - it
really depends on what it's doing.

=> This CL will change it so that only actually parked threads will
have `Thread::IsAtSafepoint()`.

In order to do that we change varrious usages of `IsAtSafepoint()` to be
more precise:

  * `Thread::OwnsSafepoint()`: True if this thread owns the
    active safepoint. The thread is running.

  * `Thread::OwnsGCSafepoint()`: True if the active safepoint is a GC
    (or Deopt) safepoint and this thread owns it. The thread is running.

  * `Thread::OwnsDeoptSafepoint()`: True if the active safepoint is a
    Deopt safepoint and this thread owns it. The thread is running.

  * `Thread::CanAcquireSafepointLocks()`: True if the thread is allowed
    to acquire safepoint locks.

  * `Thread::IsAtSafepoint()`: true if this thread is parked at a
    safepoint

TEST=ci

Change-Id: I1a5a6727e84843ae79e0a344c438da19b7d6d916
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295781
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-04-19 08:47:31 +00:00
Martin Kustermann a1b7e761eb [vm] Make vm/cc/SafepointOperation_SafepointPointTest more robust
Closes https://github.com/dart-lang/sdk/issues/48716

TEST=vm/cc/SafepointOperation_SafepointPointTest

Change-Id: I03e392710fdc37da4a7c3b2c0934f4c4c71958fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295780
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-04-19 07:48:26 +00:00
Martin Kustermann abeb88a038 [vm] Refactoring to existing safepoint mechanism
This CL makes some refactorings to the current safepoint mechanism:

  * When owning safepoint level L we set current thread to be only at
    safepoint level L (not Thread::Current()->current_safepoint_level()).
    This ensures that after [WaitUntilThreadsReachedSafepointLevel] all
    other threads are actually parked.

  * When having nested safepoint scopes we increase operation count on
    the level we own and all nested levels. This will (in later CL) allow
    detection which closest scope we're in.

TEST=ci

Change-Id: Iffb2e9f4eea817a381acbd7a771bc75f5a89877b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295541
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-04-19 07:29:51 +00:00
Ömer Sinan Ağacan b180aa3c55 [dart2wasm] Use identical in switch statements
Currently when `switch` expression is nullable (so the values are boxed)
we currently use `ref.eq` to compare the values.

This doesn't work as expected when one of the values is a constant and
the other one is a runtime-allocated value. Example:

    void test(bool? x) {
      switch (x) {
        case false:
          print('no');
        case true:
          print('yes');
        case null:
          print('maybe');
      }
    }

    bool runtimeTrue = int.parse('1') == 1;

    void main() {
      test(runtimeTrue);
    }

Here the return value of `runtimeTrue` is boxed in the call site of
`test`. In the body of `test` we use globals for constants `true` and
`false`, which are never equal to runtime-allocated values.

We now use `identical` in these cases, which handles `bool`, `String`,
and `num` values as expected and compares the rest using `ref.eq`.

New passing test: co19/LanguageFeatures/Patterns/exhaustiveness_A01_t10

Fixes #52075

Change-Id: Ibbeda7525fd40cfec5ee477493d0d96ac6e139b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295941
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-04-19 07:28:56 +00:00
Robert Nystrom b9fa34d40a Roll the latest dart_style in.
This contains two minor formatting changes to records.

Change-Id: Ib90479ae60646c7cb0d5c746b5772fc63ee2a0f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296026
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2023-04-19 07:21:47 +00:00
lauren n. liberda 22d666d67a add tools for generating shim headers
Closes https://github.com/dart-lang/sdk/pull/51612

GitOrigin-RevId: 7e71761d5f13e9dff8d60c0287cc12fda56f9642
Change-Id: I76400e00ead54d9fc3d0dae26c2468e8401f3de8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286601
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-04-19 01:37:48 +00:00
Konstantin Shcheglov cef5bcb602 Remove '@experimental' from declarations related to records and patterns.
Change-Id: I4db54e3097c343ec72e041f78df2b38b1835853e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296061
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-04-19 00:51:58 +00:00
Nate Biggs 21de916eb8 [dart2js] Add back kernel source file caching guarded by a flag.
Removing this cache means that errors from dill-loaded sources only display an offset rather than an exact file location. This makes debugging externally reported issues more difficult.

See here for more background: https://github.com/dart-lang/sdk/issues/52020#issuecomment-1513533855

Change-Id: I243d0bd340708ddbf979d77b5e9559751ee1b79e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296040
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-04-19 00:34:03 +00:00
DEPS Autoroller 1c29e9ab3f Roll Clang from fa3cb517e4a5 to e8cfbfd05a95
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/clang-dart-sdk
Please CC dart-engprod@google.com,dart-vm-gardener@grotations.appspotmail.com,dart-vm-team@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Clang: https://bugs.fuchsia.dev/p/fuchsia/issues/list?q=component%3AToolchain
To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

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

Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try;luci.dart.try:dart-sdk-mac-try;luci.dart.try:dart-sdk-mac-arm64-try;luci.dart.try:dart-sdk-win-try
Change-Id: I972f69116a6d4181548d46f063c56014c89a402a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296000
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-04-18 23:42:47 +00:00
Jake Macdonald b55b46bcd6 update the serialization bbenchmark to capture the difference between sockets and stdin, and use message grouper
Change-Id: I5736ba0f9687e9dce4e1bf4ad27dd0cb9d9b75ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296100
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2023-04-18 23:30:39 +00:00
Stephen Adams 4c0de8ed89 [dart2js] sync* fixes
Change the calling convention of the sync* body to fix bugs and avoid allocations.

- Body takes the controlling _SyncStarIterator as a parameter.

- `yield` assigns directly to the `_current` field and returns.

- `yield*` calls a method on the controlling iterator (rather than returning the iterable). This avoids an allocation to wrap the iterable, a type test to distinguish `yield` from `yield*`, and allows the `get:iterator` call to happen in the dynamic scope of try-catch surrounding the `yield*` to that it will catch any exceptions.

- Avoid using IIFE to bind constants just to call the body.

- Use a dummy body to avoid the need to testing termination of the body.


Tests now passing:

co19_2/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_sync_t05
language_2/sync_star/move_past_end_test
language_2/sync_star/sync_star_exception_current_test
language_2/sync_star/sync_star_exception_iterator_test
language_2/sync_star/sync_star_exception_nested_test
language_2/sync_star/sync_star_exception_test


Bug: #51992


Change-Id: I397b470e121b8d71242ac28b3130637b78a1d0dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294685
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-04-18 22:24:24 +00:00
Nate Biggs 7714e67efe [dart2js] Merge experimental inferrer into main inferrer branch.
Inference runtime metrics on a large program:
-----Before-----
Duration - Mean: 182.303 Median: 174.500 Max: 292.0
Memory - Mean: 5857.426 Median: 5752.639 Max: 6167.91

-----After-----
Duration - Mean: 144.525 Median: 133.500 Max: 242.0
Memory - Mean: 5867.756 Median: 5727.506 Max: 6262.414

This shows ~20% improvement in runtime and virtually no change in memory usage. Previously we saw a memory regression due to this change. But thanks to improvements in the representation of TypeInformation nodes that memory regression no longer exists.

Code size for this program is also very similar before and after this change.

Before: 43258484 bytes JS
After: 43258444 bytes JS
Change-Id: I6512637f16d83f3127fd1c060bb770ae56405b88
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295460
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2023-04-18 22:15:49 +00:00
Alexander Markov 135443706b [vm] Avoid expanding/flattening type arguments vectors in Type objects
Previously, vectors of type arguments were expanded to include type
arguments corresponding to superclasses both in the instances of
generic classes and in Type objects (after type finalization).
As a result, Type objects after finalization could be recursive and
need to use extra TypeRef objects to break loops. The finalization of
types was very complex and sometimes slow.

This change simplifies the representation of Type objects: now they
always have short type argument vectors, corresponding only to
the type parameters of their own classes (both before and after
finalization). Vectors of type arguments in the instances of generic
classes are still expanded/flattened.

This greatly simplifies type finalization, makes Type objects
non-recursive and removes the need to create and handle excessive
TypeRefs for type arguments corresponding to superclasses,
as those type arguments are no longer included into types.
The only remaining use of TypeRefs is for bounds of type parameters.

In order to expand/flatten type arguments, new methods Type::GetInstanceTypeArguments / Class::GetInstanceTypeArguments
are introduced. They build canonical declaration type arguments
once (for each class), and then instantiate them as needed.

There are also simple helper methods to shrink type arguments (TypeArguments::FromInstanceTypeArguments) and expand type arguments without filling type arguments corresponding to superclasses (TypeArguments::ToInstantiatorTypeArguments).

Time of edge case 'regress_51960_test' 15min -> 300ms.

TEST=ci, runtime/tests/vm/dart/regress_51960_test.dart

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

Change-Id: I75b466b74698a33c0bb5e1dcbd29542e413812a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295060
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-04-18 22:08:21 +00:00
Konstantin Shcheglov c948d37f97 Add CONVERT_TO_SWITCH_STATEMENT for if-case statement.
Bug: https://github.com/dart-lang/sdk/issues/52068
Change-Id: Ia561a8e711272cfcae690a4de1ea3e39906bef47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295724
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-04-18 21:26:02 +00:00