Commit Graph

161 Commits

Author SHA1 Message Date
Vyacheslav Egorov 7e1d584218 VM: [Kernel] Implement CatchBlockEntryInstr::should_restore_closure_context on all platforms.
This was the only Kernel specific backend change - to simplify the graph builder
we allowed it to capture exception and stack trace variables. This in turn
requires CatchBlockEntryInstr to respect that this variables can be captured
and correctly update them when exception is caught.

This was implemented on X64 and ARM before. This CL expands implementation to
all other implementations including DBC.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2796283003 .
2017-04-05 20:32:03 +02:00
Florian Schneider 9ea0dbcab1 VM: Remove unused optimization of merging of sin/cos.
It was only implemented on ia32/x64, and has been disabled
for a long time (broken on Windows).

Fixes #22504.

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2658733002 .
2017-01-26 12:42:54 -08:00
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
Florian Schneider 6d66f3dea8 VM: Make optimized try-catch work in DBC.
The catch entry block has all locals in fixed locations
(Rj) where j = kNumberOfRegisters - i for parameter i.

This means we reserve a range of DBC registers at the top-end of the frame.
Those registers are blocked for general allocation to avoid any overlap
with the rest of the registers that are allocated from the bottom.

Each optimized frame with a try-catch will be kNumberOfRegisters wide.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2388093003 .
2016-10-13 11:36:23 -07:00
Florian Schneider 7ca3da1a3a Fix lazy deoptimization in the presence of exceptions
Catch block entries need to be considered when doing lazy deoptimization.

In addition to the return, also patch all catch entry blocks in a function scheduled for lazy deoptimization.

Also, move restoring the pool pointer to the jump-to-handler stub to simplify patching the catch entry.

BUG=#27419
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2357343003 .
2016-09-26 16:24:23 -07:00
Zachary Anderson fe2b7b35c4 DBC: Enables unboxed doubles
This CL enables unboxed doubles for simdbc64. Unboxed
doubles are stored in regular dbc registers, which are
really 64-bit stack slots. It also implements binary
and unary double operations and comparisons.

R=vegorov@google.com

Review URL: https://codereview.chromium.org/2120703002 .
2016-07-14 16:05:20 -07:00
Vyacheslav Egorov 669edf6375 VM: Fix frame size computation for optimized DBC code
Register allocator was not accounting for fixed register constraints correctly.

R=zra@google.com
BUG=

Review URL: https://codereview.chromium.org/2072823002 .
2016-06-16 21:58:55 +02:00
Ivan Posva 0c38e23e1d - Fix product mode SIMDBC build.
BUG=

Review URL: https://codereview.chromium.org/2011363002 .
2016-05-27 10:56:11 -07:00
Vyacheslav Egorov 655bc90489 Enable optimizer pipeline for DBC.
Most of the infrastructure is fixed to work with DBC stack layout:

- register allocator allocates DBC registers with the limitation that we allocate only 20 registers and bail out if anything needs spilling (there is no use implementing spilling on DBC because registers are memory locations themselves). We should be able to bump number of CPU registers on DBC up to 256 but this requires major surgery in some parts - so I postponed this;
- lazy deoptimization is implemented, eager deoptimization is not - because we don't emit any code that actually requires it. it's a minor change to support it once we have a target;
- stack scanning respects stack maps built by registers allocator;

We bailout from all unsupported instructions.

R=zra@google.com

Review URL: https://codereview.chromium.org/1992963002 .
2016-05-24 14:35:50 +02:00
Harry Terkelsen 1745ba77f5 fix all instances of "the the"
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1980573003 .
2016-05-13 12:38:25 -07:00
Florian Schneider 5c38712ce9 Clean up more flags using flag list.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1766573003 .
2016-03-04 15:15:40 -08:00
John McCutchan e2e7af1229 Remove more feature in product mode
- Remove Timeline.
- Remove more vmservice code.
- Remove AST printing.
- Remove IL printing.
- Remove profiler.
- Remove thread interrupter.
- Remove disassembler.
- Remove Library::CheckFunctionFingerprints.

- Update test status files for product mode.

Size of dart_bootstrap before: 5287631
Size of dart_bootstrap after: 5112783

Reduction in size: 174848 bytes.

Total reduction in size (382734 + 174848): 557582 bytes.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1678203002 .
2016-02-09 08:45:32 -08:00
Ryan Macnak c483ba8451 Instrinsics on object pool architectures must preserve CODE_REG.
This fixes c13b481aeb.

