Commit Graph

314 Commits

Author SHA1 Message Date
Ryan Macnak 93dcfaa289 [vm, gc] Concurrent marking.
Fall back to parallel marking
 - on IA32 (barrier unimplemented)
 - when write_protect_code is enabled (protection dependency on marking state unimplemented)

Bug: https://github.com/dart-lang/sdk/issues/34002
Change-Id: If093f24e4dc6bf29f407cc45e95bb2274fc53dcf
Reviewed-on: https://dart-review.googlesource.com/71389
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-09-21 21:30:33 +00:00
Ryan Macnak 78d9a281d3 [vm, arm] Globally block LR for register allocation.
Flutter Gallery release:
Instructions(CodeSize): 5668368 -> 5670880 (+0.044%)

Fixes #34411

Bug: https://github.com/dart-lang/sdk/issues/34411
Change-Id: I5281ac9609ec5953cdaa881226f7034a5697d0ce
Reviewed-on: https://dart-review.googlesource.com/74923
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-09-14 21:58:29 +00:00
Ryan Macnak ebca3aba60 [vm, gc] Concurrent marking barrier.
Code size impact on flutter_gallery after enabled:
ARM32 Instructions(CodeSize): 5892064 -> 6110592 (+3.71%)
ARM64 Instructions(CodeSize): 6307104 -> 6514528 (+3.28%)

Bug: https://github.com/dart-lang/sdk/issues/34002
Change-Id: If093f24e4dc6bf29f407cc45e95bb2274fc53dce
Reviewed-on: https://dart-review.googlesource.com/68481
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-09-11 21:14:25 +00:00
Martin Kustermann 01518b725d [VM] Optimize object allocation on ARM/ARM64 for code size as well as performance
Decreases flutter gallery RX size by 0.5 % on ARM
Decreases flutter gallery RX size by 0.85 % on ARM64
Increases performance slightly of various benchmarks, e.g. DeltaBlue by 2.2% on ARM64-aot

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

Change-Id: I258eae5bdc33d0220d0e73f60ad21824da5ec7f1
Reviewed-on: https://dart-review.googlesource.com/72762
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-09-11 12:53:56 +00:00
Martin Kustermann 05ccfa8502 [VM] Reduce size of monomorphic entries in AOT on ARM/ARM64 & use smaller tail-calls in various places
Decreases flutter gallery RX size by 1.5 % on ARM
Decreases flutter gallery RX size by 1.3 % on ARM64

Improves arm performance (significantly), e.g. DeltaBlue +6.8%, many typed data benchmarks +xx%
Improves arm64 performance, e.g. DeltaBlue +3.1%


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

Change-Id: Iaa6cc31597e0bcde471ec2e966730c3f2c9fdd05
Reviewed-on: https://dart-review.googlesource.com/73180
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-09-11 09:03:02 +00:00
Ryan Macnak d66572d09b [vm, arm64] Eliminate some no-ops already filtered from the other architectures.
Flutter Gallery release:
Instructions(CodeSize): 6270144 -> 6234080 (-0.58%)

