Commit graph

91239 commits

Author SHA1 Message Date
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
Ryan Macnak 7b2cfdbc8c [standalone] Remove tcmalloc.
Removes build complexity around which combinations of compiler/architecture/sysroot/libc support tcmalloc, reduces binary size, and reduces memory usage at the expense of some throughput.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/51111
Bug: https://github.com/dart-lang/sdk/issues/51535
Bug: https://github.com/dart-lang/sdk/issues/51639
Change-Id: Id73d5b87e2b16c1cd1e5228ba0cbf1aa2521c01a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287001
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-04-18 20:56:00 +00:00
Janice Collins 7c1e2fee70 Fix analytics logic to report on analysis complete transitions.
Bug: https://github.com/dart-lang/sdk/issues/52089
Change-Id: If9fe7d702cd70c3e8804a59e47870d6aad7cf680
Fixes: https://github.com/dart-lang/sdk/issues/52089
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296023
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Janice Collins <jcollins@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2023-04-18 20:48:58 +00:00
pq fffd7e8c6f support destructuring local object pattern variable declarations
See: https://github.com/dart-lang/sdk/issues/52025

Change-Id: I6dc5d2f0c8391d8ad719c23b47aadeac9a8ab969
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295722
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-04-18 20:47:57 +00:00
Stephen Adams 62a67ba5bc [dart2js][js_runtime] Use Array.isArray more consistently
The main reason is to do this change is to avoid inconsistencies in what is considered to be a `JSArray`. Using `Array.isArray` allows js-interop where the JavaScript code subclasses `Array`.

dart2js-production results:

ArrayLoop.pseudopoly.hoisted1-indexing  -50.20%
ArrayLoop.pseudopoly.indexing           -35.18%
Iteration.concat.manual                  11.69%
ListCopy.List.int.unmodifiable.2         12.03%
ListCopy.for.int.2                       12.58%
ListCopy.spread.int.2                    13.57%
ListCopy.toList.fixed.100                16.06%
ListCopy.List.of.fixed.100               16.96%
ListCopy.toList.100                      17.28%
ListCopy.spread.int.cast.2               18.45%
ObjectHash.hash.5                        19.62%
TypedDataPoly.A_UVx5.view.2              21.12%
ObjectHash.manual.5                      21.70%
ListCopy.spread.int.map.2                21.96%
ListCopy.spread.int.cast.100             22.12%
TypedDataPoly.A_UVx5.view.100            23.04%
ListCopy.spread.int.map.100              25.26%
ListCopy.List.of.100                     27.88%
ImagingGaussianBlurOnce                  29.67%
MegaEquality                             37.90%

An investigation of the two regressions shows that they benefit from a micro-benchmarking effect. The previous code was monomorphic at the property access in `receiver.constructor == Array`. If this is forced to be polymorphic, the baseline is quite a bit worse, leading to an improvement in line with some of the other benchmarks.


Change-Id: I5c265b1d7408fbd41da9c6fa17472bf648000c8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287140
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-04-18 20:39:39 +00:00
Konstantin Shcheglov 000655e4d3 Support sealed classes in canBeSubtypeOf()
Bug: https://github.com/dart-lang/linter/issues/4280
Change-Id: Iab92670d7c5db535968b4fe4ac26a5777e1bf6ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295801
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-04-18 20:02:58 +00:00
Brian Quinlan db491eb671 Set minimum mac SDK version to 10.14
Bug: https://github.com/dart-lang/sdk/issues/47820
Change-Id: I42310999303d1849aaedd800e4222e6863870fc5
Tested: Build-only change - tested with flutter engine build
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295389
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-04-18 19:55:03 +00:00
Derek Xu 6011ba67b3 Reland "Reland "[VM] Begin supporting Perfetto file recorder""
This is a reland of commit 4cd9c9c666

This will be relanded without changes because we discussed the .proto
definition package name clashing problem with the Dart in google3 team,
and we have decided that the best solution is to ignore the checked in
.proto files in google3 builds.

TEST=Recorded traces with the Perfetto file recorder and explored them
in Perfetto's trace viewer, CI

