Title: [151876] branches/dfgFourthTier
Revision
151876
Author
[email protected]
Date
2013-06-21 22:56:14 -0700 (Fri, 21 Jun 2013)

Log Message

fourthTier: DFG should CSE MakeRope
https://bugs.webkit.org/show_bug.cgi?id=117905

Source/_javascript_Core: 

Reviewed by Geoffrey Garen.
        
Adds MakeRope to the CSE phase and removes the comment that says that
we could do it but aren't doing it.
        
Also fixed SpeculatedType dumping so that if you have a Cell type then
it just prints "Cell" and if you just have Object then it just prints
"Object", instead of printing the long list of types.

* bytecode/SpeculatedType.cpp:
(JSC::dumpSpeculation):
* dfg/DFGCSEPhase.cpp:
(JSC::DFG::CSEPhase::performNodeCSE):

LayoutTests: 

Reviewed by Geoffrey Garen.
        
This benchmark speeds up by 50%.

* fast/js/regress/make-rope-cse-expected.txt: Added.
* fast/js/regress/make-rope-cse.html: Added.
* fast/js/regress/script-tests/make-rope-cse.js: Added.
(foo):

Modified Paths

Added Paths

Diff

Modified: branches/dfgFourthTier/LayoutTests/ChangeLog (151875 => 151876)


--- branches/dfgFourthTier/LayoutTests/ChangeLog	2013-06-22 02:36:13 UTC (rev 151875)
+++ branches/dfgFourthTier/LayoutTests/ChangeLog	2013-06-22 05:56:14 UTC (rev 151876)
@@ -1,5 +1,19 @@
 2013-06-21  Filip Pizlo  <[email protected]>
 
+        fourthTier: DFG should CSE MakeRope
+        https://bugs.webkit.org/show_bug.cgi?id=117905
+
+        Reviewed by Geoffrey Garen.
+        
+        This benchmark speeds up by 50%.
+
+        * fast/js/regress/make-rope-cse-expected.txt: Added.
+        * fast/js/regress/make-rope-cse.html: Added.
+        * fast/js/regress/script-tests/make-rope-cse.js: Added.
+        (foo):
+
+2013-06-21  Filip Pizlo  <[email protected]>
+
         fourthTier: DFG should't exit just because it GetByVal'd a big character
         https://bugs.webkit.org/show_bug.cgi?id=117899
 

Added: branches/dfgFourthTier/LayoutTests/fast/js/regress/make-rope-cse-expected.txt (0 => 151876)


--- branches/dfgFourthTier/LayoutTests/fast/js/regress/make-rope-cse-expected.txt	                        (rev 0)
+++ branches/dfgFourthTier/LayoutTests/fast/js/regress/make-rope-cse-expected.txt	2013-06-22 05:56:14 UTC (rev 151876)
@@ -0,0 +1,10 @@
+JSRegress/make-rope-cse
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS no exception thrown
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/dfgFourthTier/LayoutTests/fast/js/regress/make-rope-cse.html (0 => 151876)


--- branches/dfgFourthTier/LayoutTests/fast/js/regress/make-rope-cse.html	                        (rev 0)
+++ branches/dfgFourthTier/LayoutTests/fast/js/regress/make-rope-cse.html	2013-06-22 05:56:14 UTC (rev 151876)
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+</body>
+</html>

Added: branches/dfgFourthTier/LayoutTests/fast/js/regress/script-tests/make-rope-cse.js (0 => 151876)


--- branches/dfgFourthTier/LayoutTests/fast/js/regress/script-tests/make-rope-cse.js	                        (rev 0)
+++ branches/dfgFourthTier/LayoutTests/fast/js/regress/script-tests/make-rope-cse.js	2013-06-22 05:56:14 UTC (rev 151876)
@@ -0,0 +1,13 @@
+function foo(a, b) {
+    var result = "";
+    for (var i = 0; i < 100000; ++i) {
+        result += a + b;
+        result += a + b;
+        result += a + b;
+    }
+    return result;
+}
+
+var result = foo("foo", "bar");
+if (result.length != 1800000)
+    throw "Bad result: " + result.length;

Modified: branches/dfgFourthTier/Source/_javascript_Core/ChangeLog (151875 => 151876)


--- branches/dfgFourthTier/Source/_javascript_Core/ChangeLog	2013-06-22 02:36:13 UTC (rev 151875)
+++ branches/dfgFourthTier/Source/_javascript_Core/ChangeLog	2013-06-22 05:56:14 UTC (rev 151876)
@@ -1,5 +1,24 @@
 2013-06-21  Filip Pizlo  <[email protected]>
 
+        fourthTier: DFG should CSE MakeRope
+        https://bugs.webkit.org/show_bug.cgi?id=117905
+
+        Reviewed by Geoffrey Garen.
+        
+        Adds MakeRope to the CSE phase and removes the comment that says that
+        we could do it but aren't doing it.
+        
+        Also fixed SpeculatedType dumping so that if you have a Cell type then
+        it just prints "Cell" and if you just have Object then it just prints
+        "Object", instead of printing the long list of types.
+
+        * bytecode/SpeculatedType.cpp:
+        (JSC::dumpSpeculation):
+        * dfg/DFGCSEPhase.cpp:
+        (JSC::DFG::CSEPhase::performNodeCSE):
+
+2013-06-21  Filip Pizlo  <[email protected]>
+
         fourthTier: DFG should't exit just because it GetByVal'd a big character
         https://bugs.webkit.org/show_bug.cgi?id=117899
 

Modified: branches/dfgFourthTier/Source/_javascript_Core/bytecode/SpeculatedType.cpp (151875 => 151876)


