Commit Graph

31 Commits

Author SHA1 Message Date
Aart Bik fa6fce61fa [dart/vm] Improved inlining methods and heuristics
Rationale:
Previous method cached graph information (instruction and call site
counts) on a per-function level, not accounting for potential
specializations. The improved method runs an extra constant folding
pass, and only caches per-function information for non-specialized
cases. As a result, we inling much better, see for example, the
added test as illustration.

Since we no longer cache for constants, compile-time may be increased
a bit due to the extra scan. In the long run we should consider
for common constant "situations" as the call site.

https://github.com/dart-lang/sdk/issues/36880

Change-Id: I19f007c7f1860ad0ea88fafb38695dc154189ad5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105460
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-06-12 19:39:10 +00:00
Aart Bik b0727bd661 [dart/vm] enhanced graph checker
Rationale:
Refactored existing verify uses (with some overlap and some
additional checks) into the graph checker. Also added more
verification code and repaired some inconsistencies in IR
found by new checker. However, some checks are disabled with
a TODO, since the IR does not currently meet all the stricter
assumptions. Fixes will follow.

https://github.com/dart-lang/sdk/issues/36893
https://github.com/dart-lang/sdk/issues/36894
https://github.com/dart-lang/sdk/issues/36895
https://github.com/dart-lang/sdk/issues/36899

Change-Id: Ic0395208da38ecb6fc8ca2551efe819e6458a731
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101922
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-05-13 17:47:11 +00:00
Aart Bik 7e0b680851 [dart/vm] minor test refactoring
Rationale:
Combining test and declaration. Also reorder
test for efficiency.

Change-Id: I6422c0c3fdf31fccd7b2a58f885bca2daa1e996c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102080
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-05-10 15:50:40 +00:00
Martin Kustermann a3c19d4ffc [vm/compiler] Move inlining/intrinsics pipeline passes to compiler_pass.h
This makes it easier to maintain since all of them are in one place.

Change-Id: If55a9fb4a703aee36889c3fbdb8dded9f6233cb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99467
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-04-25 10:55:40 +00:00
Martin Kustermann dbfd00f44d [vm/compiler] Add new optimization pass which inlines typed data accesses
Based on the unified typed data layout, we can now inline accesses to
typed data interface classes if there are no 3rd party implementations
of those interfaces.

Example: If a receiver is of type Uint8List and we call `[]` or `[]=` we
will inline the byte access.

Instead of changing the existing inliner / call specializer we add this
as an extra pass: If the inliner / call specializer infer that the
receiver type is e.g. internal typed data then it will perform the
inlining itself using more optimized LoadIndexed instruction.

=> Only if those existing optimization passes have not been able to inline
   the access will we, later on in the compilation pipeline, run a
   specialized pass which will inline the accesses using LoadUntagged +
   LoadIndexed (which is slightly less efficient than using only LoadIndexed
   for internal typed data).

As a first step this is only done for AOT.

For ease of writing tests matching certain IR graphs this CL also adds a
IR pattern matcher.

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

Cq-Include-Trybots: luci.dart.try:vm-canary-linux-debug-try, vm-dartkb-linux-debug-x64-try, vm-dartkb-linux-release-x64-try, vm-kernel-asan-linux-release-x64-try, vm-kernel-checked-linux-release-x64-try, vm-kernel-linux-debug-ia32-try, vm-kernel-linux-debug-simdbc64-try, vm-kernel-linux-debug-x64-try, vm-kernel-linux-product-x64-try, vm-kernel-linux-release-ia32-try, vm-kernel-linux-release-simarm-try, vm-kernel-linux-release-simarm64-try, vm-kernel-linux-release-simdbc64-try, vm-kernel-linux-release-x64-try, vm-kernel-optcounter-threshold-linux-release-ia32-try, vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-android-release-arm-try, vm-kernel-precomp-bare-linux-release-simarm-try, vm-kernel-precomp-bare-linux-release-simarm64-try, vm-kernel-precomp-bare-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-product-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-obfuscate-linux-release-x64-try, vm-kernel-precomp-win-release-simarm64-try, vm-kernel-precomp-win-release-x64-try, vm-kernel-reload-linux-debug-x64-try, vm-kernel-reload-linux-release-x64-try, vm-kernel-reload-rollback-linux-debug-x64-try, vm-kernel-reload-rollback-linux-release-x64-try, vm-kernel-win-debug-ia32-try, vm-kernel-win-debug-x64-try, vm-kernel-win-product-x64-try, vm-kernel-win-release-ia32-try, vm-kernel-win-release-x64-try

