Commit graph

81562 commits

Author SHA1 Message Date
pq b3cb952a69 fixed Linter CHANGELOG entry
Follow-up from:

https://dart-review.googlesource.com/c/sdk/+/210500/12/CHANGELOG.md
https://dart-review.googlesource.com/c/sdk/+/209765/3/CHANGELOG.md

Change-Id: I6524f93dc8d75331cf7a5910d01a9186d78f4911
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212600
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2021-09-07 17:14:33 +00:00
Alexander Markov 74dc879d25 [vm/compiler] Optimize 'double == int' in AOT
TEST=vm/cc/IRTest_DoubleEqualsSmi
Fixes https://github.com/dart-lang/sdk/issues/47031

Change-Id: I6395ae50806b238971872b375c495962cb868cb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212484
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-09-07 17:06:43 +00:00
Konstantin Shcheglov 74d2704382 Separate index/search kind for ConstructorReference.
When we just search, it is enough to know that there is just any
reference kind, however wheb I attempted to implemented rename
refactoring, I realized that we need to know if the reference is
from a ConstructorReference, so `.new` is required.

I think this change will let us do this, however I still have not
tried to actually wire it, so might still be wrong.

Change-Id: Ie97e23d391ea89d7f3695663368835e747cbeee5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212546
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-07 16:52:32 +00:00
Ahmed Ashour 20a8d62cca Enable ADD_CONST for bulk
Fixes #47001

Change-Id: Ia42affb8f26e69f94e12192458e68bc29e848ed9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211446
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-09-07 16:39:32 +00:00
Alexander Aprelev 78116e1d2c [vm/switchable_calls] Clean up assert in monomorphic miss jit handler.
The check for number of isolates was racy because isolates might be exiting, number of isolates in the group going down as we enter ic cache miss runtime handler.
This caused flaky failures on debug buildbots.

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

Change-Id: Ie78a80fecb30d2cc40635acd465078cb0f22a234
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212487
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-09-07 16:24:24 +00:00
Konstantin Shcheglov 1957af707c Use CONSTRUCTOR_TEAR_OFF for ConstructorReference highlighting.
Change-Id: Iee9731ef6e273ae89bc5328d6941aa8ddd530562
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212488
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-07 16:08:02 +00:00
Daco Harkes 40bbb6dcc2 [vm] Const map, remove invalid assert
Isolates are allowed to race each other to initialize _indexNullable,
the last isolate wins. See
https://dart-review.googlesource.com/c/sdk/+/210726 and
https://dart-review.googlesource.com/c/sdk/+/203765.

These asserts were wrong, because another isolate could have initialized
_indexNullable in between places calling _createIndex and _createIndex
itself.

Closes: https://github.com/dart-lang/sdk/issues/47118

Change-Id: I5d55b9715ef622737a6f70c0b57590076ece3225
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212586
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-09-07 15:47:22 +00:00
Johnni Winther bc1c71fd9b [cfe] Handle un-inlined fields/locals in eager instantiation constantification
Closes #47108

TEST=existing

Change-Id: I590939161cde1316eede7d828dff5fe6ac2790fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212577
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-09-07 15:14:36 +00:00
Daco Harkes 015c4e604a [vm] Bail out inlining on wrong optional arguments
TEST=runtime/tests/vm/dart/regress_flutter89482_test.dart

Before: assert (debug mode)
After:
  Closure Calls (1)
  => other (deopt count 0)
     Bailout: optional arg mismatch

Bug: https://github.com/flutter/flutter/issues/89482

Change-Id: I5b0a9b738465d12c47304e9309bfa8f701c5aae6
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-simarm_x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212570
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-09-07 14:32:22 +00:00
Martin Kustermann 6ac8ad9881 [vm/concurrency] Ensure unreachable new space objects use null filler objects instead of 0 Smis
The new space allocated objects created by transitive object copy are
themselves always GC safe. If an invalid object is encountered and the
copy is aborted, there will be unreachable, allocated new space objects
left, that the next scavenge will reclaim.

If an object in the heap is unreachable it shouldn't really be touched
(not even by GC). Only heap iterations can possibly look at them.

