From d23eeef3492b53102eb8093524cf37e2b4c296db Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Mon, 18 May 2015 22:31:29 +0100 Subject: Support for inlining methods that call/throw. Mostly fixes here and there to make it working. Change-Id: I1b535e895105d78b65634636d675b818551f783e --- compiler/optimizing/nodes.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'compiler/optimizing/nodes.cc') 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. -- cgit v1.2.3-59-g8ed1b