IA32 does not load a constant pool and does not use the CODE_REG to
create the pc marker, so it does not need to preserve CODE_REG in
instrinsics. Blocking another register from graph instrinsics caused some of
them to need to spill, which is asserted to never happen.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1418813005 .
2015-10-26 09:13:12 -07:00
Ryan Macnak b2b6e55b7e Revert "Intrinsics must also preserve CODE_REG (if they can fall through)."
This reverts commit c13b481aeb.

Review URL: https://codereview.chromium.org/1405063005 .
2015-10-23 09:45:23 -07:00
Ryan Macnak c13b481aeb Intrinsics must also preserve CODE_REG (if they can fall through).
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1422553006 .
2015-10-23 09:32:16 -07:00
Ryan Macnak 91bc8005fe Don't touch x18 on ARM64 - it is globally reserved on iOS.
Move SP on ARM64 to x19.

Use a mask instead of a range for determining the globally blocked registers.

R=regis@google.com

Review URL: https://codereview.chromium.org/1417433002 .
2015-10-19 14:17:07 -07:00
Florian Schneider 8adefa8e79 VM: Support phis with pair representations.
This enables unboxed int64 values in phis on 32-bit platforms (ia32, ARM, MIPS).

On ia32 I measured SHA256 +14%, SHA1 +6%, MD5 +2%.

BUG=
R=johnmccutchan@google.com, regis@google.com

Review URL: https://codereview.chromium.org//1377113004 .
2015-10-08 11:43:55 +02:00
Daniel Andersson a1bc527306 Migrate logging infrastructure Isolate->Thread
This enables thread-safe logging (e.g., ISL_Print, which will soon be renamed to THR_Print), which is needed for concurrent
marking (DetachCode) and compilation.

Make finalization of GC marking tasks concurrent, now that it's thread-safe.

BUG=
R=iposva@google.com

Review URL: https://codereview.chromium.org//1314673008 .
2015-09-09 15:30:38 -07:00
Ivan Posva ccf44becd2 - Use #if defined(DEBUG)
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1152773003
2015-05-29 17:43:36 -07:00
Daniel Andersson fd890f4097 Cache current thread in a reserved register and use it in LoadIsolate
Add THR register that caches the current thread in generated code.
Shuffle some registers around as needed to free one up.

Note: Assembler::LoadIsolate now always loads the *current* isolate whenever the code is executed, rather than the isolate in which the code was compiled (no existing code was affected by this slight change in semantics).

Rewrite some ia32 stubs to use one less register, and for some ia32 bigint intrinsics, explicitly save THR (like CTX in the past, see r44699).

Next steps:
- pass current thread rather than isolate in NativeArguments
- ditto for exception handler jump
- migrate fields vm_tag, top_exit_frame_info, etc. to thread

R=srdjan@google.com

Review URL: https://codereview.chromium.org//1156593002
2015-05-26 13:46:12 -07:00
johnmccutchan@google.com 635ba4bbd9 Port flow_graph*, disassembler to ISL_Print
BUG=
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43609 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-09 20:49:32 +00:00
srdjan@google.com 12c5e2bbaf Cleanup: use const reference for ParsedFunction where possible.
R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43226 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-28 00:41:09 +00:00
srdjan@google.com 110a74f954 Cleanups: parsed_function()->function() => function()
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43213 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-27 22:09:31 +00:00
koda@google.com 99127744c6 Add Zone-based handle allocation interface and reduce use of Isolate-based interfaces.
Remove deprecated Isolate-based BitVector constructor.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43136 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-26 14:54:02 +00:00
koda@google.com 280dc6fbd4 Introduce simple Thread class to support gradual refactoring of interfaces.
This first iteration of Thread just forwards a subset of the BaseIsolate methods.

The plan is to first add Thread/Zone-based interfaces where appropriate, deprecate their Isolate-based versions, and finally remove them once all callsites have been migrated.

This CL only demonstrates a small part of this migration, for BitVector and some of the compiler classes. There are thousands of additional call-sites that will need to be updated.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43073 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-22 14:14:16 +00:00
koda@google.com 33b55e64e4 Isolate/Thread split: Isolate -> Zone for LocationSummary.
The isolate was being passed around, even though only its current zone was used.