Turns out that hot reload performs heap iterations without collecting
all garbage first. That means it can encounter such an unreachable
object.

Hot reload assumes that it can (for instances of generic classes) always
get a valid TypeArguments vector (or null) - though it encountered 0
instead.

So there's several solutions:

  * Make Hot-Reload only work on actually alive objects.
  * Make the unreachable objects have null instead of 0 in them

We'll choose the latter and use the existing Object::InitializeObject()
helper method (although it will be slower than the existing
implementation).

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

TEST=Fixes vm/dart_2/isolates/closures_without_captured_variables_test in hot-reload test mode.

Change-Id: I15d48473f0ce4a856316fe24166e81ebc87ccdbd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212585
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-09-07 14:16:52 +00:00
Martin Kustermann 258487cafd [vm] If isolate group spawning fails, we need to enter the IG in order to delete the api state
Fixes https://github.com/dart-lang/sdk/issues/47087

TEST=Fixes vm/dart_2/spawn_shutdown_test/1 test failure.

Change-Id: I416c4732d71eed9fe6fb26b8a5ce12ed5b122d4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212584
Commit-Queue: Martin Kustermann <kustermann@google.com>
Auto-Submit: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-09-07 14:08:32 +00:00
Danny Tuppeny e161187728 [dds] Refactor some DAP classes in preperation for "dart test" adapter
Change-Id: Ice48b45c0ad11a1981e8e4115bb8de6d009d7b5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212062
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-09-07 14:03:03 +00:00
Jens Johansen eb808b0e35 [CFE] Fix dependency pruning in regards to constant evaluation
Change-Id: I82226c433e28ada640b4fa102f9def506a2e8758
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212466
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-09-07 10:53:42 +00:00
Dmitry Stefantsov 0a9d14a8e3 [cfe] Adjust computation of nullability in flatten
Closes #47057.

Bug: https://github.com/dart-lang/sdk/issues/47057
Change-Id: Iad719192d0ecbe97461bfed868899072a6dd52e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212467
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-09-07 10:40:44 +00:00
Dmitry Stefantsov ab508bb2d1 [cfe] Add basic parsing support for extension show clause
Change-Id: I63847a06ff7370dd1b92fc6b4b706c684f15638e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209909
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-09-07 10:35:12 +00:00
Jens Johansen ccfe2d65a9 [CFE] Fix weak status entry for general/external_import
Change-Id: I6c28ccee258b470c4630f374f5b42cd3a63dc280
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212581
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-09-07 10:32:42 +00:00
Alexander Thomas a6d840054d [co19] Roll co19 to 4aae571b0358e2f063ab68f2eb92857e31deb0b9
2021-09-06 sgrekhov@unipro.ru Assertion updated in constructor tear-off ambiguities tests
2021-09-06 sgrekhov@unipro.ru Fixes 1191. Generic instantiation of 'call' method is now allowed

Cq-Include-Trybots: dart/try:analyzer-nnbd-linux-release-try,dart2js-nnbd-linux-x64-chrome-try,ddc-nnbd-linux-release-chrome-try,front-end-nnbd-linux-release-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try
Change-Id: I071c79dec550970ed74f6cc3b3a4fc9a071b0387
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212578
Reviewed-by: William Hesse <whesse@google.com>
2021-09-07 09:52:24 +00:00
Dmitry Stefantsov d120af39c6 [cfe] Fix crash on const constructor tear-off
Closes #46133.

