Title: [198976] trunk/Source/_javascript_Core
Revision
198976
Author
[email protected]
Date
2016-04-02 14:16:01 -0700 (Sat, 02 Apr 2016)

Log Message

[JSC] Initialize SSA's live values at tail lazily
https://bugs.webkit.org/show_bug.cgi?id=156126

Patch by Benjamin Poulain <[email protected]> on 2016-04-02
Reviewed by Mark Lam.

Setting up the clean state early looks harmless but it is
actually quite expensive.

The problem is AbstractValue is gigantic, you really want
to minimize how much you touch that memory.

By removing the initialization, most blocks only
get 2 or 3 accesses. Once to setup the value, and a few
queries for merging the current block with the successors.

* dfg/DFGInPlaceAbstractState.cpp:
(JSC::DFG::InPlaceAbstractState::endBasicBlock):
(JSC::DFG::setLiveValues): Deleted.
(JSC::DFG::InPlaceAbstractState::initialize): Deleted.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (198975 => 198976)


--- trunk/Source/_javascript_Core/ChangeLog	2016-04-02 21:14:08 UTC (rev 198975)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-04-02 21:16:01 UTC (rev 198976)
@@ -1,5 +1,27 @@
 2016-04-02  Benjamin Poulain  <[email protected]>
 
+        [JSC] Initialize SSA's live values at tail lazily
+        https://bugs.webkit.org/show_bug.cgi?id=156126
+
+        Reviewed by Mark Lam.
+
+        Setting up the clean state early looks harmless but it is
+        actually quite expensive.
+
+        The problem is AbstractValue is gigantic, you really want
+        to minimize how much you touch that memory.
+
+        By removing the initialization, most blocks only
+        get 2 or 3 accesses. Once to setup the value, and a few
+        queries for merging the current block with the successors.
+
+        * dfg/DFGInPlaceAbstractState.cpp:
+        (JSC::DFG::InPlaceAbstractState::endBasicBlock):
+        (JSC::DFG::setLiveValues): Deleted.
+        (JSC::DFG::InPlaceAbstractState::initialize): Deleted.
+
+2016-04-02  Benjamin Poulain  <[email protected]>
+
         [JSC] Add an option to avoid disassembling baseline code for the JSC Profiler
         https://bugs.webkit.org/show_bug.cgi?id=156127
 

Modified: trunk/Source/_javascript_Core/dfg/DFGInPlaceAbstractState.cpp (198975 => 198976)


--- trunk/Source/_javascript_Core/dfg/DFGInPlaceAbstractState.cpp	2016-04-02 21:14:08 UTC (rev 198975)
+++ trunk/Source/_javascript_Core/dfg/DFGInPlaceAbstractState.cpp	2016-04-02 21:16:01 UTC (rev 198976)
@@ -74,16 +74,6 @@
     m_structureClobberState = basicBlock->cfaStructureClobberStateAtHead;
 }
 
-static void setLiveValues(HashMap<Node*, AbstractValue>& values, HashSet<Node*>& live)
-{
-    values.clear();
-    
-    HashSet<Node*>::iterator iter = live.begin();
-    HashSet<Node*>::iterator end = live.end();
-    for (; iter != end; ++iter)
-        values.add(*iter, AbstractValue());
-}
-
 static void setLiveValues(Vector<BasicBlock::SSAData::NodeAbstractValuePair>& values, HashSet<Node*>& live)
 {
     values.resize(0);
@@ -163,7 +153,6 @@
             if (!block)
                 continue;
             setLiveValues(block->ssa->valuesAtHead, block->ssa->liveAtHead);
-            setLiveValues(block->ssa->valuesAtTail, block->ssa->liveAtTail);
         }
     }
 }
@@ -203,11 +192,9 @@
         for (size_t i = 0; i < block->valuesAtTail.size(); ++i)
             changed |= block->valuesAtTail[i].merge(m_variables[i]);
 
-        HashSet<Node*>::iterator iter = block->ssa->liveAtTail.begin();
-        HashSet<Node*>::iterator end = block->ssa->liveAtTail.end();
-        for (; iter != end; ++iter) {
-            Node* node = *iter;
-            changed |= block->ssa->valuesAtTail.find(node)->value.merge(forNode(node));
+        for (Node* node : block->ssa->liveAtTail) {
+            auto iterator = block->ssa->valuesAtTail.add(node, AbstractValue()).iterator;
+            changed |= iterator->value.merge(forNode(node));
         }
         break;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to