Title: [154217] trunk
Revision
154217
Author
[email protected]
Date
2013-08-16 22:36:32 -0700 (Fri, 16 Aug 2013)

Log Message

DFG optimizes out strict mode arguments tear off
https://bugs.webkit.org/show_bug.cgi?id=119504

Source/_javascript_Core: 

Reviewed by Mark Hahnenberg and Oliver Hunt.
        
Don't do the optimization for strict mode.

* dfg/DFGArgumentsSimplificationPhase.cpp:
(JSC::DFG::ArgumentsSimplificationPhase::run):
(JSC::DFG::ArgumentsSimplificationPhase::pruneObviousArgumentCreations):

LayoutTests: 

Reviewed by Mark Hahnenberg and Oliver Hunt.

* fast/js/dfg-arguments-strict-mode-expected.txt: Added.
* fast/js/dfg-arguments-strict-mode.html: Added.
* fast/js/jsc-test-list:
* fast/js/script-tests/dfg-arguments-strict-mode.js: Added.
(f):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (154216 => 154217)


--- trunk/LayoutTests/ChangeLog	2013-08-17 02:50:48 UTC (rev 154216)
+++ trunk/LayoutTests/ChangeLog	2013-08-17 05:36:32 UTC (rev 154217)
@@ -1,3 +1,16 @@
+2013-08-16  Filip Pizlo  <[email protected]>
+
+        DFG optimizes out strict mode arguments tear off
+        https://bugs.webkit.org/show_bug.cgi?id=119504
+
+        Reviewed by Mark Hahnenberg and Oliver Hunt.
+
+        * fast/js/dfg-arguments-strict-mode-expected.txt: Added.
+        * fast/js/dfg-arguments-strict-mode.html: Added.
+        * fast/js/jsc-test-list:
+        * fast/js/script-tests/dfg-arguments-strict-mode.js: Added.
+        (f):
+
 2013-08-16  Ryosuke Niwa  <[email protected]>
 
         <https://webkit.org/b/119915> REGRESSION(r154144): ASSERTION FAILED: m_history->provisionalItem() == m_requestedHistoryItem.get()

Added: trunk/LayoutTests/fast/js/dfg-arguments-strict-mode-expected.txt (0 => 154217)


--- trunk/LayoutTests/fast/js/dfg-arguments-strict-mode-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/js/dfg-arguments-strict-mode-expected.txt	2013-08-17 05:36:32 UTC (rev 154217)
@@ -0,0 +1,10 @@
+Tests what happens when you use arguments in strict mode and present the DFG with a tempting optimization opportunity.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS f(1) is 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/js/dfg-arguments-strict-mode.html (0 => 154217)


--- trunk/LayoutTests/fast/js/dfg-arguments-strict-mode.html	                        (rev 0)
+++ trunk/LayoutTests/fast/js/dfg-arguments-strict-mode.html	2013-08-17 05:36:32 UTC (rev 154217)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/fast/js/jsc-test-list (154216 => 154217)


--- trunk/LayoutTests/fast/js/jsc-test-list	2013-08-17 02:50:48 UTC (rev 154216)
+++ trunk/LayoutTests/fast/js/jsc-test-list	2013-08-17 05:36:32 UTC (rev 154217)
@@ -86,6 +86,7 @@
 fast/js/dfg-arguments-osr-exit-multiple-blocks
 fast/js/dfg-arguments-osr-exit-multiple-blocks-before-exit
 fast/js/dfg-arguments-out-of-bounds
+fast/js/dfg-arguments-strict-mode
 fast/js/dfg-arguments-unexpected-escape
 fast/js/dfg-arith-add-overflow-check-elimination-predicted-but-not-proven-int
 fast/js/dfg-arith-add-overflow-check-elimination-tower-of-large-numbers

Added: trunk/LayoutTests/fast/js/script-tests/dfg-arguments-strict-mode.js (0 => 154217)


--- trunk/LayoutTests/fast/js/script-tests/dfg-arguments-strict-mode.js	                        (rev 0)
+++ trunk/LayoutTests/fast/js/script-tests/dfg-arguments-strict-mode.js	2013-08-17 05:36:32 UTC (rev 154217)
@@ -0,0 +1,17 @@
+description(
+"Tests what happens when you use arguments in strict mode and present the DFG with a tempting optimization opportunity."
+);
+
+function f(a) {
+    "use strict";
+    a = 5;
+    return arguments[0];
+}
+
+noInline(f);
+
+while (!dfgCompiled({f:f}))
+    f(1);
+
+shouldBe("f(1)", "1");
+

Modified: trunk/Source/_javascript_Core/ChangeLog (154216 => 154217)


--- trunk/Source/_javascript_Core/ChangeLog	2013-08-17 02:50:48 UTC (rev 154216)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-08-17 05:36:32 UTC (rev 154217)
@@ -1,3 +1,16 @@
+2013-08-16  Filip Pizlo  <[email protected]>
+
+        DFG optimizes out strict mode arguments tear off
+        https://bugs.webkit.org/show_bug.cgi?id=119504
+
+        Reviewed by Mark Hahnenberg and Oliver Hunt.
+        
+        Don't do the optimization for strict mode.
+
+        * dfg/DFGArgumentsSimplificationPhase.cpp:
+        (JSC::DFG::ArgumentsSimplificationPhase::run):
+        (JSC::DFG::ArgumentsSimplificationPhase::pruneObviousArgumentCreations):
+
 2013-08-16  Benjamin Poulain  <[email protected]>
 
         [JSC] x86: improve code generation for xxxTest32

Modified: trunk/Source/_javascript_Core/dfg/DFGArgumentsSimplificationPhase.cpp (154216 => 154217)


--- trunk/Source/_javascript_Core/dfg/DFGArgumentsSimplificationPhase.cpp	2013-08-17 02:50:48 UTC (rev 154216)
+++ trunk/Source/_javascript_Core/dfg/DFGArgumentsSimplificationPhase.cpp	2013-08-17 05:36:32 UTC (rev 154217)
@@ -122,12 +122,9 @@
         bool changed = false;
         
         // Record which arguments are known to escape no matter what.
-        for (unsigned i = codeBlock()->inlineCallFrames().size(); i--;) {
-            InlineCallFrame* inlineCallFrame = &codeBlock()->inlineCallFrames()[i];
-            if (m_graph.m_executablesWhoseArgumentsEscaped.contains(
-                    m_graph.executableFor(inlineCallFrame)))
-                m_createsArguments.add(inlineCallFrame);
-        }
+        for (unsigned i = codeBlock()->inlineCallFrames().size(); i--;)
+            pruneObviousArgumentCreations(&codeBlock()->inlineCallFrames()[i]);
+        pruneObviousArgumentCreations(0); // the machine call frame.
         
         // Create data for variable access datas that we will want to analyze.
         for (unsigned i = m_graph.m_variableAccessData.size(); i--;) {
@@ -694,6 +691,14 @@
             NullableHashTraits<VariableAccessData*> > m_argumentsAliasing;
     HashSet<VariableAccessData*> m_isLive;
 
+    void pruneObviousArgumentCreations(InlineCallFrame* inlineCallFrame)
+    {
+        ScriptExecutable* executable = m_graph.executableFor(inlineCallFrame);
+        if (m_graph.m_executablesWhoseArgumentsEscaped.contains(executable)
+            || executable->isStrictMode())
+            m_createsArguments.add(inlineCallFrame);
+    }
+    
     void observeBadArgumentsUse(Node* node)
     {
         if (!node)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to