Title: [274638] releases/WebKitGTK/webkit-2.30/Source/_javascript_Core
Revision
274638
Author
carlo...@webkit.org
Date
2021-03-18 04:04:40 -0700 (Thu, 18 Mar 2021)

Log Message

Merge r271544 - [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):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.30/Source/_javascript_Core/ChangeLog (274637 => 274638)


--- releases/WebKitGTK/webkit-2.30/Source/_javascript_Core/ChangeLog	2021-03-18 11:04:36 UTC (rev 274637)
+++ releases/WebKitGTK/webkit-2.30/Source/_javascript_Core/ChangeLog	2021-03-18 11:04:40 UTC (rev 274638)
@@ -1,3 +1,15 @@
+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):
+
 2020-12-16  Tadeu Zagallo  <tzaga...@apple.com>
 
         propertyNameEnumerator must check it can still take the fast path after getGenericPropertyNames

Modified: releases/WebKitGTK/webkit-2.30/Source/_javascript_Core/dfg/DFGPreciseLocalClobberize.h (274637 => 274638)


--- releases/WebKitGTK/webkit-2.30/Source/_javascript_Core/dfg/DFGPreciseLocalClobberize.h	2021-03-18 11:04:36 UTC (rev 274637)
+++ releases/WebKitGTK/webkit-2.30/Source/_javascript_Core/dfg/DFGPreciseLocalClobberize.h	2021-03-18 11:04:40 UTC (rev 274638)
@@ -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