Title: [213856] trunk
Revision
213856
Author
[email protected]
Date
2017-03-13 11:00:25 -0700 (Mon, 13 Mar 2017)

Log Message

FTL should not flush strict arguments unless it really needs to
https://bugs.webkit.org/show_bug.cgi?id=169519

Reviewed by Mark Lam.
        
JSTests:

This benchmark runs 3.5x faster thanks to this patch.

* microbenchmarks/strict-arguments-no-escape.js: Added.
(foo):
(bar):
(baz):

Source/_javascript_Core:

This is a refinement that we should have done ages ago. This kills some pointless PutStacks
in DFG SSA IR. It can sometimes unlock other optimizations.

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

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (213855 => 213856)


--- trunk/JSTests/ChangeLog	2017-03-13 17:54:21 UTC (rev 213855)
+++ trunk/JSTests/ChangeLog	2017-03-13 18:00:25 UTC (rev 213856)
@@ -1,3 +1,17 @@
+2017-03-11  Filip Pizlo  <[email protected]>
+
+        FTL should not flush strict arguments unless it really needs to
+        https://bugs.webkit.org/show_bug.cgi?id=169519
+
+        Reviewed by Mark Lam.
+        
+        This benchmark runs 3.5x faster thanks to this patch.
+
+        * microbenchmarks/strict-arguments-no-escape.js: Added.
+        (foo):
+        (bar):
+        (baz):
+
 2017-03-13  Caio Lima  <[email protected]>
 
         [JSC] It should be possible create a label named let when parsing Statement in non strict mode

Added: trunk/JSTests/microbenchmarks/strict-arguments-no-escape.js (0 => 213856)


--- trunk/JSTests/microbenchmarks/strict-arguments-no-escape.js	                        (rev 0)
+++ trunk/JSTests/microbenchmarks/strict-arguments-no-escape.js	2017-03-13 18:00:25 UTC (rev 213856)
@@ -0,0 +1,26 @@
+"use strict";
+
+function foo()
+{
+}
+
+noInline(foo);
+
+function bar(o)
+{
+    foo();
+    return o.f.f.f.f.f;
+}
+
+function baz()
+{
+    for (var i = 0; i < 100; ++i) {
+        if (bar({f: {f: {f: {f: {f: 42}}}}}) != 42)
+            throw "Error: bad result: " + result;
+    }
+}
+
+noInline(baz);
+
+for (var i = 0; i < 20000; ++i)
+    baz();

Modified: trunk/Source/_javascript_Core/ChangeLog (213855 => 213856)


--- trunk/Source/_javascript_Core/ChangeLog	2017-03-13 17:54:21 UTC (rev 213855)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-03-13 18:00:25 UTC (rev 213856)
@@ -1,3 +1,16 @@
+2017-03-11  Filip Pizlo  <[email protected]>
+
+        FTL should not flush strict arguments unless it really needs to
+        https://bugs.webkit.org/show_bug.cgi?id=169519
+
+        Reviewed by Mark Lam.
+        
+        This is a refinement that we should have done ages ago. This kills some pointless PutStacks
+        in DFG SSA IR. It can sometimes unlock other optimizations.
+
+        * dfg/DFGPreciseLocalClobberize.h:
+        (JSC::DFG::PreciseLocalClobberizeAdaptor::readTop):
+
 2017-03-13  Caio Lima  <[email protected]>
 
         [JSC] It should be possible create a label named let when parsing Statement in non strict mode

Modified: trunk/Source/_javascript_Core/dfg/DFGPreciseLocalClobberize.h (213855 => 213856)


--- trunk/Source/_javascript_Core/dfg/DFGPreciseLocalClobberize.h	2017-03-13 17:54:21 UTC (rev 213855)
+++ trunk/Source/_javascript_Core/dfg/DFGPreciseLocalClobberize.h	2017-03-13 18:00:25 UTC (rev 213856)
@@ -197,9 +197,11 @@
 
             
         default: {
-            // All of the outermost arguments, except this, are definitely read.
-            for (unsigned i = m_graph.m_codeBlock->numParameters(); i-- > 1;)
-                m_read(virtualRegisterForArgument(i));
+            // All of the outermost arguments, except this, are read in sloppy mode.
+            if (!m_graph.m_codeBlock->isStrictMode()) {
+                for (unsigned i = m_graph.m_codeBlock->numParameters(); i-- > 1;)
+                    m_read(virtualRegisterForArgument(i));
+            }
         
             // The stack header is read.
             for (unsigned i = 0; i < CallFrameSlot::thisArgument; ++i)
@@ -207,8 +209,10 @@
         
             // 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()) {
-                for (unsigned i = inlineCallFrame->arguments.size(); i-- > 1;)
-                    m_read(VirtualRegister(inlineCallFrame->stackOffset + virtualRegisterForArgument(i).offset()));
+                if (!inlineCallFrame->isStrictMode()) {
+                    for (unsigned i = inlineCallFrame->arguments.size(); i-- > 1;)
+                        m_read(VirtualRegister(inlineCallFrame->stackOffset + virtualRegisterForArgument(i).offset()));
+                }
                 if (inlineCallFrame->isClosureCall)
                     m_read(VirtualRegister(inlineCallFrame->stackOffset + CallFrameSlot::callee));
                 if (inlineCallFrame->isVarargs())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to