Commit Graph

118 Commits

Author SHA1 Message Date
Kevin Millikin f31b6d5e2c Reland "Track the 'awaiter return' call stack..."
Original CL: https://codereview.chromium.org/2692803006/

Original commit message:
Tracking the awaiter return call stack:

- [x] Each async function closure now knows who is awaiting on their
return. This is effectively the asynchronous equivalent of the 'frame pointer'.
- [x] Each async* function closure now knows how is listening on their
stream. This is effectively the asynchronous equivalent of the 'frame pointer'.

Detecting uncaught exceptions in async functions:

- [x] Code object keeps a map from :await_jump_var to token position
- [x] Exception Handlers keep track if they are generated (as part of compilation) or directly from user code
- [x] Debugger maps :await_jump_var to a specific try index

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2725623003 .
2017-02-28 16:13:41 +01:00
Kevin Millikin a0965a641f Revert "Track the 'awaiter return' call stack..."
Revert a pair of commits that cause failure of the Kernel continuation
transformer:

  cba7e3e79a
  4fe4f177de

R=kustermann@google.com

Review-Url: https://codereview.chromium.org/2718353002 .
2017-02-28 12:46:31 +01:00
John McCutchan cba7e3e79a Track the 'awaiter return' call stack use it to detect uncaught exceptions in async functions
Tracking the awaiter return call stack:

- [x] Each async function closure now knows who is awaiting on their
return. This is effectively the asynchronous equivalent of the 'frame pointer'.
- [x] Each async* function closure now knows how is listening on their
stream. This is effectively the asynchronous equivalent of the 'frame pointer'.

Detecting uncaught exceptions in async functions:

- [x] Code object keeps a map from :await_jump_var to token position
- [x] Exception Handlers keep track if they are generated (as part of compilation) or directly from user code
- [x] Debugger maps :await_jump_var to a specific try index

Fixes #27242

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2692803006 .
2017-02-27 14:16:15 -08:00
Florian Schneider 521526d259 Fixup redefinitions before doing code motion
Also use redefined receiver consistently when inlining recognized methods.