Change-Id: I5f2e01a55f46b473f64478b05679f65b9fd7c4c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98662
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-04-05 15:51:34 +00:00
Martin Kustermann 31d558c81c [vm/compiler] Add il_test_helper.h with support for running compilation pipelines for testing
The two existing places where IR is built are changed to use this new
helper. It supports running normal JIT/AOT passes as well as a
user-specified set of passes.

In order to allow vm/cc tests to make assertions about AOT pipeline this CL
enables the DART_PRECOMPILER define in run_vm_tests binary (similar to
gen_snapshot, run_vm_tests has now JIT and AOT support)

Change-Id: Ib51a024a81e0291e89d20860b8b9a2762611426c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98482
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-04-04 05:58:29 +00:00
Vyacheslav Egorov d23909802e [vm/compiler] Eliminate dead CatchBlockEntry Parameter-s
Parameter instructions inside CatchBlockEntry's initial definitions
are similar to Phi instructions: Parameter value at entry to the
catch would be taken from corresponding slot in the environment
attached to the instruction which threw the exception which is
being caught.

Thus similarly to Phi-s Parameter instructions can be redundant (if they
always evaluate to the same value - no matter where control arrives
from) or dead (if their value never reaches real instruction).

We already had an analysis to discover subset of redundant Parameter-s
which always evaluate to a constant value.

This CL introduces analysis to eliminate dead Parameter-s.

This should significantly reduce size of metadata generated for try/catch
and reduce spilling within functions with try/catch.

On Flutter Gallery: reduces Isolate part of snapshot by 15k (0.7%), Instructions
part is reduced by 2.7K (0.06%).

Change-Id: I345813e326152ca2ed2d4d5353bb64730d7545d4
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-android-release-arm-try, vm-kernel-precomp-bare-linux-release-simarm-try, vm-kernel-precomp-bare-linux-release-simarm64-try, vm-kernel-precomp-bare-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-product-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97110
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-03-29 14:15:42 +00:00
Aart Bik 5823be65af [vm/compiler] Continued graph checker development (reland)
Rationale:
More assumption verified. Found some true issues.

Relands:
https://dart-review.googlesource.com/c/sdk/+/91702
with some fixes

https://github.com/dart-lang/sdk/issues/35803
https://github.com/dart-lang/sdk/issues/35819
https://github.com/dart-lang/sdk/issues/35848
https://github.com/dart-lang/sdk/issues/35849

Change-Id: I26101f8af3bd3fcdd5868d0882f8f096ab02b512
Reviewed-on: https://dart-review.googlesource.com/c/91945
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-02-04 23:18:42 +00:00
Aart Bik b876d12f03 Revert "[vm/compiler] Continued graph checker development"
This reverts commit b01697ba5a.

Reason for revert: we have two check fails on bleeding edge
                    reverting this until we found the underlying issue

Original change's description:
> [vm/compiler] Continued graph checker development
> 
> Rationale:
> More assumption verified. Found some true issues.
> 
> Bug:
> https://github.com/dart-lang/sdk/issues/35803
> https://github.com/dart-lang/sdk/issues/35819
> 
> Change-Id: I5526f203925fb320aa504b4e142fcf987579300a
> Reviewed-on: https://dart-review.googlesource.com/c/91702
> Commit-Queue: Aart Bik <ajcbik@google.com>
> Reviewed-by: Aart Bik <ajcbik@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

TBR=kustermann@google.com,alexmarkov@google.com,asiva@google.com,ajcbik@google.com

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

Change-Id: Ifd7ee46c42d82312f762cac7021e6a55deac83fd
Reviewed-on: https://dart-review.googlesource.com/c/91943
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-02-04 18:11:52 +00:00
Aart Bik b01697ba5a [vm/compiler] Continued graph checker development
Rationale:
More assumption verified. Found some true issues.

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

Change-Id: I5526f203925fb320aa504b4e142fcf987579300a
Reviewed-on: https://dart-review.googlesource.com/c/91702
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-02-01 19:14:27 +00:00
Aart Bik e02399da33 [vm/compiler] Introduce graph checker
Rationale:
This is a start with a graph checker that verifies
the consistency of the flow graph after each compiler
pass with the goal of detecting errors as early as
possible. The checks add overhead, so are only run
in debug mode. The objective is that all written
and unwritten assumptions on the flow graph that
are relatively easy to check will be converted
into actual code.
Change-Id: Iad9927d5b0fd87a43dc6a7369174d52761d89c9e
Reviewed-on: https://dart-review.googlesource.com/c/91143
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-01-28 18:16:47 +00:00
Ryan Macnak 169331abb1 [vm] Misc timeline tweaks.
- Move compiler pass events to a new CompilerVerbose stream
 - Remove serialization phase events
 - Add class name to class finalization event (lost along with finalization events in recent cleanups of finalization)
 - Add event for kernel loading

