Commit graph

88693 commits

Author SHA1 Message Date
Konstantin Shcheglov 09a5d048e8 Issue 50660. Fix 'get Source' for ParameterMember.
Bug: https://github.com/dart-lang/sdk/issues/50660
Change-Id: Ie6af7c60178b2010f4cd5254e563185eb7e27042
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274603
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-12-09 02:08:24 +00:00
Nate Bosch db636ba8fe Bump matcher to 7e6a665da079baa3e2a2046ab02e4353ee32556c
Changes:
```
> git log --format="%C(auto) %h %s" 15d4af2..7e6a665
 https://dart.googlesource.com/matcher.git/+/7e6a665 Stop using deprecated errors (201)

```

Diff: https://dart.googlesource.com/matcher.git/+/15d4af21002ae9adee952110192a3face96307c7~..7e6a665da079baa3e2a2046ab02e4353ee32556c/
Change-Id: If0c8c27801e31777ed88a768bbf83aadfbb8890b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274606
Auto-Submit: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2022-12-09 01:16:29 +00:00
Brian Wilkerson abda30f198 Replace NodeLocator in two more places
Change-Id: I34a67ae8b370ec4c400ac5b9195d537380aca3c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274080
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-12-09 01:13:28 +00:00
Devon Carew 0c14719954 [deps] rev dartdoc, fixnum, logging, protobuf, shelf, test, webdev
Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (4d7dc93..f2bb6e9):
  f2bb6e92  2022-12-07  Sam Rawlins  Bump to 6.1.4 (#3266)

fixnum (62916f2..e4f5e97):
  e4f5e97  2022-12-08  Michael Thomsen  Change IntegerDivisionByZeroException to UnsupportedError (#100)
  3bd726f  2022-12-08  Devon Carew  rev the sdk min to 2.19.0-0 (#99)

logging (f322480..0373ef8):
  0373ef8  2022-12-07  Mushaheed Syed  Add a check that throws if a logger name ends with '.' (#123)
  6d46d71  2022-12-06  Devon Carew  Create no-response.yml (#124)

protobuf (4f3e328..2706b53):
  2706b53  2022-12-07  Mahdi K. Fard  Add type to a method parameter (#782)
  a57c16a  2022-12-07  Mahdi K. Fard  Fix a typo (#781)

shelf (1c21047..32e342d):
  32e342d  2022-12-08  István Soós  Prepare the release of shelf_router_generator (#316)
  06e2fe6  2022-12-08  Kevin Moore  shelf: drop non-null-safe tests (#317)
  98363fd  2022-12-06  Kevin Moore  lint: sort pub dependencies
  ad6af2a  2022-12-06  Kevin Moore  shelf_static: move RegExp creation out of every request

test (4dceb87..73cd754):
  73cd7540  2022-12-07  Nate Bosch  Record the working directory for VM platform (#1804)
  e40274a6  2022-12-07  Nate Bosch  Restore mono_repo config (#1810)
  02d8764e  2022-12-07  Sigurd Meldgaard  Use Future for return type in runner `main()`. (#1809)
  3d6039b3  2022-12-05  Nate Bosch  Merge test selections by path (#1806)

webdev (e39506e..3e2364e):
  3e2364e  2022-12-07  Elliott Brooks (she/her)  Add the Dart Debugger / Flutter Inspector panels in Chrome DevTools (#1812)
  c164231  2022-12-07  Elliott Brooks (she/her)  Small fix to the extension test (#1811)
  4bbb4d0  2022-12-06  Elliott Brooks (she/her)  Gracefully handle debugger disconnect events (#1808)
  d3892cf  2022-12-05  Elliott Brooks (she/her)  Refactor puppeteer tests to use `Worker` type (#1809)

Change-Id: I42033e849f40f209831cfb344247b24ad7731ff0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274580
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-12-09 01:04:20 +00:00
Alexander Aprelev fb22336c28 [vm/sse41] Fix use of pextrd when sse41 is not available.
BUG=https://github.com/dart-lang/sdk/issues/50640
TEST=ci

Change-Id: Ief12c270cb59dace99e3a2845cb44ed5085dbdaf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274081
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-12-08 23:29:14 +00:00
Aske Simon Christensen e38242621d [dart2wasm] Canonicalize boxed constant values
This saves space for the constant values, since the same value will
use the same constant box object, and it avoids runtime allocation of
boxes for literal values that are boxed directly.

New passing tests:

- language/super/bound_closure_test/01
- co19/LanguageFeatures/Patterns/constant_A05_t01
- co19/LibTest/collection/ListBase/ListBase_class_A01_t03
- co19/LibTest/collection/ListBase/ListBase_class_A01_t04
- co19/LibTest/collection/ListBase/ListBase_class_A01_t05
- co19/LibTest/collection/ListBase/ListBase_class_A01_t06
- co19/LibTest/collection/ListMixin/ListMixin_class_A01_t03
- co19/LibTest/collection/ListMixin/ListMixin_class_A01_t04
- co19/LibTest/collection/ListMixin/ListMixin_class_A01_t05
- co19/LibTest/collection/ListMixin/ListMixin_class_A01_t06
- co19/LibTest/core/List/List_all_t03
- co19/LibTest/core/List/List_all_t04
- co19/LibTest/core/List/List_all_t05
- co19/LibTest/core/List/List_all_t06

Change-Id: Id7570a2dd16f02590e722115e4d7168c4a741d99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273843
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2022-12-08 22:11:32 +00:00
Nate Biggs 5dca4cbd42 [dart2js] Distinguish virtual calls from direct calls to recover some lost accuracy in types.
This recovers the accuracy of types that were previously being widened and even performs better than today's algorithm for some specific cases.

Change-Id: I0139a0fd662a91315282ba94e4c1a29d44056b9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273501
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-12-08 21:19:54 +00:00
Kallen Tu b58f1b4ef3 [analyzer] Report error when mixing in a sealed mixin outside of its library.
Change-Id: I62be6c21bc2bf2a5af35203137aa75c7fd1ba934
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274142
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-12-08 21:18:24 +00:00
Brian Wilkerson 44e11d9dd4 Add a utility to find adjacent siblings in a selection
This will be used to allow multiple top-level declarations to be moved
together.

Change-Id: Ib1c59e9ff3e01891f8cb29b74e78183c36b1f02d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273828
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-12-08 20:48:58 +00:00
Ryan Macnak 15c8dad750 [vm] Reorder fields on Thread to reduce code size on X64.
dart2js.jit.x64 48139536 -> 47867344 (-0.57%)
dart2js.aot.x64 27077952 -> 26799256 (-1.03%)

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/48182
Change-Id: Ibc7d2ae7473936530307eadfcb4aeb83a9fdb873
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274282
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-12-08 18:24:19 +00:00
Nate Biggs 6144b6ed89 [dart2js] Clean up ssa/optimize.dart migration files.
Change-Id: I0aaf3e719ab6ab794840a6a07f58c3ee82a61e23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274322
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-12-08 18:12:27 +00:00
Nate Biggs 25e650691f [dart2js] Migrate ssa/optimize.dart to null safety.
Change-Id: I3d6b177e30f27a73590e53d0d650fd2342c04ed2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274321
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-12-08 18:12:27 +00:00
Nate Biggs 531e356587 [dart2js] Migrate ssa/value_range_analyzer.dart to null safety.
Change-Id: I20d5d55c9a31f87bcb517e8d416ff01a712e0c4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274320
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-12-08 18:12:27 +00:00
Ryan Macnak 0150cddace [vm] Fix call-through-getter runtime handling.
This should look for `dyn:call` instead of `call`. If it was a non-dynamic call, we would hit an invoke-field-dispatcher instead.

TEST=ci
Bug: https://github.com/flutter/flutter/issues/116405
Change-Id: I98c441fec2eb53ab23ac1dd52db3aa4eaa5cbc6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274265
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-12-08 17:48:49 +00:00
Daco Harkes 1d567c888f [vm] Remove use of CastError
`CastError` is replaced by `TypeError`.

Also makes the fields of TypeError nullable. See:
https://github.com/dart-lang/sdk/issues/49279

TEST=build SDK and run default suites.

Bug: https://github.com/dart-lang/sdk/issues/49529
Change-Id: I7e880ff2d8b18c4bffdd7a942efd743244a12734
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274381
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-12-08 17:07:33 +00:00
Aske Simon Christensen 96e2e55300 [dart2wasm] Fix a build error caused by colliding commits
Change-Id: Icc6c22896def0183766bb23dc2ca978fe15430ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274441
Reviewed-by: Martin Kustermann <kustermann@google.com>
Auto-Submit: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2022-12-08 15:48:01 +00:00
Danny Tuppeny c53f70509c [dds/dap] Filter private getters from debug views
These will fail unless the current stack frame happens to be in the library that declares them, which results in a lot of exceptions being shown in variable views.

Fixes https://github.com/Dart-Code/Dart-Code/issues/4296.

Change-Id: I5919e391f25a08920dcdf1bf648526d175af00f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274040
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-12-08 15:02:04 +00:00
Martin Kustermann cdd0694a92 [gardening] Make qemu configurations get 2x the time
Running tests under qemu simulator are slow. To prevent tests from
flakily going over the timeout limit, we give them 2x the time.

Change-Id: I41f771d5b958d11d073fd9808663b0b9f298ad9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274384
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2022-12-08 14:08:09 +00:00
Aske Simon Christensen a22e0ac5ea [dart2wasm] Compute correct type for generic function instantiation
Change-Id: I3811e37002ed6ae458600513bff3ac29482a6af3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271104
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-12-08 13:54:57 +00:00
Aske Simon Christensen 8c717be409 [dart2wasm] Emit correct runtime type for tear-offs
The static type of a tear-off is the signature type of the method.
The runtime type is the same with the types of all covariant
parameters replaced by `Object?`.

Change-Id: I9bb36a36ec04e27deab2b31c977fadac515ad561
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273845
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-12-08 13:54:57 +00:00
Aske Simon Christensen ad06d73ace [dart2wasm] Use a flat index space for function type parameters
The current two-level indexing scheme for function type parameters
(depth and index) breaks down in the case of type substitution when
the substituted type is a generic function type, since its internal
type parameter types have been encoded assuming that the function type
had nesting depth zero, but after substitution its nesting depth can
be higher.

Relative indexing schemes such as De Bruijn indices will also not
work, since function type parameter types are constant types, and the
constant infrastructure assumes that the same constant always has the
same representation.

This change introduces a flat indexing scheme where function type
parameters are indexed using a single index which is independent of
the context in which the type parameter type appears. To avoid
collisions in the case of nested generic function types, every function
type has a type parameter offset, which conceptually shifts the
indexing range of its type parameters so it doesn't necessarily start
at zero.

Looking up a function type parameter in its environment thus involves
searching outwards until a function type is found whose type parameter
index range contains the index encoded in the function type parameter
type.

Change-Id: I544056d52711ff829b170f78a7274a93871825a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272361
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-12-08 13:54:57 +00:00
Aske Simon Christensen f72f2e92d5 [dart2wasm] Re-enable async tests that no longer time out
Issue: https://github.com/dart-lang/sdk/issues/50122

Change-Id: I311c7a709e74381c84cb9c42cceb3d5c9cde4d61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267960
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2022-12-08 13:43:41 +00:00
Tess Strickland a43d3cb993 [vm/compiler] Use CombineHashes/FinalizeHash methods in intrinsifier.
AsmIntrinsifier::OneByteString_getHashCode now uses the CombineHashes
and FinalizeHash Assembler methods introduced in 49f998dc31.

To avoid having to check for 0 again after masking the result of
FinalizeHash to fit the desired bit size, we create a more general
FinalizeHashForSize that also takes the desired bit size of the result.

The intrinsified versions for ARM/ARM64/RISCV are also modified to
remove the special casing for the empty string, and instead just check
the size of the string against the loop counter at the start of the
loop, similarly to X64/IA32. This is less efficient for the empty
string case, but avoids the need to create a version of FinalizeHash
that elides the zero check.

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-nnbd-linux-release-simarm_x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try,vm-kernel-precomp-nnbd-linux-debug-simriscv64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-nnbd-linux-debug-simriscv64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-linux-release-ia32-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-ia32-try,vm-kernel-nnbd-mac-release-arm64-try,vm-kernel-linux-debug-x64c-try
Change-Id: I53db731acb8bf35d16efb55fa2c5a79d8302399f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272800
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-12-08 12:58:28 +00:00
Daco Harkes 3f3c6b4b8c [cfe] Remove FallThroughError reference
I don't believe this is used anywhere, but causes failures once the
class is removed from the core libraries.

Split off from https://dart-review.googlesource.com/c/sdk/+/259041

Bug: https://github.com/dart-lang/sdk/issues/49529
Change-Id: I9a215c981b0359b1d4521df9a330ec263b3b6c04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274382
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-12-08 12:48:24 +00:00
Aske Simon Christensen fd12e2e4ae [benchmark] Test dart2wasm benchmark invocations.
Bug: b/260206997
Change-Id: I49e225d8420fc5b5c0123736d0d8069d4cecd108
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273842
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2022-12-08 11:56:56 +00:00
Aske Simon Christensen b85f0c7524 [dart2wasm] Scripts for compiling and running benchmarks
Change-Id: I01d8653e60c9667aefcbcef7f1871f408a539482
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271721
Reviewed-by: Jonas Termansen <sortie@google.com>
2022-12-08 11:56:56 +00:00
Aske Simon Christensen 8530755608 Update Binaryen to eeb838155dbff2fb6731f1ae5550cbb9494532fe
This version contains a `--closed-world` flag that we want to provide
to `wasm-opt` in the dart2wasm  benchmarking script from the start.

Change-Id: I5f97cd1911dad9946ac17fa25f9b11b0ed48bed7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273221
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-12-08 11:56:56 +00:00
Daco Harkes d86c043cbb [vm] Remove FallThroughError code in the VM
Since Dart 2.0 we can never have FallThroughErrors.

The CFE does not synthesize breaks unterminated cases which never
reach the end of the block. For example:
* Call to something that returns never.
* Nested complete switch which returns from every branch.

In these cases we need to construct a correct control flow in the VM,
even though it is dead code. Because the CFE does not make the outer
switch a labelled statement, we cannot find a jump target in the VM.

Therefore, throw something (just not a FallThroughError). This should
never be hit at runtime, because it's dead code.

When the CFE emits synthetic breaks, we can remove this workaround.

TEST=build SDK and run default suites.

Bug: https://github.com/dart-lang/sdk/issues/50595
Change-Id: I595dd3baf7253b0ac4931445bd5b6da49e84cae4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273740
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2022-12-08 11:51:31 +00:00
Ömer Sinan Ağacan 636232628b [dart2wasm] Implement missing features in dynamic invocations
This reimplements dynamic call code generation to add support for type
checking, named parameters (optional and required), and fixes a few
related bugs on the way.

Currently we do not try to be as efficient as possible. The goal with
this patch is to implement it correctly.

Summary of the changes:

- For every dynamic access kind and member name, we generate a new
  "forwarder" function. Dynamic gets, sets, and invocations are compiled
  to calls to the forwarders with the right access kind (invocation,
  get, set) and member name.

  For example, if the program has dynamic invocation of a member "f", we
  create an "invocation forwarder for f". If it has a dynamic get of a
  member "x", we generate "getter forwarder for x".

- Forwarder functions take 4 arguments:

  - Receiver of the invocation, get, or set.

  - A Dart list for type arguments in the invocation. For gets and sets
    the list is empty.

  - A Dart list for positional arguments in the invocation. For gets the
    list is empty. For sets, the list only has one element.

  - A Dart list for named arguments. For gets and sets the list is
    empty. The list has alternating elements of type `Symbol` and
    `Object?`, for the name and value of the named parameters.

- A forwarder function compares receiver class ID with the potential
  targets of the call. When it finds a match, it compares the callee
  "shape" with the parameters passed in the call site.

  As it compares the shapes it adjusts argument lists:

  - Creates default values for missing optional positional and named
    arguments

  - Reorders the named argument list to match order expected by the
    callee

  If it can't find a matching class ID and a member with the right name
  and shape, it calls `noSuchMethod` on the receiver.

  If it finds a matching class ID and a member, it calls the "type
  checker" for the member, passing the original receiver and adjusted
  argument lists.

- A "type checker" implements argument type checking for a member, and
  it's a member of the same class as the member it's checking types
  for. This is to allow accessing class-bound type parameters when
  generating type checking code.

- Type checking is implemented using `_isSubtype` on arguments in the
  lists.

- When type checking is successful a type checker calls the original
  member, passing the arguments as expected by the member.

  If type checking is unsuccessful it throws a type error.

Most of the changes are for generating Wasm functions that compare
shapes, adjusts argument lists, and checks types.

Changes to members:

- `Translator.dynamics` fields is renamed to
  `Translator.dynamicForwarders`

- New field `Translator.dynamicForwarderFunctionType` added for the Wasm
  function type of forwarder and type checker functions.

- Two new code gen utilities added:

  - `Translator.indexList`: generates code that indexes a Dart list

  - `Translator.getListLength`: generates code that gets length of a
    Dart list

- New `Reference` extensions added to get type checker function
  references of members

- New runtime library `named_parameters` implements two helper functions
  for dealing with named argument lists

- The library `dynamic_dispatch` is replaced by `dynamic_forwarders`,
  which consists of two classes:

  - `DynamicForwarders`: maintains mapping from call kind (get, set,
    invocation) and member name to forwarder functions.

  - `Forwarder`: a single forwarder, implements code generation for
    forwarder functions.

- `CodeGenerator` gets 3 new members:

  - `_callForwader` generates call to a forwarder

  - `_generateFieldSetterTypeCheckerMethod` generates code for a type
    checker of a setter function.

  - `_generateProcedureTypeCheckerMethod` generates code for a type
    checker of a method.

Fixes #50367

Change-Id: I2b9d84237c8517bd217166d8acb67e025f0498fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272261
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-12-08 10:45:12 +00:00
Jens Johansen 09a9a89d65 [analyzer] Deduplicate strings in Declaration
This CL removes some duplication of Strings:
 * Most duplication in `relevanceTagsInFile` (`ElementKind.CLASS`, etc)
   when loaded from file.
 * Usage of `()` for `parameters`.
 * Empty string return type.
 * Known type return type.

On the analyzer instance I've measured on (8 folders with analyzer etc
open) this saves:

Before CL: 161851 kb  2158725   _OneByteString dart:core
        1:  154622 kb  2001695   _OneByteString dart:core // removes most practical duplication from relevanceTagsInFile
        2:  153247 kb  1957751   _OneByteString dart:core // Removes () parameters
        3:  152970 kb  1939890   _OneByteString dart:core // Removes empty string return type
        3:  151287 kb  1886063   _OneByteString dart:core // removes void, String, bool, int, Future<void> return type

That's a total of 10,564 kb or 272,662 instances.
This is also ~1.7% of total ram usage.

Change-Id: Ide2ae55ae052d9f8bc382805a204dce48bf2b263
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273742
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-12-08 09:48:20 +00:00
Ahmed Ashour 66990edcf5 [analysis_server] fix RemoveDeadCode with forParts
Bug #43511

Change-Id: I82854382928cd29bfc7c646f0c202d28603f8836
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-12-08 06:33:09 +00:00
Srujan Gaddam 293ae7dabe [ddc] Add interop classes for static members
Fixes https://github.com/dart-lang/sdk/issues/46967

Creates classes for non-external factories and static members, and
modifies invocations to point to these members instead. Tear-offs of
interop constructors (external or otherwise) are now supported since
they're just non-external static methods.

Change-Id: Id754fb4bc872051a8df4169aefd4bdc078452fb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270501
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2022-12-08 04:57:50 +00:00
Stephen Adams 49f9a85be2 [dart2js] Clean up migration interface
Change-Id: Ie40716265fce4cdb7ce298d8cbbf6c86fe06c05d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274267
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-12-08 04:17:51 +00:00
Brian Wilkerson 8569d24f3e Attempt to fix the windows bot
Change-Id: Id1743f8998c2cb2553b5cfed801e9caef9c1d7c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274264
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-12-08 02:20:17 +00:00
Stephen Adams 2dbd64bb29 [dart2js, js_runtime] Make JSNull.== an external method
Change-Id: I5a69b4f085a1d418fe60af7a8726bc713b54a0bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273462
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-12-08 02:14:00 +00:00
Brian Wilkerson de36e1cfb7 Enable patterns in server tests
Change-Id: I1d256b4c1c0cc20cb3e46087cd896d0920f82690
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274084
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-12-08 02:12:14 +00:00
Konstantin Shcheglov 44b877b55a Create AssignedVariablePatternImpl or DeclaredVariablePatternImpl.
Change-Id: I8009a0b3c46cdaec199a38e2c25a5792ae8cd9e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274266
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-12-08 01:57:48 +00:00
Jackson Gardner 00ca59a478 [dart2wasm] Support --multi-root and --multi-root-scheme flags.
Change-Id: I111748742677073bb3cf4c1655b69cb21d42f546
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274089
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
2022-12-08 00:59:23 +00:00
Nicholas Shahan 1edc2ecd3f [ddc] Support warnings/errors in weak mode
In the new runtime type system when running with weak null safety,
perform type tests multiple times to produce optional warnings or
errors when a test passes but would fail in sound null safety.
This is the same technique DDC uses with the current type system.

Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: Ic1514987a6f4ffeb127a0d2be5ec15b606016212
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266543
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-12-08 00:52:18 +00:00
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