Bug: https://github.com/dart-lang/sdk/issues/46133
Change-Id: I73035d2b27a2d8116fa7c31abdebfdd7299d6898
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212572
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-09-07 09:39:32 +00:00
Sergey G. Grekhov c14d66253c [co19] Re-enable fixed tests
This CL re-enables (except on platforms that don't support them):
Language/Libraries_and_Scripts/Scripts/top_level_main_t01
Language/Expressions/Numbers/syntax_t34

Cq-Include-Trybots: dart/try:analyzer-nnbd-linux-release-try,dart2js-nnbd-linux-x64-chrome-try,ddc-nnbd-linux-release-chrome-try,front-end-nnbd-linux-release-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try
Change-Id: I10a1b1c9abc125c000cc9e9ba7d749b8766e193d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212563
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2021-09-06 17:30:57 +00:00
Kevin Moore f42cc14c3c Fix link to native extensions deprecation issue
Follow-up to bda70c8489

Change-Id: I76f042a08a6d313bfdee297b078e01fd81784b97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212545
Auto-Submit: Kevin Moore <kevmoo@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2021-09-06 16:46:53 +00:00
Johnni Winther 8f270ea432 [cfe] Handle external extension instance fields
Change-Id: Ia6d397e2be3cc46f252b679007f6f7b45096420f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212569
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-09-06 15:52:39 +00:00
Lasse R.H. Nielsen 2b41685519 Move the CHANGELOG entry for dart:cli deprecation to 2.15.0
Change-Id: I73bfdd310af6df6cc1d62311e155fc432b84165d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212567
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Auto-Submit: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2021-09-06 12:26:11 +00:00
Ahmed Ashour f1ded6af56 Remove import dart:core
Fixes #47092

TEST=existing

Change-Id: I3c5c0a1ec5e0426642a5dc70aa9a0391a143ed93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212298
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-09-06 11:57:40 +00:00
Daco Harkes 2b5adb7231 [vm] Implement constant Maps in the VM
This CL changes the frontend to emit map and set constants which are
then processed by the constant reader in the VM.

This CL also introduces support for sending the const maps and sets
in messages between isolates and saving it in snapshots.

TEST=tests/language/const/map_test.dart (et al, for lookups)
TEST=tests/lib/isolate/message3_test.dart (et al, for isolate messages)
TEST=tools/test.py -c dartkp (for consts from clustered snapshot)
TEST=tools/test.py -n app_jitk-linux-debug-x64 (for consts from app
     jit snapshots)
TEST=Building the SDK which uses const Maps in clustered snapshots.

Closes: https://github.com/dart-lang/sdk/issues/45908

Change-Id: I1f8150a8aba8298c4e64d2571dd147743526135a
Cq-Include-Trybots: luci.dart.try:analyzer-nnbd-linux-release-try,app-kernel-linux-debug-x64-try,dart-sdk-linux-try,front-end-nnbd-linux-release-x64-try,pkg-linux-debug-try,vm-canary-linux-debug-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-checked-linux-release-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-simarm64c-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-tsan-linux-release-x64-try,vm-kernel-tsan-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203765
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-09-06 06:28:59 +00:00
Daco Harkes e8e9e1d152 [vm] Introduce immutable maps and sets in backend
This CL introduces immutable maps and sets in the VM backend but does
not yet target them from the frontend. The changes are tested by unit
tests constructing these immutable maps and sets.

This CL introduces immutable variants of the hash map and set in
compact_hash.dart and recognizes them in the VM. The immutable ones
use a different mixin with a different recognized method for accessing
members.
* Data list is an immutable list with a different cid. (Otherwise the
  optimizer notices that immutable and mutable lists cannot be equal.)
* Index is a nullable mutable typed data. (Otherwise optimizer removes
  necessary null checks.)
* Index should use a store-release barrier when written to.

Multiple isolates might lazily compute the index for const sets and
maps. This is fine because all identityHashCodes and hashCodes are
guaranteed to be race-free. The later isolates will override the index
pointer with an identical index.

This CL does not introduce support for using these immutable maps and
sets in AOT (clustered_snapshot) and in messages to other isolates
(message_snapshot) because that is harder to test with unit tests. That
will be added in the follow-up CL.

Design doc: go/dart-vm-const-maps

TEST=runtime/vm/object_test.cc

Bug: https://github.com/dart-lang/sdk/issues/45908

Change-Id: I4042179c15e8b37692d3255655351c01c7124991
Cq-Include-Trybots: luci.dart.try:analyzer-nnbd-linux-release-try,app-kernel-linux-debug-x64-try,dart-sdk-linux-try,front-end-nnbd-linux-release-x64-try,pkg-linux-debug-try,vm-canary-linux-debug-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-checked-linux-release-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-simarm64c-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210860
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-09-06 06:28:59 +00:00
Daco Harkes 32f6f94ab5 [vm] Add store release barrier option to StoreInstanceInstr
In dependent CL, const maps and sets can be shared between isolates in
the same isolate group before the index is lazily populated. To prevent
one isolate from seeing a non-null index pointer, while not all writes
to the index itself are visible to the isolate (the mutator thread of
that isolate), we use a store release barrier on arm architectures.

This CL adds a store release barrier option to the StoreInstanceField
instruction to be used in the dependent CL.

Even though there is no barrier on x64 and ia32, we still also use the
option on these architectures because on x64 we signal the barrier to
TSAN.

The stlr instruction on arm64 does not feature an address operand.
Therefore we need to branch in the assembler on whether we're using
a store-release before we construct an Address.

Design doc: go/dart-vm-const-maps

TEST=Dependent CL, split off for ease of reviewing.

Bug: https://github.com/dart-lang/sdk/issues/45908

Change-Id: I6563aa3c813319a23e815b862ca5caabb805dc9e
Cq-Include-Trybots: luci.dart.try:analyzer-nnbd-linux-release-try,app-kernel-linux-debug-x64-try,dart-sdk-linux-try,front-end-nnbd-linux-release-x64-try,pkg-linux-debug-try,vm-canary-linux-debug-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-checked-linux-release-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-simarm64c-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-tsan-linux-release-x64-try,vm-kernel-tsan-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210726
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2021-09-06 06:28:59 +00:00
Daco Harkes f21b7cafbc [vm/ffi] Adds param number in trampoline null error
Before: `NoSuchMethodError: The method 'FfiTrampoline' was called on
null.`
After: `Invalid argument(s): argument value for ':ffi_param2' is null`.

Makes the ArgumentNullError RTE lookup the name of the argument in the
code source map when reporting a null argument.

Makes the FFI call arguments and FFI callbacks use kArgumentError
instead of the default kNoSuchMethod so that we target this RTE instead.

This changes the Error type from `NoSuchMethodError` to `ArgumentError`.
Because `Error`s should not be caught [1], this is fine.

Since FFI trampolines are created from type arguments, the arguments do
not have names. The arguments are assigned names programmatically. See
the related bug.

Also, this CL cleans up the SourcePosition of the `CheckNullOptimized`,
it was never passed.

[1] https://dart.dev/guides/language/effective-dart/usage#dont-explicitly-catch-error-or-types-that-implement-it

TEST=tests/ffi/function_test.dart

Closes: https://github.com/dart-lang/sdk/issues/47094
Bug: https://github.com/dart-lang/sdk/issues/36780

Change-Id: I15e7de4d026e034bde0eda3ba7fe3785f0da5057
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm-try,vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,app-kernel-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-ffi-android-debug-arm64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212462
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2021-09-04 07:22:03 +00:00
Konstantin Shcheglov 01c4999b31 Test search with constructor tear-offs.
Change-Id: I9f5e2c8a8f6da737f8a3c81abf964d7e93493895
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212520
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-03 23:52:48 +00:00
Alexander Aprelev 21298ee884 Reland "[vm/concurrency] Enable isolate groups by-default in all modes"
This reverts commit d0a3daffb7 that
reverted the initial land.

The fix for the problem that required the revert landed in
https://dart.googlesource.com/sdk/+/5ccf97a5a950ef70f41d84f186dad550d4acda01

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

TEST=ci

Change-Id: Ie92074059319e046809169d9e16d459ce1c2848f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212481
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-09-03 23:29:08 +00:00
Sam Rawlins 535a9bef95 analyzer: Report bad accesses to member named 'new'
Fixes https://github.com/dart-lang/sdk/issues/47077

Change-Id: Ib344204b28adbaf7a9dfa92e2ddb157930cc6547
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212500
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-09-03 22:48:47 +00:00
Alexander Aprelev 7495184e2f [vm/gardening] Fix static_function_test to accommodate closure passing.
TEST=lib/isolate/static_function_test

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

Change-Id: I4ad552c35297230123574dee5451ab83b731f406
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212489
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-09-03 22:44:28 +00:00
Srujan Gaddam 07aa93a532 [dart:html] Add js_util import to dart:html
Part of https://dart-review.googlesource.com/c/sdk/+/210100

As classes get migrated to js_util, this import is needed.

Change-Id: Ib455257883257af2e145c222ab903488b22f13f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211540
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-09-03 21:53:27 +00:00
Konstantin Shcheglov 9b3a91a515 Add constructor references to ConstructorElement indexing tests.
Change-Id: I0d62d43eb0663e6c65adb08e7c5f8bda49790b9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212486
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-03 21:27:18 +00:00
Konstantin Shcheglov d0935c2c85 Tests for FunctionReference in navigation.
Change-Id: I677197f6a27c3d20589fe612c4f5c84c5c5e2637
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212485
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-03 20:14:49 +00:00
Konstantin Shcheglov 21cbe332fd Issue 47097. Handle the case when a folder symbolic link target does not exist.
Bug: https://github.com/dart-lang/sdk/issues/47097
Change-Id: Ia32f742adf3ef24c67ec3e75cfa7dee969ff4afc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212483
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-09-03 19:24:27 +00:00
Joshua Litt 2cd38d1f5a [dart2js] Add support for 'or' nodes in program split constraints.
Change-Id: I6de8240082e9b2f0f219e3641cf702054d2334a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208001
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-09-03 19:19:48 +00:00
Martin Kustermann 5f9ec9f52a [vm/concurrency] Allow closures as entrypoints in Isolate.spawn calls
We already allow sending closures (if immutable via sharing
otherwise via copying). This CL makes use of this to allow the argument
to `Isolate.spawn()` to be any closure.

Similar to normal message sending, the spawn will fail if the closure
cannot be sent (or causes an error on the new isolate, e.g. rehashing
error).

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

TEST=vm/dart{_2,}/isolates/closure_entrypoint_test

Change-Id: Iab342267d87bd87bc8c0c82d16aec58a69a3df44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212295
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-09-03 19:08:37 +00:00
Alexander Aprelev 21cbb2ae3a [analysis_server/benchmark] Fix memory usage calculation to avoid double-counting.
When several isolates share same isolate group, they share the same heap.
This change iterates over isolate groups and aggregates their heap size instead of iterating over isolates.

Change-Id: I83b04110277b3a2d22ab758b50ee8c4ce480ea7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212382
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-09-03 19:02:27 +00:00
Konstantin Shcheglov f67d4b368c Update navigation notification to support ConstructorReference.
Change-Id: I815941304f8dd131998f5ae527f21077ce5324df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212482
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-03 18:53:57 +00:00
Konstantin Shcheglov f726874678 Support for --cache in 'dart analyze'.
Bug: https://github.com/dart-lang/sdk/issues/45267
Change-Id: I503227ac59a3562e79d3654c405debaf5d0c764c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212420
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-03 18:43:08 +00:00
Nicholas Shahan 5ea90ee907 [ddc] Enable construtor tearoff lowering
* Update tearoff runtime equality algorithm with newly specified
  requirements.
* Update kernel golden files for the dartdevc target to include
  the static method lowering for constructor tearoffs.
* Avoid adding source maps and debug symbols to the static methods
  created by the CFE lowering.
* Add additional expected non-nullable values detected in the
  nullable inference tests. These correspond to the values that
  appear in the static method return statements.

Measurements taken from large applications show the lowering causes
a code size increase of 2.5%-3.5%. That increase did not appear to
create any measurable difference in initial page load time but if
there turns out to be a regression we can revisit each of the various
lowerings to implement support in DDC at the site where the constructor
is torn off.

Fixes: https://github.com/dart-lang/sdk/issues/46486
Fixes: https://github.com/dart-lang/sdk/issues/46837
Change-Id: I01fa39d4f1d0e937919dd1466bb6a34c91a10e75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206960
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-09-03 17:48:58 +00:00
Dmitry Stefantsov 94470918b9 [cfe] Check bounds in instantiated type literals
Closes #47046.

Bug: https://github.com/dart-lang/sdk/issues/47046
Change-Id: I1d081bbda316dccbfd48ed95ddf8e3f22a386191
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212290
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-09-03 16:19:47 +00:00
Alexander Aprelev 5ccf97a5a9 [vm/reload] Fix how isolate group source loaded_blobs are visited.
loaded_blobs need to be visited as part of IsolateGroup::Visit method rather than Isolate::Visit one.
Before this change loaded_blobs could become corrupted because GC requires objects being visited only once during collection cycles.

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

TEST=ci, flutter

Change-Id: Ic61498c205c5cc072e5f45928264a507a7752e0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212440
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-09-03 15:30:09 +00:00
Sam Rawlins 29ba68fcf2 Set ConstructorReference TypeName.type to null; re-arrange bounds checks
A follow up from https://dart-review.googlesource.com/c/sdk/+/211304

Change-Id: Ia68a232befc6371739551eb40ad49a9ef15ee5c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211640
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-09-03 15:10:07 +00:00
Sam Rawlins 394b76fd61 Add tests for constructor tearoff as const function.
Also update some TODOs.

Change-Id: I02c883e717a3315892a99879ef45aba804183c86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212020
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-09-03 14:20:58 +00:00
Martin Kustermann 462eb6a105 [gardening] Ensure we have an active isolate group when destroying IsolateSpawnState
The destructor of [IsolateSpawnState] might call destructors on
[Message] which may want to delete persistent handles. Doing so requires
an active isolate group.

This CL ensure that in shutdown races (main isolate exists which
triggers VM shutdown, helper islate is about to start but fails to start
due to VM shutdown request), we still ensure to properly delete the
persistent handles.

TEST=Fixes vm/dart_2/spawn_shutdown_test/0 on app-jit configurations.

Change-Id: I0c3e0ceca7faab36f298953dabb1ccae3a0ecc8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212464
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2021-09-03 13:15:57 +00:00
Martin Kustermann ecbc4ee2d4 [gardening] Fix transitive object copy of closure support in compressed mode
The allocation routine for allocating context objects (used for copying
closures) has to use uncompressed mode - since [Context] objects aren't
compressed yet.

This is a follow-up to https://dart-review.googlesource.com/c/sdk/+/209110

TEST=Fixes closure tests in vm/dart_2/isolates/fast_object_copy2_test/<num> in compressed mode.

Change-Id: I3a16701fe662ff7ea501a238653c7efb376cda55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212465
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-09-03 13:14:47 +00:00
Martin Kustermann e9b56794fc [vm/compiler] Make closures have no context if no variables are closed over
As a side-effect of making closures without captured variables have an
empty context, we not only avoid a memory leak, but also allow such
closures to be sent across [SendPort]s.

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

TEST=vm/dart{_2,}/isolates/closures_without_captured_variables_test

Change-Id: I5e8845203059ff625f7cff3f072d845b5e48ba36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212297
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2021-09-03 12:35:58 +00:00
Alexander Thomas 9bec5d6b3b [co19] Roll co19 to a4f77a02a3676b1c2e7390c860cb0486c8515d3f
2021-09-03 sgrekhov@unipro.ru Fixes 1187. Roll failures fixed

Cq-Include-Trybots: dart/try:analyzer-nnbd-linux-release-try,dart2js-nnbd-linux-x64-chrome-try,ddc-nnbd-linux-release-chrome-try,front-end-nnbd-linux-release-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try
Change-Id: I168b3dff190ea889eba23aad0159a5d130251718
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212463
Auto-Submit: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2021-09-03 12:06:17 +00:00
Martin Kustermann 9615af4635 [vm] Cleanup some workaround due to native extensions (which got removed)
Now that support for native extensions (aka dart-ext:*) has been
removed, the kernel loader is guaranteed not to call out to embedder
anymore (it did so before for loading shared libraries).

This allos us to clean up some code as well as extend the scope of our
NoActiveIsolateScope.

TEST=ci

Change-Id: I5c8c9ee47298fdd316583ba3aed74772c1c7783f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212296
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-09-03 10:55:37 +00:00