Change-Id: Ie72bced978400ea174c1551c961baa55c691b019
Reviewed-on: https://dart-review.googlesource.com/c/90883
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-01-25 18:37:05 +00:00
Ryan Macnak 06a1e6e9e3 [vm] Enable timeline on Fuchsia even in product mode.
On Fuchsia, the timeline is accessed without involving the service isolate or vm-service.

Change-Id: Ia0d4e1ca252604e8fcef466a31e3d2a8b0912251
Reviewed-on: https://dart-review.googlesource.com/c/90100
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-18 00:06:10 +00:00
Ryan Macnak 07f95e7761 Revert "[vm] Enable timeline on Fuchsia even in product mode."
This reverts commit 3f7b371f2c.

Reason for revert: Some modes failing to find new constant?

Original change's description:
> [vm] Enable timeline on Fuchsia even in product mode.
> 
> On Fuchsia, the timeline is accessed without involving the service isolate or vm-service.
> 
> Change-Id: I0d2351dcadcfc47835732235e1b8fafa8212f883
> Reviewed-on: https://dart-review.googlesource.com/c/89880
> Reviewed-by: Zach Anderson <zra@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

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

Change-Id: Ic03a78d14821e0361d54587f1f7510bc9ebfef1c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/89942
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-17 00:39:39 +00:00
Ryan Macnak 3f7b371f2c [vm] Enable timeline on Fuchsia even in product mode.
On Fuchsia, the timeline is accessed without involving the service isolate or vm-service.

Change-Id: I0d2351dcadcfc47835732235e1b8fafa8212f883
Reviewed-on: https://dart-review.googlesource.com/c/89880
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-16 22:55:51 +00:00
Aart Bik aae0f7997d [vm/compiler] Express control dependence as data dependence.
Rationale:
This provides a more robust way of expressing control
dependences between bounds checks and their uses, while
still allowing for CSE and LICM where possible.
This also fixes the original bug that started this
whole redesign: invalid LICM of checkbound.

Note:
Deals with bounds check, null check still TBD.

Reland of:
https://dart-review.googlesource.com/c/sdk/+/85470

Mini design doc:
runtime/docs/compiler/data_dep_for_control_dep.md

https://github.com/dart-lang/sdk/issues/35139
https://github.com/dart-lang/sdk/issues/34684
https://github.com/dart-lang/sdk/issues/30633

Change-Id: I24b994344ed28c9f5fbf0ed033698be75448df1c
Reviewed-on: https://dart-review.googlesource.com/c/85720
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-12-03 18:07:39 +00:00
Aart Bik ef419f68f9 Revert "[vm/compiler] Express control dependence as data dependence."
This reverts commit 41f3d4326e.

Reason for revert: I hit +2 by accident when I wanted to submit do a dry run

Original change's description:
> [vm/compiler] Express control dependence as data dependence.
> 
> Rationale:
> This provides a more robust way of expressing control
> dependences between bounds checks and their uses, while
> still allowing for CSE and LICM where possible.
> This also fixes the original bug that started this
> whole redesign: invalid LICM of checkbound.
> 
> Note:
> Deals with bounds check, null check still TBD.
> 
> Mini design doc:
> runtime/docs/compiler/data_dep_for_control_dep.md
> 
> https://github.com/dart-lang/sdk/issues/35139
> https://github.com/dart-lang/sdk/issues/34684
> https://github.com/dart-lang/sdk/issues/30633
> 
> Change-Id: Icfbd3ca60662e37046e48b95be7f81d05d94af88
> Reviewed-on: https://dart-review.googlesource.com/c/85470
> Commit-Queue: Aart Bik <ajcbik@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

TBR=vegorov@google.com,kustermann@google.com,rmacnak@google.com,alexmarkov@google.com,asiva@google.com,ajcbik@google.com

Change-Id: Id20699f957681c248851b37d545b330fd4972d7a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/85522
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2018-11-29 03:02:17 +00:00
Aart Bik 41f3d4326e [vm/compiler] Express control dependence as data dependence.
Rationale:
This provides a more robust way of expressing control
dependences between bounds checks and their uses, while
still allowing for CSE and LICM where possible.
This also fixes the original bug that started this
whole redesign: invalid LICM of checkbound.

