Index: runtime/vm/intermediate_language.cc |
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc |
index 7b8e997150c84ea4da8d6cf68d74312d98a54121..f5f304592189ac2ed7f6f00335e1b0ee6b61e83d 100644 |
--- a/runtime/vm/intermediate_language.cc |
+++ b/runtime/vm/intermediate_language.cc |
@@ -1837,6 +1837,19 @@ Instruction* BranchInstr::Canonicalize(FlowGraphOptimizer* optimizer) { |
Value* operand = comp->InputAt(i); |
operand->set_instruction(this); |
} |
+ |
+ // If comparison has an environment then steal it. |
+ ASSERT(env() == NULL); // StrictCompare can't deoptimize. |
+ if (comp->env() != NULL) { |
+ set_env(comp->env()); |
+ comp->set_env(NULL); |
Florian Schneider
2013/02/13 11:22:11
You may also need to set a new deopt id on the env
|
+ |
+ for (Environment::DeepIterator it(env()); !it.Done(); it.Advance()) { |
+ Value* value = it.CurrentValue(); |
+ value->set_instruction(this); |
+ } |
+ } |
+ |
if (FLAG_trace_optimization) { |
OS::Print("Merging comparison v%"Pd"\n", comp->ssa_temp_index()); |
} |