Commit Graph

148 Commits

Author SHA1 Message Date
Zachary Anderson a1bcf051d8 clang-format runtime/vm
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2481873005 .
2016-11-08 13:54:47 -08:00
Regis Crelier cf52536d09 Remove default monomorphic check code from functions and stubs that do not need it.
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2463083002 .
2016-11-03 01:41:14 -07:00
Ryan Macnak 26245de7a5 Support unaligned integer loads on ARM and MIPS.
Fixes SDK build with SIMARM/SIMARM64/SIMMIPS.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2452453002 .
2016-10-31 17:41:53 -07:00
Zachary Anderson 103881d01c Make header include guards great again
i.e. #ifndef VM_WHATEVER -> #ifndef RUNTIME_VM_WHATEVER

This lets us remove a hack from the PRESUBMIT.py script that existed
for reasons that are no longer valid, and sets us up to add some
presubmit checks for the GN build.

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

Review URL: https://codereview.chromium.org/2450713004 .
2016-10-26 00:26:03 -07:00
Ryan Macnak 7ff2dd4117 Optimize AOT's switchable calls for the monomorphic case.
The call sequence is very similar to a classic IC call, except the guarded class and the target are loaded indirectly from the constant pool instead of as immediates. In the monomorphic case, we call directly to the expected target with a class check in the callee. In the unlinked, polymorphic and megamorphic cases, we call a stub; these case are now call-through instead of call-and-return.

Every code, except stubs involved in switchable calls, includes the class check sequence at the beginning. So we now distinguish between a checked and an unchecked entry point. Generated code except the switchable call continues to use the unchecked entry point.

PC offsets are calculated relative to the beginning of the instruction stream, rather than either entry point.

BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2226893002 .
2016-08-12 11:18:35 -07:00
Florian Schneider d3810213b0 VM: Array bounds checks that don't deoptimize for precompiled code.
1. Make CheckArrayBoundInstr also check the index for smi. This allows easy replacement
of the deoptimizing checks with the slow-path checks in the precompiler.

2. Add GenericCheckBoundInstr which has a slow-path attached for
handling check failures.

BUG=
R=rmacnak@google.com, vegorov@google.com

Review URL: https://codereview.chromium.org/2149023002 .

Committed: https://github.com/dart-lang/sdk/commit/4a5f651c4b2202013ab7c3db887fd95e2597e173
2016-07-15 10:07:41 -07:00
Ryan Macnak 2a535414bc Revert "VM: Array bounds checks that don't deoptimize for precompiled code."
This reverts commit 4a5f651c4b.

Review URL: https://codereview.chromium.org/2152683003 .
2016-07-14 13:28:23 -07:00
Florian Schneider 4a5f651c4b VM: Array bounds checks that don't deoptimize for precompiled code.
1. Make CheckArrayBoundInstr also check the index for smi. This allows easy replacement
of the deoptimizing checks with the slow-path checks in the precompiler.

2. Add GenericCheckBoundInstr which has a slow-path attached for
handling check failures.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2149023002 .
2016-07-14 10:48:50 -07:00
Florian Schneider ab4490e5bf VM: Remove collection of unused range feedback.
We can always put it back if the optimizer makes use of it.
It's a lot of extra code that is unused. Therefore, remove it for now.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2132933003 .
2016-07-11 06:46:50 -07:00
Siva Annamalai 006bab2c47 Land Ivan's change of 'Remove support for verified memory handling'
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2112043002 .
2016-07-01 09:21:01 -07:00
Ryan Macnak 05d8185470 Never include_isolate or allow_embedded_addresses.
Makes the JIT PIC on non-IA32 like precompilation, a prerequisite for caching code across processes.

R=fschneider@google.com, johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1911253002 .
2016-04-22 20:47:23 -07:00
Ryan Macnak e386db978e Invoke CallToRuntime via Thread instead of ObjectPools.
Most functions use CallToRuntime for the stack overflow check.

precompiled dart2js arm 20388895 -> 20308640 (-0.39%)

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1778103003 .
2016-03-11 10:03:12 -08:00
Ryan Macnak 04e8382cec VM: Share object pool entries for optimized static calls.
Independently patchable entries are not required for debugging because breakpoints are only added to unoptimized code, nor for deopt because deopt patches the instruction stream and not the object pool.

Future work: Reduce the static call table from (pc offset, function, code) triples to (pc offset, function or allocation stub) pairs.

