Reviewers: Mads Ager, William Hesse,

Description:
Merge r6534 from bleeding edge into 3.0 branch.

Fix a bug in the placement of minus-zero checks and in GVN.



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

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

Affected files:
  M     src/hydrogen-instructions.cc
  M     src/hydrogen.h
  M     src/hydrogen.cc
  M     src/version.cc
  A  +  test/mjsunit/compiler/regress-1085.js


### BEGIN SVN COPY METADATA
#$ cp branches/bleeding_edge/test/mjsunit/compiler/regress-1085.js test/mjsunit/compiler/regress-1085.js
### END SVN COPY METADATA
Index: src/hydrogen-instructions.cc
===================================================================
--- src/hydrogen-instructions.cc        (revision 6535)
+++ src/hydrogen-instructions.cc        (working copy)
@@ -253,6 +253,7 @@
   if (other->opcode() != opcode()) return false;
   if (!other->representation().Equals(representation())) return false;
   if (!other->type_.Equals(type_)) return false;
+  if (other->flags() != flags()) return false;
   if (OperandCount() != other->OperandCount()) return false;
   for (int i = 0; i < OperandCount(); ++i) {
     if (OperandAt(i)->id() != other->OperandAt(i)->id()) return false;
Index: src/hydrogen.cc
===================================================================
--- src/hydrogen.cc     (revision 6535)
+++ src/hydrogen.cc     (working copy)
@@ -1813,15 +1813,6 @@
                                               HValue* use,
                                               Representation to,
                                               bool is_truncating) {
-  // Propagate flags for negative zero checks upwards from conversions
-  // int32-to-tagged and int32-to-double.
-  Representation from = value->representation();
-  if (from.IsInteger32()) {
-    ASSERT(to.IsTagged() || to.IsDouble());
-    BitVector visited(GetMaximumValueID());
-    PropagateMinusZeroChecks(value, &visited);
-  }
-
   // Insert the representation change right before its use. For phi-uses we
   // insert at the end of the corresponding predecessor.
   HBasicBlock* insert_block = use->block();
@@ -1984,6 +1975,30 @@
 }


+void HGraph::ComputeMinusZeroChecks() {
+  BitVector visited(GetMaximumValueID());
+  for (int i = 0; i < blocks_.length(); ++i) {
+    for (HInstruction* current = blocks_[i]->first();
+         current != NULL;
+         current = current->next()) {
+      if (current->IsChange()) {
+        HChange* change = HChange::cast(current);
+ // Propagate flags for negative zero checks upwards from conversions
+        // int32-to-tagged and int32-to-double.
+        Representation from = change->value()->representation();
+        ASSERT(from.Equals(change->from()));
+        if (from.IsInteger32()) {
+          ASSERT(change->to().IsTagged() || change->to().IsDouble());
+          ASSERT(visited.IsEmpty());
+          PropagateMinusZeroChecks(change->value(), &visited);
+          visited.Clear();
+        }
+      }
+    }
+  }
+}
+
+
// Implementation of utility classes to represent an expression's context in
 // the AST.
 AstContext::AstContext(HGraphBuilder* owner, Expression::Context kind)
@@ -2243,6 +2258,7 @@
   graph_->InitializeInferredTypes();
   graph_->Canonicalize();
   graph_->InsertRepresentationChanges();
+  graph_->ComputeMinusZeroChecks();

   // Eliminate redundant stack checks on backwards branches.
   HStackCheckEliminator sce(graph_);
Index: src/hydrogen.h
===================================================================
--- src/hydrogen.h      (revision 6535)
+++ src/hydrogen.h      (working copy)
@@ -307,6 +307,7 @@
   void InitializeInferredTypes();
   void InsertTypeConversions();
   void InsertRepresentationChanges();
+  void ComputeMinusZeroChecks();
   bool ProcessArgumentsObject();
   void EliminateRedundantPhis();
   void Canonicalize();
Index: src/version.cc
===================================================================
--- src/version.cc      (revision 6535)
+++ src/version.cc      (working copy)
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     0
 #define BUILD_NUMBER      12
-#define PATCH_LEVEL       0
+#define PATCH_LEVEL       1
 #define CANDIDATE_VERSION false

 // Define SONAME to have the SCons build the put a specific SONAME into the
Index: test/mjsunit/compiler/regress-1085.js


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

Reply via email to