Index: runtime/vm/intrinsifier.cc |
diff --git a/runtime/vm/intrinsifier.cc b/runtime/vm/intrinsifier.cc |
index 9c6d9eef36ee37b4b50dd56d17d2dfc69e98fcc3..3b915134ac574dd327aff43230438ae834bf1b46 100644 |
--- a/runtime/vm/intrinsifier.cc |
+++ b/runtime/vm/intrinsifier.cc |
@@ -285,7 +285,14 @@ static intptr_t CidForRepresentation(Representation rep) { |
class BlockBuilder : public ValueObject { |
public: |
BlockBuilder(FlowGraph* flow_graph, TargetEntryInstr* entry) |
- : flow_graph_(flow_graph), entry_(entry), current_(entry) {} |
+ : flow_graph_(flow_graph), |
+ entry_(entry), |
+ current_(entry), |
+ empty_env_(new Environment(0, |
+ 0, |
+ Thread::kNoDeoptId, |
+ flow_graph->parsed_function(), |
+ NULL)) {} |
Definition* AddToInitialDefinitions(Definition* def) { |
def->set_ssa_temp_index(flow_graph_->alloc_ssa_temp_index()); |
@@ -295,11 +302,17 @@ class BlockBuilder : public ValueObject { |
Definition* AddDefinition(Definition* def) { |
def->set_ssa_temp_index(flow_graph_->alloc_ssa_temp_index()); |
- current_ = current_->AppendInstruction(def); |
+ AddInstruction(def); |
return def; |
} |
Instruction* AddInstruction(Instruction* instr) { |
+ if (instr->ComputeCanDeoptimize()) { |
+ // Since we use the presence of an environment to determine if an |
+ // instructions can deoptimize, we need an empty enviroment for |
+ // instructions that "deoptimize" to the intrinsic fall-through code. |
+ instr->SetEnvironment(empty_env_); |
+ } |
current_ = current_->AppendInstruction(instr); |
return instr; |
} |
@@ -360,6 +373,7 @@ class BlockBuilder : public ValueObject { |
FlowGraph* flow_graph_; |
BlockEntryInstr* entry_; |
Instruction* current_; |
+ Environment* empty_env_; |
}; |