Title: [187089] branches/safari-601.1-branch/Source/_javascript_Core

Diff

Modified: branches/safari-601.1-branch/Source/_javascript_Core/ChangeLog (187088 => 187089)


--- branches/safari-601.1-branch/Source/_javascript_Core/ChangeLog	2015-07-21 05:16:44 UTC (rev 187088)
+++ branches/safari-601.1-branch/Source/_javascript_Core/ChangeLog	2015-07-21 05:27:39 UTC (rev 187089)
@@ -1,5 +1,34 @@
 2015-07-20  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r186819. rdar://problem/21729083
+
+    2015-07-14  Matthew Mirman  <mmir...@apple.com>
+
+            Repatch. Makes compileArithSub in the DFG ensure that the constant is an int32.
+            https://bugs.webkit.org/show_bug.cgi?id=146910
+            rdar://problem/21729083
+
+            Reviewed by Filip Pizlo.
+
+            Also fixes the debug build problem where all edges are assumed to
+            have UntypedUse before the fixup phase.
+
+            * dfg/DFGSpeculativeJIT.cpp:
+            (JSC::DFG::SpeculativeJIT::compileArithSub):
+            * dfg/DFGValidate.cpp:
+            (JSC::DFG::Validate::validateEdgeWithDoubleResultIfNecessary):
+            * tests/stress/arith-add-with-constants.js: Added some tests for this case.
+            (arithAdd42WrittenAsInteger):
+            (testArithAdd42WrittenAsInteger):
+            (arithSub42WrittenAsDouble):
+            (testArithSub42WrittenAsDouble):
+            (doubleConstant):
+            (testDoubleConstant): Added test for the case of +0.0 and Math.min(0.0)
+            (arithAdd42WrittenAsDouble): Deleted.
+            (testArithAdd42WrittenAsDouble): Deleted.
+
+2015-07-20  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r187028. rdar://problem/21869970
 
     2015-07-18  Filip Pizlo  <fpi...@apple.com>

Modified: branches/safari-601.1-branch/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (187088 => 187089)


