Title: [285850] trunk
Revision
285850
Author
[email protected]
Date
2021-11-15 19:48:45 -0800 (Mon, 15 Nov 2021)

Log Message

[JSC] Use operation path when PutByVal child1 is not speculated as a Cell
https://bugs.webkit.org/show_bug.cgi?id=233147
rdar://85344310

Reviewed by Mark Lam.

JSTests:

* stress/put-by-val-slow-dfg.js: Added.
(foo):

Source/_javascript_Core:

r285530 removed non CellUse / non KnownCellUse case incorrectly (when we do not have Cell edge,
then we should use the slow operation path). This patch recovers it.

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compilePutByVal):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compilePutByVal):

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (285849 => 285850)


--- trunk/JSTests/ChangeLog	2021-11-16 03:20:12 UTC (rev 285849)
+++ trunk/JSTests/ChangeLog	2021-11-16 03:48:45 UTC (rev 285850)
@@ -1,3 +1,14 @@
+2021-11-15  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Use operation path when PutByVal child1 is not speculated as a Cell
+        https://bugs.webkit.org/show_bug.cgi?id=233147
+        rdar://85344310
+
+        Reviewed by Mark Lam.
+
+        * stress/put-by-val-slow-dfg.js: Added.
+        (foo):
+
 2021-11-15  Angelos Oikonomopoulos  <[email protected]>
 
         Skip tests newly-failing on mips

Added: trunk/JSTests/stress/put-by-val-slow-dfg.js (0 => 285850)


--- trunk/JSTests/stress/put-by-val-slow-dfg.js	                        (rev 0)
+++ trunk/JSTests/stress/put-by-val-slow-dfg.js	2021-11-16 03:48:45 UTC (rev 285850)
@@ -0,0 +1,9 @@
+function foo(a0) {
+  a0[0] = undefined;
+}
+
+for (let i = 0; i < 100000; i++) {
+  foo(0);
+  foo([]);
+  foo('');
+}

Modified: trunk/Source/_javascript_Core/ChangeLog (285849 => 285850)