Original change's description:
> Reland "[VM] Begin supporting Perfetto file recorder"
>
> This is a reland of commit 7424295ce9
>
> The differences between this reland and the original CL are: now the
> Perfetto file recorder does not get built in PRODUCT builds, and it does
> not get built unless the SUPPORT_PERFETTO macro is defined.
>
> TEST=Recorded traces with the Perfetto file recorder and explored them
> in Perfetto's trace viewer, CI
>
> Original change's description:
> > [VM] Begin supporting Perfetto file recorder
> >
> > This CL adds the `TimelineEventPerfettoFileRecorder` class, which is a
> > timeline recorder that writes a trace to file in Perfetto's proto
> > format. This CL supports the recording of all types of timeline events
> > except flow events. Support for flow events will be added in a future
> > CL.
> >
> > TEST=Recorded traces with the Perfetto file recorder and explored them
> > in Perfetto's trace viewer, CI
> >
> > Change-Id: Iaa2051e536589a473c5e15f9de9bb9c251f13d38
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278942
> > Reviewed-by: Ben Konyi <bkonyi@google.com>
> > Commit-Queue: Derek Xu <derekx@google.com>
>
> Change-Id: I8713f704b5fbeed5f1231012bce8a32aaf566ae4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286020
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Derek Xu <derekx@google.com>

Change-Id: Ia97ef1f0fe73e76c7022623b9ae7e21a4ea73a46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295804
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-04-18 19:39:05 +00:00
Sam Rawlins 008ef8c1a9 Bump linter
Change-Id: If108d01736a6fb7a07e4c894752934ea9fc952bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295802
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-04-18 19:25:48 +00:00
Ryan Macnak 30518b205d [infra] Copy llvm to shards, which is the target of the llvm-strip symlink.
Bug: https://github.com/dart-lang/sdk/issues/52010
Change-Id: I44d81ebb2f9e3db5ed86e560f7b043bd26804bf1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295747
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-04-18 18:33:10 +00:00
Ryan Macnak b6adf9ff6a [vm] Remove dead current_sp from Dart entry.
This was part of an older mechanism that set the checked stack limit based on the SP values we had seen so far. Today we query the exact stack boundaries on all platforms.

TEST=ci
Change-Id: I5692d97b5d4f9104ee9796de7406eb5f050ac276
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295745
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-04-18 18:31:15 +00:00
Joshua Litt c4167766f2 [js] Restrict imports in strict mode.
Change-Id: I90cdf408e60cf8115c6321448623cf363dc92f66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292960
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-04-18 17:21:27 +00:00
Sam Rawlins 25348fb95c [analyzer] Move 2 more HintCodes to be WarningCodes, UNNECESSARY_*
Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: Iddcb1b6d035e9590600e6bfbd8d2133da39bcc35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295803
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-04-18 16:55:30 +00:00
Ryan Macnak 9d834197bb [vm] Guard against invoking Dart code during AOT compilation.
TEST=ci
Change-Id: Idf213c57ad3d227738958c53e1d5b55d11477f1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295743
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-04-18 16:53:44 +00:00
Jake Macdonald cb4c9c74de Add support for mixin declarations in the macro APIs
Adds MixinDeclaration/IntrospectableMixinDeclaration for introspection.

Adds MixinTypesMacro/MixinDeclarationsMacro/MixinDefinitionsMacro macro
interfaces.

Updates supporting serialization/execution code and tests.

Change-Id: I57245fe7d177b6d5ba57649455fbd844ba1f85c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294380
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-04-18 16:04:00 +00:00
Paul Berry cc4eb93b11 Add dependency overrides for pkg/front_end
These dependency overrides prevent pub from getting confused about the
fact that our SDK development is in a mono-repo; that in turn allows
unit tests to be run from inside vscode using the standard test
integration.

Change-Id: I7629375f0ba4b07cd9ccdbb69f243d8eb0aa555a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295660
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-04-18 12:01:51 +00:00
Ilya Yanok 3c284a0c95 Revert "Reland "[VM] Begin supporting Perfetto file recorder""
This reverts commit 4cd9c9c666.

Reason for revert: reusing the same proto package for copied files breaks rolling it to G3.

Original change's description:
> Reland "[VM] Begin supporting Perfetto file recorder"
>
> This is a reland of commit 7424295ce9
>
> The differences between this reland and the original CL are: now the
> Perfetto file recorder does not get built in PRODUCT builds, and it does
> not get built unless the SUPPORT_PERFETTO macro is defined.
>
> TEST=Recorded traces with the Perfetto file recorder and explored them
> in Perfetto's trace viewer, CI
>
> Original change's description:
> > [VM] Begin supporting Perfetto file recorder
> >
> > This CL adds the `TimelineEventPerfettoFileRecorder` class, which is a
> > timeline recorder that writes a trace to file in Perfetto's proto
> > format. This CL supports the recording of all types of timeline events
> > except flow events. Support for flow events will be added in a future
> > CL.
> >
> > TEST=Recorded traces with the Perfetto file recorder and explored them
> > in Perfetto's trace viewer, CI
> >
> > Change-Id: Iaa2051e536589a473c5e15f9de9bb9c251f13d38
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278942
> > Reviewed-by: Ben Konyi <bkonyi@google.com>
> > Commit-Queue: Derek Xu <derekx@google.com>
>
> Change-Id: I8713f704b5fbeed5f1231012bce8a32aaf566ae4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286020
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Derek Xu <derekx@google.com>