Change-Id: If5d4a1d41c6a1d9e5e45f1fceab6d938aef484bc
Reviewed-on: https://dart-review.googlesource.com/74005
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-09-07 21:44:18 +00:00
Ben Konyi cd9a42239f Added empty stubs for those which are x64 specific
Change-Id: Ie02368ee446c143cf192c6f6a4515ad2a453aa09
Reviewed-on: https://dart-review.googlesource.com/74008
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-09-07 21:08:23 +00:00
Ryan Macnak 2cfe3b36ab [vm, gc] Adjust header bits to allow generational and incremental barrier filters to run together in one shift-and-mask.
Claims 3 header bits :(

Bug: https://github.com/dart-lang/sdk/issues/34002
Change-Id: Ia4fcc9f2b38ed5aa98a28823616b7de766cdde2d
Reviewed-on: https://dart-review.googlesource.com/69222
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-08-29 22:17:55 +00:00
Vyacheslav Egorov 80615aed27 [vm] Implement static type exactness tracking for method receivers.
Change-Id: I35ffcee7dfa741d2095b711d402a6caae388b2c4
Reviewed-on: https://dart-review.googlesource.com/68943
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-08-29 10:11:17 +00:00
Martin Kustermann c5a4d084a2 [VM] Fix mismatched registername array to avoid hitting ASSERT(), remove left-over pool-load in allocation stub
Change-Id: Icf10490666522bb07e0d20493b68d87db9c13998
Reviewed-on: https://dart-review.googlesource.com/71821
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-08-28 12:07:44 +00:00
Martin Kustermann b7790e3147 [VM] Make all of our compilation pipeline use a [FrameLayout] to generate code
This will allow us to have configurable frame layouts during
gen_snapshot/dart_bootstrap.

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

Change-Id: I18945189034be1a585c1e2edcf53a4b7537204c2
Reviewed-on: https://dart-review.googlesource.com/59880
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-08-21 10:26:12 +00:00
Samir Jindel dea7de23bd [vm] Use multiple entrypoints to remove unnecessary checks on calls against "this".
Test Plan:

Behavioral correctness should be ensured by existing tests. Tests in vm/dart/entrypoints
ensure that the unchecked entrypoint is used in cases where the optimization should trigger.

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

Change-Id: I5b880b2dfa6343b4bb0a96ad23562facff73e41f
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/69741
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-08-20 16:56:22 +00:00
Samir Jindel 66278e3919 [vm/precomp] Change checked/unchecked terminology to monomorphic/-
Change-Id: Ib54db47d60e7b822a4c73995998aecb6780a4cce
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/69306
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-08-10 14:32:37 +00:00
Martin Kustermann 34f17b2973 [VM] Add missing 6-type-test to subtypecache search in simdbc (it has it in 2 places)
Also this CL ports x64 changes to StubCode::GenerateSlowTypeTestStub() to arm/arm64.

Change-Id: I1e6bb3ae51724e97dac28c7d75ac9d0f4f2db01b
Reviewed-on: https://dart-review.googlesource.com/68885
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-08-08 15:45:02 +00:00
Martin Kustermann 575a8f8381 [VM] Extend subtype-test mechanism with support for generic methods
Until now the subtype-test cache mechanism did not work (i.e. could
return the wrong result) for partially instantiated generic closures.

Additionally, closures which close over generic methods were always
handled in runtime.  This caused a servere performance regression for
any code hitting this (e.g. code which uses `package:stack_trace`).

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

Change-Id: Idb73e6f348c2fe0c737f42c57009f5f7a636c9a6
Reviewed-on: https://dart-review.googlesource.com/68369
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-08-08 13:40:58 +00:00
Samir Jindel 01e69cc0c4 Take 3 for "[vm] Factor out more of the slow-path of the store barrier into the stubs."
There is no difference from the previous version of this CL.

This depends on https://dart-review.googlesource.com/c/sdk/+/67220/3 which fixes a bug
in `CompileType` that was causing `ShouldEmitStoreBarrier()` to return different results
across multiple calls on the same instruction.

The buildbot on which this caused a failure is run as a tryjob below.

Change-Id: I078b587f7e23e88d95f3b05c966019a433ba57d9
Reviewed-on: https://dart-review.googlesource.com/67221
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-07-27 18:51:20 +00:00
Samir Jindel 9686636f6b Revert "Re-land "[vm] Factor out more of the slow-path of the store barrier into the stubs.""
This reverts commit 79ed0553e9.

Reason for revert: Issue with register allocator on SIMARM.

Original change's description:
> Re-land "[vm] Factor out more of the slow-path of the store barrier into the stubs."
> 
> When compiling instrinsic graphs on ARM and ARM64 we need to save LR when emitting
> the store barrier because the intrinsics don't have frames and won't restore it before
> returning.
> 
> Original revision is in Patchset 1.
> 
> Change-Id: I58cee3941c82efa22bd6ddbd00e00c489de53898
> Cq-Include-Trybots: luci.dart.try: vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try
> Reviewed-on: https://dart-review.googlesource.com/66382
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

TBR=alexmarkov@google.com,sjindel@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: If8f8bc1a508f300ab83b03a0be7e0c318e5f99fe
Cq-Include-Trybots: luci.dart.try: vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-win-release-x64-try, vm-kernel-linux-release-simarm-try, vm-kernel-linux-release-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/67140
Reviewed-by: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-07-27 15:01:44 +00:00
Samir Jindel 79ed0553e9 Re-land "[vm] Factor out more of the slow-path of the store barrier into the stubs."
When compiling instrinsic graphs on ARM and ARM64 we need to save LR when emitting
the store barrier because the intrinsics don't have frames and won't restore it before
returning.

Original revision is in Patchset 1.

Change-Id: I58cee3941c82efa22bd6ddbd00e00c489de53898
Cq-Include-Trybots: luci.dart.try: vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/66382
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-07-25 14:11:05 +00:00
Alexander Markov 2eba6faa30 Revert "[vm] Factor out more of the slow-path of the store barrier into the stubs."
This reverts commit b3e289a95e.

Reason for revert: multiple failures on *-simarm, *-simarm64 and vm-precomp-android-release-2-3-be bots.

Original change's description:
> [vm] Factor out more of the slow-path of the store barrier into the stubs.
> 
> This delivers a 2.1% code size reduction on Flutter Gallery, and roughly 1.6% speed
> improvement on dart2js(dart2js).
> 
> Cq-Include-Trybots: luci.dart.try: vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try
> Change-Id: I2d2ceca8707d5e6fba79c558624d611f9e17d21a
> Reviewed-on: https://dart-review.googlesource.com/65060
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

TBR=alexmarkov@google.com,sjindel@google.com

Change-Id: Iae83a5108d56cbd30e5727217b5ee043449f82ff
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.dart.try: vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/66360
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-07-24 00:44:01 +00:00
Samir Jindel b3e289a95e [vm] Factor out more of the slow-path of the store barrier into the stubs.
This delivers a 2.1% code size reduction on Flutter Gallery, and roughly 1.6% speed
improvement on dart2js(dart2js).

Cq-Include-Trybots: luci.dart.try: vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try
Change-Id: I2d2ceca8707d5e6fba79c558624d611f9e17d21a
Reviewed-on: https://dart-review.googlesource.com/65060
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-07-23 22:07:39 +00:00
Ryan Macnak 7ebe83fda1 [vm] Don't need to preserve ICData past the dispatching stubs.
Change-Id: I0752c4d09c836d64c8ef43b4f65b2763a550aee8
Reviewed-on: https://dart-review.googlesource.com/64666
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-07-13 23:26:29 +00:00
Samir Jindel 771454a1cf [vm/precomp] Extend support for slow-path code sharing to ARM and ARM64.
Test Plan:

Covered by existing slow-path code sharing tests

Cq-Include-Trybots:luci.dart.try:vm-kernel-precomp-linux-debug-x64-try;luci.dart.try:vm-kernel-precomp-linux-release-simarm-try;luci.dart.try:vm-kernel-precomp-linux-release-simarm64-try;luci.dart.try:vm-kernel-precomp-linux-release-x64-try;luci.dart.try:vm-kernel-precomp-win-release-x64-try
Change-Id: Iab999e0abfa7677d60ebb259a1d3d128bb49f879
Reviewed-on: https://dart-review.googlesource.com/62903
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-07-02 14:23:23 +00:00
Samir Jindel d9c36e8d4d [vm/precomp] Re-land support for slow-path sharing of CheckStackOverflow with status file updates.
Patchset 1 contains the original revision.

Cq-Include-Trybots: luci.dart.try:vm-kernel-reload-linux-release-x64-try;luci.dart.try:vm-kernel-reload-rollback-linux-release-x64-try
Change-Id: Ic2601a268e1cf909183283e9418c03dc6559e809
Reviewed-on: https://dart-review.googlesource.com/62902
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-06-29 12:32:28 +00:00
Samir Jindel 0152213386 Revert "[vm/precomp] Support slow-path sharing for CheckStackOverflow."
This reverts commit dff333e1bf.

Reason for revert: Several hot-reload bots are broken.

Original change's description:
> [vm/precomp] Support slow-path sharing for CheckStackOverflow.
> 
> Test Plan:
> 
> Added new test "stack_overflow_shared_test" which uses --stacktrace_filter to
> force the stack overflow checks to go into the slow-path.
> 
> Change-Id: I92e8ab5f88b1e0855148af212e43adda40ce4d15
> Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try;luci.dart.try:vm-kernel-precomp-linux-release-x64-try;luci.dart.try:vm-kernel-precomp-linux-release-simarm-try
> Reviewed-on: https://dart-review.googlesource.com/60340
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

TBR=alexmarkov@google.com,sjindel@google.com

Change-Id: I632ac9840d360fa624de4c9d17ae679e72c1b16f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try;luci.dart.try:vm-kernel-precomp-linux-release-x64-try;luci.dart.try:vm-kernel-precomp-linux-release-simarm-try
Reviewed-on: https://dart-review.googlesource.com/62920
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-06-28 19:08:29 +00:00
Samir Jindel dff333e1bf [vm/precomp] Support slow-path sharing for CheckStackOverflow.
Test Plan:

Added new test "stack_overflow_shared_test" which uses --stacktrace_filter to
force the stack overflow checks to go into the slow-path.

Change-Id: I92e8ab5f88b1e0855148af212e43adda40ce4d15
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try;luci.dart.try:vm-kernel-precomp-linux-release-x64-try;luci.dart.try:vm-kernel-precomp-linux-release-simarm-try
Reviewed-on: https://dart-review.googlesource.com/60340
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-06-28 17:20:07 +00:00
Ryan Macnak 83a4d98554 [vm] Weaken CAS to RMW when accessing the remembered and mark bits.
Tighten some sequences in the write barrier stub.

Change-Id: Ib3657b9b582082137d17e86135200444172f428a
Reviewed-on: https://dart-review.googlesource.com/60820
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-06-20 21:53:12 +00:00
Ryan Macnak 2f664c141f [vm] Shorten the write barrier sequence.
flutter_gallery, release, arm32
Instructions(CodeSize): 6989360 -> 6915696 (-1.05%)

Change-Id: If8a39c8f28d424959d753e96527a59bf1e9444c1
Reviewed-on: https://dart-review.googlesource.com/61110
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-06-20 20:18:02 +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
Régis Crelier df2bf6590d [VM runtime] Minor cleanup of stubs on all architectures as already done for x64
Change-Id: Ibd5b6c074080cac231b54db2755ca57b6609e255
Reviewed-on: https://dart-review.googlesource.com/60802
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2018-06-18 22:19:13 +00:00
Martin Kustermann f1c3f997bd [VM] Clear out return-value-register from call-to-runtime-stub, it needs to be GC-safe for lazy deopts
When the slow path code of StackOverflowInstr is calling out to runtime
and the runtime causes a lazy-deopt, the lazy deopt stub will treat the value in the
return-value-register as GC-safe and the value will be visited during GCs.

This CL changes the call-to-runtime-stub to always put 0 into the
return-value-register.

This should fix the flaky vm-linux-debug-x64-reload-be builder.

Change-Id: Ibea3630b8b9fa5de2b96134725df0017c09282bd
Reviewed-on: https://dart-review.googlesource.com/60661
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-06-18 19:25:43 +00:00
Samir Jindel f1d1da6164 [vm/precomp] Reduce the size of slow-path code in precompiled mode.
The stub code for calling into the runtime is now responsible for saving any
live registers. Since it doesn't know which registers are live (it's shared
across many safepoints), it saves all the registers. The stackmaps and
environments for safepoints which call this stub are extended to cover the stack
slots in the stub's frame which correspond to registers which are actually live
at the safepoint.