Pass that zone directly instead, giving two benefits:
1. helps prepare for the upcoming Isolate/Thread split, where "new(isolate)" must go, and
2. saves a pointer indirection at the allocation sites.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42935 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-15 21:29:57 +00:00
srdjan@google.com bad6a61899 Cleanups.
R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42069 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-02 18:48:12 +00:00
fschneider@google.com 876193b31a Make CTX allocatable by the register allocator.
This change makes CTX available by not caching the current
context while in Dart code. Instead the current context
is held in a local variable (:saved_current_context_var) and
is passed as argument in CTX at calls.

This also simplifies a lot of code in the debugger: As a result,
Isolate::top_context is not needed anymore since the current context
can always be extracted from a Dart frame.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41422 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-30 15:42:38 +00:00
vegorov@google.com 3f5c8471bf Keep list of uses sorted when building it.
We were violating sorting at instructions that use the same value as both fixed register input and an unallocated one producing a list that contained use at P, followed by a use at P-1.

This would later cause a problem when we split live-range at P-1 and spill [..., P-1) prefix.

Use at P-1 would be attributed to unspilled part of the range leading to completely incorrect parallel move at P-1: [rx <- S+X, ry <- rx], where rx - is the aforementioned fixed register and ry is a register selected for an unallocated use of the value.

R=srdjan@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40681 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-25 17:10:06 +00:00
srdjan@google.com b8891bf412 Pass isolate to BitVector constructor.
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40528 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-19 23:14:34 +00:00
fschneider@google.com da0fb6bbe2 More intrinsics in IR.
R=srdjan@google.com, vegorov@google.com, zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40088 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-10 13:34:58 +00:00
vegorov@google.com 33b533e564 Fix register hinting for phis.
The way it was implemented did not always work for phis for live ranges extending past the loop, because the hint itself stayed uncoverted until after register allocation inside the loop was completed.

For the loop like this:

f() {
  var x = 1.0,  y = 2.0;
  for (var i = 0; i < 100; i++) x += y;
  return x;
}

That used to generate:

loop:
  cmp ecx,0xc8
  jnl ->exit
  mov xmm3, xmm2
  addsd xmm3, xmm1
  mov xmm2, xmm3
  add ecx,0x2
  jmp ->loop

With this change we generate:

loop:
  cmp ecx,0xc8
  jnl ->exit
  addsd xmm2,xmm1
  add ecx,0x2
  jmp ->loop

R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40024 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-09 11:26:58 +00:00
vegorov@google.com 2d9907c88c Ensure that BoxInt32 input is correctly preserved on the slow-path.
Register allocator is unable to preserve writable registers automatically because they behave like temps: have no fixed represenation or usage inside the instruction template.

This means writable registers have to be manually added with the right representation to the live_register set when necessary.

Add verification that checks this and fix existing misuses.

R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39703 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-29 15:19:51 +00:00
vegorov@google.com 9f9e250e92 Support Int32 representation for selected binary operations.
BUG=
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39595 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-27 14:49:19 +00:00
vegorov@google.com 77c26187f2 Support allocation sinking for compound objects.
- Improve escape/alias analysis:
-- Storing an object into a field of another object does not mean that this object escapes (or has aliases) as long as that object does not have any loads from the same place;
-- Places like X.f and Y.f don't alias if X and Y are two different allocation instructions even if X and Y themselves potentially have aliases;
-- Improve precision of alias analysis for indexed properties;

- Support dematerialization and rematerialization of objects that are referenced by other dematerialized objects.
-- Use fix-point algorithm to collect candidates for allocation sinking;
-- Support aborting unsuccessful allocation sinking.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38404 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-18 18:35:08 +00:00
johnmccutchan@google.com 92330fbc32 Support SameAsFirstInput policy in register allocator when inputs are paired machine registers
BUG=
R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38290 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-16 16:45:10 +00:00
johnmccutchan@google.com 2ebd74a740 Add Uint32 representation.
- Add new representation: kUnboxedUint32.
- Add BinaryUint32Op, UnaryUint32Op, ShiftUint32Op instructions.
- Add new optimization pass which replaces Mint instructions with Uint32 instructions when possible.
- IA32 completed.
- ARM completed.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38198 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-14 17:01:02 +00:00
vegorov@google.com 00daaa6106 Don't assign safepoint at the definition to the definition's live-range.
This avoids treating spill slot associated with the definition live during GC as
it will only be filled in after definition's code is fully executed.

