kmillikin@google.com
54e54f4194
Refactor the code for making inlining decisions.
...
Separate the decision to inlin, which produces a graph to inline, from the
act of inlining itself. For polymorphic inlining we need such a separation.
Change the function that integrates an inlined function graph into a caller
graph so that it operates on a graph entry and set of inlined exits rather
than on an entire flow graph. Flow graphs represent a whole function so
this change allows us to replace an instruction with an arbitrary subgraph.
Change the name of the InliningContext class to InlineExitCollector to more
accurately reflect what it does.
Review URL: https://codereview.chromium.org//13932005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21539 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-16 08:40:27 +00:00
vegorov@google.com
81ecaba321
Re-apply r20377.
...
Compute local variable liveness before translation to SSA.
Use it to remove dead values from deoptimization environments.
R=fschneider@google.com
BUG=
Review URL: https://codereview.chromium.org//14215006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21439 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-15 11:53:50 +00:00
kmillikin@google.com
067b9ff8d5
Reapply "Incrementally recompute dominators when inlining."
...
Including a fix for a silly off-by-one bug. GrowableArray::TruncateTo takes
the new length, not the new last index.
Review URL: https://codereview.chromium.org//14135006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21353 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-12 11:41:10 +00:00
vegorov@google.com
9f3783186f
Ensure that all goto instructions have deoptimization target.
...
R=kmillikin@google.com
BUG=
Review URL: https://codereview.chromium.org//12457034
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21351 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-12 11:19:34 +00:00
kmillikin@google.com
40002d8663
Revert "Incrementally recompute dominators when inlining."
...
This reverts svn commit r21268 due to dart2js test failures.
TBR=fschneider@google.com
Review URL: https://codereview.chromium.org//13910003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21270 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-11 11:49:07 +00:00
kmillikin@google.com
9cb005c517
Incrementally recompute dominators when inlining.
...
Before: we marked the entire graph's dominator tree invalid in case there
were multiple exits from an inlined function and recomputed dominators after
inlining. Now: in case there are multiple exits we collect them in a fresh
join block and compute its immediate dominator as the nearest common
ancestor in the dominator tree over all predecessors.
Review URL: https://codereview.chromium.org//14067002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21268 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-11 11:44:36 +00:00
srdjan@google.com
cbe8bd9a3a
Restore r20998 with a bug fix: add field to guarded_fields_ when it contains relevant cid. Was missing most cases and did not check for unique adds.
...
Review URL: https://codereview.chromium.org//13726023
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21008 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-05 23:26:53 +00:00
srdjan@google.com
e7f1ae5383
Revert r20998.
...
Review URL: https://codereview.chromium.org//13739002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21001 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-05 21:44:17 +00:00
srdjan@google.com
44938de19c
Fix guarded_cid handling: add field to list of guarded_field at LoadField creation time.
...
Review URL: https://codereview.chromium.org//13529021
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20998 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-05 21:01:30 +00:00
vegorov@google.com
535ed8eb25
Revert "Compute local variable liveness before translation to SSA."
...
Attaching environments to branches on strict comparisons breaks pattern matching in the optimizer and regresses performance.
This reverts commit r20377.
TBR=kmillikin@google.com
Review URL: https://codereview.chromium.org//12827027
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20400 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-22 18:32:17 +00:00
vegorov@google.com
66ecd504f9
Compute local variable liveness before translation to SSA.
...
Use it to remove dead values from deoptimization environments.
R=kmillikin@google.com
BUG=
Review URL: https://codereview.chromium.org//12638040
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20377 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-22 12:33:42 +00:00
vegorov@google.com
1c9d22d75c
Collect type feedback for fields.
...
BUG=
Review URL: https://codereview.chromium.org//12529008
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20235 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-19 20:15:10 +00:00
kmillikin@google.com
9ee9cfb78d
Remove dead phis as soon as they are discovered.
...
Previously we removed dead phis late, in the register allocator. This
change removes them as soon as they are discovered to be dead and packs the
phi array to squeeze out NULLs. This speeds iteration but doesn't save
space because the phi array is zone-allocated.
The PhiIterator is used everywhere to iterate phis except a few places that
need to know the phi index (e.g., SSA construction, phi elimination).
R=vegorov@google.com
Review URL: https://codereview.chromium.org//12340108
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19206 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-28 08:25:58 +00:00
kmillikin@google.com
45a6441346
Add functions for setting an environment and rebinding a use.
...
Add functions for setting or clearing an instruction's environment, which
initialize the environment uses. Add a function for changing a use's
definition.
R=vegorov@google.com
Review URL: https://codereview.chromium.org//12335063
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19036 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-26 11:50:28 +00:00
kmillikin@google.com
bfdad288d9
Set instruction/use_index when adding an input to an IL instruction.
...
When setting an input (including in the constructor) of an IL instruction,
automatically set the input use's instruction and use_index fields.
R=vegorov@google.com
Review URL: https://codereview.chromium.org//12316065
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18961 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-25 11:24:08 +00:00
kmillikin@google.com
87a04450c2
Weaken a bogus assertion in use list verification.
...
It is allowed for a phi to refer to itself as input without violating
properties of SSA form.
R=fschneider@google.com
BUG=
Review URL: https://codereview.chromium.org//12317043
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18830 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-21 13:56:40 +00:00
kmillikin@google.com
509261dd45
Reapply "Change the SSA construction pass to also construct def-use chains."
...
This reapplies svn commit 18813 with a bug fix. In the case of an
inlined call whose value is not used, the inliner hase inserted a use
of the return value's definition, which must be removed.
R=vegorov@google.com
BUG=
Review URL: https://codereview.chromium.org//12334007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18827 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-21 12:57:43 +00:00
kmillikin@google.com
733a05c801
Revert "Change the SSA construction pass to also construct def-use chains."
...
This reverts svn revision 18813 due to dart2js test failures.
TBR=kasperl@google.com
BUG=
Review URL: https://codereview.chromium.org//12313033
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18817 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-21 11:06:31 +00:00
kmillikin@google.com
85c27b7733
Change the SSA construction pass to also construct def-use chains.
...
Also modify constant propagation to preserve def-use chains. Fix a small
bug in the def-use chain for definitions of inlined function return values.
R=vegorov@google.com
Review URL: https://codereview.chromium.org//12326012
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18813 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-21 10:09:10 +00:00
kmillikin@google.com
f2053df219
Remove two more places where we computed use lists and add verification.
...
Remove computation of use lists after type propagation which was
unnecessary, and a call per inlined function after ApplyICData which was
also unnecessary.
Add verification code after all compiler passes.
R=vegorov@google.com
BUG=
Review URL: https://codereview.chromium.org//12317007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18750 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-20 13:01:25 +00:00
kmillikin@google.com
622efda5fb
Convert some compiler passes to preserve valid def-use chains.
...
Change the ApplyICData, ApplyClassIds, Canonicalize, and
SelectRepresentations passes to preserve valid use lists.
Review URL: https://codereview.chromium.org//12212093
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18676 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-19 12:09:01 +00:00
kmillikin@google.com
ab3cbf5796
Change CSE, LICM, and range analysis to preserve use lists.
...
Change the common subexpression elimination, loop-invariant code
motion, and range analysis passes to maintain use lists.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18209 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-07 09:42:36 +00:00
kmillikin@google.com
361300cb71
Move recording of definition uses from the value to the definition.
...
It was weird that this method mutated an object that wasn't even
mentioned in the call. Also, change Definition::ReplaceUsesWith so that
it appends all at once instead of consing each individual use.
Review URL: https://codereview.chromium.org//12091091
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18048 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-04 14:01:35 +00:00
kmillikin@google.com
a2436038da
Make use lists into doubly-linked lists.
...
At the cost of a word per use, we gain constant time removal from use
lists.
BUG=
Review URL: https://codereview.chromium.org//12079096
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17924 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-31 16:10:15 +00:00
kmillikin@google.com
27af144369
Move code around in preparation for better inlining.
...
To inlining calls in a test context, the code to plug the inlined
function graph into the caller graph should be dispatched on the type
of the inlining context.
This change moves code around without otherwise changing it.
Review URL: https://codereview.chromium.org//11953076
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17569 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-24 14:13:02 +00:00
srdjan@google.com
76dffe600c
Removed loop depth info tracking at graph build time.
...
60% compilation speed improvement on pathological case. Improvements for dart2js
The loop depth signal was made unnecessary by the call frequency signal.
Review URL: https://codereview.chromium.org//11975061
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17408 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-22 16:15:54 +00:00
vegorov@google.com
a77fc9701c
When requested to extract a method M from class C inject a method extractor (consisting of a single AST node CreateClosure) as a getter get:M into C.
...
This allows to cache and optimize method extraction requests as normal method invocations and at hot method extraction sites that significantly decreases overhead of method extraction which previously required two trips into runtime system and was not cached at all.
BUG=
Review URL: https://codereview.chromium.org//11642003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17261 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-18 11:54:45 +00:00
kmillikin@google.com
0f65888e88
Change the inlining context from an enum to a class.
...
To support inlining in test contexts, the inlining context needs to have its
dispatched behavior and state. This change introduces a context class
representing calls inlined for their value or solely for their effects. The
intermediate array of exits is moved from the graph to the inlining context.
The implementation behavior is otherwise the same as before.
Review URL: https://codereview.chromium.org//11856010
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16965 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-11 11:43:48 +00:00
zerny@google.com
5aac823c39
Revert "Remove push arguments and replace constants in FlowGraph::InlineCall."
...
This reverts r14468 due to test failures.
TBR=kmillikin@google.com
Review URL: https://codereview.chromium.org//11362060
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14471 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-02 14:02:53 +00:00
zerny@google.com
8522885d32
Remove push arguments and replace constants in FlowGraph::InlineCall.
...
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//11262008
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14468 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-02 13:29:35 +00:00
zerny@google.com
8f5aa24ec9
More inlining flags and tuned heuristics.
...
The heuristics should be examined further, but these maintain about the same
runtime for the benchmarks while decreasing compile time for dart2js.
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//11269040
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14463 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-02 12:26:07 +00:00
iposva@google.com
15114867c7
- GrowableArray::RemoveLast returns the value being removed
...
to avoid having to call Last() followed by RemoveLast().
Review URL: https://codereview.chromium.org//11348026
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14237 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-30 00:52:21 +00:00
zerny@google.com
79ddbd6638
Set previous pointer to graph entry for initial definitions.
...
This should be replace with direct pointers to the containing block on all
instructions.
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//11265005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14001 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-24 09:46:24 +00:00
zerny@google.com
8459bad004
Inlining of calls with optional parameters.
...
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//11028140
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13999 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-24 08:22:11 +00:00
zerny@google.com
500e301a13
Avoid rediscovering blocks on each call to FlowGraph::InlineCall.
...
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//11092102
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13922 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-23 06:11:31 +00:00
fschneider@google.com
9797d9caa2
Avoid creating unnecessary environments during SSA renaming.
...
Only instructions that can deoptimize and Goto-instructions
ever need an environment.
Review URL: https://codereview.chromium.org//11225028
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13871 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-22 13:31:31 +00:00
zerny@google.com
5200dfb8b1
Remove slow assert from VM.
...
Replaced slow-asserts with verify-compiler and removed vm/assert.h
R=srdjan@google.com
BUG=5720
Review URL: https://codereview.chromium.org//11017027
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13456 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-10 08:03:28 +00:00
zerny@google.com
3ae0b96762
Set previous instruction pointers when building the graph.
...
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//11043016
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13174 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-03 15:05:27 +00:00
srdjan@google.com
62f74c19c9
Revert r13022 (revert inlining of methods with control flow), Review URL: https://codereview.chromium.org//10979078 ; disable inlining of methods with control-flow so that we do not run out of heap space.
...
Review URL: https://codereview.chromium.org//11029002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13081 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-01 18:33:13 +00:00
zerny@google.com
792a5cbcee
Added slow_assert macro and flag for slow development assertions in the VM.
...
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//11014013
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13069 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-01 14:27:45 +00:00
kmillikin@google.com
c4e717264d
Revert several inlining related changes.
...
Revert svn revisions r12990, r12991, r12995, and r13000. Increased inlining
leads to excessive code growth, preventing dart2js to run in checked mode.
The changes will be relanded when we can come up with improved size
thresholds.
R=ngeoffray@google.com
BUG=
Review URL: https://codereview.chromium.org//10979078
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13022 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-28 13:50:17 +00:00
zerny@google.com
5936a443d6
Instruction size and growth threshold for inlining.
...
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//10996057
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13000 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-28 10:22:29 +00:00
zerny@google.com
ddd377b294
Disable slow debug assertions in use-list verification code.
...
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//10979073
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12995 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-28 08:34:35 +00:00
zerny@google.com
02822c775b
Inlining functions with control flow.
...
Functions containing control flow are now inlined and incrementally extend the graph in SSA form. For the special case of a function with only one exit, we locally update the dominator tree. If multiple exits occur, we currently recompute the dominator tree for the full resulting graph.
Review URL: https://codereview.chromium.org//10967007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12990 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-28 07:10:06 +00:00
kmillikin@google.com
63fa392807
Reapply "A simpler scheme for garbage collection of ureachable phi inputs."
...
Fix two issues:
* Unreachable code elimination did not correctly identify all unreachable
blocks.
* Loop detection in the register allocator relied on the block IDs.
R=vegorov@google.com
BUG=
Review URL: https://codereview.chromium.org//10956013
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12756 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-24 07:27:36 +00:00
kmillikin@google.com
52af2225e9
Revert "A simpler scheme for garbage collection of ureachable phi inputs."
...
This reverts svn revision 12621. It causes unexpected test timouts.
TBR=sgjesse@google.com
BUG=
Review URL: https://codereview.chromium.org//10964012
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12624 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-20 09:11:44 +00:00
kmillikin@google.com
13ef2a994e
A simpler scheme for garbage collection of ureachable phi inputs.
...
Simplify the garbage collection of unreachable phi inputs. Assign immutable
block ids to basic blocks and ensure that both predecessor blocks and phi
inputs are kept sorted by block id.
R=vegorov@google.com
BUG=
Review URL: https://codereview.chromium.org//10939036
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12621 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-20 08:47:57 +00:00
kmillikin@google.com
be0492a8a8
Reapply "Initial implementation of sparse conditional constant propagation."
...
With a fix for compilation on Mac. GrowableArray is DISALLOW_COPY_AND_ASSIGN,
so we can't create a temporary one to be ignored and have to pass one in to be
ignored.
R=fschneider@google.com ,zerny@google.com
BUG=
Review URL: https://codereview.chromium.org//10949020
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12561 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-19 14:10:14 +00:00
zerny@google.com
8ca2c4e6e9
Replace start_env with initial_definitions in GraphEntryInstr.
...
The initial definitions do not have any deoptimization information and can be
represented as just a list of definitions. For easy access, the constant_null
getter remains but assumes that index 0 contains the constant.
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//10939031
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12555 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-19 12:37:57 +00:00
kmillikin@google.com
5e449aea52
Revert "Initial implementation of sparse conditional constant propagation."
...
Revert due to compilation failures on Mac.
TBR=fschneider@google.com
BUG=
Review URL: https://codereview.chromium.org//10946027
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12552 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-19 11:04:36 +00:00