Currently this is only supported in precompiled X64 for the `CheckNull`
slow-path. By creating a separate stub for the CheckNull slow path we are able
to eliminate the size overhead of preparing arguments for the runtime call stub,
and reduce the slow-path size on X64 to 1 instruction.

# Test Plan

The stackmap for a safepoint in the `CheckNull` slowpath is only used when
handling the exception causes a GC, which is extremely unlikely. To induce this,
we add a flag to force this behavior in debug-mode and a test which exercises
this. The rest of the changes inherit existing coverage.

Change-Id: I3d8f2a7c3560c432599344d7420d42ddbee7a89d
Reviewed-on: https://dart-review.googlesource.com/59660
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-06-15 15:59:05 +00:00
Alexander Markov c3b5939965 [vm] Remove --limit-ints-to-64-bits option and old _Bigint class
Closes https://github.com/dart-lang/sdk/issues/33306

Change-Id: I7088d8b7143edbe24f5cefe4be037ad2006e0625
Reviewed-on: https://dart-review.googlesource.com/58101
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-06-04 20:10:40 +00:00
Vyacheslav Egorov 99a5f149ac [vm] Enable type stubs based type checks in JIT mode for some types.
Relanding 4be50d6fa1 with fixes to DBC
and location summaries: AssertAssignable must save FPU registers.

For now we are limiting this to type checks against type parameter types.


In Dart 1 mode Dart2JS compiles itself in 28s when running from source
and in 23s when running from ideal app-jit snapshot (trained on the
same workload).

Before this change in Dart 2 mode numbers were 51s and 57s respectively.

After this change in Dart 2 mode numbers are 38s and 32s. Meaning
that regression is reduced by 50%.

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

Change-Id: Ifb55f86453bfdf36a2e03bcd7f3197cfde257103
Reviewed-on: https://dart-review.googlesource.com/57980
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-06-01 20:58:33 +00:00
Vyacheslav Egorov 0aadba1189 Revert "[vm] Enable type stubs based type checks in JIT mode for some types."
This reverts commit 4be50d6fa1.

