Commit graph

88654 commits

Author SHA1 Message Date
Konstantin Shcheglov fd30c4f269 Report XYZ_FROM_DEFERRED_LIBRARY during constant evaluation.
Change-Id: I3cf2fa1dfcee3d9a2ddc6d506465d26a40181524
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274141
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-12-08 00:19:34 +00:00
Konstantin Shcheglov fe968d979e Handle Tag.MemberLegacyWithoutTypeArguments, don't write empty type arguments.
Change-Id: I838a046a4dfa7744528e85ceae90efe0403b1ef6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274261
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-12-07 22:57:58 +00:00
Alexander Markov 66f1dee48c [vm] Runtime type check in await
'await e' should check that e is a Future<flatten(S)>, where S is a
static type of e before awaiting e. If e is not a Future<flatten(S)>,
then 'await e' should await Future.value(e) instead of e. So futures
of incompatible type are not awaited and soundness is not violated.

TEST=tests/language/async/await_type_check_test.dart
(Based on https://dart-review.git.corp.google.com/c/sdk/+/267422.)

Fixes https://github.com/dart-lang/sdk/issues/50529
Part of https://github.com/dart-lang/sdk/issues/49396

Change-Id: Ia418db1be6736710abc9be87d95584c50cbc677e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273002
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-12-07 22:46:22 +00:00
Paul Berry 38cab10852 Patterns parsing: track when variable patterns are in an assignment context.
Variable patterns behave so differently inside a patternAssignment
that we may want to represent them using different AST nodes inside
the analyzer/CFE.  This change adds a boolean flag allowing the
implementation to know what kind of variable pattern it's looking at
when parsing occurs.

Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I60adf2865bbe24f85b72a79b1360833bf823bd67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273829
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-12-07 22:45:40 +00:00
Konstantin Shcheglov aea639bd03 Issue 50604. Fix renaming extension at its declaration.
Bug: https://github.com/dart-lang/sdk/issues/50604
Change-Id: I1c685ea7545ef120e5fc23fe6a507ded8c4f4cb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274083
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-12-07 22:38:19 +00:00
Konstantin Shcheglov 356d15a3fc Issue 50603. Fix element kind to EXTENSION in search.getElementDeclarations
Bug: https://github.com/dart-lang/sdk/issues/50603
Change-Id: I22b4d827bc9472544cf3c3aad3473de8050e2f6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274085
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-12-07 22:37:37 +00:00
Alexander Aprelev efaad34a46 [vm/simd] Recognize TypedData Float64x2 getter/setters
```
import 'dart:typed_data';

@pragma("vm:never-inline")
fetch(l, i) => l[i];

main() {
  const n = 16*1024*1024;
  final l = ByteData(16 * n).buffer.asFloat64x2List();
  for (int i = 0; i < n; i++) {
    fetch(l, i);
  }
  final sw = Stopwatch()..start();
  for (int i = 0; i < n; i++) {
    fetch(l, i);
  }
  print(sw.elapsedMilliseconds);
}
```

on x64
before 1137ms
after 101ms

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

Change-Id: I90ef8ccfa1161d4d8bb076a3c1a0e3c7d6521289
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274263
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-12-07 22:25:25 +00:00
Konstantin Shcheglov bd30de18ba Prepare to publish analyzer 5.3.0 and _fe_analyzer_shared 51.0.0
Bug: https://github.com/dart-lang/sdk/issues/50637
Change-Id: I0ce445af106168fd4af6529e2c55deceb954e559
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274086
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-12-07 22:18:37 +00:00
Konstantin Shcheglov 52be8e0f3e Issue 50496. Add mixin super invoked names to the unlinked signature.
Bug: https://github.com/dart-lang/sdk/issues/50496
Change-Id: I09c6dbc025cecc52e8f0340388bbf2b79ea78057
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273831
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-12-07 22:17:22 +00:00
Paul Berry 0fd211facd Shared analysis testing: Distinguish Var.errorId from variable identity.
The field `Var.errorId` was being used for two purposes:

- For checking error messages.

- To distinguish different variables with the same name when merging
  variables in `||` and cases.

As a result, a lot of variables to be tagged with error IDs even in
tests that weren't generating any errors, which was confusing.

This change creates a new `Var.identity` field which is used for
merging variables in `||` and cases; it defaults to the variable name
but may be overridden in tests where distinguishing variables of the
same name is important.

Change-Id: Ieb587f434520dc484180aaa72658c899a2eb06d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273824
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-07 22:10:35 +00:00
Paul Berry 3407cdb6ac Shared analysis: update ifCaseElement API to match ifCase.
This change makes the API for the `ifCaseElement` method similar to
that of `ifCase`, which should make it easier to write flow analysis
unit tests for if-case elements.

Bug: https://github.com/dart-lang/sdk/issues/50419
Change-Id: I64c160f3b6df38b0d337f9b8f9c6c9189e9a13ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274161
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-12-07 22:08:30 +00:00
Paul Berry 759a742c16 Shared analysis: update ifCase API to match if_.
This change makes the API for the `ifCase` method the same as that of
`if_`, which should make it easier to write flow analysis unit tests
for if-case statements.

Bug: https://github.com/dart-lang/sdk/issues/50419
Change-Id: Iea7e0fabba9966eae52c0d28b52d2f8fcea25e46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273820
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-07 22:02:32 +00:00
Kallen Tu 7ff20a67ca [analyzer] Report error when subtyping a sealed class outside of its library.
Change-Id: Iee6c9120d096ed49592ca3d155c81c876ceb5c34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273832
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-12-07 22:00:28 +00:00
Danny Tuppeny df3df89fd9 [analysis_server] Include type in extract-local-variable if always_specify_types is enabled
Fixes https://github.com/Dart-Code/Dart-Code/issues/4177.

Change-Id: I8da492c947466677e84d7892113f0bbfbdacfb87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274240
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-12-07 21:11:47 +00:00
Alexander Aprelev d1a34df210 [benchmarks] Add IsolateRegExp benchmark for regexp passing between isolates.
BUG=https://github.com/dart-lang/sdk/issues/50639
TEST=ci

Change-Id: I81bab7c61ce34d1b3a608a1fb0cc7cfd7a2d8e62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274120
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-12-07 20:56:02 +00:00
Konstantin Shcheglov acf7a95410 Split VariablePattern into AssignedVariablePattern and DeclaredVariablePattern.
Change-Id: I19ef3be7edb273eccf5f1afa61985ab24e584f1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274082
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-12-07 20:55:17 +00:00
Mark Zhou d9ea7207e8 [ddc] Wrapping loadLibrary checks in a future to obey eval order rules
These checks are cosmetic right now in DDC, but the load check was happening synchronously rather than after the future returned by loadLibrary completed.

Change-Id: I867779605ddfe4f63b83b47418994e0c5e68572a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274087
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
2022-12-07 20:47:17 +00:00
Martin Kustermann 4be2981c2d [vm/ffi] Ensure there's a single Function object per ffi-callback + exceptional-return combination
Right each `Pointer.fromFunction()` invocation will lead to creation of
a new ffi trampoline function & it's following JITed code. In AOT we
have exactly one ffi trampoline per target/native-signature/exceptional-return
combination.
=> This CL ensures we have only one such function.

Furthermore each `Pointer.fromFunction()` will currently perform 2
runtime calls in JIT: One to create a `Function` object, the other to
JIT that function & register callback metadata.
=> This CL ensures we won't do a runtime call to get a function, instead
   do it at compile-time (as in AOT)

Furthermore we eagerly assign a callback-id to the unique/deduped ffi
trampoline callbacks. Only when the application requests a pointer, do
we populate metadata on the `Thread` object.

This CL doesn't (yet) change the fact that in JIT mode we have
isolate-specific jit trampolines (that will call now shared ffi trampoline
functions).

We also avoid baking in C++ runtime function pointers in generated
code. As a result we can now preserve ffi trampolines across AppJIT
serialization.

As a nice side-effect, we remove 100 lines of code.

TEST=ffi{,_2}/ffi_callback_unique_test

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

Change-Id: I458831a47b041a088086f28f825de2a3849f6adc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273420
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-12-07 20:47:13 +00:00
Nate Bosch 2f864c0a5d Use async/await for readAsString
The comment mentions that this was a planned refactoring after
--sync-async became the default. Avoid eagerly reading
`StackTrace.current` and switch to an `async` method.

Change-Id: I6a8e9399fa4c282ddbd42eb93f6e19669e75ebc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274260
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
2022-12-07 20:39:15 +00:00
Kevin Moore 1b79875bb7 changelog: sort and front-load new lints in 2.19 and 2.18 sections
Some other whitespace tweaks
Dropped a bunch of gratuitous `[]` bits next to links

Change-Id: I32b46138d3ff7df68b8a4dab80b346de20fee73f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274088
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
2022-12-07 20:39:10 +00:00
Danny Tuppeny 092bdb17d3 [analysis_server] Improve Snippet performance with caching and earlier filtering
This shares a cache for mapping Elements to their public LibraryElements across each snippet producer, and also skips snippet producers that produce snippets that won't match any typed prefix.

Change-Id: I6b64b3c55f1030a5eaa7ca1afdcd6c416e4baa08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273962
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-12-07 20:31:12 +00:00
Sigmund Cherem e8906e65e7 [3.0 alpha][dart2js] No longer infer the null-safety mode from sources.
This prepares dart2js to default to sound null safety in Dart 3.0.

The compiler no longer infers the default mode based on the input
program, instead uses sound null safety unless
'--no-sound-null-safety' is specified.

On a separate change, we expect to remove the option of disabling
null safety.

Note: this change should also be reflected in the CHANGELOG, but
we've currently not included it to redeuce merge conflicts, as we plan
to land multiple 3.0-alpha changes in a short window of time

Change-Id: Id87498cc5976548ec89d1f36c60674b72406950a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270860
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2022-12-07 04:02:13 +00:00
Martin Kustermann 896675c462 [vm] Always share double/float32x4/float64x2/int32x4 in inter-isolate messages
The JIT support for dynamically unboxing has been removed in [0]. As
such all double/float32x4/float64x2/int32x4 objects are immutable and
can therefore be shared across isolates.

[0] https://dart-review.googlesource.com/c/sdk/+/256211

TEST=ci

Change-Id: Ifd4e7c2444415b2e3b5269d9fbeb6570cc5d6768
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273680
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-12-07 00:48:28 +00:00
asiva e70e2bc1b7 [Dart 3.0 alpha] Fix some test issues (legacy mode argument not passed in)
TEST=ci

Change-Id: Iebb31a509b99837e41cf3823ca366c1560777af6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273920
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-12-06 19:34:47 +00:00
asiva 606a64a743 [3.0 alpha][VM/Runtime] - Flip flag to make strong null safety the default.
- Flip flag to make strong null safety the default
- Remove code that auto detects null safety mode from source files,
  it is necessary to specify --no-strong-null-safety to opt out.
- Retains sniffing of AOT/JIT snapshots and kernel files to determine
  null safety mode, the opt out has to be done when generating these
  file.

TEST=ci

Change-Id: If2c9608eedb7c46d9c3cd85e261ee9640e0d28eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261140
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-12-06 04:04:23 +00:00
Alexander Thomas 7e0d92d69d [3.0 alpha] Bump version to 3.0.0
Tested: Standard CQ.
Bug: https://github.com/dart-lang/sdk/issues/49529
Change-Id: I329b9940db7309c7e48f17eecd7a66d5b853a484
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271922
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-12-06 02:40:36 +00:00
Devon Carew 3a1d7c7d74 [deps] rev dartdoc, http, sync_http, test, webdev
Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (dc502d0..4d7dc93):
  4d7dc93b  2022-12-05  dependabot[bot]  Bump github/codeql-action from 2.1.31 to 2.1.35 (#3263)
  bcf8b6e8  2022-12-05  Parker Lougheed  Weight enums the same as classes for searching (#3260)
  7d95578b  2022-12-04  Parker Lougheed  Update template descriptions (#3258)
  d558f043  2022-12-04  Parker Lougheed  Fix error when using base element href (#3256)
  c3663762  2022-12-04  Parker Lougheed  Add unnecessary override ignore to fix build (#3257)

http (976bd56..46a7708):
  46a7708  2022-12-02  Brian Quinlan  Remove binary artifact (#833)

sync_http (f5c1f18..8622614):
  8622614  2022-12-02  Kevin Moore  blast_repo fixes (#32)

test (f3d80a6..4dceb87):
  4dceb87c  2022-12-01  Nate Bosch  Ignore some usage of dperecated errors (#1807)

webdev (91b8a19..e39506e):
  e39506e  2022-12-05  Anna Gringauze  Pre-warm expression compiler to speed up Flutter Inspector page loading. (#1786)
  9b19b3b  2022-12-02  Elliott Brooks (she/her)  Can save storage objects in both `session` and `local` storage (#1807)
  e75c45e  2022-12-02  Elliott Brooks (she/her)  Injected client adds `isFlutterApp` to global window object (#1806)
  ba5e3ec  2022-12-01  Elliott Brooks (she/her)  `DebugSession` listens to events instead of just sending events (#1804)

Change-Id: I881d02e966b763879df72b29653a9f241b71eb3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273826
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2022-12-05 23:18:40 +00:00
Kallen Tu 7e4d4bfef6 [corelib] _RawSecureSocket implements _RawSocketBase to avoid dynamic call in _Socket
Change-Id: Iaca38bcc5df51636016b2833c10f1bb7200ce708
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273021
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-12-05 23:05:54 +00:00
Danny Tuppeny c24f36d470 [analysis_server] Use public (non-src) URIs for Flutter snippet imports
Fixes https://github.com/dart-lang/sdk/issues/49081.

Change-Id: I0734b4f45c72d70f7b32640bed6b6ec2e8130c01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273841
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-12-05 22:32:19 +00:00
Nate Biggs badf1c5a0e [dart2js] Use new call target calculation in DynamicCallSiteTypeInformation.
Change-Id: I7077df4e718cc8836aa00aa7fc37249f8c735140
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267140
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-12-05 20:22:25 +00:00
Nate Biggs efe18b5c4a [dart2js] Add inferrer engine changes for type graph call linearization.
Change-Id: I23c1f12f4b619be9f4409b23f83cf54cd0fcc301
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267062
Reviewed-by: Mayank Patke <fishythefish@google.com>
2022-12-05 20:22:25 +00:00
Nate Biggs 6173ba5dab [dart2js] Add findRootsOfTargets to abstract domain.
Change-Id: Ib5035537f242a0b518a47d53c5d4e20b8bbb71fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266880
Reviewed-by: Mayank Patke <fishythefish@google.com>
2022-12-05 20:22:25 +00:00
Anna Gringauze 3bb1323b92 Reland "Cache expression compilers in incremental DDC mode"
- Fix ddc null dereference while generating symbols with mixins
- Fix incremental compiler failure on non-SCC components
- Reworked expression compiler worker tests for effiiciency
- Create module configuration in tests only once
- Add test case of compiling expression in an non-SCC module
- Add test case of compiling expression in an SCC module

This is a reland of commit e6f779bcdd

Original change's description:
> Cache expression compilers in incremental DDC mode
>
> - cache expression compilers in expression compiler worker
>   to improve performance of exression compilation.
> - pass module format in expression compiler worker
>   (the ddc format tests were not running!)
> - fix an issue where the same library was imported twice
>   in module_builder.dart
> - add verbose mode timeline logging to ProgramCompiler.
> - update tests.
>
> Closes: https://github.com/dart-lang/sdk/issues/49944
> Change-Id: Ie7408dcd42e757b1eb5e7f5ccbc1b078b6417011
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268361
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Mark Zhou <markzipan@google.com>
> Commit-Queue: Anna Gringauze <annagrin@google.com>
> Reviewed-by: Nicholas Shahan <nshahan@google.com>

Change-Id: I80546773d957f37ec5b2353ea060b50f3fba0aa7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271801
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2022-12-05 18:39:17 +00:00
Ryan Macnak d9dd8300ca [vm, gc] Fix rare failure to update target of FinalizerBase or WeakReference.
At the end of a scavenge, ObjectPtr::IsRawNull was used on what is either a pointer into old-space or a pointer into from-space. If a pointer into from-space, the header may be a forwarding pointer. When IsRawNull interprets this is an object header, the bits in the ClassIdTag position will sometimes happen to equal kNullCid, causing the pointer to be incorrectly interpreted as null instead of a forwarding pointer and thus leaving behind a dangling pointer into from-space.

This separate null check can simply be removed because null is always an old-space object.

TEST=splay_{weak/c_finalizer/dart_finalizer}_test
Bug: https://github.com/dart-lang/sdk/issues/50578
Bug: https://github.com/dart-lang/sdk/issues/50612
Change-Id: Ifc7dc19c36703222a9302a8dbb68982fdbbc91fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273560
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-12-05 18:08:46 +00:00
Brian Wilkerson 7953da5cf1 Fix the windows bot
Change-Id: I4d71fd70b2f0b4a4a3af3446f56fbd9b79fd0954
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273821
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-12-05 18:00:16 +00:00
Ben Konyi 3850a595b9 [ VM ] Ensure heap sampling profiler is initialized on newly spawned threads
Also fixes some incorrect TLAB boundary calculations

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

TEST=DartAPI_HeapSampling looped under full system load for 30 minutes

Change-Id: I6e56cc659b58f9b246d20dc5b649fc367af9c672
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273500
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-12-05 17:41:08 +00:00
Ahmed Ashour bea7045517 [analyzer] add failing test case
Bug #50496

Change-Id: Iaa6007af1b9dbbf7bac3f2ad835dece3eb64b189
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271520
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-12-05 17:37:43 +00:00
Devon Carew 4b4b3645b8 [dartdev] uncomment the dependencies: section in the create templates
Change-Id: I7ad57d3a2fd357b368e8d2210a6dfef0fe2ed4a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273543
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-12-05 17:34:03 +00:00
Paul Berry c02a050721 Add handleMergedStatementCase.isTerminating boolean.
This can be used by the front end to detect when to add synthetic
break statements to switches involving patterns.

Bug: https://github.com/dart-lang/sdk/issues/50624
Change-Id: I783b0920b8dc6ccbc7af8062fba7bfdeaa9dd9cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273800
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-05 17:10:50 +00:00
Paul Berry 55902d3702 Fix ToSourceVisitor.visitSwitchExpressionCase.
In
b2889872c3,
the switch expression syntax was changed so that it no longer uses the
`case` keyword.

Change-Id: I97c10b3462b5849e1baf386df81a656d5ac25c09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273623
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-12-05 16:53:35 +00:00
Paul Berry e7832eba4c Update AstComparator.visitPatternVariableDeclaration to account for metadata.
Change-Id: Icd875b10088cef17b4a3351591e29b1275900a50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273622
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-12-05 16:52:26 +00:00
Paul Berry 05ee431fb4 Capture metadata in for-in loops with patterns.
Change-Id: I90607774cfd5ae34b91af36538eb77b7ce0b6a0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-05 15:44:18 +00:00
Sigurd Meldgaard a890972aee Filter '#' characters from log in tool/manage_deps.dart
Change-Id: Icac7b594a942787477beda2979eb0e427d8dcece
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273780
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2022-12-05 15:10:30 +00:00
Jens Johansen 93ef21b00b [vm] Add examples to heapsnapshot tool
Change-Id: I2b3735341146e532a747e302050e3983ee8f7e1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273240
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-12-05 15:02:27 +00:00
Paul Berry 7a3aa5c7f5 CFE parser test cases for metadata in for-in loops with patterns.
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I336b391c9102e4e6dd3eabce1051763e3bc797d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273621
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-05 14:56:41 +00:00
Jens Johansen b0ca324b08 [VM] Fix crash on >num filter in heapsnapshot tool
Change-Id: I873d98452e88d2b55b485cc14daa1823af2ba0f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273741
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-12-05 14:49:50 +00:00
Johnni Winther a392d30e1d [cfe] Handle direct access to instance methods and getters in views
Change-Id: I63fbdf31b225ea503f35b85601b8f9718431d6cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273380
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-05 10:13:22 +00:00
Erik Ernst ac68a593d4 New test, testing the behavior under scrutiny in SDK issue 49396
Change-Id: I1ebb2ea12f4d01c4077fca6fc380353f821bc68a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267422
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-12-05 09:40:08 +00:00
Sergey G. Grekhov c0330b6444 [co19] Roll co19 to 9cfd817af42a5b3f934829aa1a82b5f27463130f
2022-12-01 sgrekhov22@gmail.com dart-lang/co19#1401. [Patterns] More test cases added to variable and wildcards tests (dart-lang/co19#1551)
2022-12-01 sgrekhov22@gmail.com dart-lang/co19#1401. [Patterns] Constant pattern tests update according to the new spec (dart-lang/co19#1566)
2022-12-01 sgrekhov22@gmail.com dart-lang/co19#1401. [Patterns] Parenthesized pattern tests added (dart-lang/co19#1548)

Change-Id: I2458848da6ba816368c6d5b9bfe8d7fa6467dfcd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273360
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2022-12-05 08:41:02 +00:00
Jens Johansen b812517fac [analyzer] Don't ask for subtypes for the same elements several times when searching for references
When asking for all references of a member it starts by finding all
supertypes for the class, then for each supertype (including itself)
(that has a member with the same name as the one we're querying for)
it searches for all subtypes.

We recall that when getting all subtypes, it really gets all direct
subtypes, then for each of those, their direct subtypes etc.
Naturally, then, with getting all subtypes for all supertypes we
will often ask for all direct subtypes of the same class several times.

In fact, it's O(n^2):

As an example, if asking for references to `foo` on this
(in a file in analyzer, with 8 workspaces):
```
class X0 { void foo() { print('hello'); } }
class X1 extends X0 { void foo() { print('hello'); } }
class X2 extends X1 { void foo() { print('hello'); } }
[...]
class X149 extends X148 { void foo() { print('hello'); } }
```
we ask for subtypes 90600 (150 classes * 151 / 2 * 8 workspaces) times.

This CL stops that from happening and in the example from above we
"only" asks for subtypes 1200 (150 classes * 8 workspaces) times.

For the `newFile` from `AbstractSingleUnitTest` example, for instance,
we go from 28,264 asks to 17,432 asks (a ~38% reduction).

Non-first runtimes when asking for references:

Before:
0:00:03.074853
0:00:03.021881
0:00:03.034707
0:00:03.115596
0:00:03.032574

After:
0:00:02.223978
0:00:02.149937
0:00:02.150236
0:00:02.104704
0:00:02.175859

Difference at 95.0% confidence
        -0.894979 +/- 0.060283
        -29.2867% +/- 1.97266%
        (Student's t, pooled s = 0.0413338)

Change-Id: Id792a595e74de01c7186ab1263c38728f051f603
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272623
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-12-05 08:03:24 +00:00