Title: [116168] trunk
Revision
116168
Author
[email protected]
Date
2012-05-04 14:18:25 -0700 (Fri, 04 May 2012)

Log Message

DFG should not Flush GetLocal's
https://bugs.webkit.org/show_bug.cgi?id=85663
<rdar://problem/11373600>

Reviewed by Oliver Hunt.

Source/_javascript_Core: 

* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::flushArgument):
(JSC::DFG::ByteCodeParser::handleCall):

LayoutTests: 

* fast/js/dfg-flush-get-local-expected.txt: Added.
* fast/js/dfg-flush-get-local.html: Added.
* fast/js/script-tests/dfg-flush-get-local.js: Added.
(foo):
(fuzz):
(bar):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (116167 => 116168)


--- trunk/LayoutTests/ChangeLog	2012-05-04 21:16:30 UTC (rev 116167)
+++ trunk/LayoutTests/ChangeLog	2012-05-04 21:18:25 UTC (rev 116168)
@@ -1,3 +1,18 @@
+2012-05-04  Filip Pizlo  <[email protected]>
+
+        DFG should not Flush GetLocal's
+        https://bugs.webkit.org/show_bug.cgi?id=85663
+        <rdar://problem/11373600>
+
+        Reviewed by Oliver Hunt.
+
+        * fast/js/dfg-flush-get-local-expected.txt: Added.
+        * fast/js/dfg-flush-get-local.html: Added.
+        * fast/js/script-tests/dfg-flush-get-local.js: Added.
+        (foo):
+        (fuzz):
+        (bar):
+
 2012-05-04  Tony Chang  <[email protected]>
 
         The computed style of flex-item-align should never be auto.

Added: trunk/LayoutTests/fast/js/dfg-flush-get-local-expected.txt (0 => 116168)


--- trunk/LayoutTests/fast/js/dfg-flush-get-local-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/js/dfg-flush-get-local-expected.txt	2012-05-04 21:18:25 UTC (rev 116168)
@@ -0,0 +1,10 @@
+Tests that if we emit a Flush of a GetLocal, we flush the source of the GetLocal.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS result is 500000
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/js/dfg-flush-get-local.html (0 => 116168)


--- trunk/LayoutTests/fast/js/dfg-flush-get-local.html	                        (rev 0)
+++ trunk/LayoutTests/fast/js/dfg-flush-get-local.html	2012-05-04 21:18:25 UTC (rev 116168)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/js/script-tests/dfg-flush-get-local.js (0 => 116168)


--- trunk/LayoutTests/fast/js/script-tests/dfg-flush-get-local.js	                        (rev 0)
+++ trunk/LayoutTests/fast/js/script-tests/dfg-flush-get-local.js	2012-05-04 21:18:25 UTC (rev 116168)
@@ -0,0 +1,24 @@
+description(
+"Tests that if we emit a Flush of a GetLocal, we flush the source of the GetLocal."
+);
+
+function foo(a, b) {
+    return a.f + a.g + b;
+}
+
+function fuzz(a, b) {
+    if (a < b)
+        return a - b;
+    else
+        return b - a;
+}
+
+function bar(a, b) {
+    return foo({f:(a < b ? a - b : b - a), g:a}, b);
+}
+
+var result = 0;
+for (var i = 0; i < 1000; ++i)
+    result += bar(i, 1000 - i);
+
+shouldBe("result", "500000");

Modified: trunk/Source/_javascript_Core/ChangeLog (116167 => 116168)


--- trunk/Source/_javascript_Core/ChangeLog	2012-05-04 21:16:30 UTC (rev 116167)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-05-04 21:18:25 UTC (rev 116168)
@@ -1,3 +1,15 @@
+2012-05-04  Filip Pizlo  <[email protected]>
+
+        DFG should not Flush GetLocal's
+        https://bugs.webkit.org/show_bug.cgi?id=85663
+        <rdar://problem/11373600>
+
+        Reviewed by Oliver Hunt.
+
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::flushArgument):
+        (JSC::DFG::ByteCodeParser::handleCall):
+
 2012-05-04  Allan Sandfeld Jensen  <[email protected]>
 
         Doesn't build with ENABLE_JIT=0 

Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (116167 => 116168)


--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2012-05-04 21:16:30 UTC (rev 116167)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2012-05-04 21:18:25 UTC (rev 116168)
@@ -365,10 +365,19 @@
         
         if (nodeIndex != NoNode) {
             Node& node = m_graph[nodeIndex];
-            if (node.op() == Flush)
+            switch (node.op()) {
+            case Flush:
                 nodeIndex = node.child1().index();
+                break;
+            case GetLocal:
+                nodeIndex = node.child1().index();
+                break;
+            default:
+                break;
+            }
             
-            ASSERT(m_graph[nodeIndex].op() != Flush);
+            ASSERT(m_graph[nodeIndex].op() != Flush
+                   && m_graph[nodeIndex].op() != GetLocal);
             
             // Emit a Flush regardless of whether we already flushed it.
             // This gives us guidance to see that the variable also needs to be flushed
@@ -1033,6 +1042,16 @@
     CallLinkStatus callLinkStatus = CallLinkStatus::computeFor(
         m_inlineStackTop->m_profiledBlock, m_currentIndex);
     
+#if DFG_ENABLE(DEBUG_VERBOSE)
+    dataLog("For call at @%lu bc#%u: ", m_graph.size(), m_currentIndex);
+    if (callLinkStatus.isSet()) {
+        if (callLinkStatus.couldTakeSlowPath())
+            dataLog("could take slow path, ");
+        dataLog("target = %p\n", callLinkStatus.callTarget());
+    } else
+        dataLog("not set.\n");
+#endif
+    
     if (m_graph.isFunctionConstant(callTarget))
         callType = ConstantFunction;
     else if (callLinkStatus.isSet() && !callLinkStatus.couldTakeSlowPath()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to