Change-Id: I2da67ffe5bff01d568f32f682455bb2c789499b0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295821
Commit-Queue: Ilya Yanok <yanok@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Oleh Prypin <oprypin@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
2023-04-18 11:25:49 +00:00
dependabot[bot] 754aca0049 Bump github/codeql-action from 2.2.11 to 2.2.12
Closes https://github.com/dart-lang/sdk/pull/52053

GitOrigin-RevId: e5391795af051fe4761c4d376784afc6cc9a8cdb
Change-Id: I704cd2830c0c36a87c4582cf22ea44b6b5c8b915
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295561
Reviewed-by: Alexander Thomas <athom@google.com>
2023-04-18 08:20:48 +00:00
dependabot[bot] 7c8e61104f Bump actions/checkout from 3.5.0 to 3.5.2
Closes https://github.com/dart-lang/sdk/pull/52054

GitOrigin-RevId: 50fafd4554841ee069fe126d80b3be36d3a19929
Change-Id: If6be6160b332988fc309c575d821d32e19229448
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295560
Reviewed-by: Alexander Thomas <athom@google.com>
2023-04-18 08:19:56 +00:00
Daco Harkes f9f1030959 [infra] DEPS and test dart-lang/native packages
This CL pulls in dart-lang/native packages and runs them on the
pkg bots.

Bug: https://github.com/dart-lang/sdk/issues/50565
Change-Id: Ifcd8ba25f8bdfeca8f4c161adfc3c20e0ce500d1
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/+/295280
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2023-04-18 08:04:49 +00:00
Alexander Aprelev b04b084406 [vm/win7] Dynamically load functions for unwinding instructions.
Dynamically probe and load system functions for adding/deleting unwinding instructions to ensure vm can gracefully handle running on Windows 7, where those functions are not available.

Fixes https://github.com/dart-lang/sdk/issues/52071
TEST=ci

Change-Id: If4696bb8172d12f84f49d1d10affd7930a5bedfe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295741
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-04-18 02:38:48 +00:00
Janice Collins a6ebd6fa8e Bump tools to 545d7e1c73ce21b8c91f638021f9d487d324a501
This will customize the consent message based on the `dart` or `flutter`
entry points and allow unified_analytics to honor the legacy analytics
opt-out.

Changes:
```
> git log --format="%C(auto) %h %s" 2308c67..545d7e1
 https://dart.googlesource.com/tools.git/+/545d7e1 Honor legacy opt out status (80)

```

Diff: https://dart.googlesource.com/tools.git/+/2308c672e0d7446f5bfdba96594b41f26fa24a2e..545d7e1c73ce21b8c91f638021f9d487d324a501/
Bug: https://github.com/dart-lang/tools/issues/74
Bug: https://github.com/dart-lang/tools/issues/82
Change-Id: I36bffde69b6d7f798a40f140ca5e838336d81d3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295742
Reviewed-by: Elias Yishak <eliasyishak@google.com>
Commit-Queue: Elias Yishak <eliasyishak@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
Auto-Submit: Janice Collins <jcollins@google.com>
2023-04-17 23:09:14 +00:00
Ryan Macnak c4795a7550 [vm, compiler] Don't do safepoint transitions in generated code under TSAN.
Go to the runtime so TSAN sees the instrumented access to Thread::safepoint_state_, avoiding false data race reports.

TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/52024
Change-Id: Ic686bac2221d8ac6b9865ce9c82a4c36711037a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295740
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-04-17 22:37:57 +00:00
Danny Tuppeny 39fc15a0b4 [analysis_server] Add missing declaration semantic token modifier on classes/constructors
Fixes https://github.com/Dart-Code/Dart-Code/issues/4498.

Change-Id: Ia1c89d02a12fd51fe6f18ce4208ff88a7fbd7ba3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295621
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-04-17 21:19:25 +00:00