precompiled dart2js arm 20747140 -> 20674954 (-0.34%)

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1713853003 .
2016-02-24 13:57:19 -08:00
Ryan Macnak c315da5a06 ARM: Don't generate memory instructions with writeback where the data and address registers are the same.
BUG=http://dartbug.com/24855
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1434323003 .
2015-11-13 12:13:55 -08:00
Ryan Macnak 7e2e9cb949 ARM: Fix double use of IP when storing object fields with large offsets.
TEST=language/large_class_declaration --noopt
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1409733009 .
2015-11-05 09:54:50 -08:00
Ryan Macnak 1a34875064 Make arm assembler explicitly take both registers for load/store-pair.
R=zra@google.com

Review URL: https://codereview.chromium.org/1407393006 .
2015-10-23 10:16:32 -07:00
Florian Schneider 9fa3d7c9e4 VM: Initialize Instruction objects with break instructions instead of null.
On ia32 this is int3().  This also makes precompiled instruction snapshots
deterministic (to be precise the empty space due to alignment), and not depending
 on the address of the null object at snapshot creation time.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1367973002 .
2015-09-25 14:10:32 +02:00
Ryan Macnak f1a0056430 Load the native call wrapper via Thread.
R=fschneider@google.com

Review URL: https://codereview.chromium.org//1358773002 .
2015-09-20 13:48:17 -07:00
Florian Schneider bac82e2592 VM: New calling convention for generated code.
Instead of calling code object directly, call indirectly and
pass the code object in a register. The object pool is then loaded from
the code object. This is another preparation step for making generated code
relocatable.

All non-ia32 platforms:
No entry patching.

ARM:
PC marker (now code object) moves to the same place as on x64 (below saved PP, above saved FP).
R9 is now used as PP, R10 as CODE_REG.

BUG=
R=koda@google.com, rmacnak@google.com

Committed: https://github.com/dart-lang/sdk/commit/1d343e5a7b75168fb6c9f86b64c55173cdbdc9b2

