It is not valid to access either the NativeArguments slots (quasi handles) or the result's CID/header during the execution state kThreadInNative. During such a state, GC can be running on another thread and object headers and handles might contain forwarding pointers.
TEST=no
Bug: b/301044910
Change-Id: If3de5e9d7d3708d44a2939225a7c314c2c4d13c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326903
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
The method is _buildAugmentationImport(), used for any other augmentation.
To do this, we create a FileState instance that corresponds to the
augmentation library. This way, we keep its content there, so that
later we will able resolve it.
For now, this allows reusing existing support for imports, and write
a macro that references a type identifier from a library, that later
is generated into a library import, and a prefixed referenced in code.
Change-Id: I5affeaa07253f2464b1da255c6218c3d46a3d887
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326882
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Also marks CheckBoundBase as an abstract instruction, instead of it
being treated specially.
Now when matching IL graphs that use bounds check instructions, which
differ in JIT vs. AOT, the matcher can match the abstract base
instruction (CheckBoundBase) instead of having to separately match the
concrete subclasses on JIT (CheckArrayBound) and AOT
(GenericCheckBound).
TEST=ci
Change-Id: I73dd6bf6711a99cc2c52a69cf31f22ba4850f2b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/327001
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
`FlowModel.promotionInfo` is currently a map from integer promotion
keys to PromotionModel data structures. This is inefficient because
FlowModel is an immutable data structure, so whenever the promotion
state of a variable changes, the map must be duplicated. In a
follow-up CL I will be changing `FlowModel.promotionInfo` to a much
more efficient data structure. However, that data structure will
require some extra plumbing. For ease in code review, I'm doing the
extra plumbing first, as its own CL.
This CL makes the following changes:
- Removes unnecessary null checks from the `FlowModel.withInfo`
constructor. These null checks are no longer needed because all the
clients of flow analysis are now fully null safe. This change is not
strictly necessary; it's just a long-overdue clean-up.
- Adds a `helper` argument (of type `FlowAnalysisHelper`) to
`FlowModel.conservativeJoin`, `FlowModel.declare`, and
`FlowModel.infoFor`, `FlowModel.inheritTested`, and
`FlowModel._updatePromotionInfo`. This is needed because these
methods will need access to `FlowAnalysisHelper` in order to read
and update the new data structure.
- Removes the `typeOperations` argument of `FlowModel.inheritTested`,
since it can be easily obtained from the new `helper` argument.
- Changes `FlowModel._updatePromotionInfo` to a public method
annotated with `@visibleForTesting`. This will be needed by flow
analysis unit tests to create the new data structure.
Note that this change causes a small regression in the performance of
CFE compilation, due to the extra `helper` arguments:
instructions:u: 0.0693% +/- 0.0008% (13413234.33 +/- 155671.09)
branches:u: 0.0886% +/- 0.0012% (3502620.67 +/- 45724.97)
The follow-up CL that switches to a more efficient data structure will
result in a performance improvement roughly an order of magnitude
larger.
Change-Id: I21c13fb817f05281b558f0473119473a26ea0fb8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326860
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This is the last version before the (breaking) switch to the final
WasmGC instruction encoding.
Change-Id: I5664dbcde897ab2b32c8b34e1328d82bdc9445be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326820
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Auto-Submit: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Now that the canary configurations are more reliable we can start
running these tests again. They were originally skipped when the
async implementation in the new type system was not working correctly.
The `web/async_stacktrace_test` has actually been timing out in the
stable configs as well. The timeout is consistent and reproducible
locally so I'm filing a new issue and skipping it on all DDC configs
for now.
Fixes: https://github.com/dart-lang/sdk/issues/50666
Issue: https://github.com/dart-lang/sdk/issues/53555
Change-Id: I7306ba66afe595fb213f06c0ad884d376240addc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326721
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Previously the pattern would only be recorded as a reference to the getter. If there was a reference to the declared variable elsewhere in the visited code, it would then record the variable declaration (via the reference).
In LSP, we locate declarations by only looking at the node at the cursor, so we can't rely on the declaration being recorded by some other reference (if one even exists) so this ensure it is recorded explicitly.
Fixes https://github.com/dart-lang/sdk/issues/53554.
Change-Id: I8983d0637f2d89a427fb1fa11293eec8e06fede8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326700
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
TL;DR: This CL is shown to reduce memory usage by ~660MB when asking
for many completions.
Before this CL the analyzer cached `_ElementCompletionData` for every
element that have ever had it calculated. This itself contains new
strings, lists etc.
This was likely (although I'm guessing) done because it was asked for
it a lot: In my benchmarks, asking for at most 250 completions for each
of the first 200 files (twice) it was asked more than 113 million times.
Likely (extrapolating) it would take ~26 minutes creating these if not
cached.
In practise we don't need to ask for >113 million of them though.
Each request only wants at most, say, 100 results and likely fewer.
In the benchmark the `build` command was only run ~31% more times than
the number of caches. Building 100 results (again just using the
average) would take ~1.4 ms so hardly matters.
This CL removes the caching (including the field on many `Element`s),
and only calculates it when needed (i.e. on `build` as it's about to be
sent to the users IDE).
When asking for at most 250 completions in the first 1000 files in flutter/flutter (80+ contexts) we save ~669MB of heap usage, making
the heap usage decrease from ~8.34GB to ~7.69GB.
Details:
```
ExtensionElementImpl (package:analyzer/src/dart/element/element.dart) (bytes):
Difference at 95.0% confidence
-1185728.00 +/- 413.05
-8.36% +/- 0.00%
SimpleIdentifierImpl (package:analyzer/src/dart/ast/ast.dart) (bytes):
Difference at 95.0% confidence
-1187104.00 +/- 133935.98
-1.14% +/- 0.13%
_List (dart:core) (instances):
Difference at 95.0% confidence
-1204916.00 +/- 5571.96
-10.08% +/- 0.05%
ConstTopLevelVariableElementImpl (package:analyzer/src/dart/element/element.dart) (bytes):
Difference at 95.0% confidence
-1301800.00 +/- 12081.85
-7.93% +/- 0.07%
_OneByteString (dart:core) (instances):
Difference at 95.0% confidence
-1825992.50 +/- 186205.44
-28.49% +/- 2.91%
ConstructorElementImpl (package:analyzer/src/dart/element/element.dart) (bytes):
Difference at 95.0% confidence
-5518400.00 +/- 135361.21
-6.29% +/- 0.15%
ClassElementImpl (package:analyzer/src/dart/element/element.dart) (bytes):
Difference at 95.0% confidence
-6820704.00 +/- 21606.00
-6.34% +/- 0.02%
CompletionDefaultArgumentList (package:analysis_server/src/services/completion/dart/utilities.dart) (bytes):
Difference at 95.0% confidence
-9054304.00 +/- 6195.82
-100.00% +/- 0.07%
InterfaceTypeImpl (package:analyzer/src/dart/element/type.dart) (bytes):
Difference at 95.0% confidence
-9941600.00 +/- 776821.86
-2.32% +/- 0.18%
ElementLocationImpl (package:analyzer/src/dart/element/element.dart) (bytes):
Difference at 95.0% confidence
-10401472.00 +/- 111022.97
-46.19% +/- 0.49%
_TwoByteString (dart:core) (bytes):
Difference at 95.0% confidence
-11262480.00 +/- 227076.11
-11.77% +/- 0.24%
MethodElementImpl (package:analyzer/src/dart/element/element.dart) (bytes):
Difference at 95.0% confidence
-13877752.00 +/- 351565.94
-7.70% +/- 0.20%
_ElementDocumentation (package:analysis_server/src/services/completion/dart/suggestion_builder.dart) (bytes):
Difference at 95.0% confidence
-18954304.00 +/- 202259.10
-100.00% +/- 1.07%
_GrowableList (dart:core) (bytes):
Difference at 95.0% confidence
-23003968.00 +/- 3135.17
-25.12% +/- 0.00%
Location (package:analyzer_plugin/protocol/protocol_common.dart) (bytes):
Difference at 95.0% confidence
-63403200.00 +/- 444171.45
-99.68% +/- 0.70%
_List (dart:core) (bytes):
Difference at 95.0% confidence
-71587648.00 +/- 2062003.75
-5.54% +/- 0.16%
Element (package:analyzer_plugin/protocol/protocol_common.dart) (bytes):
Difference at 95.0% confidence
-79254080.00 +/- 555214.31
-100.00% +/- 0.70%
_ElementCompletionData (package:analysis_server/src/services/completion/dart/suggestion_builder.dart) (bytes):
Difference at 95.0% confidence
-110955712.00 +/- 777300.03
-100.00% +/- 0.70%
_OneByteString (dart:core) (bytes):
Difference at 95.0% confidence
-258932360.00 +/- 9586397.08
-35.00% +/- 1.30%
maxRSS:
Difference at 95.0% confidence
-327434240.00 +/- 121326188.82
-3.05% +/- 1.13%
currentRSS:
Difference at 95.0% confidence
-551153664.00 +/- 121286389.20
-5.34% +/- 1.18%
heapCapacity:
Difference at 95.0% confidence
-555710464.00 +/- 164879781.95
-5.75% +/- 1.71%
heapUsage:
Difference at 95.0% confidence
-701868280.00 +/- 8054728.47
-7.84% +/- 0.09%
```
Change-Id: I3b3631520d56ab36dabaee913e802aa1b7ebacfe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326822
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
No functional changes, just moving some more tests from old functions to the "new" TestCode class
Change-Id: If146725ec71460512988f7104d7d4ec77fa55f0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326823
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
No functional changes, just migrating a few more tests to Test Code.
Change-Id: Iae9ced80ddbfb2fceab080f32c899dfcbb5ed5df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326824
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Most of the tests removed here already are covered in the new tests.
And also two test cases are added.
Change-Id: I3d6e15d2b9fde14a2b2249a3422ca1508a0d7572
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326726
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
In this CL, I also add the foundation file, and move some existing
elements into it, and correct all of the necessary tests.
Change-Id: I772f76d6eaf64612667a445270f86741a4771ce8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326684
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
I tried my best to match terminology with other existing diagnostic docs.
Fixes https://github.com/dart-lang/site-www/issues/5172
Change-Id: I8c59bcdd6b0e9315dd35e120e3a9536d7a6c9930
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325923
Reviewed-by: Marya Belanger <mbelanger@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This copies the const_finder visitor from the Flutter SDK to the
Dart SDK to avoid having source code dependency on package:kernel
in the Flutter repository.
Change-Id: I76f98453c1650e63623708a9f4860d80ab4b25aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326645
Reviewed-by: Christopher Fujino <fujino@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: William Hesse <whesse@google.com>
- Update dart2wasm script to accept a `-O` argument. When passed it also
passed `--inlining-limit 10` to dart2wasm (unless it's already passed
by the caller) and runs wasm-opt on the output, with the same
arguments as `compile_benchmark`.
- Add new test configurations to run tests with optimized binaries.
Example configuration: `dart2wasm-linux-optimized-d8`.
Change-Id: Ia7bd8d9c99d3a4baecb72b92b2ba38c0e92807c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326620
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
wasm-opt can update a file in-place when input and output arguments are
the same. Do it and remove temp file and dirs.
Also remove `--enable-experiment` flags as they're no longer needed.
Change-Id: Ifd07e88b55a98ca9953aad1de8622249513f2f79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326302
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
This reverts commit d3124b87e5.
Reason for revert: unknown code for now.
Original change's description:
> observatory: Ignore new static Warning
>
> There are two spots where a nullable value is passed to a non-nullable
> Future.value call, or a non-nullable Completer.complete call. In the
> interest of not making any functional change, I'm just ignoring this
> new code.
>
> ```
> warning - lib/src/service/object.dart:870:29 - 'Future<Isolate>.value' shouldn't be called with an argument of nullable type 'Isolate?'. Try passing a non-null argument. - nullable_argument_to_non_null_type
> warning - lib/src/service/object.dart:1559:29 - 'Future<Class>.value' shouldn't be called with an argument of nullable type 'Class?'. Try passing a non-null argument. - nullable_argument_to_non_null_type
> ```
>
> Related to https://github.com/dart-lang/sdk/issues/53253
>
> TEST=N/A
>
> Change-Id: I091990975a1f2b927e007564b6ca0658c6a34c20
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324762
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Auto-Submit: Samuel Rawlins <srawlins@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
Change-Id: Id5d033ca8601ea2f18aa9d2c8f8aeee8a2ceaf0d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326725
Commit-Queue: Alexander Thomas <athom@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
This is a reland of commit 54522db98f
Original change's description:
> [dart2wasm] Fix nullable JS type and int parameters in JSFunction
>
> When a callback is toJS'd with an int parameter, we should attempt
> a conversion to int if possible, similar to return values on
> external functions. Similarly, parameters where the expected type is
> a JS type should check to make the value isn't nullish before boxing,
> as JS null and undefined are converted to Dart null.
>
> Tests are added for conversion semantics of JSFunctions.
>
> Change-Id: I95566c2954d915b8cf31cdc55fed359c695404f2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323445
> Reviewed-by: Aske Simon Christensen <askesc@google.com>
Change-Id: I36ec7702b1e08fc9e4d6290952ae548b0e074ee3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325971
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
There are two spots where a nullable value is passed to a non-nullable
Future.value call, or a non-nullable Completer.complete call. In the
interest of not making any functional change, I'm just ignoring this
new code.
```
warning - lib/src/service/object.dart:870:29 - 'Future<Isolate>.value' shouldn't be called with an argument of nullable type 'Isolate?'. Try passing a non-null argument. - nullable_argument_to_non_null_type
warning - lib/src/service/object.dart:1559:29 - 'Future<Class>.value' shouldn't be called with an argument of nullable type 'Class?'. Try passing a non-null argument. - nullable_argument_to_non_null_type
```
Related to https://github.com/dart-lang/sdk/issues/53253
TEST=N/A
Change-Id: I091990975a1f2b927e007564b6ca0658c6a34c20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324762
Reviewed-by: Ben Konyi <bkonyi@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This change improves handling of extension types when they are used in
the generic types involved in parameter type checks.
Instead of treating extension types as unknown opaque types, TFA now
uses their type erasures.
TEST=pkg/vm/testcases/transformations/type_flow/transformer/extension_type.dart
Fixes https://github.com/dart-lang/sdk/issues/53542
Issue https://github.com/dart-lang/sdk/issues/49737
Change-Id: I04bb8f1940c0983b6c09403df577b89f5de4a81d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326681
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This is a reland of commit 2a669c571f.
External APIs when using dart:js_interop should only allow
primitives, JS types, and other static interop types. This
was previously checked in a more restrictive mode called
"strict mode" but is not checked everywhere where dart:js_interop
APIs exist.
Change-Id: I1a8d04071a519c4965b266eb2800bcc3c3bb8393
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325961
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
This makes it easier to see at a glance which messages need to be
supported by the website.
I've included the new links that I intend to support as part of the
new "field promotion" feature.
Bug: https://github.com/dart-lang/sdk/issues/53102
Change-Id: I67ad47c5a00db9807a6c726677a06427cdbe02c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325803
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
The last uses were removed in
b04c2a3783
Change-Id: I3eae2145ba5d5fdab8e9e13c20b466f5a0c9eb14
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326248
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>