Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Unified Diff: runtime/vm/flow_graph.cc

Issue 10952002: Reapply "Deoptimization support in inlined code." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/deopt_instructions.cc ('k') | runtime/vm/flow_graph_allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph.cc
diff --git a/runtime/vm/flow_graph.cc b/runtime/vm/flow_graph.cc
index ca6c43944dffe4a21d3a6b112a2ae06a92f6b233..0b743d95be6a9d48b34d1d69121af561ff138a23 100644
--- a/runtime/vm/flow_graph.cc
+++ b/runtime/vm/flow_graph.cc
@@ -514,7 +514,9 @@ void FlowGraph::Rename(GrowableArray<PhiInstr*>* live_phis) {
start_env.Add(graph_entry_->constant_null());
}
graph_entry_->set_start_env(
- Environment::From(start_env, num_non_copied_params_, NULL));
+ Environment::From(start_env,
+ num_non_copied_params_,
+ parsed_function_.function()));
BlockEntryInstr* normal_entry = graph_entry_->SuccessorAt(0);
ASSERT(normal_entry != NULL); // Must have entry.
@@ -547,8 +549,12 @@ void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry,
// Attach current environment to the instruction. First, each instruction
// gets a full copy of the environment. Later we optimize this by
// eliminating unnecessary environments.
- current->set_env(
- Environment::From(*env, num_non_copied_params_, NULL));
+ current->set_env(Environment::From(*env,
+ num_non_copied_params_,
+ parsed_function_.function()));
+ if (current->CanDeoptimize()) {
+ current->env()->set_deopt_id(current->deopt_id());
+ }
// 2a. Handle uses:
// Update expression stack environment for each use.
@@ -778,6 +784,12 @@ void FlowGraph::InlineCall(Definition* call, FlowGraph* callee_graph) {
TargetEntryInstr* callee_entry = callee_graph->graph_entry()->normal_entry();
ZoneGrowableArray<ReturnInstr*>* callee_exits = callee_graph->exits();
+ // 0. Attach the outer environment on each instruction in the callee graph.
+ for (ForwardInstructionIterator it(callee_entry); !it.Done(); it.Advance()) {
+ Instruction* instr = it.Current();
+ if (instr->CanDeoptimize()) call->env()->DeepCopyToOuter(instr);
+ }
+
// 1. Insert the callee graph into the caller graph.
if (callee_exits->is_empty()) {
// If no normal exits exist, inline and truncate the block after inlining.
« no previous file with comments | « runtime/vm/deopt_instructions.cc ('k') | runtime/vm/flow_graph_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698