Title: [273611] trunk
Revision
273611
Author
[email protected]
Date
2021-02-26 17:58:56 -0800 (Fri, 26 Feb 2021)

Log Message

Remove bad assertion of AI ArrayMode state in various "by val" opcodes
https://bugs.webkit.org/show_bug.cgi?id=222494
<rdar://73613460>

Reviewed by Filip Pizlo.

JSTests:

* stress/dont-assert-ai-proved-array-mode.js: Added.
(bar):
(foo):

Source/_javascript_Core:

It's invalid to ever assert that AI must have proved something. We've been
slowly removing these faulty asserts from the compiler, and this patch
removes some more of them. AI is conservative, and it's not guaranteed
that it will prove X, even if X must be true.

In this particular test case, we are looking at a race between the concurrent
compiler thread and the main thread, and the compilation will be thrown away
because of a Structure transition.

What happened in this particular program is we had a CheckStructure that was
proved to exit in an early run of AI, that is not shown to exit during a later
run of AI. Because of that, in the earlier AI run, we have some narrower type
info (because fewer predecessory type info). This narrower type info allowed
us to elide a CheckArray. The later runs don't have this narrower type info,
because the CheckStructure doesn't exit. The safety of all of this is
guaranteed by the compilation being thrown away because we fired the transition
watchpoint from the earlier Structure seen by AI.

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileGetByValOnString):
(JSC::DFG::SpeculativeJIT::compilePutByValForFloatTypedArray):
(JSC::DFG::SpeculativeJIT::compileGetByValOnDirectArguments):
(JSC::DFG::SpeculativeJIT::compileGetByValOnScopedArguments):
(JSC::DFG::SpeculativeJIT::compileGetArrayLength):

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (273610 => 273611)


--- trunk/JSTests/ChangeLog	2021-02-27 01:54:54 UTC (rev 273610)
+++ trunk/JSTests/ChangeLog	2021-02-27 01:58:56 UTC (rev 273611)
@@ -1,3 +1,15 @@
+2021-02-26  Saam Barati  <[email protected]>
+
+        Remove bad assertion of AI ArrayMode state in various "by val" opcodes
+        https://bugs.webkit.org/show_bug.cgi?id=222494
+        <rdar://73613460>
+
+        Reviewed by Filip Pizlo.
+
+        * stress/dont-assert-ai-proved-array-mode.js: Added.
+        (bar):
+        (foo):
+
 2021-02-26  Michael Saboff  <[email protected]>
 
         unexpected minimumInputSize in setupDisjunctionOffsets for regexp engine(yarr)

Added: trunk/JSTests/stress/dont-assert-ai-proved-array-mode.js (0 => 273611)


--- trunk/JSTests/stress/dont-assert-ai-proved-array-mode.js	                        (rev 0)
+++ trunk/JSTests/stress/dont-assert-ai-proved-array-mode.js	2021-02-27 01:58:56 UTC (rev 273611)
@@ -0,0 +1,19 @@
+//@ requireOptions("--jitPolicyScale=0", "--slowPathAllocsBetweenGCs=15")
+
+function foo(a0, a1, a2, a3, ...a4) {
+    function bar() {
+        for (let i=0; i<10; i++) {
+            new Uint8Array(arguments);
+            arguments[0];
+            try {
+                0..waffles();
+            } catch (e) {
+            }
+            foo.__proto__ = arguments;
+        }
+    }
+    bar();
+}
+for (let i=0; i<100; i++) {
+    foo();
+}

Modified: trunk/Source/_javascript_Core/ChangeLog (273610 => 273611)