Reason for revert: Failures on SIMDBC64 and Analyzer bots.

Original change's description:
> [vm] Enable type stubs based type checks in JIT mode for some types.
> 
> For now we are limiting this to type checks against type parameter types.
> 
> # Performance improvements
> 
> In Dart 1 mode Dart2JS compiles itself in 28s when running from source
> and in 23s when running from ideal app-jit snapshot (trained on the
> same workload).
> 
> Before this change in Dart 2 mode numbers were 51s and 57s respectively.
> 
> After this change in Dart 2 mode numbers are 38s and 32s. Meaning
> that regression is reduced by 50%.
> 
> Issue https://github.com/dart-lang/sdk/issues/31798
> Issue https://github.com/dart-lang/sdk/issues/33257
> 
> Change-Id: I34bf5385a5cc3c7702dc281c6dfa89da85d3dde1
> Reviewed-on: https://dart-review.googlesource.com/57601
> Reviewed-by: Régis Crelier <regis@google.com>
> Commit-Queue: Vyacheslav Egorov <vegorov@google.com>

TBR=vegorov@google.com,kustermann@google.com,regis@google.com

Change-Id: I85a30c962b0cd556310e19193f5993ab76ecf2e7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/57840
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-06-01 11:23:08 +00:00
Vyacheslav Egorov 4be50d6fa1 [vm] Enable type stubs based type checks in JIT mode for some types.
For now we are limiting this to type checks against type parameter types.

# Performance improvements

In Dart 1 mode Dart2JS compiles itself in 28s when running from source
and in 23s when running from ideal app-jit snapshot (trained on the
same workload).

Before this change in Dart 2 mode numbers were 51s and 57s respectively.

After this change in Dart 2 mode numbers are 38s and 32s. Meaning
that regression is reduced by 50%.

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

Change-Id: I34bf5385a5cc3c7702dc281c6dfa89da85d3dde1
Reviewed-on: https://dart-review.googlesource.com/57601
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-06-01 10:50:09 +00:00
Régis Crelier 41fcbd097c [VM runtime] Initial version of Kernel Bytecode interpreter in VM runtime.
Not fully working yet, only x64, no gc, no frame walking, etc...

Change-Id: I4d8357f6d46371bf21c3d54266cfe26163e3c8dc
Reviewed-on: https://dart-review.googlesource.com/50021
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-05-09 20:29:27 +00:00
Martin Kustermann 3b414a277c Reland "[VM] Introduction of type testing stubs - Part 1-4"
Relands 165c583d57

    [VM] Introduction of type testing stubs - Part 1

    This CL:

      * Adds a field to [RawAbstractType] which will always hold a pointer
        to the entrypoint of a type testing stub

      * Makes this new field be initialized to a default stub whenever a
        instances are created (e.g. via Type::New(), snapshot reader, ...)

      * Makes the clustered snapshotter write a reference to the
        corresponding [RawInstructions] object when writing the field and do
        the reverse when reading it.

      * Makes us call the type testing stub for performing assert-assignable
        checks.

    To reduce unnecessary loads on callsites, we store the entrypoint of the
    type testing stubs directly in the type objects.  This means that the
    caller of type testing stubs can simply branch there without populating
    a code object first.  This also means that the type testing stubs
    themselves have no access to a pool and we therefore also don't hold on
    to the [Code] object, only the [Instruction] object is necessary.

    The type testing stubs do not setup a frame themselves and also have no
    safepoint.  In the case when the type testing stubs could not determine
    a positive answer they will tail-call a general-purpose stub.

    The general-purpose stub sets up a stub frame, tries to consult a
    [SubtypeTestCache] and bails out to runtime if this was unsuccessful.

    This CL is just the the first, for ease of reviewing.  The actual
    type-specialized type testing stubs will be generated in later CLs.

    Reviewed-on: https://dart-review.googlesource.com/44787

Relands f226c22424

    [VM] Introduction of type testing stubs - Part 2

    This CL starts building type testing stubs specialzed for [Type] objects
    we test against.

    More specifically, it adds support for:

      * Handling obvious fast cases on the call sites (while still having a
        call to stub for negative case)

      * Handling type tests against type parameters, by loading the value
        of the type parameter on the call sites and invoking it's type testing stub.

      * Specialzed type testing stubs for instantiated types where we can
        do [CidRange]-based subtype-checks.

        ==> e.g. String/List<dynamic>

      * Specialzed type testing stubs for instantiated types where we can
        do [CidRange]-based subclass-checks for the class and
        [CidRange]-based subtype-checks for the type arguments.

        ==> e.g. Widget<State>, where we know [Widget] is only extended and not
                 implemented.

      * Specialzed type testing stubs for certain non-instantiated types where we
        can do [CidRange]-based subclass-checks for the class and
        [CidRange]-based subtype-checks for the instantiated type arguments and
        cid based comparisons for type parameters.  (Note that this fast-case migth
        result in some false-negatives!)

        ==> e.g. _HashMapEntry<K, V>, where we know [_HashMapEntry] is only
                 extended and not implemented.

       This optimizes cases where the caller uses `new HashMap<A, B>()` and only
       uses `A` and `B` as key/values (and not subclasses of it).  The false-negative
       can occur when subtypes of A or B are used.  In such cases we fall back to the
       [SubtypeTestCache]-based imlementation.

    Reviewed-on: https://dart-review.googlesource.com/44788

