Commit Graph

167 Commits

Author SHA1 Message Date
Vyacheslav Egorov f496e538f4 [vm] Decouple assemblers from runtime.
This is the next step towards preventing compiler from directly peeking
into runtime and instead interact with runtime through a well defined
surface. The goal of the refactoring to locate all places where compiler
accesses some runtime information and partion those accesses into two
categories:

- creating objects in the host runtime (e.g. allocating strings, numbers, etc)
during compilation;
- accessing properties of the target runtime (e.g. offsets of fields) to
embed those into the generated code;

This change introduces dart::compiler and dart::compiler::target namespaces.

All code in the compiler will gradually be moved into dart::compiler namespace.
One of the motivations for this change is to be able to prevent access to
globally defined host constants like kWordSize by shadowing them in the
dart::compiler namespace.

The nested namespace dart::compiler::target hosts all information about
target runtime that compiler could access, e.g. compiler::target::kWordSize
defines word size of the target which will eventually be made different
from the host kWordSize (defined by dart::kWordSize).

The API for compiler to runtime interaction is placed into compiler_api.h.

Note that we still permit runtime to access compiler internals directly -
this is not going to be decoupled as part of this work.

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

Change-Id: If4396d295879391becfa6c38d4802bbff81f5b20
Reviewed-on: https://dart-review.googlesource.com/c/90242
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-01-25 16:45:13 +00:00
Martin Kustermann be47aad327 [VM/Compiler/AOT] Bare instructions 9: Improve write barrier on ARM/ARM64/X64
ARM write barrier goes from

   ldrne lr, [thr, #+508]
   blxne lr
to
   blne <offset>

ARM64 write barrier goes from (similarly X64)

   beq +8
   ldrx lr, [thr, #1056]
   blr lr
to
   beq +4
   bl <offset>

It reduces RX on arm/arm64 by around 0.9%

Though the write barrier wrappers stub has multiple entrypoints (one for
each available register).  Because of this, we modify the relocation
logic to support per-call offsets into the target.

To avoid making the assembler code depend on StubCode/FlowGraphCompiler,
we set a closure, which the assembler can call.

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

Change-Id: I9e3d68260cab7ef19ea88f1235c78d6031819d6d
Reviewed-on: https://dart-review.googlesource.com/c/90063
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-01-18 16:13:17 +00:00
Martin Kustermann ca2db2ad53 [VM/Compiler/AOT] Bare instructions 8: Improve AOT code by using pc-relative calls
This CL improves AOT code for StackOverflowInstr/CheckNullInstr:

  * On ARM we can do a conditional pc-relative calls for the stack overflow
    checks, getting rid of the slow-paths entirely.

  * On ARM64 we can do pc-relative calls on the slow path, avoiding an
    extra load.

Flutter gallery size impact (in bare instructions mode):
  * ARM: -3.7% RX
  * ARM64: -1.4% RX

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

Change-Id: Ia1acd76ac6efa26642f99e1ce3e417100aa357f3
Reviewed-on: https://dart-review.googlesource.com/c/89620
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-01-17 17:53:52 +00:00
Vyacheslav Egorov a9ce969e53 [vm] Decouple growable_array.h and zone.h from thread.h
- Introduce a slimmed down version of thread.h, which just depends on the
Zone and StackResource.
- Introduce a layering check that would prevent the coupling in the future.

This is the first step towards decoupling compiler from runtime.

There are multiple reasons to introduce the decoupling but the main
reason currently is to introduce a controlled surface through which
compiler reaches into runtime to catch any places where runtime word size
might influence the compiler and then enable building compiler that
targets 32-bit runtime but is embedded into a 64-bit runtime.

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

Change-Id: Id63ebbaddca55dd097298e51c90d957a73fa476e
Reviewed-on: https://dart-review.googlesource.com/c/87182
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-01-11 20:47:10 +00:00
Zach Anderson 42702e2c64 [vm] Spot fixes for Fuchsia
Change-Id: I4714f92cd2732875df584fc816228fb4b88f5828
Reviewed-on: https://dart-review.googlesource.com/c/88285
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2019-01-03 19:04:10 +00:00
Ryan Macnak d9c8f29b48 [vm, dbc] Remove bad assert from DBC deoptimization.
DBC's "FPU registers" are in fact stack slots.

Bug: https://github.com/dart-lang/sdk/issues/35395
Change-Id: I64f90f29b55f3f9bb0fec863e1a13c651f364ee7
Reviewed-on: https://dart-review.googlesource.com/c/87271
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-12-14 20:18:46 +00:00
Régis Crelier 25851db73d [vm/bytecode] Replace InstanceCall instruction with InterfaceCall and DynamicCall.
Dispatch interface calls via hashtable rather than inline cache.
InterfaceCall doesn't need to take arguments descriptor into account
when doing method lookup.

Change-Id: I30eae6ea638d1d2ad2cf3ff073c653fee3377f31
Reviewed-on: https://dart-review.googlesource.com/c/86106
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2018-12-14 16:51:51 +00:00
Martin Kustermann 28f8c96abe [VM] Bare instructions - Part 5: Get rid of CODE_REG indirection in SwitchableCalls
If the --use-bare-instructions flag is enabled we will:

  * Make call sites load the target directly from the pool (instead of
    the code object) - this saves one instruction (and an indirect load)

  * Ensure the object pool will have direct entry addresses by:

     - Letting the clustered snapshot reader change any StubCode::UnlinkedCall()
       in the object pool by it's monomorphic entry
     - Change the code patcher to patch SwitchableCalls by writing the
       monomorphic entry into the pool (instead of the code object)

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

Change-Id: I4e41fc8e4461bde477cc559a6a4fccaaf3a350b5
Reviewed-on: https://dart-review.googlesource.com/c/86160
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-12-14 16:11:53 +00:00
Martin Kustermann f205292227 [VM] Bare instructions - Part 4: Add --use-bare-instructions flag to AOT compiler & runtime
This is the final CL which adds a new --use-bare-instructions flag to
the VM.

If this flag is set during AOT compilation, we will:

  * Build one global object pool (abbr: GOP) which all code objects
    share. This gop will be stored in the object store.  The PP register
    is populated in the enter dart stub and it is restored when
    returning from native calls.

  * Gets rid of the CODE_REG/PP slots from the dart frames. Instead the
    compiled code uses the global object pool, which is always in PP.

  * Starts emitting pc-relative calls for calls between two dart
    functions or when invoking a stub.
    Limitation: We only emit pc-relative calls between two code objects
    in the same isolate (this is because the image writer is writing
    instruction objects for vm-isolate/main-isolate seperately)

  * We do compile-time relocation of those static calls after the
    precompiler has finished its work, but before writing the snapshot.
    This patches all the instruction objects with pc-relative calls to
    have the right .text distance.

  * We emit a sorted list of code objects in ObjectStore::reverse_code_table,
    which will be used by the AOT runtime to go back from PC to Code
    objects (where all metadata, e.g. stack maps, catch entry moves, pc
    descriptors are available).

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

Change-Id: I6c5dd2b1571e3a889b27e804a24c2986c71e03b6
Reviewed-on: https://dart-review.googlesource.com/c/85769
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-12-14 16:03:04 +00:00
Ryan Macnak 0b1935ca70 [vm] Remove hash-by-address from the ObjectPool builder.
Bug: https://github.com/dart-lang/sdk/issues/30978
Change-Id: I345be6d3f1d4680bd247225cb714017ac16501ec
Reviewed-on: https://dart-review.googlesource.com/c/85649
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-12-13 01:30:54 +00:00
Samir Jindel 921e62f1bf [vm] Introduce multiple entrypoints to AOT.
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
Change-Id: I8643033febf9bdc57c8298dca5f43346fb8bf6d1
Reviewed-on: https://dart-review.googlesource.com/c/80304
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-12-07 13:19:24 +00:00
Ryan Macnak e1ffe76a36 [vm] Replace StubEntry with Code handles.
StubEntry was holding raw pointers across safepoints in several places in the compiler.

Bug: https://github.com/dart-lang/sdk/issues/34934
Change-Id: Id17cb7651f4d3508915c8cb90f5cb2353df6dac0
Reviewed-on: https://dart-review.googlesource.com/c/85040
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-11-21 17:45:11 +00:00
Régis Crelier f721d52163 [VM runtime] Introduce a new VM class Bytecode.
Allow pc_marker slot to hold a Code object or a new Bytecode object.

Change-Id: If11c1df6dafc5b1cfcce6f0322c36d1d68e86df9
Reviewed-on: https://dart-review.googlesource.com/c/82526
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-11-14 02:48:03 +00:00
Martin Kustermann 600af11045 [VM] When disassembling dump functions seperately from non-function Code
Change-Id: Ic7d7f9746c4f723d3da08b003a943b83b779dad3
Reviewed-on: https://dart-review.googlesource.com/c/84038
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-11-13 10:32:28 +00:00
Martin Kustermann 0fd14324c5 [VM] Use "null" object pool instead of nullptr for empty pools
Fixes https://github.com/dart-lang/sdk/issues/35054

Change-Id: I5b852701e1e70d5ab1345625296752208ed06ce7
Reviewed-on: https://dart-review.googlesource.com/c/82983
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-11-06 11:38:33 +00:00
Martin Kustermann cd98dd72f6 [VM] Make all stubs inside the VM isolate share the same pool
Issue https://github.com/dart-lang/sdk/issues/33274

Change-Id: I556272952e6d7846721c6d48ef0ffbae5891cfde
Reviewed-on: https://dart-review.googlesource.com/c/82587
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-11-06 10:01:03 +00:00
Ryan Macnak 04941b5507 [vm, gc] For large arrays (arrays on a large heap page), use a card-based remembered set.
Bug: https://github.com/dart-lang/sdk/issues/30433
Change-Id: I7c710d9e36ab593295d00fc5e9e72a86a1b843af
Reviewed-on: https://dart-review.googlesource.com/c/63688
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-11-05 22:03:34 +00:00
Régis Crelier 27127b364a [DBC simulator] Rename class Bytecode to SimulatorBytecode.
This frees the name Bytecode that will become the name of a new VM class.
Class Code will only refer to compiled code and Bytecode will refer to kernel
bytecode.

Change-Id: If64a5d688f0bf75220e67ef2932f4141782e9dc3
Reviewed-on: https://dart-review.googlesource.com/c/82703
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2018-11-02 20:53:24 +00:00
Martin Kustermann a01513c685 [VM] Allow including disassembler in product mode if FORCE_INCLUDE_DISASSEMBLER is defined
This helps VM developers working with product mode.

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

Change-Id: I1933dea6f2d88c4745c63be772cfe301259f4a9c
Reviewed-on: https://dart-review.googlesource.com/c/82583
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-11-02 13:02:25 +00:00
Ryan Macnak a651838652 [vm] Fix misc printf format bugs.
Bug: https://github.com/dart-lang/sdk/issues/35009
Change-Id: I6b509e1eb8e76e07f60a086c67358d65d2a1fae4
Reviewed-on: https://dart-review.googlesource.com/c/82460
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-11-01 16:37:22 +00:00
Martin Kustermann b0b7cdb3da [VM] Add ArrayView class to access [Array]s which are treated as lists of tuples in a type-safe way
Change-Id: I0c356ba01bf3fc362d6e353285ddda7c21d56de4
Reviewed-on: https://dart-review.googlesource.com/c/81823
Commit-Queue: Martin Kustermann <kustermann@google.com>
Auto-Submit: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-11-01 15:09:49 +00:00
Martin Kustermann 9b9a035154 [VM] Add PcRelativeCall / PcRelativeJump patterns & assembler support
Issue https://github.com/dart-lang/sdk/issues/33274

Change-Id: I0297c4bb502a1af28e3cf16646eade49f4cd0676
Reviewed-on: https://dart-review.googlesource.com/c/81827
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-11-01 12:34:42 +00:00
Martin Kustermann 29396606c8 [VM] Allow Code::object_pool() to be 'null', refactor some code in precompiler.cc
This is preparation work for a global object pool, which will not be attached
to the Code objects.

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

Change-Id: Ia1746ea657fe6d8e9adb7552d6835425ff65542c
Reviewed-on: https://dart-review.googlesource.com/c/82064
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-11-01 11:59:44 +00:00
Ryan Macnak fa4fdcefb0 [vm, gc] Enable concurrent marking on Android/iOS.
On a Flutter app scrolling through a large table running on a Moto G 4, max pause time reduces from 129ms to 52ms.
Before
   6-44ms CollectNewGeneration
118-129ms CollectOldGeneration
After
   6-52ms CollectNewGeneration
   3-10ms StartConcurrentMarking
  20-42ms CollectOldGeneration (i.e., finalize marking)

Code size increases on Flutter Gallery:
ARM32 Instructions(CodeSize): 5772688 -> 5968624 (+3.39%)
ARM64 Instructions(CodeSize): 6082400 -> 6251008 (+2.77%)

Bug: https://github.com/dart-lang/sdk/issues/34002
Change-Id: Iac9a0b3d91b497b5016c4f89e8779c488f105a5b
Reviewed-on: https://dart-review.googlesource.com/c/76780
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-10-31 20:34:25 +00:00
Martin Kustermann 70abec503d [VM] Reland "[VM] Extract common code from Assembler to new AssemblerBase base class"
This reverts commit 04381d7571.

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

Change-Id: I843c3fe4cc8265fb43b6b09623e7509837a878f0
Reviewed-on: https://dart-review.googlesource.com/c/82041
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-10-30 12:00:22 +00:00
Alexander Aprelev 04381d7571 Revert "[VM] Extract common code from Assembler to new AssemblerBase base class"
This reverts commit 388c41de94 as it
breaks appjit_determinism_test on arm.

Bug: dartbug.com/34973
Change-Id: I25e995d3c4c8a77f2f3b681ed717adc4f723d86c
Reviewed-on: https://dart-review.googlesource.com/c/82000
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2018-10-29 23:08:34 +00:00
Martin Kustermann 388c41de94 [VM] Extract common code from Assembler to new AssemblerBase base class
Issue https://github.com/dart-lang/sdk/issues/33274

Change-Id: Ie7189081b3acac53a80a399b1353261c2312da79
Reviewed-on: https://dart-review.googlesource.com/c/81641
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-10-29 15:36:22 +00:00
Martin Kustermann 973c9519b7 [VM] Add a "kind" field to the entries of the Code::static_calls_target_table array
This is preparation for adding other kinds of static calls, e.g.
pc-relative calls.

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

Change-Id: Ief83aa3571036fabd72c2f82f946ca4757c76cb1
Reviewed-on: https://dart-review.googlesource.com/c/81407
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-10-26 14:29:34 +00:00
Alexander Markov 59e626e5c9 [vm/bytecode] Change encoding of MoveSpecial bytecode instruction
Previously MoveSpecial bytecode instruction used unsigned 8-bit A field
to encode target local variable index. This is too restrictive as we allow
signed 16-bit local variable indices.

After this change MoveSpecial has A_X encoding, with A field used for
special index (0 or 1), and signed 16-bit X field used for target local.

Change-Id: Ib87992e192b2923a39a9968913c39476947d3ea5
Reviewed-on: https://dart-review.googlesource.com/c/81440
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
2018-10-25 19:07:19 +00:00
Régis Crelier 11ad25a1c3 Reland "[VM runtime] Support Smi instances in type test cache."
This is a reland of 6ba3e55ecc

The issue was that SlowTypeTestStub used in precompiled mode did not handle a
Smi instance before calling the Subtype2TestCache stub which does not support
it. See PatchSet 2 for the fix.
Is there a more efficient solution?

Original change's description:
> [VM runtime] Support Smi instances in type test cache.
>
> This adds SubtypeTestCache-based optimizations for type tests against
>       * dst_type = FutureOr<T> (when T=int/num)
>       * dst_type = T (when T = FutureOr<int/num>)
>
> Remove dangerous LoadClass pseudo assembler instruction (does not work for Smi).
> Handle instantiated void in type tests (along with dynamic and Object).
>
> Change-Id: I0df0fc72ff173b9464d16cc971969132b055a429
> Reviewed-on: https://dart-review.googlesource.com/c/81182
> Commit-Queue: Régis Crelier <regis@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

Change-Id: I333ca47aebd7f0b663059ab6afc5d1cd8d7d5210
Reviewed-on: https://dart-review.googlesource.com/c/81320
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-10-24 17:54:13 +00:00
Régis Crelier 6134ac8648 Revert "[VM runtime] Support Smi instances in type test cache."
This reverts commit 6ba3e55ecc.

Reason for revert: unhappy kernel-precomp bots

Original change's description:
> [VM runtime] Support Smi instances in type test cache.
> 
> This adds SubtypeTestCache-based optimizations for type tests against
>       * dst_type = FutureOr<T> (when T=int/num)
>       * dst_type = T (when T = FutureOr<int/num>)
> 
> Remove dangerous LoadClass pseudo assembler instruction (does not work for Smi).
> Handle instantiated void in type tests (along with dynamic and Object).
> 
> Change-Id: I0df0fc72ff173b9464d16cc971969132b055a429
> Reviewed-on: https://dart-review.googlesource.com/c/81182
> Commit-Queue: Régis Crelier <regis@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

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

Change-Id: I73be5fc068cd24e0a13ba0872a99a24ab5a8eeca
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/81284
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2018-10-23 19:04:18 +00:00
Régis Crelier 6ba3e55ecc [VM runtime] Support Smi instances in type test cache.
This adds SubtypeTestCache-based optimizations for type tests against
      * dst_type = FutureOr<T> (when T=int/num)
      * dst_type = T (when T = FutureOr<int/num>)

Remove dangerous LoadClass pseudo assembler instruction (does not work for Smi).
Handle instantiated void in type tests (along with dynamic and Object).

Change-Id: I0df0fc72ff173b9464d16cc971969132b055a429
Reviewed-on: https://dart-review.googlesource.com/c/81182
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-10-23 18:01:40 +00:00
Ryan Macnak b8760fed67 [vm, compiler] Remove ASTs and AST flow graph builder.
Change-Id: I4d3c6500577d5285ced327954040dab42ba92341
Reviewed-on: https://dart-review.googlesource.com/c/78823
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-10-10 18:00:21 +00:00
asiva 32c484bb71 [VM] Fix typo in BitTestImmediate unit test.
Change-Id: Id2dc17e0df20a17c3f37dbf7640f21250b72c88a
Reviewed-on: https://dart-review.googlesource.com/c/78861
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-10-09 18:22:40 +00:00
Ryan Macnak 7f55e52888 [vm, x64] Use short forms for object pool loads.
We now patch object pool entries instead of pool load indices.

dart2js release
AOT X64 Instructions(CodeSize): 10171808 -> 9567168 (-5.94%)
JIT X64 Instructions(CodeSize): 14298624 -> 13163968 (-7.94%)

Bug: https://github.com/dart-lang/sdk/issues/29077
Change-Id: I84938a5717b79d65e941141539d7f82e02c89858
Reviewed-on: https://dart-review.googlesource.com/c/78185
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2018-10-09 17:30:25 +00:00
Ryan Macnak 41a9c38433 [vm, compiler] Shrink deopt stub and runtime call sequences.
dart2js release
AOT X64 Instructions(CodeSize): 10171456 -> 10090272 (-0.798%)
AOT ARM Instructions(CodeSize): 10814976 -> 10708512 (-0.984%)
AOT ARM64 Instructions(CodeSize): 11751328 -> 11646464 (-0.892%)
JIT X64 Instructions(CodeSize): 14296224 -> 13593536 (-4.92%)
JIT ARM Instructions(CodeSize): 16034352 -> 15685664 (-2.17%)
JIT ARM64 Instructions(CodeSize): 17207968 -> 16901504 (-1.78%)

Bug: https://github.com/dart-lang/sdk/issues/26033
Change-Id: Ic41a80fe8a90973811e74471e13f3edb6e4bffb6
Reviewed-on: https://dart-review.googlesource.com/c/77987
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-10-08 17:44:43 +00:00
Ryan Macnak b2d22be0f3 [vm, arm64] Take advantage of Fuchsia's lack of signal handlers.
Change-Id: I5cac30574a697a91116658cab5289d80f316f4b1
Reviewed-on: https://dart-review.googlesource.com/c/77901
Reviewed-by: Zach Anderson <zra@google.com>
2018-10-08 16:59:20 +00:00
Alexander Markov deb0645654 [vm/bytecode] Cleanup unused bytecode instructions
Change-Id: I956525dbeb3fdcb4b65a5530dbb59a96b4a02e81
Reviewed-on: https://dart-review.googlesource.com/77224
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-09-28 21:23:22 +00:00
Ryan Macnak 808ed6238b [vm, compiler] Make register allocator instead of assembler put the write barrier value into a fixed register.
Unlike the assembler, the register allocator is in a position to avoid a move. Use the call result register since it is the most popular value source.

This pattern will also be needed to get the write barrier slot into a fixed register for card-marking, since X64 and ARM don't have a TMP2.

dart2js aot product:
X64 Instructions(CodeSize): 9049952 -> 8994240 (-0.62%)
ARM Instructions(CodeSize): 9772096 -> 9711696 (-0.62%)
ARM64 Instructions(CodeSize): 10185056 -> 10122496 (-0.61%)

Bug: https://github.com/dart-lang/sdk/issues/34002
Change-Id: Id2e9dd7b3d86069a9da3ba4e141720511ce6399e
Reviewed-on: https://dart-review.googlesource.com/76307
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-09-26 23:55:27 +00:00
Vyacheslav Egorov c9bcfe877b [vm] Fix byte displacement printing in x86 disassembler
Use int8_t type instead of char - which does not have a defined signedness.

Change-Id: I14d43419d3e59cea71fb27f15bb1f72e450baca6
Reviewed-on: https://dart-review.googlesource.com/76563
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-09-25 22:42:36 +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
Ryan Macnak 482d27dfe7 [vm, compiler] Block LR for StoreStaticField and StoreIndexed on ARM.
Skip barrier for x.slot = x. Note that box allocations are non-Smi.

Bug: https://github.com/dart-lang/sdk/issues/34411
Change-Id: I846639747f0b583c24cb6ecf40548cf32b76d580
Reviewed-on: https://dart-review.googlesource.com/74324
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-09-11 17:05:24 +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 4bbeda1826 [VM] Use one double-word load instruction for populating ic-data/code-obj in switchable calls
Decreases flutter gallery RX size by 0.5 % on ARM64
Increases ARM64 perf, e.g. by 3.8% DeltaBlue

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

Change-Id: I32e9be0d1df2fc50d287761d75b6db60c187d225
Reviewed-on: https://dart-review.googlesource.com/73902
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-09-11 10:02:04 +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
Zach Anderson b4004f6476 [vm] Reland: Move the interpreter under a flag.
After this CL, the interpreter is included by default in the
JIT VM under the flag --enable-interpreter.

Reland with fix to NativeArgument setup in simulator_arm.cc

Change-Id: Ib9b4df6eb4d997dfbe361188b8a127828c1d9c6f
Reviewed-on: https://dart-review.googlesource.com/74003
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-09-07 19:25:31 +00:00
Zach Anderson 21406f576a Revert "[vm] Move the interpreter under a flag."
This reverts commit 715ab7b30b.

Reason for revert: simarm and kernel precomp builds failing

Original change's description:
> [vm] Move the interpreter under a flag.
> 
> After this CL, the interpreter is included by default in the
> JIT VM under the flag --enable-interpreter.
> 
> Change-Id: I06458f20288d67981822788ee6e867c2127ebdd3
> Reviewed-on: https://dart-review.googlesource.com/71800
> Commit-Queue: Zach Anderson <zra@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

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

Change-Id: I3622f4dbe53288d07fc21b34ee5ff68f2682b36d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/74001
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-09-07 17:14:21 +00:00
Ryan Macnak 94eb90af80 [vm, arm64] Don't use the object pool for small Smi constants.
Shrinks the clustered snapshot from fewer object pool entries but increases the image snapshot from less deduplication. Removes memory traffic for these constants.

Flutter Gallery
profile Total(CodeSize): 15284383 -> 15271689 (-0.08%)
release Total(CodeSize): 11358403 -> 11361337 (+0.02%)

Change-Id: I2ee4d49ba11241da5bf2928cfa44a39d5605eb86
Reviewed-on: https://dart-review.googlesource.com/73680
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-09-07 17:04:23 +00:00