| 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.
|
|
|