summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2015-05-29 14:03:10 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2015-05-29 14:03:10 +0000
commit66a7d7a4612b0dfb8a409fbf05bbefd07122fd80 (patch)
treecb9d448af1b932c52c8017b53e70b7243c3093d8 /compiler/optimizing/nodes.cc
parentbd699ea018d12b061282f17a6abf329590ab263c (diff)
parentd23eeef3492b53102eb8093524cf37e2b4c296db (diff)
Merge "Support for inlining methods that call/throw."
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.