Relands 25f98bcc75

    [VM] Introduction of type testing stubs - Part 3

    The changes include:

      * Make AssertAssignableInstr no longer have a call-summary, which
        helps methods with several parameter checks by not having to
        re-load/re-initialize type arguments registers

      * Lazily create SubtypeTestCaches: We already go to runtime to warm up
        the caches, so we now also create the caches on the first runtime
        call and patch the pool entries.

      * No longer load the destination name into a register: We only need
        the name when we throw an exception, so it is not on the hot path.
        Instead we let the runtime look at the call site, decoding a pool
        index from the instructions stream.  The destination name will be
        available in the pool, at a consecutive index to the subtype cache.

      * Remove the fall-through to N=1 case for probing subtypeing tests,
        since those will always be handled by the optimized stubs.

      * Do not generate optimized stubs for FutureOr<T> (so far it just
        falled-through to TTS).  We can make optimzed version of that later,
        but it requires special subtyping rules.

      * Local code quality improvement in the type-testing-stubs: Avoid
        extra jump at last case of cid-class-range checks.

    There are still a number of optimization opportunities we can do in
    future changes.

    Reviewed-on: https://dart-review.googlesource.com/46984

Relands 2c52480ec8

    [VM] Introduction of type testing stubs - Part 4

    In order to avoid generating type testing stubs for too many types in
    the system - and thereby potentially cause an increase in code size -
    this change introduces a smarter way to decide for which types we should
    generate optimized type testing stubs.

    The precompiler creates a [TypeUsageInfo] which we use to collect
    information.  More specifically:

       a) We collect the destination types for all type checks we emit
          (we do this inside AssertAssignableInstr::EmitNativeCode).

          -> These are types we might want to generate optimized type testing
             stubs for.

       b) We collect type argument vectors used in instance creations (we do
          this inside AllocateObjectInstr::EmitNativeCode) and keep a set of
          of used type argument vectors for each class.

    After the precompiler has finished compiling normal code we scan the set
    of destination types collected in a) for uninstantiated types (or more
    specifically, type parameter types).

    We then propagate the type argument vectors used on object allocation sites,
    which were collected in b), in order to find out what kind of types are flowing
    into those type parameters.

    This allows us to extend the set of types which we test against, by
    adding the types that flow into type parameters.

    We use this final augmented set of destination types as a "filter" when
    making the decision whether to generate an optimized type testing stub
    for a given type.

    Reviewed-on: https://dart-review.googlesource.com/48640

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

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

Change-Id: Ib79fbe7f043aa88f32bddad62d7656c638914b44
Reviewed-on: https://dart-review.googlesource.com/50944
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-04-13 09:06:56 +00:00
Ryan Macnak b3c94b5d52 Revert "Reland "[VM] Introduction of type testing stubs - Part 1-4""
This reverts commit 34763bc4c9.

Bug: https://github.com/dart-lang/sdk/issues/32852
Change-Id: I2131907d7036644707d5109a951969fc48dd74e1
Reviewed-on: https://dart-review.googlesource.com/50842
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-04-11 22:42:59 +00:00
Martin Kustermann 34763bc4c9 Reland "[VM] Introduction of type testing stubs - Part 1-4"
Relands 165c583d57

    [VM] Introduction of type testing stubs - Part 1

    This CL:

      * Adds a field to [RawAbstractType] which will always hold a pointer
        to the entrypoint of a type testing stub

      * Makes this new field be initialized to a default stub whenever a
        instances are created (e.g. via Type::New(), snapshot reader, ...)

      * Makes the clustered snapshotter write a reference to the
        corresponding [RawInstructions] object when writing the field and do
        the reverse when reading it.

      * Makes us call the type testing stub for performing assert-assignable
        checks.

    To reduce unnecessary loads on callsites, we store the entrypoint of the
    type testing stubs directly in the type objects.  This means that the
    caller of type testing stubs can simply branch there without populating
    a code object first.  This also means that the type testing stubs
    themselves have no access to a pool and we therefore also don't hold on
    to the [Code] object, only the [Instruction] object is necessary.

    The type testing stubs do not setup a frame themselves and also have no
    safepoint.  In the case when the type testing stubs could not determine
    a positive answer they will tail-call a general-purpose stub.

    The general-purpose stub sets up a stub frame, tries to consult a
    [SubtypeTestCache] and bails out to runtime if this was unsuccessful.

    This CL is just the the first, for ease of reviewing.  The actual
    type-specialized type testing stubs will be generated in later CLs.

    Reviewed-on: https://dart-review.googlesource.com/44787

Relands f226c22424

    [VM] Introduction of type testing stubs - Part 2

    This CL starts building type testing stubs specialzed for [Type] objects
    we test against.

    More specifically, it adds support for:

      * Handling obvious fast cases on the call sites (while still having a
        call to stub for negative case)

      * Handling type tests against type parameters, by loading the value
        of the type parameter on the call sites and invoking it's type testing stub.

      * Specialzed type testing stubs for instantiated types where we can
        do [CidRange]-based subtype-checks.

        ==> e.g. String/List<dynamic>

      * Specialzed type testing stubs for instantiated types where we can
        do [CidRange]-based subclass-checks for the class and
        [CidRange]-based subtype-checks for the type arguments.

        ==> e.g. Widget<State>, where we know [Widget] is only extended and not
                 implemented.

      * Specialzed type testing stubs for certain non-instantiated types where we
        can do [CidRange]-based subclass-checks for the class and
        [CidRange]-based subtype-checks for the instantiated type arguments and
        cid based comparisons for type parameters.  (Note that this fast-case migth
        result in some false-negatives!)

        ==> e.g. _HashMapEntry<K, V>, where we know [_HashMapEntry] is only
                 extended and not implemented.

       This optimizes cases where the caller uses `new HashMap<A, B>()` and only
       uses `A` and `B` as key/values (and not subclasses of it).  The false-negative
       can occur when subtypes of A or B are used.  In such cases we fall back to the
       [SubtypeTestCache]-based imlementation.

    Reviewed-on: https://dart-review.googlesource.com/44788