Review URL: https://codereview.chromium.org//1192103004 .
2015-09-19 13:21:09 +02:00
Ryan Macnak 13e0a49d47 ARM & MIPS: Try to use the object pool before trying to embed a pointer, like ARM64 and X64.
(In particular, don't embed pointers to arguments descriptors.)

R=fschneider@google.com

Review URL: https://codereview.chromium.org//1344153002 .
2015-09-16 10:18:38 -07:00
Florian Schneider 7af7a2db87 Revert "VM: New calling convention for generated code."
This reverts commit 1d343e5a7b.

Because of Windows test failures.

BUG=
TBR=whesse@google.com

Review URL: https://codereview.chromium.org//1343373003 .
2015-09-16 13:46:05 +02:00
Florian Schneider 1d343e5a7b VM: New calling convention for generated code.
Instead of calling code object directly, call indirectly and
pass the code object in a register. The object pool is then loaded from
the code object. This is another preparation step for making generated code
relocatable.

All non-ia32 platforms:
No entry patching.

ARM:
PC marker (now code object) moves to the same place as on x64 (below saved PP, above saved FP).
R9 is now used as PP, R10 as CODE_REG.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1192103004 .
2015-09-16 13:05:58 +02:00
Florian Schneider 1907b5a3e1 VM: Fix bug in ARM v5/v6 loading of immediates.
The condition was not correctly passed on as argument in LoadDecodableImmediate.

BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org//1318003003 .
2015-09-11 10:00:22 +02:00
Ryan Macnak 8ebb9f9b39 Track which entries in the ObjectPool are native entries, and reset them when loading a precompiled snapshot.
R=fschneider@google.com

Review URL: https://codereview.chromium.org//1316673005 .
2015-09-10 15:41:37 -07:00
Florian Schneider 7e082c1082 VM: Use constant pool also for leaf runtime calls on x64, arm, arm64 and mips.
Remove unused branch/call macro instructions from the assembler.

Setup a frame and pool pointer when invoking leaf runtime functions (in the
deoptimzation stub and store-buffer update stub).

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1314883002 .
2015-08-28 10:46:02 +02:00
Florian Schneider 63a8e5227d VM: More abstract interface for generating stub calls.
This makes the code in the code generator independent from how stubs
are actually called (i.e. directly embedding the target address, or
indirectly by loading the target address from the code object).

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1270803003 .
2015-08-05 10:18:35 +02:00
Regis Crelier 23982c63e9 Load immediates via the constant pool on armv5te and armv6.
Fixes #23306

R=zra@google.com

Review URL: https://codereview.chromium.org//1250323002 .
2015-07-24 08:27:50 -07:00
Florian Schneider 8d38a58c18 Make array allocation stub shared between isolates.
This allows to make the last explicitly named stubs shared between isolates.

When sharing code stubs, we can't do patching at their entry anymore.
Therefore, I had to remove patching support of the array allocation stub.
Is this a functionality we want to keep?

The change is mostly performance-neutral because optimized code has an inlined fast
path for array allocation and only uses the stub for the slow-case.

The only isolate-specific stubs left are object allocation stubs which are
associated with their Class are per-isolate.

Since this CL removes any isolate-specific stubs from StubCode, it becomes AllStatic.

BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org//1247783002 .
2015-07-23 12:56:16 +02:00
Regis Crelier 3b2a4cb33c Rename assembler field/getter/setter allow_constant_pool to constant_pool_allowed
R=zra@google.com

Review URL: https://codereview.chromium.org//1249933003 .
2015-07-22 14:51:49 -07:00
Florian Schneider 0cf617ef13 VM: Refactor allocation stats code and remove duplicate code.
Make context allocation stub shared between isolates.

The fast-path used in optimized code still has isolate-specific
addresses inlined for performance reasons.

Common functions are moved into class_table.h/.cc.

This is a preparation for adding an isolate-independent version of the
allocation code and allocation tracking code.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1241863002 .
2015-07-17 15:15:33 +02:00
John McCutchan 598c67001b Update Assembler::TryAllocate to support inline allocation tracing
- Track whether class allocation should be traced in existing ClassHeapStats structure.
- Emit compare and branch at top of ::TryAllocate

These changes appear to be performance neutral.

An alternative approach is to deoptimize all code that inlined allocations for a specific class. I do not think this is a good approach because we will spoil the water- allocations that aren't occurring in the (optimized steady state) running program  will appear in the allocation profile. This will make the data much less actionable bordering on misleading. The approach used in this CL will guarantee the allocation profile aligns with the actual running program.

R=regis@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org//1213013002 .
2015-07-10 12:19:01 -07:00
Ryan Macnak 77c206f231 Don't bother trying to reuse object pool entries for ICs, type test caches, or edge counters as they will have unique entries anyway.
Avoids lookups of object pool entries, which dominates in very large functions such as regex.

First program from http://dartbug.com/23249 goes from 66.439s to 10.918s on X64 (6.1x).

R=srdjan@google.com

Review URL: https://codereview.chromium.org//1231463002 .
2015-07-07 16:40:27 -07:00
Srdjan Mitrovic c0b359db6c Intrinsic version of Object.runtimeType
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org//1217323002.
2015-07-01 10:13:14 -07:00
Florian Schneider 957af25419 Use object pool for runtime calls.
Also, set up a stub frame with object pool loaded in all stubs on those
platforms.  This is a preparation step to making code relocatable.

ia32 is not affected because there is no object pool.

BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1189573004.
2015-06-17 10:37:52 +02:00
Florian Schneider 265a54411a Object pool with support for untagged entries.
This adds meta-information to object pool entries to allow storing
untagged immediates or code addresses (ExternalLabel) directly.

This eliminates the need to generate extra code to preserve the LSB
when storing immediates as smis (x64, arm64).

BUG=

Review URL: https://codereview.chromium.org//1175523002.
2015-06-10 11:41:22 +02:00
regis@google.com 2e2bcf6149 Use a breakpoint instruction for a stop message on arm instead of
a svc instruction (or hlt instruction on arm64).
The instructions svc and hlt are used in conjunction with a simulator only.
At least, gdb now stops on armv5te when hitting a stop message (no prompt).
Add support for printing stop message in disassembly on mips and arm64.
Clean up various bkpt codes on arm (now similar to arm64 and mips).

R=zra@google.com

Review URL: https://codereview.chromium.org//1097413004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45363 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-22 20:45:52 +00:00
fschneider@google.com 4aa1febbe6 Eliminate object table and use regular object pool for deoptimization infos.
On platforms that already use an object pool, we had a separate object table
used only for deoptimization infos. With this CL we don't have separate
tables, but only use the common object pool for both purposes.

R=vegorov@google.com

Review URL: https://codereview.chromium.org//1073173003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45108 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-13 15:43:58 +00:00
zra@google.com 9eaea2e779 Fixes ARM instruction version checking.
Emulates umaal on ARMv5TE.

Review URL: https://codereview.chromium.org//1062593003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44940 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-07 17:36:46 +00:00
zra@google.com b253b7c2ba A few fixes for ARMv5TE.
This CL:
- Adds SupportsHardwareDivision() to FlowGraphCompiler.
  In FlowGraphOptimizer, if SupportsHardwareDivision()
  is false, Smi and Mint division operations are not
  inlined.
- Reduces the supported addressing modes for ldrd, strd.
  For ARMv6 and up, the address only needs to be 4-byte
  aligned, for ARMv5TE and below the address must be
  8-byte aligned. So, on ARMv5TE, we can split these
  each into two instructions, which is easier to do if
  the addressing modes are restricted to base + offset,
  which is all we were using anyway.
- Uses the smull instruction on ARMv5TE and ARMv6. I don't
  remember why it was disabled, and the docs say
  it is supported. Verified working on ARMv5TE hardware.
- Fixes a bug in OSR frame entry caused by the
  difference between the PC read offset in store vs.
  other instructions.
- Fixes assembler tests that have a float return for
  targets without vfp.

R=regis@google.com

Review URL: https://codereview.chromium.org//1043943002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44788 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-30 20:46:52 +00:00
fschneider@google.com 56853c6bc9 Undo unnecessary changes to ARM assembler.
R=zra@google.com

Review URL: https://codereview.chromium.org//885443012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43596 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-09 16:14:11 +00:00
fschneider@google.com df94b27666 VM: Align implementations of assembler constant pools.
Add Support for adding patchable/non-patchable entries on ARM/MIPS like
already done for x64/ARM64.

R=vegorov@google.com

Review URL: https://codereview.chromium.org//886173003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43589 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-09 11:47:36 +00:00
koda@google.com 6bb285d5d9 ARM port of r42723.
R=iposva@google.com

Review URL: https://codereview.chromium.org//841343002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42962 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-16 16:51:23 +00:00
fschneider@google.com 1e7310d48f Improve constant pool implementation in the assembler.
Instead of using RawObject* as keys, use Object*. Using handles eliminates any assumption
about the underlying GC implementation (e.g. requiring that old objects don't move).

Remove special handling of null_object by making HashMap more generic and
allowing the trait to specify the value used to indicate an empty element.

The goal is to use one unified, efficient implementation of the constant
pool on all architectures that require one (x64, arm64, mips).

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

Review URL: https://codereview.chromium.org//848703002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42901 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-15 10:43:36 +00:00
vegorov@google.com aa48bd4759 Range feedback for arithmetic operations.
In addition to tracking input and output ranges in the IC-stubs with a Smi fastpath (SmiAdd and SmiSub, currently) this CL also introduces two IC stubs that have no fast-path by still track ranges and update the range feedback.

We are able to distinguish between the following ranges (encoding of the lattice is shown in the parens):

- u-smi  (0000)
- smi    (0001)
- uint31 (0010)
- int32  (0011)
- uint32 (0100)
- int64  (1xxx) and (x1x1)

BUG=
R=fschneider@google.com, srdjan@google.com, zra@google.com

Review URL: https://codereview.chromium.org//735543003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42370 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-15 18:48:15 +00:00
koda@google.com 56defa8060 Write-barrier verification on ARM.
Add and use methods on Assembler for writing and verifying object fields.
Enable tests in verified_mem mode for simarm.
Also generalize and use InitializeFieldsNoBarrierUnrolled in one more place.

R=iposva@google.com

Review URL: https://codereview.chromium.org//730343005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42208 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-09 16:15:33 +00:00
zerny@google.com 4fb54d853d Support use of external strings as inputs to LoadCodeUnitsInstr.
R=vegorov@google.com
BUG=

Review URL: https://codereview.chromium.org//765743003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42099 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-04 09:26:48 +00:00
koda@google.com e775ee5dac arm: Move unrolled array initialization to Assembler.
This is the final preparation before adding write barrier verification infrastructure on ARM
(which requires all pointer writes to pass through write-barrier aware code).

R=zra@google.com

Review URL: https://codereview.chromium.org//752633002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41914 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-21 18:09:40 +00:00
koda@google.com 5f688e0465 Dedupe code for array/object initialization on ARM.
This creates fewer places to audit the GC's write barrier logic.

R=zra@google.com

Review URL: https://codereview.chromium.org//746623002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41872 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-20 23:09:21 +00:00
zra@google.com f3a21e3ff3 Uses correct mnemonic for vmrs instructions.
Keeps vmstat as a macro.

R=iposva@google.com

Review URL: https://codereview.chromium.org//647523002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41042 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-10 15:30:41 +00:00
regis@google.com 632edf5d55 Implement bigint mulAdd and sqrAdd intrinsics on ARM.
Add support for umaal instruction on ARM (assembler, disassembler, simulator).
Add assembler test for umaal instruction on ARM.

R=johnmccutchan@google.com, zra@google.com

Review URL: https://codereview.chromium.org//638983002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40993 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-08 16:59:59 +00:00