Title: [251408] trunk
Revision
251408
Author
[email protected]
Date
2019-10-21 18:33:37 -0700 (Mon, 21 Oct 2019)

Log Message

ValuePow's constant folding rule differs from what the runtime does
https://bugs.webkit.org/show_bug.cgi?id=203220
<rdar://problem/56181441>

Reviewed by Yusuke Suzuki.

JSTests:

* value-pow-ai-rule-should-box-the-same-way-as-the-runtime.js: Added.
(foo):

Source/_javascript_Core:

The constant folding rule for ValuePow was boxing the result using jsDoubleNumber,
where the runtime function was boxing the result using jsNumber. This patch makes
it so that constant folding agrees with what the runtime is doing.

* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (251407 => 251408)


--- trunk/JSTests/ChangeLog	2019-10-22 01:31:22 UTC (rev 251407)
+++ trunk/JSTests/ChangeLog	2019-10-22 01:33:37 UTC (rev 251408)
@@ -1,3 +1,14 @@
+2019-10-21  Saam Barati  <[email protected]>
+
+        ValuePow's constant folding rule differs from what the runtime does
+        https://bugs.webkit.org/show_bug.cgi?id=203220
+        <rdar://problem/56181441>
+
+        Reviewed by Yusuke Suzuki.
+
+        * value-pow-ai-rule-should-box-the-same-way-as-the-runtime.js: Added.
+        (foo):
+
 2019-10-21  Mark Lam  <[email protected]>
 
         Fix missing exception check in JSON Stringifier.

Added: trunk/JSTests/value-pow-ai-rule-should-box-the-same-way-as-the-runtime.js (0 => 251408)


--- trunk/JSTests/value-pow-ai-rule-should-box-the-same-way-as-the-runtime.js	                        (rev 0)
+++ trunk/JSTests/value-pow-ai-rule-should-box-the-same-way-as-the-runtime.js	2019-10-22 01:33:37 UTC (rev 251408)
@@ -0,0 +1,16 @@
+//@ runDefault("--validateAbstractInterpreterState=1", "--validateAbstractInterpreterStateProbability=1.0", "--useRandomizingFuzzerAgent=1", "--thresholdForFTLOptimizeAfterWarmUp=0", "--useConcurrentJIT=0")
+
+let x = 0;
+
+function foo(a0) {
+    for (let j=0; j<2; j++) {
+        const y = a0 === typeof x;
+        [a0, 0.1];
+        x = [];
+        ((y|0)**0) && 0;
+    } 
+}
+
+for (let i = 0; i < 100; i++) {
+    foo(0);
+}

Modified: trunk/Source/_javascript_Core/ChangeLog (251407 => 251408)


--- trunk/Source/_javascript_Core/ChangeLog	2019-10-22 01:31:22 UTC (rev 251407)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-10-22 01:33:37 UTC (rev 251408)
@@ -1,3 +1,18 @@
+2019-10-21  Saam Barati  <[email protected]>
+
+        ValuePow's constant folding rule differs from what the runtime does
+        https://bugs.webkit.org/show_bug.cgi?id=203220
+        <rdar://problem/56181441>
+
+        Reviewed by Yusuke Suzuki.
+
+        The constant folding rule for ValuePow was boxing the result using jsDoubleNumber,
+        where the runtime function was boxing the result using jsNumber. This patch makes
+        it so that constant folding agrees with what the runtime is doing.
+
+        * dfg/DFGAbstractInterpreterInlines.h:
+        (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
+
 2019-10-21  Mark Lam  <[email protected]>
 
         Fix missing exception check in JSON Stringifier.

Modified: trunk/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h (251407 => 251408)


--- trunk/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h	2019-10-22 01:31:22 UTC (rev 251407)
+++ trunk/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h	2019-10-22 01:33:37 UTC (rev 251408)
@@ -939,7 +939,8 @@
             // when node->useKind is UntypedUse. In the case of BigIntUse, children will be
             // cleared by `AbstractInterpreter::executeEffects`.
             didFoldClobberWorld();
-            setConstant(node, jsDoubleNumber(operationMathPow(childX.asNumber(), childY.asNumber())));
+            // Our boxing scheme here matches what we do in operationValuePow.
+            setConstant(node, jsNumber(operationMathPow(childX.asNumber(), childY.asNumber())));
             break;
         }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to