Relands 25f98bcc75

    [VM] Introduction of type testing stubs - Part 3

    The changes include:

      * Make AssertAssignableInstr no longer have a call-summary, which
        helps methods with several parameter checks by not having to
        re-load/re-initialize type arguments registers

      * Lazily create SubtypeTestCaches: We already go to runtime to warm up
        the caches, so we now also create the caches on the first runtime
        call and patch the pool entries.

      * No longer load the destination name into a register: We only need
        the name when we throw an exception, so it is not on the hot path.
        Instead we let the runtime look at the call site, decoding a pool
        index from the instructions stream.  The destination name will be
        available in the pool, at a consecutive index to the subtype cache.

      * Remove the fall-through to N=1 case for probing subtypeing tests,
        since those will always be handled by the optimized stubs.

      * Do not generate optimized stubs for FutureOr<T> (so far it just
        falled-through to TTS).  We can make optimzed version of that later,
        but it requires special subtyping rules.

      * Local code quality improvement in the type-testing-stubs: Avoid
        extra jump at last case of cid-class-range checks.

    There are still a number of optimization opportunities we can do in
    future changes.

    Reviewed-on: https://dart-review.googlesource.com/46984

Relands 2c52480ec8

    [VM] Introduction of type testing stubs - Part 4

    In order to avoid generating type testing stubs for too many types in
    the system - and thereby potentially cause an increase in code size -
    this change introduces a smarter way to decide for which types we should
    generate optimized type testing stubs.

    The precompiler creates a [TypeUsageInfo] which we use to collect
    information.  More specifically:

       a) We collect the destination types for all type checks we emit
          (we do this inside AssertAssignableInstr::EmitNativeCode).

          -> These are types we might want to generate optimized type testing
             stubs for.

       b) We collect type argument vectors used in instance creations (we do
          this inside AllocateObjectInstr::EmitNativeCode) and keep a set of
          of used type argument vectors for each class.

    After the precompiler has finished compiling normal code we scan the set
    of destination types collected in a) for uninstantiated types (or more
    specifically, type parameter types).

    We then propagate the type argument vectors used on object allocation sites,
    which were collected in b), in order to find out what kind of types are flowing
    into those type parameters.

    This allows us to extend the set of types which we test against, by
    adding the types that flow into type parameters.

    We use this final augmented set of destination types as a "filter" when
    making the decision whether to generate an optimized type testing stub
    for a given type.

    Reviewed-on: https://dart-review.googlesource.com/48640

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

Change-Id: I6d33d4ca3d5187a1eb1664078c003061855f0160
Reviewed-on: https://dart-review.googlesource.com/50482
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-04-10 12:20:10 +00:00
Martin Kustermann 1e997ee6b7 Revert "Reland "[VM] Introduction of type testing stubs - Part 1-4""
This reverts commit 8054409a02.

Reason for revert: Potential cause of flakes, not entirely clear yet if it was caused by this CL.

Change-Id: Icb119a107f22245ba2f303c7f2ae11f061f605f5
Reviewed-on: https://dart-review.googlesource.com/50261
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-04-09 14:29:07 +00:00
Martin Kustermann 8054409a02 Reland "[VM] Introduction of type testing stubs - Part 1-4"
Relands 165c583d57

    [VM] Introduction of type testing stubs - Part 1

    This CL:

      * Adds a field to [RawAbstractType] which will always hold a pointer
        to the entrypoint of a type testing stub

      * Makes this new field be initialized to a default stub whenever a
        instances are created (e.g. via Type::New(), snapshot reader, ...)

      * Makes the clustered snapshotter write a reference to the
        corresponding [RawInstructions] object when writing the field and do
        the reverse when reading it.

      * Makes us call the type testing stub for performing assert-assignable
        checks.

    To reduce unnecessary loads on callsites, we store the entrypoint of the
    type testing stubs directly in the type objects.  This means that the
    caller of type testing stubs can simply branch there without populating
    a code object first.  This also means that the type testing stubs
    themselves have no access to a pool and we therefore also don't hold on
    to the [Code] object, only the [Instruction] object is necessary.

    The type testing stubs do not setup a frame themselves and also have no
    safepoint.  In the case when the type testing stubs could not determine
    a positive answer they will tail-call a general-purpose stub.

    The general-purpose stub sets up a stub frame, tries to consult a
    [SubtypeTestCache] and bails out to runtime if this was unsuccessful.

    This CL is just the the first, for ease of reviewing.  The actual
    type-specialized type testing stubs will be generated in later CLs.

    Reviewed-on: https://dart-review.googlesource.com/44787

Relands f226c22424

    [VM] Introduction of type testing stubs - Part 2

    This CL starts building type testing stubs specialzed for [Type] objects
    we test against.

    More specifically, it adds support for:

      * Handling obvious fast cases on the call sites (while still having a
        call to stub for negative case)

      * Handling type tests against type parameters, by loading the value
        of the type parameter on the call sites and invoking it's type testing stub.

      * Specialzed type testing stubs for instantiated types where we can
        do [CidRange]-based subtype-checks.

        ==> e.g. String/List<dynamic>

      * Specialzed type testing stubs for instantiated types where we can
        do [CidRange]-based subclass-checks for the class and
        [CidRange]-based subtype-checks for the type arguments.

        ==> e.g. Widget<State>, where we know [Widget] is only extended and not
                 implemented.

      * Specialzed type testing stubs for certain non-instantiated types where we
        can do [CidRange]-based subclass-checks for the class and
        [CidRange]-based subtype-checks for the instantiated type arguments and
        cid based comparisons for type parameters.  (Note that this fast-case migth
        result in some false-negatives!)

        ==> e.g. _HashMapEntry<K, V>, where we know [_HashMapEntry] is only
                 extended and not implemented.

       This optimizes cases where the caller uses `new HashMap<A, B>()` and only
       uses `A` and `B` as key/values (and not subclasses of it).  The false-negative
       can occur when subtypes of A or B are used.  In such cases we fall back to the
       [SubtypeTestCache]-based imlementation.

    Reviewed-on: https://dart-review.googlesource.com/44788

