Title: [118582] trunk/Source/_javascript_Core
Revision
118582
Author
[email protected]
Date
2012-05-25 16:00:26 -0700 (Fri, 25 May 2012)

Log Message

DFG CSE should eliminate redundant WeakJSConstants
https://bugs.webkit.org/show_bug.cgi?id=87179

Reviewed by Gavin Barraclough.
        
Merged r118141 from dfgopt.

* dfg/DFGCSEPhase.cpp:
(JSC::DFG::CSEPhase::weakConstantCSE):
(CSEPhase):
(JSC::DFG::CSEPhase::performNodeCSE):
* dfg/DFGNode.h:
(JSC::DFG::Node::weakConstant):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (118581 => 118582)


--- trunk/Source/_javascript_Core/ChangeLog	2012-05-25 22:57:45 UTC (rev 118581)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-05-25 23:00:26 UTC (rev 118582)
@@ -1,5 +1,21 @@
 2012-05-22  Filip Pizlo  <[email protected]>
 
+        DFG CSE should eliminate redundant WeakJSConstants
+        https://bugs.webkit.org/show_bug.cgi?id=87179
+
+        Reviewed by Gavin Barraclough.
+        
+        Merged r118141 from dfgopt.
+
+        * dfg/DFGCSEPhase.cpp:
+        (JSC::DFG::CSEPhase::weakConstantCSE):
+        (CSEPhase):
+        (JSC::DFG::CSEPhase::performNodeCSE):
+        * dfg/DFGNode.h:
+        (JSC::DFG::Node::weakConstant):
+
+2012-05-22  Filip Pizlo  <[email protected]>
+
         DFG CSE should do redundant store elimination
         https://bugs.webkit.org/show_bug.cgi?id=87161
 

Modified: trunk/Source/_javascript_Core/dfg/DFGCSEPhase.cpp (118581 => 118582)


--- trunk/Source/_javascript_Core/dfg/DFGCSEPhase.cpp	2012-05-25 22:57:45 UTC (rev 118581)
+++ trunk/Source/_javascript_Core/dfg/DFGCSEPhase.cpp	2012-05-25 23:00:26 UTC (rev 118582)
@@ -141,6 +141,22 @@
         return NoNode;
     }
     
+    NodeIndex weakConstantCSE(Node& node)
+    {
+        for (unsigned i = endIndexForPureCSE(); i--;) {
+            NodeIndex index = m_currentBlock->at(i);
+            Node& otherNode = m_graph[index];
+            if (otherNode.op() != WeakJSConstant)
+                continue;
+            
+            if (otherNode.weakConstant() != node.weakConstant())
+                continue;
+            
+            return index;
+        }
+        return NoNode;
+    }
+    
     NodeIndex impureCSE(Node& node)
     {
         NodeIndex child1 = canonicalize(node.child1());
@@ -869,6 +885,11 @@
             setReplacement(constantCSE(node), AllowPredictionMismatch);
             break;
             
+        case WeakJSConstant:
+            // FIXME: have CSE for weak constants against strong constants and vice-versa.
+            setReplacement(weakConstantCSE(node));
+            break;
+            
         case GetArrayLength:
             setReplacement(impureCSE(node));
             break;

Modified: trunk/Source/_javascript_Core/dfg/DFGNode.h (118581 => 118582)


--- trunk/Source/_javascript_Core/dfg/DFGNode.h	2012-05-25 22:57:45 UTC (rev 118581)
+++ trunk/Source/_javascript_Core/dfg/DFGNode.h	2012-05-25 23:00:26 UTC (rev 118582)
@@ -246,6 +246,7 @@
     
     JSCell* weakConstant()
     {
+        ASSERT(op() == WeakJSConstant);
         return bitwise_cast<JSCell*>(m_opInfo);
     }
     
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to