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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 12220150: When canonicalizing branch on StrictCompare ensure that branch gets correct environment. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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
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());
}
« no previous file with comments | « no previous file | tests/language/branch_canonicalization_test.dart » ('j') | tests/language/branch_canonicalization_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698