Relands 25f98bcc75

    [VM] Introduction of type testing stubs - Part 3

    The changes include:

      * Make AssertAssignableInstr no longer have a call-summary, which
        helps methods with several parameter checks by not having to
        re-load/re-initialize type arguments registers

      * Lazily create SubtypeTestCaches: We already go to runtime to warm up
        the caches, so we now also create the caches on the first runtime
        call and patch the pool entries.

      * No longer load the destination name into a register: We only need
        the name when we throw an exception, so it is not on the hot path.
        Instead we let the runtime look at the call site, decoding a pool
        index from the instructions stream.  The destination name will be
        available in the pool, at a consecutive index to the subtype cache.

      * Remove the fall-through to N=1 case for probing subtypeing tests,
        since those will always be handled by the optimized stubs.

      * Do not generate optimized stubs for FutureOr<T> (so far it just
        falled-through to TTS).  We can make optimzed version of that later,
        but it requires special subtyping rules.

      * Local code quality improvement in the type-testing-stubs: Avoid
        extra jump at last case of cid-class-range checks.

    There are still a number of optimization opportunities we can do in
    future changes.

    Reviewed-on: https://dart-review.googlesource.com/46984

Relands 2c52480ec8

    [VM] Introduction of type testing stubs - Part 4

    In order to avoid generating type testing stubs for too many types in
    the system - and thereby potentially cause an increase in code size -
    this change introduces a smarter way to decide for which types we should
    generate optimized type testing stubs.

    The precompiler creates a [TypeUsageInfo] which we use to collect
    information.  More specifically:

       a) We collect the destination types for all type checks we emit
          (we do this inside AssertAssignableInstr::EmitNativeCode).

          -> These are types we might want to generate optimized type testing
             stubs for.

       b) We collect type argument vectors used in instance creations (we do
          this inside AllocateObjectInstr::EmitNativeCode) and keep a set of
          of used type argument vectors for each class.

    After the precompiler has finished compiling normal code we scan the set
    of destination types collected in a) for uninstantiated types (or more
    specifically, type parameter types).

    We then propagate the type argument vectors used on object allocation sites,
    which were collected in b), in order to find out what kind of types are flowing
    into those type parameters.

    This allows us to extend the set of types which we test against, by
    adding the types that flow into type parameters.

    We use this final augmented set of destination types as a "filter" when
    making the decision whether to generate an optimized type testing stub
    for a given type.

    Reviewed-on: https://dart-review.googlesource.com/48640

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

Change-Id: I44a1d5d4b27454ae026aef2a301aada3dd399ea0
Reviewed-on: https://dart-review.googlesource.com/49861
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-04-09 11:25:36 +00:00
Martin Kustermann dbb1d3d44f Revert "[VM] Introduction of type testing stubs - Part 1-4"
This reverts commit 2c52480ec8.
This reverts commit 25f98bcc75.
This reverts commit f226c22424.
This reverts commit 165c583d57.

Change-Id: I3892d672b9ca0b0acc0b9b83c32ecc92355839c2
Reviewed-on: https://dart-review.googlesource.com/49843
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-04-06 08:35:01 +00:00
Martin Kustermann 25f98bcc75 [VM] Introduction of type testing stubs - Part 3
The changes include:

  * Make AssertAssignableInstr no longer have a call-summary, which
    helps methods with several parameter checks by not having to
    re-load/re-initialize type arguments registers

  * Lazily create SubtypeTestCaches: We already go to runtime to warm up
    the caches, so we now also create the caches on the first runtime
    call and patch the pool entries.

  * No longer load the destination name into a register: We only need
    the name when we throw an exception, so it is not on the hot path.
    Instead we let the runtime look at the call site, decoding a pool
    index from the instructions stream.  The destination name will be
    available in the pool, at a consecutive index to the subtype cache.

  * Remove the fall-through to N=1 case for probing subtypeing tests,
    since those will always be handled by the optimized stubs.

  * Do not generate optimized stubs for FutureOr<T> (so far it just
    falled-through to TTS).  We can make optimzed version of that later,
    but it requires special subtyping rules.

  * Local code quality improvement in the type-testing-stubs: Avoid
    extra jump at last case of cid-class-range checks.

There are still a number of optimization opportunities we can do in
future changes.

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

Change-Id: I4dc5a8a49f939178fe74d44736ef69e4b9088e46
Reviewed-on: https://dart-review.googlesource.com/46984
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-04-06 07:00:50 +00:00
Martin Kustermann f226c22424 [VM] Introduction of type testing stubs - Part 2
This CL starts building type testing stubs specialzed for [Type] objects
we test against.

More specifically, it adds support for:

  * Handling obvious fast cases on the call sites (while still having a
    call to stub for negative case)

  * Handling type tests against type parameters, by loading the value
    of the type parameter on the call sites and invoking it's type testing stub.

  * Specialzed type testing stubs for instantiated types where we can
    do [CidRange]-based subtype-checks.

    ==> e.g. String/List<dynamic>

  * Specialzed type testing stubs for instantiated types where we can
    do [CidRange]-based subclass-checks for the class and
    [CidRange]-based subtype-checks for the type arguments.

    ==> e.g. Widget<State>, where we know [Widget] is only extended and not
	     implemented.

  * Specialzed type testing stubs for certain non-instantiated types where we
    can do [CidRange]-based subclass-checks for the class and
    [CidRange]-based subtype-checks for the instantiated type arguments and
    cid based comparisons for type parameters.  (Note that this fast-case migth
    result in some false-negatives!)

    ==> e.g. _HashMapEntry<K, V>, where we know [_HashMapEntry] is only
	     extended and not implemented.

   This optimizes cases where the caller uses `new HashMap<A, B>()` and only
   uses `A` and `B` as key/values (and not subclasses of it).  The false-negative
   can occur when subtypes of A or B are used.  In such cases we fall back to the
   [SubtypeTestCache]-based imlementation.

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

