Title: [96482] trunk/Source/_javascript_Core
Revision
96482
Author
[email protected]
Date
2011-10-02 19:13:11 -0700 (Sun, 02 Oct 2011)

Log Message

DFG misses some obvious opportunities for common subexpression elimination
https://bugs.webkit.org/show_bug.cgi?id=69233

Reviewed by Oliver Hunt.
        
0.7% speed-up on SunSpider.

* dfg/DFGPropagator.cpp:
(JSC::DFG::Propagator::getByValLoadElimination):
(JSC::DFG::Propagator::getMethodLoadElimination):
(JSC::DFG::Propagator::checkStructureLoadElimination):
(JSC::DFG::Propagator::getByOffsetLoadElimination):
(JSC::DFG::Propagator::getPropertyStorageLoadElimination):
(JSC::DFG::Propagator::performNodeCSE):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (96481 => 96482)


--- trunk/Source/_javascript_Core/ChangeLog	2011-10-03 01:11:45 UTC (rev 96481)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-10-03 02:13:11 UTC (rev 96482)
@@ -1,3 +1,20 @@
+2011-10-02  Filip Pizlo  <[email protected]>
+
+        DFG misses some obvious opportunities for common subexpression elimination
+        https://bugs.webkit.org/show_bug.cgi?id=69233
+
+        Reviewed by Oliver Hunt.
+        
+        0.7% speed-up on SunSpider.
+
+        * dfg/DFGPropagator.cpp:
+        (JSC::DFG::Propagator::getByValLoadElimination):
+        (JSC::DFG::Propagator::getMethodLoadElimination):
+        (JSC::DFG::Propagator::checkStructureLoadElimination):
+        (JSC::DFG::Propagator::getByOffsetLoadElimination):
+        (JSC::DFG::Propagator::getPropertyStorageLoadElimination):
+        (JSC::DFG::Propagator::performNodeCSE):
+
 2011-10-02  Gavin Barraclough  <[email protected]>
 
         Bug 67455 - Different regular _expression_ result

Modified: trunk/Source/_javascript_Core/dfg/DFGPropagator.cpp (96481 => 96482)


--- trunk/Source/_javascript_Core/dfg/DFGPropagator.cpp	2011-10-03 01:11:45 UTC (rev 96481)
+++ trunk/Source/_javascript_Core/dfg/DFGPropagator.cpp	2011-10-03 02:13:11 UTC (rev 96482)
@@ -964,11 +964,18 @@
                 if (node.child1() == child1 && canonicalize(node.child2()) == canonicalize(child2))
                     return node.child3();
                 break;
+            case PutStructure:
+            case PutByOffset:
+                // GetByVal currently always speculates that it's accessing an
+                // array with an integer index, which means that it's impossible
+                // for a structure change or a put to property storage to affect
+                // the GetByVal.
+                break;
             default:
+                if (clobbersWorld(index))
+                    return NoNode;
                 break;
             }
-            if (clobbersWorld(index))
-                break;
         }
         return NoNode;
     }
@@ -978,13 +985,30 @@
         NodeIndex start = startIndexForChildren(child1);
         for (NodeIndex index = m_compileIndex; index-- > start;) {
             Node& node = m_graph[index];
-            if (node.op == CheckMethod
-                && node.child1() == child1
-                && node.identifierNumber() == identifierNumber
-                && m_graph.m_methodCheckData[node.methodCheckDataIndex()] == methodCheckData)
-                return index;
-            if (clobbersWorld(index))
+            switch (node.op) {
+            case CheckMethod:
+                if (node.child1() == child1
+                    && node.identifierNumber() == identifierNumber
+                    && m_graph.m_methodCheckData[node.methodCheckDataIndex()] == methodCheckData)
+                    return index;
                 break;
+                
+            case PutByOffset:
+                // If a put was optimized to by-offset then it's not changing the structure
+                break;
+                
+            case PutByVal:
+            case PutByValAlias:
+                // PutByVal currently always speculates that it's accessing an array with an
+                // integer index, which means that it's impossible for it to cause a structure
+                // change.
+                break;
+                
+            default:
+                if (clobbersWorld(index))
+                    return NoNode;
+                break;
+            }
         }
         return NoNode;
     }
@@ -1011,6 +1035,13 @@
                 // Setting a property cannot change the structure.
                 break;
                 
+            case PutByVal:
+            case PutByValAlias:
+                // PutByVal currently always speculates that it's accessing an array with an
+                // integer index, which means that it's impossible for it to cause a structure
+                // change.
+                break;
+                
             default:
                 if (clobbersWorld(index))
                     return false;
@@ -1044,6 +1075,13 @@
                 // Changing the structure cannot change the outcome of a property get.
                 break;
                 
+            case PutByVal:
+            case PutByValAlias:
+                // PutByVal currently always speculates that it's accessing an array with an
+                // integer index, which means that it's impossible for it to cause a structure
+                // change.
+                break;
+                
             default:
                 if (clobbersWorld(index))
                     return NoNode;
@@ -1070,6 +1108,13 @@
                 // change the property storage pointer.
                 break;
                 
+            case PutByVal:
+            case PutByValAlias:
+                // PutByVal currently always speculates that it's accessing an array with an
+                // integer index, which means that it's impossible for it to cause a structure
+                // change.
+                break;
+                
             default:
                 if (clobbersWorld(index))
                     return NoNode;
@@ -1191,11 +1236,14 @@
         case ArithMax:
         case ArithSqrt:
         case GetCallee:
-        case GetArrayLength:
         case GetStringLength:
             setReplacement(pureCSE(node));
             break;
             
+        case GetArrayLength:
+            setReplacement(impureCSE(node));
+            break;
+            
         case GetScopeChain:
             setReplacement(getScopeChainLoadElimination(node.scopeChainDepth()));
             break;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to