--- trunk/Source/_javascript_Core/ChangeLog	2021-11-16 03:20:12 UTC (rev 285849)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-11-16 03:48:45 UTC (rev 285850)
@@ -1,3 +1,19 @@
+2021-11-15  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Use operation path when PutByVal child1 is not speculated as a Cell
+        https://bugs.webkit.org/show_bug.cgi?id=233147
+        rdar://85344310
+
+        Reviewed by Mark Lam.
+
+        r285530 removed non CellUse / non KnownCellUse case incorrectly (when we do not have Cell edge,
+        then we should use the slow operation path). This patch recovers it.
+
+        * dfg/DFGSpeculativeJIT.cpp:
+        (JSC::DFG::SpeculativeJIT::compilePutByVal):
+        * ftl/FTLLowerDFGToB3.cpp:
+        (JSC::FTL::DFG::LowerDFGToB3::compilePutByVal):
+
 2021-11-14  Yusuke Suzuki  <[email protected]>
 
         [JSC] Use CallLinkInfo in LLInt

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (285849 => 285850)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2021-11-16 03:20:12 UTC (rev 285849)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2021-11-16 03:48:45 UTC (rev 285850)
@@ -2626,6 +2626,11 @@
 void SpeculativeJIT::compilePutByVal(Node* node)
 {
     ArrayMode arrayMode = node->arrayMode().modeForPut();
+    Edge child1 = m_jit.graph().varArgChild(node, 0);
+    Edge child2 = m_jit.graph().varArgChild(node, 1);
+    Edge child3 = m_jit.graph().varArgChild(node, 2);
+    Edge child4 = m_jit.graph().varArgChild(node, 3);
+
     switch (arrayMode.type()) {
     case Array::AnyTypedArray:
     case Array::ForceExit:
@@ -2648,22 +2653,22 @@
 #endif
     case Array::Generic: {
         DFG_ASSERT(m_jit.graph(), node, node->op() == PutByVal || node->op() == PutByValDirect, node->op());
-        if (m_graph.m_slowPutByVal.contains(node)) {
-            if (m_jit.graph().varArgChild(node, 0).useKind() == CellUse) {
-                if (m_jit.graph().varArgChild(node, 1).useKind() == StringUse) {
+        if (m_graph.m_slowPutByVal.contains(node) || (child1.useKind() != CellUse && child1.useKind() != KnownCellUse)) {
+            if (child1.useKind() == CellUse || child1.useKind() == KnownCellUse) {
+                if (child2.useKind() == StringUse) {
                     compilePutByValForCellWithString(node);
                     break;
                 }
 
-                if (m_jit.graph().varArgChild(node, 1).useKind() == SymbolUse) {
+                if (child2.useKind() == SymbolUse) {
                     compilePutByValForCellWithSymbol(node);
                     break;
                 }
             }
 
-            JSValueOperand base(this, m_jit.graph().varArgChild(node, 0));
-            JSValueOperand property(this, m_jit.graph().varArgChild(node, 1));
-            JSValueOperand value(this, m_jit.graph().varArgChild(node, 2));
+            JSValueOperand base(this, child1);
+            JSValueOperand property(this, child2);
+            JSValueOperand value(this, child3);
             JSValueRegs baseRegs = base.jsValueRegs();
             JSValueRegs propertyRegs = property.jsValueRegs();
             JSValueRegs valueRegs = value.jsValueRegs();
@@ -2679,9 +2684,9 @@
             break;
         }
 
-        JSValueOperand base(this, m_jit.graph().varArgChild(node, 0), ManualOperandSpeculation);
-        JSValueOperand property(this, m_jit.graph().varArgChild(node, 1), ManualOperandSpeculation);
-        JSValueOperand value(this, m_jit.graph().varArgChild(node, 2), ManualOperandSpeculation);
+        JSValueOperand base(this, child1, ManualOperandSpeculation);
+        JSValueOperand property(this, child2, ManualOperandSpeculation);
+        JSValueOperand value(this, child3, ManualOperandSpeculation);
         JSValueRegs baseRegs = base.jsValueRegs();
         JSValueRegs propertyRegs = property.jsValueRegs();
         JSValueRegs valueRegs = value.jsValueRegs();
@@ -2693,9 +2698,9 @@
             stubInfoGPR = stubInfo.gpr();
         }
 
-        speculate(node, m_jit.graph().varArgChild(node, 0));
-        speculate(node, m_jit.graph().varArgChild(node, 1));
-        speculate(node, m_jit.graph().varArgChild(node, 2));
+        speculate(node, child1);
+        speculate(node, child2);
+        speculate(node, child3);
 
         CodeOrigin codeOrigin = node->origin.semantic;
         CallSiteIndex callSite = m_jit.recordCallSiteAndGenerateExceptionHandlingOSRExitIfNeeded(codeOrigin, m_stream->size());
@@ -2707,11 +2712,11 @@
             m_jit.codeBlock(), &m_jit.jitCode()->common.m_stubInfos, JITType::DFGJIT, codeOrigin, callSite, AccessType::PutByVal, usedRegisters,
             baseRegs, propertyRegs, valueRegs, InvalidGPRReg, stubInfoGPR);
 
-        if (m_state.forNode(m_jit.graph().varArgChild(node, 1)).isType(SpecString))
+        if (m_state.forNode(child2).isType(SpecString))
             gen.stubInfo()->propertyIsString = true;
-        else if (m_state.forNode(m_jit.graph().varArgChild(node, 1)).isType(SpecInt32Only))
+        else if (m_state.forNode(child2).isType(SpecInt32Only))
             gen.stubInfo()->propertyIsInt32 = true;
-        else if (m_state.forNode(m_jit.graph().varArgChild(node, 1)).isType(SpecSymbol))
+        else if (m_state.forNode(child2).isType(SpecSymbol))
             gen.stubInfo()->propertyIsSymbol = true;
 
         gen.generateFastPath(m_jit);
@@ -2739,7 +2744,7 @@
         break;
     }
     case Array::Int32: {
-        speculateInt32(m_jit.graph().varArgChild(node, 2));
+        speculateInt32(child3);
         FALLTHROUGH;
     }
     case Array::Contiguous: {
@@ -2752,10 +2757,10 @@
     }
     case Array::ArrayStorage:
     case Array::SlowPutArrayStorage: {
-        SpeculateCellOperand base(this, m_jit.graph().varArgChild(node, 0));
-        SpeculateStrictInt32Operand property(this, m_jit.graph().varArgChild(node, 1));
-        JSValueOperand value(this, m_jit.graph().varArgChild(node, 2));
-        StorageOperand storage(this, m_jit.graph().varArgChild(node, 3));
+        SpeculateCellOperand base(this, child1);
+        SpeculateStrictInt32Operand property(this, child2);
+        JSValueOperand value(this, child3);
+        StorageOperand storage(this, child4);
 
         GPRReg baseReg = base.gpr();
         GPRReg propertyReg = property.gpr();

Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp (285849 => 285850)


--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp	2021-11-16 03:20:12 UTC (rev 285849)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp	2021-11-16 03:48:45 UTC (rev 285850)
@@ -5720,7 +5720,7 @@
         case Array::BigUint64Array:
         case Array::Generic: {
             if (m_graph.m_slowPutByVal.contains(m_node) || (child1.useKind() != CellUse && child1.useKind() != KnownCellUse)) {
-                if (child1.useKind() == CellUse) {
+                if (child1.useKind() == CellUse || child1.useKind() == KnownCellUse) {
                     V_JITOperation_GCCJ operation = nullptr;
                     if (child2.useKind() == StringUse) {
                         if (m_node->op() == PutByValDirect) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to