Title: [260651] trunk
Revision
260651
Author
[email protected]
Date
2020-04-24 10:20:03 -0700 (Fri, 24 Apr 2020)

Log Message

[JSC] DFG AI for some bitops + BigInt32 should be precise
https://bugs.webkit.org/show_bug.cgi?id=210956

Reviewed by Keith Miller.

JSTests:

* stress/bigint-bitops.js: Added.
(shouldBe):
(test):

Source/_javascript_Core:

Use SpecBigInt32 for ValueBitXor, ValueBitAnd, and ValueBitOr since they are always producing BigInt32 and they have inlined implementations in DFG / FTL.

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

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (260650 => 260651)


--- trunk/JSTests/ChangeLog	2020-04-24 17:02:15 UTC (rev 260650)
+++ trunk/JSTests/ChangeLog	2020-04-24 17:20:03 UTC (rev 260651)
@@ -1,3 +1,14 @@
+2020-04-24  Yusuke Suzuki  <[email protected]>
+
+        [JSC] DFG AI for some bitops + BigInt32 should be precise
+        https://bugs.webkit.org/show_bug.cgi?id=210956
+
+        Reviewed by Keith Miller.
+
+        * stress/bigint-bitops.js: Added.
+        (shouldBe):
+        (test):
+
 2020-04-24  Paulo Matos  <[email protected]>
 
         Skip on ARM and MIPS stress/for-of-iterator-open* added at r260585

Added: trunk/JSTests/stress/bigint-bitops.js (0 => 260651)


--- trunk/JSTests/stress/bigint-bitops.js	                        (rev 0)
+++ trunk/JSTests/stress/bigint-bitops.js	2020-04-24 17:20:03 UTC (rev 260651)
@@ -0,0 +1,26 @@
+function shouldBe(actual, expected) {
+    if (actual !== expected)
+        throw new Error('bad value: ' + actual);
+}
+
+function test(a, b)
+{
+    let v1 = a & b;
+    let v2 = a | b;
+    let v3 = a ^ b;
+    return [v1, v2, v3];
+}
+noInline(test);
+
+for (let i = 0; i < 1e4; ++i) {
+    let [v1, v2, v3] = test(BigInt(i), BigInt(i + 1));
+    shouldBe(v1, BigInt(i & (i + 1)));
+    shouldBe(v2, BigInt(i | (i + 1)));
+    shouldBe(v3, BigInt(i ^ (i + 1)));
+}
+let a = 0x7ffffffffn;
+let b = 0xfff8302n;
+let [v1, v2, v3] = test(a, b);
+shouldBe(v1, a & b);
+shouldBe(v2, a | b);
+shouldBe(v3, a ^ b);

Modified: trunk/Source/_javascript_Core/ChangeLog (260650 => 260651)


--- trunk/Source/_javascript_Core/ChangeLog	2020-04-24 17:02:15 UTC (rev 260650)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-04-24 17:20:03 UTC (rev 260651)
@@ -1,3 +1,15 @@
+2020-04-24  Yusuke Suzuki  <[email protected]>
+
+        [JSC] DFG AI for some bitops + BigInt32 should be precise
+        https://bugs.webkit.org/show_bug.cgi?id=210956
+
+        Reviewed by Keith Miller.
+
+        Use SpecBigInt32 for ValueBitXor, ValueBitAnd, and ValueBitOr since they are always producing BigInt32 and they have inlined implementations in DFG / FTL.
+
+        * dfg/DFGAbstractInterpreterInlines.h:
+        (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
+
 2020-04-23  Alexey Shvayka  <[email protected]>
 
         Remove revoked Proxy checks from ProxyCreate

Modified: trunk/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h (260650 => 260651)


--- trunk/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h	2020-04-24 17:02:15 UTC (rev 260650)
+++ trunk/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h	2020-04-24 17:20:03 UTC (rev 260651)
@@ -541,13 +541,27 @@
             break;
 
         // FIXME: this use of binaryUseKind means that we cannot specialize to (for example) a HeapBigInt left-operand and a BigInt32 right-operand.
+        // https://bugs.webkit.org/show_bug.cgi?id=210977
         if (node->binaryUseKind() == BigInt32Use) {
 #if USE(BIGINT32)
+            switch (node->op()) {
+            case ValueBitXor:
+            case ValueBitAnd:
+            case ValueBitOr:
+                setTypeForNode(node, SpecBigInt32);
+                break;
+
             // FIXME: We should have inlined implementation that always returns BigInt32.
             // https://bugs.webkit.org/show_bug.cgi?id=210847
-            setTypeForNode(node, SpecBigInt);
+            case ValueBitRShift:
+            case ValueBitLShift:
+                setTypeForNode(node, SpecBigInt);
+                break;
+            default:
+                DFG_CRASH(m_graph, node, "Incorrect DFG op");
+            }
 #else
-            RELEASE_ASSERT_NOT_REACHED();
+            DFG_CRASH(m_graph, node, "No BigInt32 support");
 #endif
         } else if (node->binaryUseKind() == HeapBigIntUse)
             setTypeForNode(node, SpecHeapBigInt);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to