Title: [263180] trunk
Revision
263180
Author
[email protected]
Date
2020-06-17 13:23:17 -0700 (Wed, 17 Jun 2020)

Log Message

[JSC] Freeze JSBigInt when setting it as a constant in AI
https://bugs.webkit.org/show_bug.cgi?id=213310
<rdar://problem/64450410>

Reviewed by Mark Lam.

JSTests:

* stress/bigint-constant-fold-to-numeric.js: Added.
(foo):

Source/_javascript_Core:

JSCells should be explicitly frozen via DFG::Graph::freeze or DFG::Graph::freezeStrong. And heap JSBigInt is JSCell.
We should freeze it before setting it as a parameter of setConstant in AI. We use DFG::Graph::freeze since we know
that this is coming from somewhere in DFG graph: this ToNumeric node itself is not newly producing this JSBigInt.

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

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (263179 => 263180)


--- trunk/JSTests/ChangeLog	2020-06-17 20:09:26 UTC (rev 263179)
+++ trunk/JSTests/ChangeLog	2020-06-17 20:23:17 UTC (rev 263180)
@@ -1,3 +1,14 @@
+2020-06-17  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Freeze JSBigInt when setting it as a constant in AI
+        https://bugs.webkit.org/show_bug.cgi?id=213310
+        <rdar://problem/64450410>
+
+        Reviewed by Mark Lam.
+
+        * stress/bigint-constant-fold-to-numeric.js: Added.
+        (foo):
+
 2020-06-17  Alexey Shvayka  <[email protected]>
 
         Update test262 to commit 8d3dd2d1a0a5

Added: trunk/JSTests/stress/bigint-constant-fold-to-numeric.js (0 => 263180)


--- trunk/JSTests/stress/bigint-constant-fold-to-numeric.js	                        (rev 0)
+++ trunk/JSTests/stress/bigint-constant-fold-to-numeric.js	2020-06-17 20:23:17 UTC (rev 263180)
@@ -0,0 +1,13 @@
+//@ runDefault("--useConcurrentJIT=0")
+
+function foo() {
+    let x = 10000000000n
+    for (let i = 0; i <= 100000; i++) {
+        let a0 = [];
+        a0[x++];
+        x = 0;
+    }
+}
+
+foo();
+foo();

Modified: trunk/Source/_javascript_Core/ChangeLog (263179 => 263180)


--- trunk/Source/_javascript_Core/ChangeLog	2020-06-17 20:09:26 UTC (rev 263179)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-06-17 20:23:17 UTC (rev 263180)
@@ -1,3 +1,18 @@
+2020-06-17  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Freeze JSBigInt when setting it as a constant in AI
+        https://bugs.webkit.org/show_bug.cgi?id=213310
+        <rdar://problem/64450410>
+
+        Reviewed by Mark Lam.
+
+        JSCells should be explicitly frozen via DFG::Graph::freeze or DFG::Graph::freezeStrong. And heap JSBigInt is JSCell.
+        We should freeze it before setting it as a parameter of setConstant in AI. We use DFG::Graph::freeze since we know
+        that this is coming from somewhere in DFG graph: this ToNumeric node itself is not newly producing this JSBigInt.
+
+        * dfg/DFGAbstractInterpreterInlines.h:
+        (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
+
 2020-06-17  Keith Miller  <[email protected]>
 
         $vm.haveABadTime/isHavingABadTime should work with non-globalObject parameters

Modified: trunk/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h (263179 => 263180)


--- trunk/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h	2020-06-17 20:09:26 UTC (rev 263179)
+++ trunk/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h	2020-06-17 20:23:17 UTC (rev 263180)
@@ -2703,7 +2703,10 @@
         JSValue childConst = forNode(node->child1()).value();
         if (childConst && (childConst.isNumber() || childConst.isBigInt())) {
             didFoldClobberWorld();
-            setConstant(node, childConst);
+            if (childConst.isCell())
+                setConstant(node, *m_graph.freeze(childConst.asCell()));
+            else
+                setConstant(node, childConst);
             break;
         }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to