Since Dart 2, library prefixes are always loaded eagerly on the VM.
Also remove reload check for deferred prefixes. This check was added to avoid behavior of library prefixes giving spurious "not loaded" errors after a reload, but now this error can never occur. Resolves a difference in reload between AST and bytecode modes, since bytecode mode isn't surfacing the deferred property.
Change-Id: Ide5fb6cac2efc90ca1b108a35bc09d342cbd60de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116051
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
In Dart2, the type relation "is more specific than" is no different than "is
subtype of". Since Dart1 is not supported anymore, type checking in the runtime
can be simplified and cleaned up.
Change-Id: I8e95b9e47146315c9a6f6c29b732ecbeb4e9ae97
Reviewed-on: https://dart-review.googlesource.com/c/88221
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
In Dart2, type bounds checking is either performed by the common front-end or
by explicitly generated code, but not by type finalization or runtime anymore,
as it was done in Dart1.
Consequently, the class BoundedType is not needed anymore, and malbounded or
malformed types are not seen by the runtime either.
Change-Id: I5d6e4c68d153d6730fa7ff7f6d9dcfa611299c16
Reviewed-on: https://dart-review.googlesource.com/c/86687
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
This is a reland of 1a4cff1bd4
Original change's description:
> [VM] Remove unused flags
>
> Remove the following flags which are always ON
> --strong
> --reify_generic_functions
>
> and these flags which are not applicable anymore
> --error-on-bad-override
> --error-on-bad-type
> --enable-type-checks
>
> Change-Id: I6e1aeb68e663953f4ae49ca94ea0daa87b661900
> Reviewed-on: https://dart-review.googlesource.com/c/79431
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>
Change-Id: Ib4452c22fb05eed38820708abb648939e03b1df0
Reviewed-on: https://dart-review.googlesource.com/c/84923
Reviewed-by: Siva Annamalai <asiva@google.com>
Remove the following flags which are always ON
--strong
--reify_generic_functions
and these flags which are not applicable anymore
--error-on-bad-override
--error-on-bad-type
--enable-type-checks
Change-Id: I6e1aeb68e663953f4ae49ca94ea0daa87b661900
Reviewed-on: https://dart-review.googlesource.com/c/79431
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
- Remove dead Isolate::IsTopLevelParsing.
- Remove dead TraceFunctionEntry/Exit.
- Migrate more tracing flags to flag_list.h to allow code elimination in non-debug modes.
- Require an explicit Zone parameter for CheckedHandles.
- Remove side-effects from RuntimeEntry constructor.
out/ProductX64/exe.stripped/dart_precompiled_runtime 4063464 -> 4046952 (-16k)
Change-Id: Iffd3de25a03d2354cdecf2d79aa761c33ab08bd3
Reviewed-on: https://dart-review.googlesource.com/c/83120
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This makes explicit downcasts more efficient by re-using the
optimizations we already have for implicit downcasts.
For implicit/explicit as checks we use the symbol to distinguish which
exception to throw if the check fails. So this does not actually
require unification of _CastError and _TypeError.
Issue https://github.com/dart-lang/sdk/issues/34582
Issue https://github.com/dart-lang/sdk/issues/30632
Issue https://github.com/dart-lang/sdk/issues/30571
Change-Id: I7b8818d2698e249c90a3e1b8790bad69ada649a9
Reviewed-on: https://dart-review.googlesource.com/c/78748
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
This function can be used to avoid checked down casts in the parts
of the code where we know by construction that the type of the
value matches expectations.
Use it to avoid down-cast in the _LinkedHashMap.operator[].
Bug: https://github.com/dart-lang/sdk/issues/31798
Change-Id: I80949bfb84dde7716fc23aeba311931970ce16aa
Reviewed-on: https://dart-review.googlesource.com/70511
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Remove some dead includes.
Change-Id: I31f3e739e5ee46dcbba5d6a2f091491b46402943
Reviewed-on: https://dart-review.googlesource.com/60146
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Leave --print-snapshot-sizes on stdout because it is parsed by Flutter benchmarks.
Replace all runtime/bin uses of OS::Print with Log::Print.
Bug: https://github.com/dart-lang/sdk/issues/32134
Change-Id: I74aacfb410cdfa9270d06e7f6ab0534520c7c7ba
Reviewed-on: https://dart-review.googlesource.com/60021
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
This fixes#33073 for all code which is relevant to Dart 2.
Change-Id: I3956bf9f2bb06f0e67c8b643e8a7765f28464f5f
Reviewed-on: https://dart-review.googlesource.com/54260
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
This change has been adjusted to account for the recent fix to Internal_prependTypeArguments.
Reviewed-on: https://dart-review.googlesource.com/50980
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Change-Id: I434a42578b91f0930b088c4d264d882c3ef5b4a3
Reviewed-on: https://dart-review.googlesource.com/53801
call Internal_prependTypeArguments to protect against vector reuse optimization.
This is indirectly related to issue #33040.
Change-Id: Ic03805135b1c68b59234336e145f5578cf178c74
Reviewed-on: https://dart-review.googlesource.com/53692
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
A reused type argument vector that is longer than necessary needs to be
shortened to the correct length upon type canonicalization.
The runtime call comparing two instance runtime types also needs to consider
reused vectors.
Add regression test.
Change-Id: Ib3b9620409b9cff313f270c4f3fb7051fecbb604
Reviewed-on: https://dart-review.googlesource.com/45340
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
It was pointed out that the previous fix
(5c74e0e16f) wasn't strong mode safe
because the returned array when length = 0 was not properly typed.
This fixes the issue by removing the old fix and simply removing the
assert.
Bug: 31381
Change-Id: I6d63d3329da2711067f632adbb9be998a4d468d9
Reviewed-on: https://dart-review.googlesource.com/37741
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
There's an assert in InvocationMirror_unpackTypeArguments checking that
the length of the incomming TypeArguments is positive (len > 0).
That's not a valid assert.
When creating TypeArguments it will be TypeArguments::null() if it is
empty or contains only dynamic.
TypeArguments::null() will answer 0 as length which is thus perfectly
valid.
This CL fixes the wrong assert (technically it returns before the assert,
but still).
Fixes#31381.
Change-Id: I7a253418b69751b13e98fcf2def2b23b32f96142
Reviewed-on: https://dart-review.googlesource.com/37480
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Update status files.
This cl includes implementing these two features on all platforms:
1) Support calling generic functions via DartEntry::InvokeFunction().
2) Support native generic functions. These are currently allowed, but type
arguments are ignored, and therefore not accessible from the C++ side.
Change-Id: Id39e8ca46c2ba1ba3d46946c16712a8572ff64ea
Reviewed-on: https://dart-review.googlesource.com/34023
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
This fixes some incorrect asserts that were breaking the debug bots.
The original revision is available in Patchset 1.
This reverts commit 26735519cb.
Bug:
Change-Id: Ifa599b7bff752dec4c505e10fd6db206e1abd977
Reviewed-on: https://dart-review.googlesource.com/23820
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
This reverts commit f13f772bb2.
Reason for revert: dartk(p)-strong debug mode is completely broken
because we convert int values non-representable as Smi to Smi, which
triggers that assert. The code that does tagging checks that
Untag(Tag(x)) == x, however for our purposes this identity does not
need to hold because we only care about lower bits and ignore the sign.
Reverting to restore green-ness of DEBUG builds.
TBR=sjindel@google.com
Bug:
Change-Id: Id436cbe000d6dec8db3469070ed531327cc82d89
Reviewed-on: https://dart-review.googlesource.com/23661
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
The revision begins the implementation of:
https://docs.google.com/document/d/1KK8b6kzr0pQev5YNftSZhN3M6I8HcvOJwJ6U-cW4nfw/edit?ts=5a05b3e9#heading=h.7j21arix8p2
* The ArgumentsDescriptor is updated to hold a bitvector for positional arguments.
* The kernel flowgraph builder is updated to calculate the appropriate bits from
the interface target and pass them through the ArgumentsDescriptor
for regular MethodInvocations.
Bug:
Change-Id: I1cd9f43f697df1dd4f36103bbdfc0ba000125c02
Reviewed-on: https://dart-review.googlesource.com/21541
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
number of free function type parameters.
Add test and mark status files.
Change-Id: I081de7674693c5ac2071a33948d25aadfc65f4ae
Reviewed-on: https://dart-review.googlesource.com/13901
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
This CL optimizes Type.hashCode similarly to String.hashCode, by
introducing intrinsic version of hashCode calculation which uses
hashcode stored in Type instance.
This is important for Flutter's .of pattern, which heavily uses
Maps with Type keys.
Results on Flutter stocks/build_bench.dart microbenchmark:
Before: 4906 µs
After: 4751 µs
(minimum of 5 runs, using tip of Flutter and Flutter engine)
Issue: https://github.com/dart-lang/sdk/issues/31011
Issue: https://github.com/flutter/flutter/issues/11572
Change-Id: Ifbaf721050007db49bbd969dc669d070f4ce839e
Reviewed-on: https://dart-review.googlesource.com/12622
Reviewed-by: Zach Anderson <zra@google.com>
This reverts commit 8cf9ef22c4.
The expectations in Dart2js and Kernel tests have now been updated.
Change-Id: I9d65ff207490cfc783849b1b726db81cf56ecfc2
Reviewed-on: https://dart-review.googlesource.com/9124
Reviewed-by: Régis Crelier <regis@google.com>
This reverts commit db15f5d73b.
Dart2js and Kernel tests are comparing text that has changed because of
the core lib change.
Change-Id: I1d33716a3d6e6a077aa1f1a9ad7cc37825d31fa6
Reviewed-on: https://dart-review.googlesource.com/9082
Reviewed-by: Siva Chandra <sivachandra@google.com>
Inline instance object hash code into object header on 64 bit.
64 bit objects have 32 bits of free space in the header word.
This is used for the hash code in string objects. We take it
for the default hash code on all objects that don't override
the hashCode getter.
This is both faster and a memory reduction. Eg it makes the
MegaHashCode part of the Megamorphic benchmark 6 times faster.
This is a reland of https://codereview.chromium.org/2954453002/
which fixes an issue that made script snapshots generated on
64 bit platforms incompatible with 32 bit VMs.
BUG=
R=vegorov@google.com
Review-Url: https://codereview.chromium.org/2965723002 .
Inline instance object hash code into object header on 64 bit.
64 bit objects have 32 bits of free space in the header word.
This is used for the hash code in string objects. We take it
for the default hash code on all objects that don't override
the hashCode getter.
This is both faster and a memory reduction. Eg it makes the
MegaHashCode part of the Megamorphic benchmark 6 times faster.
This is a reland of https://codereview.chromium.org/2912863006/
It fixes issues with the 32 bit compare-swap instruction on
ARM64 and fixes a fragile tree shaking test that is sensitive
to which private methods are in the core libraries.
R=kustermann@google.com, vegorov@google.com
BUG=
Review-Url: https://codereview.chromium.org/2954453002 .
64 bit objects have 32 bits of free space in the header word.
This is used for the hash code in string objects. We take it
for the default hash code on all objects that don't override
the hashCode getter.
This is both faster and a memory reduction. Eg it shaves about
70% off the running time of this microbenchmark:
List list = [];
class Thing {
get hashCode => 42;
}
class Thing2 {
get hashCode => 42;
}
class Thing3 { }
class Thing4 { }
main() {
int sum = 103;
for (int i = 0; i < 10000000; i++) {
list = [];
list.add("foo");
list.add(123);
list.add(1.23);
list.add(new Object());
list.add(new Thing());
list.add(new Thing2());
list.add(new Thing3());
list.add(new Thing4());
for (int j = 0; j < 2; j++) {
sum ^= biz(list);
}
}
print(sum);
}
int biz(List list) {
int sum = 103;
for (var x in list) {
sum ^= x.hashCode;
}
return sum;
}
R=rmacnak@google.com, vegorov@google.com
BUG=
Review-Url: https://codereview.chromium.org/2912863006 .
Do this in unoptimized code only, when --reify-generic-functions is specified.
This is still work in progress, and support in optimizer, in inliner, in DBC,
in kernel to ir, and other areas, will follow.
Many small fixes and added todos.
R=rmacnak@google.com, vegorov@google.com
Review-Url: https://codereview.chromium.org/2941643002 .
The assertions which tried to assert that we only use
StackFrameIterator to walk frames of the current thread was incorrect.
We already have cases where other threads will walk the stack of the
mutator thread, see below for an example where this can happen.
Thread::VisitObjectPointers was incorrectly passing Thread::Current() to
the StackFrameIterator instead of 'this'. (Code in thread_registry.cc will
loop over a number of threads and calls VisitObjectPointers on them)
Mutator thread:
0 pthread_cond_wait@@GLIBC_2.3.2
1 dart::Monitor::WaitMicros
2 dart::Monitor::Wait
3 dart::MonitorLocker::Wait
4 dart::ThreadBarrier::Sync
5 dart::GCMarker::MarkObjects
6 dart::PageSpace::MarkSweep
7 dart::Heap::CollectOldSpaceGarbage
8 dart::Heap::CollectNewSpaceGarbage
9 dart::Heap::CollectGarbage
10 dart::DN_HelperObject_<native>
11 dart::BootstrapNatives::<native>
<dart frames>
MarkTask thread:
1 dart::EntryFrame::VisitObjectPointers
2 dart::Thread::VisitObjectPointers <---- Walks mutator thread stack
3 dart::ThreadRegistry::VisitObjectPointers <---- Iterates over a number of threads
4 dart::Isolate::VisitStackPointers
5 dart::Isolate::VisitObjectPointers
6 dart::GCMarker::IterateRoots
7 dart::MarkTask::Run
8 dart::ThreadPool::Worker::Loop
9 dart::ThreadPool::Worker::Main
10 dart::ThreadStart
R=rmacnak@google.com
Review-Url: https://codereview.chromium.org/2845053003 .
With generic methods, uninstantiated types will require 2 instantiators, one
reflecting the class type arguments (as of today) and one reflecting the
function type arguments (new).
This is work in progress and the second instantiator is always null for now.
R=asiva@google.com
Review-Url: https://codereview.chromium.org/2799373002 .
This reverts commit d44fec08b0.
Remove special-cases for known types (int, String, num, double, Smi). The generic
lowering into an instance call (_simpleInstanceOf) works just fine for these predefined
types.
Also, remove parameter for negated is-tests. Instead insert explicit negation when.
building the flow graph.
Diff to original CL:
* Correct number of arguments in invocation of _instanceOf in kernel_to_il.cc.
R=vegorov@google.comTBR=vegorov@google.com
Review-Url: https://codereview.chromium.org/2748063003 .
Remove special-cases for known types (int, String, num, double, Smi). The generic
lowering into an instance call (_simpleInstanceOf) works just fine for these predefined
types.
Also, remove parameter for negated is-tests. Instead insert explicit negation when.
building the flow graph.
R=rmacnak@google.com
Review-Url: https://codereview.chromium.org/2751543003 .