--- trunk/Source/_javascript_Core/ChangeLog	2021-02-27 01:54:54 UTC (rev 273610)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-02-27 01:58:56 UTC (rev 273611)
@@ -1,3 +1,36 @@
+2021-02-26  Saam Barati  <[email protected]>
+
+        Remove bad assertion of AI ArrayMode state in various "by val" opcodes
+        https://bugs.webkit.org/show_bug.cgi?id=222494
+        <rdar://73613460>
+
+        Reviewed by Filip Pizlo.
+
+        It's invalid to ever assert that AI must have proved something. We've been
+        slowly removing these faulty asserts from the compiler, and this patch
+        removes some more of them. AI is conservative, and it's not guaranteed
+        that it will prove X, even if X must be true.
+        
+        In this particular test case, we are looking at a race between the concurrent
+        compiler thread and the main thread, and the compilation will be thrown away
+        because of a Structure transition.
+        
+        What happened in this particular program is we had a CheckStructure that was
+        proved to exit in an early run of AI, that is not shown to exit during a later
+        run of AI. Because of that, in the earlier AI run, we have some narrower type
+        info (because fewer predecessory type info). This narrower type info allowed
+        us to elide a CheckArray. The later runs don't have this narrower type info,
+        because the CheckStructure doesn't exit. The safety of all of this is
+        guaranteed by the compilation being thrown away because we fired the transition
+        watchpoint from the earlier Structure seen by AI.
+
+        * dfg/DFGSpeculativeJIT.cpp:
+        (JSC::DFG::SpeculativeJIT::compileGetByValOnString):
+        (JSC::DFG::SpeculativeJIT::compilePutByValForFloatTypedArray):
+        (JSC::DFG::SpeculativeJIT::compileGetByValOnDirectArguments):
+        (JSC::DFG::SpeculativeJIT::compileGetByValOnScopedArguments):
+        (JSC::DFG::SpeculativeJIT::compileGetArrayLength):
+
 2021-02-26  Chris Dumez  <[email protected]>
 
         Reduce explicit usage of [objC retain] in WebKit

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (273610 => 273611)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2021-02-27 01:54:54 UTC (rev 273610)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2021-02-27 01:58:56 UTC (rev 273611)
@@ -2362,8 +2362,6 @@
     }
 #endif
 
-    ASSERT(ArrayMode(Array::String, Array::Read).alreadyChecked(m_jit.graph(), node, m_state.forNode(m_graph.child(node, 0))));
-
     // unsigned comparison so we can filter out negative indices and indices that are too large
     m_jit.loadPtr(MacroAssembler::Address(baseReg, JSString::offsetOfValue()), scratchReg);
     JITCompiler::Jump outOfBounds = m_jit.branch32(
@@ -3422,7 +3420,6 @@
     StorageOperand storage(this, m_jit.graph().varArgChild(node, 3));
     GPRReg storageReg = storage.gpr();
     
-    Edge baseUse = m_jit.graph().varArgChild(node, 0);
     Edge valueUse = m_jit.graph().varArgChild(node, 2);
 
     SpeculateDoubleOperand valueOp(this, valueUse);
@@ -3430,8 +3427,6 @@
     FPRReg valueFPR = valueOp.fpr();
     FPRReg scratchFPR = scratch.fpr();
 
-    ASSERT_UNUSED(baseUse, node->arrayMode().alreadyChecked(m_jit.graph(), node, m_state.forNode(baseUse)));
-    
     MacroAssembler::Jump outOfBounds = jumpForTypedArrayOutOfBounds(node, base, property);
     
     switch (elementSize(type)) {
@@ -7616,8 +7611,6 @@
     if (!m_compileOkay)
         return;
     
-    ASSERT(ArrayMode(Array::DirectArguments, Array::Read).alreadyChecked(m_jit.graph(), node, m_state.forNode(m_graph.varArgChild(node, 0))));
-    
     speculationCheck(
         ExoticObjectMode, JSValueSource(), nullptr,
         m_jit.branchTestPtr(
@@ -7661,8 +7654,6 @@
     if (!m_compileOkay)
         return;
     
-    ASSERT(ArrayMode(Array::ScopedArguments, Array::Read).alreadyChecked(m_jit.graph(), node, m_state.forNode(m_graph.varArgChild(node, 0))));
-    
     m_jit.loadPtr(
         MacroAssembler::Address(baseReg, ScopedArguments::offsetOfStorage()), resultRegs.payloadGPR());
 
@@ -7827,8 +7818,6 @@
         if (!m_compileOkay)
             return;
         
-        ASSERT(ArrayMode(Array::DirectArguments, Array::Read).alreadyChecked(m_jit.graph(), node, m_state.forNode(node->child1())));
-        
         speculationCheck(
             ExoticObjectMode, JSValueSource(), nullptr,
             m_jit.branchTestPtr(
@@ -7851,8 +7840,6 @@
         if (!m_compileOkay)
             return;
         
-        ASSERT(ArrayMode(Array::ScopedArguments, Array::Read).alreadyChecked(m_jit.graph(), node, m_state.forNode(node->child1())));
-        
         speculationCheck(
             ExoticObjectMode, JSValueSource(), nullptr,
             m_jit.branchTest8(
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to