summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2015-05-18 22:31:29 +0100
committer Nicolas Geoffray <ngeoffray@google.com> 2015-05-29 14:15:04 +0100
commitd23eeef3492b53102eb8093524cf37e2b4c296db (patch)
tree57d3e9ab2853d5b8092568bb3d29bc850c113315 /compiler/optimizing/nodes.cc
parenta15c78d3cc28f514a482ffd792a767e97fe53c95 (diff)
Support for inlining methods that call/throw.
Mostly fixes here and there to make it working. Change-Id: I1b535e895105d78b65634636d675b818551f783e
Diffstat (limited to 'compiler/optimizing/nodes.cc')
-rw-r--r--compiler/optimizing/nodes.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 80d4b4a863..06f6a7fd88 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -1314,6 +1314,29 @@ void HGraph::DeleteDeadBlock(HBasicBlock* block) {
void HGraph::InlineInto(HGraph* outer_graph, HInvoke* invoke) {
DCHECK(HasExitBlock()) << "Unimplemented scenario";
+ // Update the environments in this graph to have the invoke's environment
+ // as parent.
+ {
+ HReversePostOrderIterator it(*this);
+ it.Advance(); // Skip the entry block, we do not need to update the entry's suspend check.
+ for (; !it.Done(); it.Advance()) {
+ HBasicBlock* block = it.Current();
+ for (HInstructionIterator instr_it(block->GetInstructions());
+ !instr_it.Done();
+ instr_it.Advance()) {
+ HInstruction* current = instr_it.Current();
+ if (current->NeedsEnvironment()) {
+ current->GetEnvironment()->SetAndCopyParentChain(
+ outer_graph->GetArena(), invoke->GetEnvironment());
+ }
+ }
+ }
+ }
+ outer_graph->UpdateMaximumNumberOfOutVRegs(GetMaximumNumberOfOutVRegs());
+ if (HasBoundsChecks()) {
+ outer_graph->SetHasBoundsChecks(true);
+ }
+
if (GetBlocks().Size() == 3) {
// Simple case of an entry block, a body block, and an exit block.
// Put the body block's instruction into `invoke`'s block.