Note:
Deals with bounds check, null check still TBD.

Mini design doc:
runtime/docs/compiler/data_dep_for_control_dep.md

https://github.com/dart-lang/sdk/issues/35139
https://github.com/dart-lang/sdk/issues/34684
https://github.com/dart-lang/sdk/issues/30633

Change-Id: Icfbd3ca60662e37046e48b95be7f81d05d94af88
Reviewed-on: https://dart-review.googlesource.com/c/85470
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-11-29 01:47:18 +00:00
Martin Kustermann d31e83b909 [VM] Do simple block re-ordering in AOT by moving throwing blocks to the end
If we inline something inside a loop which might throw, the throwing blocks
are currently spliced in the middle of the loop.  This CL moves those blocks
to the very end.

This improves a number of typed data benchmarks in dart-aot mode by 5-10%.

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

Change-Id: I5dc86291240d8dac61798ff873ffa7205edc0007
Reviewed-on: https://dart-review.googlesource.com/c/85263
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-11-26 17:22:56 +00:00
Aart Bik 9eb1d74881 Reland "[vm/compiler] Fine tune operator and phi handling."
This reverts commit cde479301a.

Reason for revert: the real underlying bug has been fixed

Original change's description:
> Revert "[vm/compiler] Fine tune operator and phi handling."
> 
> This reverts commit 4d5b5bb5a6.
> 
> Reason for revert: We are seeing an AOT compiler issue as a result of this change (please see https://github.com/flutter/flutter/issues/23879)
> 
> Original change's description:
> > [vm/compiler] Fine tune operator and phi handling.
> > 
> > Rationale:
> > Running an extra call specialization pass a bit later
> > in the compiler passes stream (after types are propagated)
> > recognizes more operators, which execute more efficiently.
> > In addition, unboxing phis seems useful on all archs, not
> > just 32-bit. These minor tweeks combined improve the prime
> > number benchmark 3 fold.
> > 
> > https://github.com/flutter/flutter/issues/19677
> > 
> > Change-Id: Ib2102ce807c2f0a9f801542e0c4bc6a7673f552b
> > Reviewed-on: https://dart-review.googlesource.com/69240
> > Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> > Commit-Queue: Aart Bik <ajcbik@google.com>
> 
> TBR=vegorov@google.com,alexmarkov@google.com,asiva@google.com,ajcbik@google.com
> 
> # Not skipping CQ checks because original CL landed > 1 day ago.
> 
> Change-Id: I46e420f9355bfc3c4a3f2fb9274f648e8a596d9a
> Reviewed-on: https://dart-review.googlesource.com/c/83229
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Aart Bik <ajcbik@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>

TBR=vegorov@google.com,alexmarkov@google.com,asiva@google.com,ajcbik@google.com

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

Change-Id: I7f9d892a6225c42810e7be52b6845bfee9cc017d
Reviewed-on: https://dart-review.googlesource.com/c/83800
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2018-11-08 20:58:16 +00:00
Siva Annamalai cde479301a Revert "[vm/compiler] Fine tune operator and phi handling."
This reverts commit 4d5b5bb5a6.

Reason for revert: We are seeing an AOT compiler issue as a result of this change (please see https://github.com/flutter/flutter/issues/23879)

Original change's description:
> [vm/compiler] Fine tune operator and phi handling.
> 
> Rationale:
> Running an extra call specialization pass a bit later
> in the compiler passes stream (after types are propagated)
> recognizes more operators, which execute more efficiently.
> In addition, unboxing phis seems useful on all archs, not
> just 32-bit. These minor tweeks combined improve the prime
> number benchmark 3 fold.
> 
> https://github.com/flutter/flutter/issues/19677
> 
> Change-Id: Ib2102ce807c2f0a9f801542e0c4bc6a7673f552b
> Reviewed-on: https://dart-review.googlesource.com/69240
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> Commit-Queue: Aart Bik <ajcbik@google.com>

TBR=vegorov@google.com,alexmarkov@google.com,asiva@google.com,ajcbik@google.com

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

Change-Id: I46e420f9355bfc3c4a3f2fb9274f648e8a596d9a
Reviewed-on: https://dart-review.googlesource.com/c/83229
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-11-07 01:09:52 +00:00
Aart Bik 914065d80b [vm/compiler] Use loop framework for register allocator
Rationale:
Rather than relying on a separate loop detector, rely
on the new loop framework, which avoids code duplication
and ensures any improvement in loop detection/handling
will benefit this phase too. Note, most of the time, the
same loops are discovered with a few exceptions (which
is okay, since this is "just" heuristic usage). This CL
also simplifies loop detection a bit.

https://github.com/dart-lang/sdk/issues/34473

Change-Id: I1a1b19b99a698c74822473d2a1fe370287c1ade4
Reviewed-on: https://dart-review.googlesource.com/c/80523
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-10-22 19:29:30 +00:00
Ryan Macnak 662ff7f112 [vm] Remove TokenStream, TokenValue, CompilerStats.
(CompilerStats timers have been replaced with the timeline events.)

Change-Id: Iddcb752c085de9762eb802371b6d2905fa608a76
Reviewed-on: https://dart-review.googlesource.com/c/79086
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-10-10 21:39:45 +00:00
Alexander Markov a386c07281 [vm/aot] Add extra call specialization pass
The extra call specialization pass after constant propagation is able to
replace more calls in AOT, as constant propagation removes unreachable
code and subsequent type propagation infers more accurate types.

Performance improvement (armv8):
DartMicroBench.IntPower3 196.4%
DartMicroBench.IntPower2 273.1%

Change-Id: I7076608f828484c4045e7a7b605ed8ff7981a868
Reviewed-on: https://dart-review.googlesource.com/75564
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-09-19 20:49:28 +00:00
Samir Jindel 60757d0873 [vm/kernel] Fix bug with optimization of this-invocations.
Fixes #34268.

Change-Id: Ie6a70f80d4e01d83e0381412c1c908d241e33ecd
Reviewed-on: https://dart-review.googlesource.com/71640
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-08-28 12:22:20 +00:00
Vyacheslav Egorov a69844cb19 [vm/compiler] Check for catch presence explicitly in optimizer.
Some optimizations were checking for a number of successors of graph
entry - but that count includes unchecked entry and indirect entries.

Change-Id: Ib163a7710aaba3e68023a9cd04ca194c03262c33
Reviewed-on: https://dart-review.googlesource.com/71302
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-08-23 17:19:00 +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
Aart Bik 4d5b5bb5a6 [vm/compiler] Fine tune operator and phi handling.
Rationale:
Running an extra call specialization pass a bit later
in the compiler passes stream (after types are propagated)
recognizes more operators, which execute more efficiently.
In addition, unboxing phis seems useful on all archs, not
just 32-bit. These minor tweeks combined improve the prime
number benchmark 3 fold.

https://github.com/flutter/flutter/issues/19677

Change-Id: Ib2102ce807c2f0a9f801542e0c4bc6a7673f552b
Reviewed-on: https://dart-review.googlesource.com/69240
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2018-08-10 16:46:22 +00:00
Samir Jindel c1df0d4c10 [vm] Very basic store barrier elimination.
If the left-hand side of the store is an allocation and no GC-triggering
instructions have been executed since, it is safe to elide the store barrier.

This gives a 1.4% code size reduction on Flutter Gallery ARM32.

Change-Id: Ib7227d3ef9d798d5e30f238f3f789f9a2e637d6a
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/64687
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-07-17 22:59:28 +00:00
Vyacheslav Egorov cf8c76dc50 [vm/compiler] Restore old print-flow-graph behavior.
If either of print-flow-graph/print-flow-graph-optimized is passed then
print the flow-graph after the register allocation.

Change-Id: If1ad9117ee2c1d5bf7d3608110f9f72eee7393e2
Reviewed-on: https://dart-review.googlesource.com/50726
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-04-11 15:53:46 +00:00
Vyacheslav Egorov 4fb15fcbf2 [vm/compiler] Consolidate compiler passes and share them between JIT and AOT.
Passes bodies are moved into compiler_pass{.cc,.h}.

Invoking a pass is just INVOKE_PASS(Name) now, instead of putting a bunch of
if-s and calls in compiler.cc or precompiler.cc.

We also consolidate ability to print IL and enable-disable passes under a
single flag --compiler-passes, e.g.

--compiler-passes=-Inlining,-CSE    disable inlining and CSE passes

--compiler-passes=Inlining+         print IL after Inlining pass and all
                                    subsequent passes

Change-Id: I90ff54b04a54f20099f5bf38dd45b16b8e3c4781
Reviewed-on: https://dart-review.googlesource.com/43968
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-01 16:43:58 +00:00