Commit graph

134 commits

Author SHA1 Message Date
Ryan Macnak 84db16381d [vm] Remove dead --load_deferred_eagerly and dependent code tracking for library prefixes.
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>
2019-09-06 23:37:33 +00:00
Régis Crelier 08492f41cd [VM Runtime] Removed 'IsMoreSpecificThan' support in the VM.
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>
2019-01-03 00:41:20 +00:00
Daco Harkes 14ff2110ce [vm] refactor native entry and native entry type arguments
Change-Id: I03efbbf4340de1c8f23c60854ed991671ca2b647
Reviewed-on: https://dart-review.googlesource.com/c/87077
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2018-12-13 19:29:26 +00:00
Régis Crelier 5f36c5f9d8 [vm] Delete BoundedType class in VM.
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>
2018-12-10 23:15:27 +00:00
asiva 0ca1c57593 Reland "[VM] Remove unused flags"
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>
2018-11-20 17:25:42 +00:00
Siva Annamalai f6c41ac3bc Revert "[VM] Remove unused flags"
This reverts commit 1a4cff1bd4.

Reason for revert: The precompiled arm bot failed a test.

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>

TBR=rmacnak@google.com,alexmarkov@google.com,asiva@google.com,regis@google.com

Change-Id: Ib0fe4f33c044047ef1cb31bca9d38591176b7d40
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/84883
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-11-20 07:32:11 +00:00
asiva 1a4cff1bd4 [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>
2018-11-20 06:41:06 +00:00
Ryan Macnak 30b0b9b723 [vm] Code size reductions:
- 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>
2018-11-08 02:02:39 +00:00
Martin Kustermann 16ddfc1565 [VM] Use assert assignable implementation for explicit downcasts
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>
2018-10-10 12:36:42 +00:00
asiva cd3ddede99 Move flags strong/sync-async/reify-generic-functions back to global vm flags (they are not set as isolate specific flags).
Change-Id: I4d5cba4f5ac657a0834e3755312147cff1fbc001
Reviewed-on: https://dart-review.googlesource.com/71426
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-09-07 21:22:13 +00:00
Samir Jindel 777b95cdfc [vm] Fixes and review comments to change in partial instantiation semantics revision.
Change-Id: Ic6eb4f7827ef60e7347a747912dee434080d5da6
Reviewed-on: https://dart-review.googlesource.com/72420
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-08-31 12:00:19 +00:00
Samir Jindel dbe868de02 [vm] Correct semantics of bounds-checks on partial instantiation.
Fixes #34267.

Change-Id: Ieb557e186aa457bac3b99b6817050bde8f8e142f
Reviewed-on: https://dart-review.googlesource.com/72161
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-08-31 10:13:51 +00:00
Vyacheslav Egorov 7708989538 [vm/intrinsics] Introduce dart:_internal.uncheckedCast.
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>
2018-08-20 13:25:10 +00:00
Ryan Macnak 8da46d35f5 [vm] Move heap-related code to its own subdirectory (cf. compiler).
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>
2018-06-20 00:39:49 +00:00
Ryan Macnak 9b5a931b06 [vm] Replace most runtime/vm uses of OS::Print with OS::PrintErr.
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>
2018-06-13 19:51:40 +00:00
Samir Jindel 0cafdc4fdb [vm] Fix handling of all-dynamic type arguments in noSuchMethod.
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>
2018-05-10 17:06:42 +00:00
Samir Jindel 772c9bb5f3 [vm/kernel] Re-land partial instantiation of local functions.
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
2018-05-05 21:26:37 +00:00
Régis Crelier 54d842a89c [VM runtime] Explicitly specify length of parent type argument vector in native
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>
2018-05-03 23:51:36 +00:00
Alexander Aprelev e6d7d67f4b Revert 4f18af12c7 as it causes test breakages.
Bug: https://github.com/dart-lang/sdk/issues/33040
Change-Id: I09aac75e440876111a2c91aaf728ba514d7d5c6b
Reviewed-on: https://dart-review.googlesource.com/53688
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2018-05-03 21:11:44 +00:00
Samir Jindel 4f18af12c7 [vm/kernel] Enable partial instantiation of local functions.
This change introduces some refactoring shared with the instantiate-to-bounds CL.

Change-Id: I65523e2542ba440205814779b7fc97e97a53a0d2
Reviewed-on: https://dart-review.googlesource.com/50980
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-04-18 14:33:39 +00:00
Martin Kustermann 17d6d470a2 [VM] Remove experimental, unused, argument bits from argdesc and reduce prologue size
Change-Id: I1411b718e20394297aa2b761ab47970fcdc36c52
Reviewed-on: https://dart-review.googlesource.com/50920
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-04-12 12:54:29 +00:00
Régis Crelier 383517d292 [VM runtime] Fix type canonicalization (fixes #32425).
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>
2018-03-08 09:55:35 +00:00
Ryan Macnak 1451cfd741 [vm] Add Dart_NewListOfType to the embedding API.
Change-Id: I4729d9b39b0902ad5b77de2acd9f1e867134a619
Reviewed-on: https://dart-review.googlesource.com/39840
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-02-07 22:05:30 +00:00
Jens Johansen e4238bea4c Fix wrong assert in InvocationMirror_unpackTypeArguments (take 2)
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>
2018-02-01 07:09:38 +00:00
Jens Johansen 5c74e0e16f Fix wrong assert in InvocationMirror_unpackTypeArguments
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>
2018-01-30 12:25:49 +00:00
Régis Crelier 0c2793b3db [VM runtime] Implement support for _extractTypeArguments in the VM (fixes #31805).
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>
2018-01-12 21:32:20 +00:00
Samir Jindel be07555207 Revert "Revert "[kernel] Implementation of fine-grained strong mode argument type-checks, phase 2""
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>
2017-11-27 18:25:31 +00:00
Vyacheslav Egorov 26735519cb Revert "[kernel] Implementation of fine-grained strong mode argument type-checks, phase 2"
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>
2017-11-26 10:21:01 +00:00
Samir Jindel f13f772bb2 [kernel] Implementation of fine-grained strong mode argument type-checks, phase 2
This revision continues the implementation of:
https://docs.google.com/document/d/1KK8b6kzr0pQev5YNftSZhN3M6I8HcvOJwJ6U-cW4nfw/edit?ts=5a05b3e9#heading=h.7j21arix8p2

* Add argument checking bits for named arguments in the arguments descriptor.
* Add argument checking bits for type arguments.
* Calculate argument checking bits for setters.
* Add dispatch category to PropertySet and DirectPropertySet.

Bug:
Change-Id: Ieb0a4a99c401f53a72de473fda7bab61581f9996
Reviewed-on: https://dart-review.googlesource.com/22700
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2017-11-24 18:23:57 +00:00
Samir Jindel a991c17dc9 [kernel] Implementation of fine-grained strong mode argument type-checks, phase 1
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>
2017-11-21 15:35:48 +00:00
Régis Crelier 390c80234a [VM generic functions] Properly instantiate generic signatures by providing the
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>
2017-10-16 21:57:05 +00:00
Alexander Markov 86fde60e4d [VM] Intrinsify Type.hashCode
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>
2017-10-10 23:46:09 +00:00
Régis Crelier db8b20107b Revert "Revert "Dart Core Lib change to support generic functions in class NoSuchMethodError.""
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>
2017-09-28 00:27:24 +00:00
Régis Crelier 8cf9ef22c4 Revert "Dart Core Lib change to support generic functions in class NoSuchMethodError."
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>
2017-09-27 21:08:20 +00:00
Régis Crelier db15f5d73b Dart Core Lib change to support generic functions in class NoSuchMethodError.
Change-Id: If7d1a8c07e4bee7ec68fede80a9d17cae0044d31
Reviewed-on: https://dart-review.googlesource.com/5329
Reviewed-by: Florian Loitsch <floitsch@google.com>
2017-09-27 17:57:41 +00:00
Régis Crelier b3a7dd6e9d [VM generic function reification] Support generic functions in Invocation class.
Make VM object TypeArguments a Dart instance.
Add a test verifying that noSuchMethod works with generic functions.

R=floitsch@google.com, rmacnak@google.com

Review-Url: https://codereview.chromium.org/3007603002 .
2017-08-28 17:00:39 -07:00
Zachary Anderson 6cd8a79078 VM: Re-format to use at most one newline between functions
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -07:00
Erik Corry 955a4b6e71 VM: Reland Inline instance object hash code into object header on 64bit.
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 .
2017-07-03 09:26:46 +02:00
Ryan Macnak f1b7e8ed8c Add gdb helper functions for creating a handle and using ToCString with RawObjects.
Improves gdb debugging when Object::Handle() is optimized away.

Replace some intermediate static_libraries with source_sets to fix export issue.

R=regis@google.com, vegorov@google.com, zra@google.com

Review-Url: https://codereview.chromium.org/2957843002 .
2017-06-29 14:31:44 -07:00
Erik Corry 3c543bb210 Revert "VM: Reland Inline instance object hash code into object header on 64bit."
This reverts commit 8378b8fdbf due to
mysterious crashes on 32 bit ARM with the Flutter Gallery app.

R=aam@google.com
BUG=

Review-Url: https://codereview.chromium.org/2962543002 .
2017-06-26 23:06:09 +02:00
Erik Corry 8378b8fdbf VM: Reland Inline instance object hash code into object header on 64bit.
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 .
2017-06-22 14:56:24 +02:00
Erik Corry 847cd093ba Revert "Inline instance object hash code into object header on 64 bit."
This reverts commit ac6310d5f3 because
of test failures on real ARM64 hardware as opposed to the DartVM
simulator.  Original review: https://codereview.chromium.org/2912863006/

R=kustermann@google.com
BUG=

Review-Url: https://codereview.chromium.org/2953753002 .
2017-06-22 10:22:48 +02:00
Erik Corry ac6310d5f3 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 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 .
2017-06-22 09:25:52 +02:00
Régis Crelier a62107cfaf Check for a passed-in type argument vector in the prolog of generic functions.
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 .
2017-06-21 09:02:16 -07:00
Martin Kustermann ac8d2056a3 Fix asserts in StackFrameIterator which were effectively disabled
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 .
2017-05-03 10:27:01 +02:00
Regis Crelier d0a7bad121 Pass a second type argument vector to all type instantiation calls in the VM.
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 .
2017-04-10 21:25:33 -07:00
Dmitry Olshansky ffc4c1df30 VM [KERNEL] Use simpleInstanceOf in kernel.
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2794373002 .
2017-04-05 14:56:42 +02:00
Florian Schneider 71cb54714b Reland "VM: Simplify lowering of is-tests.""
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.com
TBR=vegorov@google.com

Review-Url: https://codereview.chromium.org/2748063003 .
2017-03-14 09:19:51 -07:00
Vyacheslav Egorov d44fec08b0 Revert "VM: Simplify lowering of is-tests."
This reverts commit 066123e037.

Reason for revert: vm-kernel-* is broken because kernel_to_il.cc was not updated
in sync with flow_graph_builder.cc.

TBR=fschneider@google.com, rmacnak@google.com,

Review-Url: https://codereview.chromium.org/2748073002 .
2017-03-14 12:27:41 +01:00
Florian Schneider 066123e037 VM: Simplify lowering of is-tests.
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 .
2017-03-13 16:48:59 -07:00