Title: [189531] trunk/Source/_javascript_Core
Revision
189531
Author
benja...@webkit.org
Date
2015-09-08 21:02:24 -0700 (Tue, 08 Sep 2015)

Log Message

[JSC] reduce the amount of memory access needed for LivenessAnalysisPhase
https://bugs.webkit.org/show_bug.cgi?id=148414

Patch by Benjamin Poulain <bpoul...@apple.com> on 2015-09-08
Reviewed by Mark Lam.

LivenessAnalysisPhase still causes a huge number of cache miss.
This patch reduces the amount of accesses needed by the HashTables.

* dfg/DFGBasicBlock.h:
* dfg/DFGLivenessAnalysisPhase.cpp:
(JSC::DFG::LivenessAnalysisPhase::run):
(JSC::DFG::LivenessAnalysisPhase::process):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (189530 => 189531)


--- trunk/Source/_javascript_Core/ChangeLog	2015-09-09 03:27:48 UTC (rev 189530)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-09-09 04:02:24 UTC (rev 189531)
@@ -1,3 +1,18 @@
+2015-09-08  Benjamin Poulain  <bpoul...@apple.com>
+
+        [JSC] reduce the amount of memory access needed for LivenessAnalysisPhase
+        https://bugs.webkit.org/show_bug.cgi?id=148414
+
+        Reviewed by Mark Lam.
+
+        LivenessAnalysisPhase still causes a huge number of cache miss.
+        This patch reduces the amount of accesses needed by the HashTables.
+
+        * dfg/DFGBasicBlock.h:
+        * dfg/DFGLivenessAnalysisPhase.cpp:
+        (JSC::DFG::LivenessAnalysisPhase::run):
+        (JSC::DFG::LivenessAnalysisPhase::process):
+
 2015-09-08  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         Prospective build fix after r189517

Modified: trunk/Source/_javascript_Core/dfg/DFGBasicBlock.h (189530 => 189531)


--- trunk/Source/_javascript_Core/dfg/DFGBasicBlock.h	2015-09-09 03:27:48 UTC (rev 189530)
+++ trunk/Source/_javascript_Core/dfg/DFGBasicBlock.h	2015-09-09 04:02:24 UTC (rev 189531)
@@ -239,8 +239,9 @@
         AvailabilityMap availabilityAtHead;
         AvailabilityMap availabilityAtTail;
         
+        bool liveAtTailIsDirty { false };
+        HashSet<Node*> liveAtTail;
         HashSet<Node*> liveAtHead;
-        HashSet<Node*> liveAtTail;
         HashMap<Node*, AbstractValue> valuesAtHead;
         HashMap<Node*, AbstractValue> valuesAtTail;
         

Modified: trunk/Source/_javascript_Core/dfg/DFGLivenessAnalysisPhase.cpp (189530 => 189531)


--- trunk/Source/_javascript_Core/dfg/DFGLivenessAnalysisPhase.cpp	2015-09-09 03:27:48 UTC (rev 189530)
+++ trunk/Source/_javascript_Core/dfg/DFGLivenessAnalysisPhase.cpp	2015-09-09 04:02:24 UTC (rev 189531)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -57,6 +57,7 @@
             BasicBlock* block = m_graph.block(blockIndex);
             if (!block)
                 continue;
+            block->ssa->liveAtTailIsDirty = true;
             block->ssa->liveAtHead.clear();
             block->ssa->liveAtTail.clear();
         }
@@ -85,8 +86,11 @@
         if (!block)
             return;
 
+        if (!block->ssa->liveAtTailIsDirty)
+            return;
+        block->ssa->liveAtTailIsDirty = false;
+
         m_live = block->ssa->liveAtTail;
-        
         for (unsigned nodeIndex = block->size(); nodeIndex--;) {
             Node* node = block->at(nodeIndex);
             
@@ -128,12 +132,16 @@
             }
         }
         
-        if (m_live == block->ssa->liveAtHead)
-            return;
-        
-        m_changed = true;
-        for (unsigned i = block->predecessors.size(); i--;)
-            block->predecessors[i]->ssa->liveAtTail.add(m_live.begin(), m_live.end());
+        for (Node* node : m_live) {
+            if (!block->ssa->liveAtHead.contains(node)) {
+                m_changed = true;
+                for (unsigned i = block->predecessors.size(); i--;) {
+                    BasicBlock* predecessor = block->predecessors[i];
+                    if (predecessor->ssa->liveAtTail.add(node).isNewEntry)
+                        predecessor->ssa->liveAtTailIsDirty = true;
+                }
+            }
+        }
         block->ssa->liveAtHead = WTF::move(m_live);
     }
     
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to