Reviewers: danno, Massi,

Message:
Around ~11% in imaging-desaturate on my machine.


Zheng Liu
[email protected]

Description:
Don't reference transitioned elements in hoisted instructions.
Test=imaging-desaturate slightly faster

Please review this at http://codereview.chromium.org/10544133/

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     src/hydrogen.cc


Index: src/hydrogen.cc
===================================================================
--- src/hydrogen.cc     (revision 11791)
+++ 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);

@@ -1689,6 +1690,7 @@
                          &accumulated_first_time_depends,
                          &accumulated_first_time_changes);
       }
+      PostProcessLoopPreHeader(block->predecessors()->at(0));
     }
   }
 }
@@ -1801,7 +1803,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();
+      }
+    }
+    instr = next;
+  }
+}

+
 bool HGlobalValueNumberer::AllowCodeMotion() {
return info()->shared_info()->opt_count() + 1 < Compiler::kDefaultMaxOptCount;
 }


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to