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

Unified Diff: src/hydrogen.cc

Issue 10544133: Don't reference transitioned elements in loop pre header (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
===================================================================
--- src/hydrogen.cc (revision 11825)
+++ src/hydrogen.cc (working copy)
@@ -1512,6 +1512,7 @@
GVNFlagSet loop_kills,
GVNFlagSet* accumulated_first_time_depends,
GVNFlagSet* accumulated_first_time_changes);
+ void PostProcessLoopPreHeader(HBasicBlock* pre_header);
bool AllowCodeMotion();
bool ShouldMove(HInstruction* instr, HBasicBlock* loop_header);
@@ -1691,6 +1692,12 @@
}
}
}
+ for (int i = graph_->blocks()->length() - 1; i >= 0; --i) {
+ HBasicBlock* block = graph_->blocks()->at(i);
+ if (block->IsLoopHeader()) {
+ PostProcessLoopPreHeader(block->predecessors()->at(0));
+ }
+ }
}
@@ -1801,7 +1808,27 @@
}
}
+void HGlobalValueNumberer::PostProcessLoopPreHeader(HBasicBlock* pre_header) {
+ HInstruction* instr = pre_header->first();
+ while (instr != NULL) {
+ HInstruction* next = instr->next();
+ if (instr->IsTransitionElementsKind()) {
+ HValue* old_elems = instr->OperandAt(0), *new_elems = instr;
+ HInstruction* current = next;
+ while (current != NULL) {
+ for (int i = 0; i < current->OperandCount(); ++i) {
+ if (current->OperandAt(i) == old_elems) {
+ current->SetOperandAt(i, new_elems);
+ }
+ }
+ current = current->next();
+ }
+ }
danno 2012/06/19 15:45:05 This is potentially a n^2 algorithm with respect t
+ instr = next;
+ }
+}
+
bool HGlobalValueNumberer::AllowCodeMotion() {
return info()->shared_info()->opt_count() + 1 < Compiler::kDefaultMaxOptCount;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698