Additionally this makes output register dead for GC inside the definiton itself
which is something we used to guarantee manually by removing it from the
live_registers set before calling on the slow path.

BUG=
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38059 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-08 14:12:00 +00:00
iposva@google.com 3878793b10 - Reduce the number of Isolate::Current() calls.
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36564 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-23 12:07:33 +00:00
johnmccutchan@google.com 8f4cbeaefa Use GPRs for mints.
Changes:

* Register allocator now allocates GPRs for kUnboxedMint.
* Register allocator supports for SameAsFirstInput for register pairs.
* Register allocator properly handles register pairs in environment uses and materialization uses.
* BoxInteger updated on IA32/ARM.
* UnboxInteger updated on IA32/ARM.
* BinaryMintOp updated on IA32/ARM.
* ShiftMintOp updated on IA32/ARM.
* UnaryMintOp updated on IA32/ARM.
* RelationalOp updated on IA32/ARM.
* EqualityCompare updated on IA32/ARM.
* LoadIndexed and StoreIndexed updated on IA32/ARM.
* New Deopt instructions added.
* Update live_registers when an instruction has a fixed register input and a call on the slow path.
* Improve printing of register pairs in flow graph.
* Do not assume live registers in slow paths contain tagged values.
* LiveRange pairs for kUnboxedMint definitions marked as kUntagged representation (reduces stack usage).
* Live register spilling on ARM uses same register order as stack map encoding.
* Spill slots containing tagged and untagged are segregated.
* Print stack maps when printing live ranges with safe points.
* Print allocated spill slot when printing live ranges.

Status:

* IA32 completed. All tests are passing.
* ARM completed. All tests passing.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36468 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-22 06:30:51 +00:00
srdjan@google.com 25bab2bb3b Another fix in register allocation where th eimplicit assumption is that numebr of CPU registers is equal or greater than number of FPU registers.
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36267 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-16 18:57:22 +00:00
srdjan@google.com 7ba400fc44 Fix register allocator to properly allocate containers.
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36264 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-16 18:21:04 +00:00
ngeoffray@google.com e3f17ce842 Code is truly a no-op. Previous failure was due to a leftover printf statement.
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35789 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-06 08:19:49 +00:00
ngeoffray@google.com c5672f5c39 Remove debugging code.
Review URL: https://codereview.chromium.org//267793004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35685 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-02 09:20:18 +00:00
ngeoffray@google.com eea043b4dc Revert r35682, one test is failing: standalone/io/process_sync_test. Code may actually be changing something.
Review URL: https://codereview.chromium.org//262823007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35683 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-02 09:17:28 +00:00
ngeoffray@google.com 24fa40e0b8 Remove code that has no effect: live_outs are always empty at this stage.
R=fschneider@google.com, vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35682 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-02 08:56:11 +00:00
zra@google.com 2348d3ebd1 Teaches the register allocator about a second assembler temporary.
ARM64 explicitly has two assembler temporaries that fall in the
middle of the range of registers that Dart may otherwise use. To
comply with this convention, the register allocator must
recognize two TMP registers. I've called the added one TMP2,
but I'm open to suggestions for other names.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35070 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-15 18:01:51 +00:00
johnmccutchan@google.com 1eb7046d00 Restore WritableRegister input LiveRange shape
BUG=
R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34838 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-08 20:25:22 +00:00
johnmccutchan@google.com 3834c9a869 Support for multiple register values
- Adds a PairLocation type (Location is still a single word but now has two tags one for constants and one for pairs).
- New representations: kPairOfTagged & kPairOfUnboxedDouble.
- Register allocator uses second SSA index for Definitions that use two registers.
- Fix LiveRange shape for kWritableRegister inputs.
- Updated MergedMathInstr that returns a kPairOfTagged or kPairOfUnboxedDouble (depending on the merged math kind).
- A new instruction (ExtractNthOutput) for extracting a single register from an instruction that has a output register pair.

Open issues that need to be addressed in a follow up CL:

- Adjust PhiInstr and handling of PhiInstr in the register allocator to work with output pairs (once unboxed mints are in GPRs).

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34833 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-08 16:13:43 +00:00
johnmccutchan@google.com e255df56ed Refactor to support multiple outputs in location summary
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34250 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-21 14:40:30 +00:00