This CL re-enables type propagation from CheckClassId instructions which
was disabled as a temporary stop-gap to prevent illegal code motion.
(reverts https://codereview.chromium.org/1928633002)

Now uses of redefined values that are dominated by the redefinition are renamed before doing LICM.

Related to #26347.

R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2709093003 .
2017-02-23 12:34:55 -08: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
Florian Schneider 890bfa8015 AOT: Fix bug in receiver type propagation after unique selector calls.
Insert Redefinition instructions to prohibit unsafe code motion. If we propagate
the receiver type downwards from a call to a unique selector, we must not hoist
instructions that were optimized using this type information across the call.

R=vegorov@google.com

Review URL: https://codereview.chromium.org/2498073004 .
2016-11-16 10:14:40 -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
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
Florian Schneider 7d6f78b88f VM: More refactoring of recognized methods inlining.
Move inlining OneByteString._setAt, List constructor, Object constructor
and a few math function to the flow-graph inliner.

Enable inlining of trigonometric math functions in AOT that were previously not inlined.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2273943002 .
2016-08-24 10:35:05 -07:00
Florian Schneider 8eaa762d4a VM: Remove more duplicate code between AOT and JIT compiler.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2265873005 .
2016-08-22 15:20:54 -07:00
Ryan Macnak e048774776 Precompilation: Specialize instance calls when the call receiver is the method receiver and the method class has a small number of concrete subclasses (currently 5).
CompileOnceHelloHtml (ARMv7HF) +17.194%
DeltaBlueClosures (ARMv7HF) +28.379%
DeltaBlue (ARMv7HF) +30.190%

precompiled dart2js arm 19071745 -> 19504726 (+2.3%)

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1867913004 .
2016-04-11 12:52:28 -07:00
Florian Schneider 4b5d05e12f Fix bug in receiver-phi computation.
This fixes a bug in my previous CL (https://codereview.chromium.org/1841073003/)

Computes the is-receiver property on demand, but for all phis at once using a worklist-approach.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/1851653002 .
2016-04-02 13:51:02 -07:00
Florian Schneider 2783afd607 VM: Fix receiver type propagation in presence of try-catch.
With catch blocks appearing as additional function entry blocks,
there can be phis for the receiver (parameter 0).

This CL fixes the problem that the receiver type information
was lost in the presence of try-catch.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/1841073003 .
2016-03-30 15:55:11 -07:00
Srdjan Mitrovic 0c77e70b49 Cleanup access to guarded_fields
BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1712563006 .
2016-02-19 11:07:44 -08:00
Florian Schneider 3076bdf321 VM: Move representation selection code out of the flow graph optimizer.
I moved these functions to flow_graph.cc since these optimizations only need
a FlowGraph as input, and they are shared between precompiler and compiler.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/1700103002 .
2016-02-18 07:37:38 -08:00
Srdjan Mitrovic c5ea105261 Disable reg-exp compilation in background via a flag; abort background compilation if deoptimization needs to be triggered while compiling; Both issues will be fixed later
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1679373002 .
2016-02-09 12:48:31 -08:00
Florian Schneider d39c867369 VM: Move redundancy elimination phases into a separate file.
Reorganizing these is part of splitting flow_graph_optimizer.cc
into a JIT- and a precompiler-specific part.

Most of the phases in redundancy_elimination.cc can be shared unchanged
between compilers.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/1679853002 .
2016-02-08 18:08:15 +01:00
Srdjan Mitrovic 4600d37dc1 Background compilation work:
- Defer deoptimization from optimizing compiler to code installation in mutator thread.
- Defer registration of field and leaf class dependency until code is installed in mutator thread.
- Cleanup.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1433243003 .
2015-11-12 11:25:58 -08:00
koda@google.com 9c181ec6d5 Thread/Isolate refactoring: new(Isolate*) -> new(Zone*)
Refactor all remaning cases where the current zone is used through new(Isolate*) and remove this interface.

Removing this interface is needed to move towards multiple threads per isolate, and also makes the caller more aware of the scope of the zone used, reducing the risk of use-after-free.

Make the current thread and the stack zone created around native/runtime entries directly available in their body, saving an indirection (and optimized away if unused).

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44541 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-17 19:24:26 +00:00
srdjan@google.com 81d8099650 Redesign inlining interval computation.
Review URL: https://codereview.chromium.org//904763003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43622 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-09 23:11:05 +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 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
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 abde3a9699 Merge chains of straight-line blocks.
R=zerny@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42038 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-01 12:40:55 +00:00
zerny@google.com 8e807c8550 Integrate the Irregexp Regular Expression Engine.
BUG=http://dartbug.com/19090
R=fschneider@google.com

Committed: https://code.google.com/p/dart/source/detail?r=41949

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41983 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-26 09:32:43 +00:00
zerny@google.com 84a4135901 Revert "Integrate the Irregexp Regular Expression Engine."
This reverts commit https://code.google.com/p/dart/source/detail?r=41949

TBR=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41950 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-25 13:36:40 +00:00
zerny@google.com 43ac0c6f33 Integrate the Irregexp Regular Expression Engine.
BUG=http://dartbug.com/19090
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41949 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-25 13:10:21 +00:00
srdjan@google.com 6303b10fe3 Cleanup: remove flow-graph's cached copy of num stack locals as it can become stale if variables get added after flow graph is created.
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41791 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-17 21:24:06 +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
fschneider@google.com e6ef4b16bf Fix captured parameters and optimized try-catch.
The stack slots of captured parameters must be skipped when
generating sync code in optimized try-catch. Since those parameters
are initially copied into the context, their values are not recorded
in the environment.

Store-to-load forwarding may though use the original initial value
from the stack and therefore it must not be overwritten by try-sync
code that predeeds every call inside optimized try-blocks.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41099 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-14 14:48:32 +00:00
vegorov@google.com e6113cc0f5 If bounds check 0 <= index < length is not redundant we attempt to
replace it with a sequence of checks that guarantee

          0 <= LowerBound(index) < UpperBound(index) < length

and hoist all of those checks out of the enclosing loop.

Upper/Lower bounds are symbolic arithmetic expressions with +, -, *
operations and are computed based on discovered simple induction variables.

Simple induction variable is a variable that follows the pattern v1 <- phi(v0, v1 + 1)

BUG=
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40969 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-07 18:50:29 +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
srdjan@google.com 2a3c2ad058 Add loop printing to block comments.
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39673 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-28 19:52:47 +00:00
fschneider@google.com f917ffe213 VM: Micro-optimization of inline array allocation code.
The loop initializing a newly allocated array now has only
one branch, instead of two per iteration.

Removed some dead code from flowgraph.cc/.h.

R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39092 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-11 15:59:00 +00:00
fschneider@google.com 55f0e1be81 Use hash map for the SSA builder constant pool.
This avoid the linear search and quadratic runtime when optimizing
e.g. functions with a large number of constant literals.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37817 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-30 12:52:42 +00:00
iposva@google.com f14e2c1842 - Cleanup FlowGraph:
Bailout is not really needed any longer after removing the optimize_try_catch flag.
  Ensure the availability of VerifyUseLists in non-DEBUG code.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37474 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-19 05:26:33 +00:00
srdjan@google.com 3480ac4a0e Fix deferred library code disabling for inlined functions.
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37107 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-06 22:14:40 +00:00
srdjan@google.com 45692c1248 More reduction of accessing TLS by caching/passing isolate value.
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36598 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-23 23:26:48 +00:00
srdjan@google.com 16282635a1 Use isolate when allocation Zone objects and handles: focus on FlowGraphOptimizer, next inliner.
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36587 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-23 21:15:29 +00:00
fschneider@google.com c71d29f6b6 VM: Remove unnecessary field use_kind from IL instructions.
We already store a SSA- or temp-index that indicates if a definition
is used or not. There is no need to have a separate field to store
this information.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36432 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-21 14:26:09 +00:00
fschneider@google.com 927d43caf2 More general dead phi elimination.
This CL adds an explicit pass to eliminate dead phis. Until now, we
only removed redundant phis that occurred after load elimination locally.

Also, constant propagation may result in dead / or redundant phis which
are removed by this phase.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36094 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-13 09:48:46 +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
fschneider@google.com bfcb5174a5 Fix bug in flow-graph loop detection.
With OSR there can be multiple loops that share one common loop header.
These loops must be treated as one loop, otherwise
side effects are not correctly computed.

BUG=dartbug.com/16151
TEST=language/osr_test
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31956 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-21 16:02:12 +00:00
fschneider@google.com 893b25e5b4 Revert r31601 (Use constants from the frame at OSR entry...).
Because this CL also changed the way spill slots are allocated for
catch entry blocks it caused invalid code for optimized try-catch
under certain conditions.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31948 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-20 10:43:41 +00:00
fschneider@google.com c414fbf2ca Use constants from the frame at OSR entry.
The code for reserving stack slots for OSR entry values is shared with the
code for reserving stack slots for try/catch. It does not handle them
optimally (reserving slots above the desired ones and copying them down,
instead of directly reserving the desired one). This CL simplifies allocation
of spill slots for try-catch as well.

This is an rebased version of Kevin's original CL
(https://codereview.chromium.org/102173003/).
I removed an invalid assertion and removed more code that became unnecessary
with this change.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31601 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-08 11:27:10 +00:00
turnidge@google.com 2ad40bc29b When a value has been optimized away by the compiler, set its value to
"<optimized out>".  This will make it less confusing for people using
the debugger.

- Added constant_dead() to the flow graph.
- Added Symbols::OptimizedOut().

R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28671 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-15 18:35:07 +00:00
kmillikin@google.com e375053d2f Pattern match on generated code to find edge counters.
In unoptimized code, use platform-specific pattern matching on generated
code to find edge counter arrays.  Previously we searched pointer offsets,
but that does not work on platforms that encode the edge counters as indexes
into an object pool (i.e., x64, ARM, MIPS).

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28085 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-01 10:22:47 +00:00
fschneider@google.com b7afb65a10 Clean up handling of guarded fields in the flow graph builder.
FlowGraphBuilder has a zone-allocated list of fields and passes it
on to the FlowGraph.

R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27699 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-20 12:14:06 +00:00
fschneider@google.com 1072bc1c60 Reland: Fix bug in field type tracking and polymorphic inlining.
Original CL: https://codereview.chromium.org/24096018/

This fixes the bug by changing FlowGraphBuilder to a zone object
because it is needed by the inliner later in the pipeline.

R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27695 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-20 10:35:01 +00:00