Title: [153242] trunk
Revision
153242
Author
[email protected]
Date
2013-07-24 21:03:35 -0700 (Wed, 24 Jul 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: trunk/LayoutTests/ChangeLog (153241 => 153242)


--- trunk/LayoutTests/ChangeLog	2013-07-25 04:03:33 UTC (rev 153241)
+++ trunk/LayoutTests/ChangeLog	2013-07-25 04:03:35 UTC (rev 153242)
@@ -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: trunk/LayoutTests/fast/js/regress/make-rope-cse-expected.txt (0 => 153242)


--- trunk/LayoutTests/fast/js/regress/make-rope-cse-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/js/regress/make-rope-cse-expected.txt	2013-07-25 04:03:35 UTC (rev 153242)
@@ -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: trunk/LayoutTests/fast/js/regress/make-rope-cse.html (0 => 153242)


--- trunk/LayoutTests/fast/js/regress/make-rope-cse.html	                        (rev 0)
+++ trunk/LayoutTests/fast/js/regress/make-rope-cse.html	2013-07-25 04:03:35 UTC (rev 153242)
@@ -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: trunk/LayoutTests/fast/js/regress/script-tests/make-rope-cse.js (0 => 153242)


--- trunk/LayoutTests/fast/js/regress/script-tests/make-rope-cse.js	                        (rev 0)
+++ trunk/LayoutTests/fast/js/regress/script-tests/make-rope-cse.js	2013-07-25 04:03:35 UTC (rev 153242)
@@ -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: trunk/Source/_javascript_Core/ChangeLog (153241 => 153242)


--- trunk/Source/_javascript_Core/ChangeLog	2013-07-25 04:03:33 UTC (rev 153241)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-07-25 04:03:35 UTC (rev 153242)
@@ -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: trunk/Source/_javascript_Core/bytecode/SpeculatedType.cpp (153241 => 153242)


--- trunk/Source/_javascript_Core/bytecode/SpeculatedType.cpp	2013-07-25 04:03:33 UTC (rev 153241)
+++ trunk/Source/_javascript_Core/bytecode/SpeculatedType.cpp	2013-07-25 04:03:35 UTC (rev 153242)
@@ -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: trunk/Source/_javascript_Core/dfg/DFGCSEPhase.cpp (153241 => 153242)


--- trunk/Source/_javascript_Core/dfg/DFGCSEPhase.cpp	2013-07-25 04:03:33 UTC (rev 153241)
+++ trunk/Source/_javascript_Core/dfg/DFGCSEPhase.cpp	2013-07-25 04:03:35 UTC (rev 153242)
@@ -1049,15 +1049,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:
@@ -1101,6 +1092,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