--- branches/safari-601.1-branch/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2015-07-21 05:16:44 UTC (rev 187088)
+++ branches/safari-601.1-branch/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2015-07-21 05:27:39 UTC (rev 187089)
@@ -2989,7 +2989,7 @@
     case Int32Use: {
         ASSERT(!shouldCheckNegativeZero(node->arithMode()));
         
-        if (node->child2()->isNumberConstant()) {
+        if (node->child2()->isInt32Constant()) {
             SpeculateInt32Operand op1(this, node->child1());
             int32_t imm2 = node->child2()->asInt32();
             GPRTemporary result(this);
@@ -3006,7 +3006,7 @@
             return;
         }
             
-        if (node->child1()->isNumberConstant()) {
+        if (node->child1()->isInt32Constant()) {
             int32_t imm1 = node->child1()->asInt32();
             SpeculateInt32Operand op2(this, node->child2());
             GPRTemporary result(this);

Modified: branches/safari-601.1-branch/Source/_javascript_Core/dfg/DFGValidate.cpp (187088 => 187089)


--- branches/safari-601.1-branch/Source/_javascript_Core/dfg/DFGValidate.cpp	2015-07-21 05:16:44 UTC (rev 187088)
+++ branches/safari-601.1-branch/Source/_javascript_Core/dfg/DFGValidate.cpp	2015-07-21 05:27:39 UTC (rev 187089)
@@ -544,9 +544,9 @@
             return;
 
         if (m_graph.m_planStage < PlanStage::AfterFixup)
-            VALIDATE((node, edge), edge.useKind() == UntypedUse);
-        else
-            VALIDATE((node, edge), edge.useKind() == DoubleRepUse || edge.useKind() == DoubleRepRealUse || edge.useKind() == DoubleRepMachineIntUse);
+            return;
+        
+        VALIDATE((node, edge), edge.useKind() == DoubleRepUse || edge.useKind() == DoubleRepRealUse || edge.useKind() == DoubleRepMachineIntUse);
     }
 
     void checkOperand(

Modified: branches/safari-601.1-branch/Source/_javascript_Core/tests/stress/arith-add-with-constants.js (187088 => 187089)


--- branches/safari-601.1-branch/Source/_javascript_Core/tests/stress/arith-add-with-constants.js	2015-07-21 05:16:44 UTC (rev 187088)
+++ branches/safari-601.1-branch/Source/_javascript_Core/tests/stress/arith-add-with-constants.js	2015-07-21 05:27:39 UTC (rev 187089)
@@ -167,56 +167,105 @@
 testArithAdd42WrittenAsInteger();
 
 
-function arithAdd42WrittenAsDouble(x) {
-    var a = x + 42.0;
-    var b = 42. + x;
+
+
+// Test "value + 42".
+function arithAdd42WrittenAsInteger(x) {
+    var a = x + 42;
+    var b = 42 + x;
     if (!(isNaN(x) && isNaN(a) && isNaN(b)) && a !== b)
-        throw "Internal error on arithAdd42WrittenAsDouble, a = " + a + " b = " + b;
+        throw "Internal error on arithAdd42WrittenAsInteger, a = " + a + " b = " + b;
     return a;
 }
-noInline(arithAdd42WrittenAsDouble);
+noInline(arithAdd42WrittenAsInteger);
 
-function testArithAdd42WrittenAsDouble() {
+function testArithAdd42WrittenAsInteger() {
     for (var i = 0; i < 1e4; ++i) {
-        var result = arithAdd42WrittenAsDouble(13);
+        var result = arithAdd42WrittenAsInteger(13);
         if (result !== 55) {
-            throw "arithAdd42WrittenAsDouble(i) = " + result + ", expected 55";
+            throw "arithAdd42WrittenAsInteger(13) = " + result + ", expected 55";
         }
     }
 
     for (var i = 0; i < 1e4; ++i) {
-        var result = arithAdd42WrittenAsDouble(-0);
+        var result = arithAdd42WrittenAsInteger(-0);
         if (result !== 42) {
-            throw "arithAdd42WrittenAsDouble(-0) = " + result + ", expected 42";
+            throw "arithAdd42WrittenAsInteger(-0) = " + result + ", expected 42";
         }
     }
 
     for (var i = 0; i < 1e4; ++i) {
-        var result = arithAdd42WrittenAsDouble(13.3);
+        var result = arithAdd42WrittenAsInteger(13.3);
         if (result !== 55.3) {
-            throw "arithAdd42WrittenAsDouble(13.3) = " + result + ", expected 55.3";
+            throw "arithAdd42WrittenAsInteger(13.3) = " + result + ", expected 55.3";
         }
     }
 
     for (var i = 0; i < 1e4; ++i) {;
-        var result = arithAdd42WrittenAsDouble(NaN);
+        var result = arithAdd42WrittenAsInteger(NaN);
         if (!isNaN(result)) {
-            throw "arithAdd42WrittenAsDouble(NaN) = " + result + ", expected NaN";
+            throw "arithAdd42WrittenAsInteger(NaN) = " + result + ", expected NaN";
         }
     }
 
     for (var i = 0; i < 1e4; ++i) {;
-        var result = arithAdd42WrittenAsDouble(Infinity);
+        var result = arithAdd42WrittenAsInteger(Infinity);
         if (isFinite(result)) {
-            throw "arithAdd42WrittenAsDouble(Infinity) = " + result + ", expected Infinity";
+            throw "arithAdd42WrittenAsInteger(Infinity) = " + result + ", expected Infinity";
         }
     }
 
     for (var i = 0; i < 1e4; ++i) {;
-        var result = arithAdd42WrittenAsDouble(-Infinity);
+        var result = arithAdd42WrittenAsInteger(-Infinity);
         if (isFinite(result) || result >= 0) {
-            throw "arithAdd42WrittenAsDouble(-Infinity) = " + result + ", expected -Infinity";
+            throw "arithAdd42WrittenAsInteger(-Infinity) = " + result + ", expected -Infinity";
         }
     }
 }
-testArithAdd42WrittenAsDouble();
\ No newline at end of file
+testArithAdd42WrittenAsInteger();
+
+function arithSub42WrittenAsDouble(x) {
+    var a = (x|0) - 42.0;
+    var b = -42. + (x|0);
+    if (!(isNaN(x) && isNaN(a) && isNaN(b)) && a !== b)
+        throw "Internal error on arithSub42WrittenAsDouble, a = " + a + " b = " + b;
+    return a;
+}
+noInline(arithSub42WrittenAsDouble);
+
+function testArithSub42WrittenAsDouble() {
+    for (var i = 0; i < 1e4; ++i) {
+        var result = arithSub42WrittenAsDouble(13);
+        if (result !== -29) {
+            throw "arithSub42WrittenAsDouble(13) = " + result + ", expected -29";
+        }
+    }
+
+    for (var i = 0; i < 1e4; ++i) {
+        var result = arithSub42WrittenAsDouble(-0);
+        if (result !== -42) {
+            throw "arithSub42WrittenAsDouble(-0) = " + result + ", expected -42";
+        }
+    }
+
+    for (var i = 0; i < 1e4; ++i) {
+        var result = arithSub42WrittenAsDouble(13.3);
+        if (result !== -29) {
+            throw "arithSub42WrittenAsDouble(13.3) = " + result + ", expected -29";
+        }
+    }
+}
+testArithSub42WrittenAsDouble();
+
+
+function doubleConstant(){
+    Math.min(0.0);
+    +0.0;
+} noInline(doubleConstant);
+
+function testDoubleConstant(){
+    for (var i = 0; i < 1e4; ++i) {
+        doubleConstant();
+    }
+}
+testDoubleConstant();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to