When inlining implicit getters via the polymorphic inliner
(and not through the flow graph optimizer) the fields loaded
must be added to the list of guarded fields that trigger
deoptimization when a store violated the field type guard.
Also, this CL avoids adding fields to the list from inlining
candidates that do not get inlined after all. Previously, the
optimizer pass on the callee graph would add guarded fields
even if the final graph does not get inlined.
TEST=tests/language/vm/optimized_guarded_field_test.dart
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//24096018
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27655 260f80e4-7a28-3924-810f-c04153c831b5
This CL adds the necessary parts to enable polymorphic
inlining of recognized methods. For now it handles only
[]-calls. This helps code that deals with e.g. growable
and fixed-length lists.
The basic idea is to adapt the code in the flow graph
optimizer so that it can be used from the generic inliner.
Currently this adds a bit of boilerplate code which I intend
to reduce when adding more recognized methods to be handled.
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//23684059
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27627 260f80e4-7a28-3924-810f-c04153c831b5
Add profiling support to select OSR candidates and launch the compiler
for OSR, followed by entry to the function at the OSR entry point.
Implemented only on IA32 and X64. The initial implementation can be
improved in various ways --- specifically: tuning of profiling
parameters and incorporation of feedback about the actual values seen
at OSR entry.
R=fschneider@google.com
Review URL: https://codereview.chromium.org//16693006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24024 260f80e4-7a28-3924-810f-c04153c831b5
AllocationSinking pass discovers non-escaping allocations that have no input uses other than uses in the stores into its own fields.
Every environment use of such allocation is replaced by a state snapshot (MaterializeObject instruction) that describes the state of each initialized field in the object. State snapshots are computed through an additional round of load-forwarding.
Once snapshots are computed allocations are removed from the graph.
MaterializeObject instructions are not compiled into native code but produce deoptimization instructions instead that describe how object should be materialized at deoptimization.
Deoptimization instructions now follow the following format:
[mat obj #1]...[mat obj #N][ret addr][... mat arguments ...][... real frames ...]
- the prefix describes each object to materialize on deopt via kMaterializeObject instruction;
- actual values that are needed for materialization are emited as a part of bottom-most stack frame. This is done to simplify implementation: they need to be discoverable by a GC during materialization phase. At the end of deoptimization they will be removed from the stack;
- normal stack slots can refer to materialized objects via kMaterializedObjectRef instruction.
Additionally this change contains fixes in load-forwarding that are needed to guarantee that all artificial LoadField instructions inserted during AllocationSinking are correctly replaced with actual values.
Limitations of the current implementation:
- can't eliminate allocations that flow into phis but otherwise don't actually escape;
- can't sink allocations out of loops;
- allocation with type arguments are not handled.
R=regis@google.com, srdjan@google.com, zra@google.com
Review URL: https://codereview.chromium.org//14935005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22485 260f80e4-7a28-3924-810f-c04153c831b5
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
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
Branch optimization pushes some branches that test the value of a phi
to the predecessor blocks. This can avoid materializing a boolean
object solely for the purposes of branching on its boolean value.
The optimization is performed after inlinining which creates
opportunities, and before constant propagation, because it exposes
opportunities for unreachable code elimination.
R=vegorov@google.com
BUG=
Review URL: https://codereview.chromium.org//12540002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19682 260f80e4-7a28-3924-810f-c04153c831b5
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
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
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
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