Title: [271829] branches/safari-611-branch/Source/_javascript_Core
Revision
271829
Author
alanc...@apple.com
Date
2021-01-25 14:11:37 -0800 (Mon, 25 Jan 2021)

Log Message

Cherry-pick r271544. rdar://problem/73471591

    [JSC] Clean up DFGPreciseLocalClobberize to avoid duplicate code
    https://bugs.webkit.org/show_bug.cgi?id=220670

    Reviewed by Filip Pizlo.

    This patch cleans up DFGPreciseLocalClobberize by extracting code to lambda to remove duplicate code.

    * dfg/DFGPreciseLocalClobberize.h:
    (JSC::DFG::PreciseLocalClobberizeAdaptor::readTop):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271544 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-611-branch/Source/_javascript_Core/ChangeLog (271828 => 271829)


--- branches/safari-611-branch/Source/_javascript_Core/ChangeLog	2021-01-25 22:11:34 UTC (rev 271828)
+++ branches/safari-611-branch/Source/_javascript_Core/ChangeLog	2021-01-25 22:11:37 UTC (rev 271829)
@@ -1,3 +1,31 @@
+2021-01-25  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r271544. rdar://problem/73471591
+
+    [JSC] Clean up DFGPreciseLocalClobberize to avoid duplicate code
+    https://bugs.webkit.org/show_bug.cgi?id=220670
+    
+    Reviewed by Filip Pizlo.
+    
+    This patch cleans up DFGPreciseLocalClobberize by extracting code to lambda to remove duplicate code.
+    
+    * dfg/DFGPreciseLocalClobberize.h:
+    (JSC::DFG::PreciseLocalClobberizeAdaptor::readTop):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-01-15  Yusuke Suzuki  <ysuz...@apple.com>
+
+            [JSC] Clean up DFGPreciseLocalClobberize to avoid duplicate code
+            https://bugs.webkit.org/show_bug.cgi?id=220670
+
+            Reviewed by Filip Pizlo.
+
+            This patch cleans up DFGPreciseLocalClobberize by extracting code to lambda to remove duplicate code.
+
+            * dfg/DFGPreciseLocalClobberize.h:
+            (JSC::DFG::PreciseLocalClobberizeAdaptor::readTop):
+
 2021-01-13  Russell Epstein  <repst...@apple.com>
 
         Revert r270664. rdar://problem/73165685

Modified: branches/safari-611-branch/Source/_javascript_Core/dfg/DFGPreciseLocalClobberize.h (271828 => 271829)


--- branches/safari-611-branch/Source/_javascript_Core/dfg/DFGPreciseLocalClobberize.h	2021-01-25 22:11:34 UTC (rev 271828)
+++ branches/safari-611-branch/Source/_javascript_Core/dfg/DFGPreciseLocalClobberize.h	2021-01-25 22:11:37 UTC (rev 271829)
@@ -105,6 +105,30 @@
     
     void readTop()
     {
+        auto readWorld = [&] (Node* node) {
+            // All of the outermost arguments, except this, are read in sloppy mode.
+            if (!m_graph.m_codeBlock->ownerExecutable()->isInStrictContext()) {
+                for (unsigned i = m_graph.m_codeBlock->numParameters(); i--;)
+                    m_read(virtualRegisterForArgumentIncludingThis(i));
+            }
+
+            // The stack header is read.
+            for (unsigned i = 0; i < CallFrameSlot::thisArgument; ++i)
+                m_read(VirtualRegister(i));
+
+            // Read all of the inline arguments and call frame headers that we didn't already capture.
+            for (InlineCallFrame* inlineCallFrame = node->origin.semantic.inlineCallFrame(); inlineCallFrame; inlineCallFrame = inlineCallFrame->getCallerInlineFrameSkippingTailCalls()) {
+                if (!inlineCallFrame->isInStrictContext()) {
+                    for (unsigned i = inlineCallFrame->argumentsWithFixup.size(); i--;)
+                        m_read(VirtualRegister(inlineCallFrame->stackOffset + virtualRegisterForArgumentIncludingThis(i).offset()));
+                }
+                if (inlineCallFrame->isClosureCall)
+                    m_read(VirtualRegister(inlineCallFrame->stackOffset + CallFrameSlot::callee));
+                if (inlineCallFrame->isVarargs())
+                    m_read(VirtualRegister(inlineCallFrame->stackOffset + CallFrameSlot::argumentCountIncludingThis));
+            }
+        };
+
         auto readFrame = [&] (InlineCallFrame* inlineCallFrame, unsigned numberOfArgumentsToSkip) {
             if (!inlineCallFrame) {
                 // Read the outermost arguments and argument count.
@@ -122,8 +146,10 @@
 
         auto readSpread = [&] (Node* spread) {
             ASSERT(spread->op() == Spread || spread->op() == PhantomSpread);
-            if (!spread->child1()->isPhantomAllocation())
+            if (!spread->child1()->isPhantomAllocation()) {
+                readWorld(spread);
                 return;
+            }
 
             ASSERT(spread->child1()->op() == PhantomCreateRest || spread->child1()->op() == PhantomNewArrayBuffer);
             if (spread->child1()->op() == PhantomNewArrayBuffer) {
@@ -238,27 +264,7 @@
         }
             
         default: {
-            // All of the outermost arguments, except this, are read in sloppy mode.
-            if (!m_graph.m_codeBlock->ownerExecutable()->isInStrictContext()) {
-                for (unsigned i = m_graph.m_codeBlock->numParameters(); i--;)
-                    m_read(virtualRegisterForArgumentIncludingThis(i));
-            }
-        
-            // The stack header is read.
-            for (unsigned i = 0; i < CallFrameSlot::thisArgument; ++i)
-                m_read(VirtualRegister(i));
-        
-            // Read all of the inline arguments and call frame headers that we didn't already capture.
-            for (InlineCallFrame* inlineCallFrame = m_node->origin.semantic.inlineCallFrame(); inlineCallFrame; inlineCallFrame = inlineCallFrame->getCallerInlineFrameSkippingTailCalls()) {
-                if (!inlineCallFrame->isInStrictContext()) {
-                    for (unsigned i = inlineCallFrame->argumentsWithFixup.size(); i--;)
-                        m_read(VirtualRegister(inlineCallFrame->stackOffset + virtualRegisterForArgumentIncludingThis(i).offset()));
-                }
-                if (inlineCallFrame->isClosureCall)
-                    m_read(VirtualRegister(inlineCallFrame->stackOffset + CallFrameSlot::callee));
-                if (inlineCallFrame->isVarargs())
-                    m_read(VirtualRegister(inlineCallFrame->stackOffset + CallFrameSlot::argumentCountIncludingThis));
-            }
+            readWorld(m_node);
             break;
         } }
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to