--- branches/dfgFourthTier/Source/_javascript_Core/bytecode/SpeculatedType.cpp	2013-06-22 02:36:13 UTC (rev 151875)
+++ branches/dfgFourthTier/Source/_javascript_Core/bytecode/SpeculatedType.cpp	2013-06-22 05:56:14 UTC (rev 151876)
@@ -51,91 +51,99 @@
     
     bool isTop = true;
     
-    if (value & SpecCellOther)
-        myOut.print("Othercell");
-    else
-        isTop = false;
+    if ((value & SpecCell) == SpecCell)
+        myOut.print("Cell");
+    else {
+        if ((value & SpecObject) == SpecObject)
+            myOut.print("Object");
+        else {
+            if (value & SpecCellOther)
+                myOut.print("Othercell");
+            else
+                isTop = false;
     
-    if (value & SpecObjectOther)
-        myOut.print("Otherobj");
-    else
-        isTop = false;
+            if (value & SpecObjectOther)
+                myOut.print("Otherobj");
+            else
+                isTop = false;
     
-    if (value & SpecFinalObject)
-        myOut.print("Final");
-    else
-        isTop = false;
+            if (value & SpecFinalObject)
+                myOut.print("Final");
+            else
+                isTop = false;
 
-    if (value & SpecArray)
-        myOut.print("Array");
-    else
-        isTop = false;
+            if (value & SpecArray)
+                myOut.print("Array");
+            else
+                isTop = false;
     
-    if (value & SpecInt8Array)
-        myOut.print("Int8array");
-    else
-        isTop = false;
+            if (value & SpecInt8Array)
+                myOut.print("Int8array");
+            else
+                isTop = false;
     
-    if (value & SpecInt16Array)
-        myOut.print("Int16array");
-    else
-        isTop = false;
+            if (value & SpecInt16Array)
+                myOut.print("Int16array");
+            else
+                isTop = false;
     
-    if (value & SpecInt32Array)
-        myOut.print("Int32array");
-    else
-        isTop = false;
+            if (value & SpecInt32Array)
+                myOut.print("Int32array");
+            else
+                isTop = false;
     
-    if (value & SpecUint8Array)
-        myOut.print("Uint8array");
-    else
-        isTop = false;
+            if (value & SpecUint8Array)
+                myOut.print("Uint8array");
+            else
+                isTop = false;
 
-    if (value & SpecUint8ClampedArray)
-        myOut.print("Uint8clampedarray");
-    else
-        isTop = false;
+            if (value & SpecUint8ClampedArray)
+                myOut.print("Uint8clampedarray");
+            else
+                isTop = false;
     
-    if (value & SpecUint16Array)
-        myOut.print("Uint16array");
-    else
-        isTop = false;
+            if (value & SpecUint16Array)
+                myOut.print("Uint16array");
+            else
+                isTop = false;
     
-    if (value & SpecUint32Array)
-        myOut.print("Uint32array");
-    else
-        isTop = false;
+            if (value & SpecUint32Array)
+                myOut.print("Uint32array");
+            else
+                isTop = false;
     
-    if (value & SpecFloat32Array)
-        myOut.print("Float32array");
-    else
-        isTop = false;
+            if (value & SpecFloat32Array)
+                myOut.print("Float32array");
+            else
+                isTop = false;
     
-    if (value & SpecFloat64Array)
-        myOut.print("Float64array");
-    else
-        isTop = false;
+            if (value & SpecFloat64Array)
+                myOut.print("Float64array");
+            else
+                isTop = false;
     
-    if (value & SpecFunction)
-        myOut.print("Function");
-    else
-        isTop = false;
+            if (value & SpecFunction)
+                myOut.print("Function");
+            else
+                isTop = false;
     
-    if (value & SpecArguments)
-        myOut.print("Arguments");
-    else
-        isTop = false;
+            if (value & SpecArguments)
+                myOut.print("Arguments");
+            else
+                isTop = false;
     
-    if (value & SpecString)
-        myOut.print("String");
-    else
-        isTop = false;
+            if (value & SpecStringObject)
+                myOut.print("Stringobject");
+            else
+                isTop = false;
+        }
+
+        if (value & SpecString)
+            myOut.print("String");
+        else
+            isTop = false;
+    }
     
-    if (value & SpecStringObject)
-        myOut.print("Stringobject");
-    else
-        isTop = false;
-    
     if (value & SpecInt32)
         myOut.print("Int");
     else

Modified: branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGCSEPhase.cpp (151875 => 151876)


--- branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGCSEPhase.cpp	2013-06-22 02:36:13 UTC (rev 151875)
+++ branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGCSEPhase.cpp	2013-06-22 05:56:14 UTC (rev 151876)
@@ -1047,15 +1047,6 @@
         dataLogF("   %s @%u: ", Graph::opName(node->op()), node->index());
 #endif
         
-        // NOTE: there are some nodes that we deliberately don't CSE even though we
-        // probably could, like MakeRope and ToPrimitive. That's because there is no
-        // evidence that doing CSE on these nodes would result in a performance
-        // progression. Hence considering these nodes in CSE would just mean that this
-        // code does more work with no win. Of course, we may want to reconsider this,
-        // since MakeRope is trivially CSE-able. It's not trivially doable for
-        // ToPrimitive, but we could change that with some speculations if we really
-        // needed to.
-        
         switch (node->op()) {
         
         case Identity:
@@ -1098,6 +1089,7 @@
         case TypeOf:
         case CompareEqConstant:
         case ValueToInt32:
+        case MakeRope:
             if (cseMode == StoreElimination)
                 break;
             setReplacement(pureCSE(node));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to