Change-Id: Ic1853977bf55d815755b0d652ec8e20e51efb4cf
Reviewed-on: https://dart-review.googlesource.com/44788
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-04-06 07:00:50 +00:00
Martin Kustermann 165c583d57 [VM] Introduction of type testing stubs - Part 1
This CL:

  * Adds a field to [RawAbstractType] which will always hold a pointer
    to the entrypoint of a type testing stub

  * Makes this new field be initialized to a default stub whenever a
    instances are created (e.g. via Type::New(), snapshot reader, ...)

  * Makes the clustered snapshotter write a reference to the
    corresponding [RawInstructions] object when writing the field and do
    the reverse when reading it.

  * Makes us call the type testing stub for performing assert-assignable
    checks.

To reduce unnecessary loads on callsites, we store the entrypoint of the
type testing stubs directly in the type objects.  This means that the
caller of type testing stubs can simply branch there without populating
a code object first.  This also means that the type testing stubs
themselves have no access to a pool and we therefore also don't hold on
to the [Code] object, only the [Instruction] object is necessary.

The type testing stubs do not setup a frame themselves and also have no
safepoint.  In the case when the type testing stubs could not determine
a positive answer they will tail-call a general-purpose stub.

The general-purpose stub sets up a stub frame, tries to consult a
[SubtypeTestCache] and bails out to runtime if this was unsuccessful.

This CL is just the the first, for ease of reviewing.  The actual
type-specialized type testing stubs will be generated in later CLs.

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

Change-Id: I174a11b3b812799f399a60af799144c2ba3c26ec
Reviewed-on: https://dart-review.googlesource.com/44787
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-04-06 07:00:50 +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
Vyacheslav Egorov d290d8ecf4 [vm] Detect and expand calls through getters in AOT call specializer.
If we know that receiver is a subclass of a certain type and that this
type has accessor get:m then call o.m(...) is guaranteed to be an
invocation through a getter. Such invocations are executed most
efficiently when expanded into o.get:m().call(...).

Source based pipeline handles this case (at least for invocations on
`this`) directly in the parser, but Kernel based graph builder does not
have this sort of special case.

Instead of teaching Kernel flow graph builder to specially handle
invocations on `this` we teach AOT call specializer to specially handle
all invocations where receiver is known to be a subclass of certain
class. Such optimization is more generic and handles things that
previously were not handled by the optimization.

AOT compiler also has heuristics for injecting field dispatchers into
classes but these heuristics only handle fields of function type and
don't work for fields like `Function f` or `var f`.

Improves ParserCombinators benchmark by 4x.

This relands eea2c168f9 with a fix.

Change-Id: I13a41544c737b980efd431e31e4d15ad31da853e
Reviewed-on: https://dart-review.googlesource.com/30455
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-12-19 21:02:04 +00:00
Vyacheslav Egorov 7aeb94423f Revert "[vm] Detect and expand calls through getters in AOT call specializer."
This reverts commit eea2c168f9.

Reason for revert: standalone_2/io/test_runner_test times out

python tools/test.py -m release -c precompiler -r dart_precompiled -a simarm64 --use-blobs standalone_2/io/test_runner_test

Original change's description:
> [vm] Detect and expand calls through getters in AOT call specializer.
> 
> If we know that receiver is a subclass of a certain type and that this
> type has accessor get:m then call o.m(...) is guaranteed to be an
> invocation through a getter. Such invocations are executed most
> efficiently when expanded into o.get:m().call(...).
> 
> Source based pipeline handles this case (at least for invocations on
> `this`) directly in the parser, but Kernel based graph builder does not
> have this sort of special case.
> 
> Instead of teaching Kernel flow graph builder to specially handle
> invocations on `this` we teach AOT call specializer to specially handle
> all invocations where receiver is known to be a subclass of certain
> class. Such optimization is more generic and handles things that
> previously were not handled by the optimization.
> 
> AOT compiler also has heuristics for injecting field dispatchers into
> classes but these heuristics only handle fields of function type and
> don't work for fields like `Function f` or `var f`.
> 
> Improves ParserCombinators benchmark by 4x.
> 
> Bug:
> Change-Id: I365d4fb2140577d02aefbf16fcf6be1bd12413a6
> Reviewed-on: https://dart-review.googlesource.com/29840
> Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=vegorov@google.com,kustermann@google.com,alexmarkov@google.com

Change-Id: I2b891b1674dd07fa43d6414428438c41e3332391
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/30400
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-12-18 22:21:07 +00:00
Vyacheslav Egorov eea2c168f9 [vm] Detect and expand calls through getters in AOT call specializer.
If we know that receiver is a subclass of a certain type and that this
type has accessor get:m then call o.m(...) is guaranteed to be an
invocation through a getter. Such invocations are executed most
efficiently when expanded into o.get:m().call(...).

Source based pipeline handles this case (at least for invocations on
`this`) directly in the parser, but Kernel based graph builder does not
have this sort of special case.

Instead of teaching Kernel flow graph builder to specially handle
invocations on `this` we teach AOT call specializer to specially handle
all invocations where receiver is known to be a subclass of certain
class. Such optimization is more generic and handles things that
previously were not handled by the optimization.

AOT compiler also has heuristics for injecting field dispatchers into
classes but these heuristics only handle fields of function type and
don't work for fields like `Function f` or `var f`.

Improves ParserCombinators benchmark by 4x.

Bug:
Change-Id: I365d4fb2140577d02aefbf16fcf6be1bd12413a6
Reviewed-on: https://dart-review.googlesource.com/29840
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2017-12-18 16:34:26 +00:00
Alexander Markov 841b1ad814 [VM] Improve performance of allocators on ARM in non-product mode
This CL improves performance of allocation statistic counters on ARM
by removing duplicated loads and increasing distance between dependent
loads. These statistic counters are part of allocator fast path in a
non-product mode.

This change improves performance of gestures/velocity_tracker_bench
Flutter micro-benchmark in 'flutter run --profile' mode:

Before: 3352 µs
After:  3156 µs (-5.8%)
(minimum of 5 runs)
Change-Id: Ic7998318d9ca3e7997379d0054faaf5b0b569bb6
Reviewed-on: https://dart-review.googlesource.com/15640
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2017-10-20 18:01:49 +00:00