Title: [221551] trunk/Source/_javascript_Core
Revision
221551
Author
[email protected]
Date
2017-09-03 10:51:45 -0700 (Sun, 03 Sep 2017)

Log Message

[JSC] Clean up BytecodeLivenessAnalysis
https://bugs.webkit.org/show_bug.cgi?id=176295

Reviewed by Saam Barati.

Previously, computeDefsForBytecodeOffset was a bit customizable.
This is used for try-catch handler's liveness analysis. But after
careful generatorification implementation, it is now not necessary.
This patch drops this customizability.

* bytecode/BytecodeGeneratorification.cpp:
(JSC::GeneratorLivenessAnalysis::computeDefsForBytecodeOffset): Deleted.
(JSC::GeneratorLivenessAnalysis::computeUsesForBytecodeOffset): Deleted.
* bytecode/BytecodeLivenessAnalysis.cpp:
(JSC::BytecodeLivenessAnalysis::computeKills):
(JSC::BytecodeLivenessAnalysis::computeDefsForBytecodeOffset): Deleted.
(JSC::BytecodeLivenessAnalysis::computeUsesForBytecodeOffset): Deleted.
* bytecode/BytecodeLivenessAnalysis.h:
* bytecode/BytecodeLivenessAnalysisInlines.h:
(JSC::BytecodeLivenessPropagation::stepOverInstruction):
(JSC::BytecodeLivenessPropagation::computeLocalLivenessForBytecodeOffset):
(JSC::BytecodeLivenessPropagation::computeLocalLivenessForBlock):
(JSC::BytecodeLivenessPropagation::getLivenessInfoAtBytecodeOffset):
(JSC::BytecodeLivenessPropagation::runLivenessFixpoint):
(JSC::BytecodeLivenessPropagation<DerivedAnalysis>::stepOverInstruction): Deleted.
(JSC::BytecodeLivenessPropagation<DerivedAnalysis>::computeLocalLivenessForBytecodeOffset): Deleted.
(JSC::BytecodeLivenessPropagation<DerivedAnalysis>::computeLocalLivenessForBlock): Deleted.
(JSC::BytecodeLivenessPropagation<DerivedAnalysis>::getLivenessInfoAtBytecodeOffset): Deleted.
(JSC::BytecodeLivenessPropagation<DerivedAnalysis>::runLivenessFixpoint): Deleted.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (221550 => 221551)


--- trunk/Source/_javascript_Core/ChangeLog	2017-09-03 17:46:48 UTC (rev 221550)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-09-03 17:51:45 UTC (rev 221551)
@@ -1,3 +1,35 @@
+2017-09-03  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Clean up BytecodeLivenessAnalysis
+        https://bugs.webkit.org/show_bug.cgi?id=176295
+
+        Reviewed by Saam Barati.
+
+        Previously, computeDefsForBytecodeOffset was a bit customizable.
+        This is used for try-catch handler's liveness analysis. But after
+        careful generatorification implementation, it is now not necessary.
+        This patch drops this customizability.
+
+        * bytecode/BytecodeGeneratorification.cpp:
+        (JSC::GeneratorLivenessAnalysis::computeDefsForBytecodeOffset): Deleted.
+        (JSC::GeneratorLivenessAnalysis::computeUsesForBytecodeOffset): Deleted.
+        * bytecode/BytecodeLivenessAnalysis.cpp:
+        (JSC::BytecodeLivenessAnalysis::computeKills):
+        (JSC::BytecodeLivenessAnalysis::computeDefsForBytecodeOffset): Deleted.
+        (JSC::BytecodeLivenessAnalysis::computeUsesForBytecodeOffset): Deleted.
+        * bytecode/BytecodeLivenessAnalysis.h:
+        * bytecode/BytecodeLivenessAnalysisInlines.h:
+        (JSC::BytecodeLivenessPropagation::stepOverInstruction):
+        (JSC::BytecodeLivenessPropagation::computeLocalLivenessForBytecodeOffset):
+        (JSC::BytecodeLivenessPropagation::computeLocalLivenessForBlock):
+        (JSC::BytecodeLivenessPropagation::getLivenessInfoAtBytecodeOffset):
+        (JSC::BytecodeLivenessPropagation::runLivenessFixpoint):
+        (JSC::BytecodeLivenessPropagation<DerivedAnalysis>::stepOverInstruction): Deleted.
+        (JSC::BytecodeLivenessPropagation<DerivedAnalysis>::computeLocalLivenessForBytecodeOffset): Deleted.
+        (JSC::BytecodeLivenessPropagation<DerivedAnalysis>::computeLocalLivenessForBlock): Deleted.
+        (JSC::BytecodeLivenessPropagation<DerivedAnalysis>::getLivenessInfoAtBytecodeOffset): Deleted.
+        (JSC::BytecodeLivenessPropagation<DerivedAnalysis>::runLivenessFixpoint): Deleted.
+
 2017-09-03  Sam Weinig  <[email protected]>
 
         Remove CanvasProxy

Modified: trunk/Source/_javascript_Core/bytecode/BytecodeGeneratorification.cpp (221550 => 221551)


--- trunk/Source/_javascript_Core/bytecode/BytecodeGeneratorification.cpp	2017-09-03 17:46:48 UTC (rev 221550)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeGeneratorification.cpp	2017-09-03 17:51:45 UTC (rev 221551)
@@ -145,7 +145,7 @@
     int m_generatorFrameSymbolTableIndex;
 };
 
-class GeneratorLivenessAnalysis : public BytecodeLivenessPropagation<GeneratorLivenessAnalysis> {
+class GeneratorLivenessAnalysis : public BytecodeLivenessPropagation {
 public:
     GeneratorLivenessAnalysis(BytecodeGeneratorification& generatorification)
         : m_generatorification(generatorification)
@@ -152,18 +152,6 @@
     {
     }
 
-    template<typename Functor>
-    void computeDefsForBytecodeOffset(UnlinkedCodeBlock* codeBlock, OpcodeID opcodeID, UnlinkedInstruction* instruction, FastBitVector&, const Functor& functor)
-    {
-        JSC::computeDefsForBytecodeOffset(codeBlock, opcodeID, instruction, functor);
-    }
-
-    template<typename Functor>
-    void computeUsesForBytecodeOffset(UnlinkedCodeBlock* codeBlock, OpcodeID opcodeID, UnlinkedInstruction* instruction, FastBitVector&, const Functor& functor)
-    {
-        JSC::computeUsesForBytecodeOffset(codeBlock, opcodeID, instruction, functor);
-    }
-
     void run()
     {
         // Perform modified liveness analysis to determine which locals are live at the merge points.

Modified: trunk/Source/_javascript_Core/bytecode/BytecodeLivenessAnalysis.cpp (221550 => 221551)


--- trunk/Source/_javascript_Core/bytecode/BytecodeLivenessAnalysis.cpp	2017-09-03 17:46:48 UTC (rev 221550)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeLivenessAnalysis.cpp	2017-09-03 17:51:45 UTC (rev 221551)
@@ -43,18 +43,6 @@
     compute();
 }
 
-template<typename Functor>
-void BytecodeLivenessAnalysis::computeDefsForBytecodeOffset(CodeBlock* codeBlock, OpcodeID opcodeID, Instruction* instruction, FastBitVector&, const Functor& functor)
-{
-    JSC::computeDefsForBytecodeOffset(codeBlock, opcodeID, instruction, functor);
-}
-
-template<typename Functor>
-void BytecodeLivenessAnalysis::computeUsesForBytecodeOffset(CodeBlock* codeBlock, OpcodeID opcodeID, Instruction* instruction, FastBitVector&, const Functor& functor)
-{
-    JSC::computeUsesForBytecodeOffset(codeBlock, opcodeID, instruction, functor);
-}
-
 void BytecodeLivenessAnalysis::getLivenessInfoAtBytecodeOffset(unsigned bytecodeOffset, FastBitVector& result)
 {
     BytecodeBasicBlock* block = m_graph.findBasicBlockForBytecodeOffset(bytecodeOffset);
@@ -119,7 +107,7 @@
         for (unsigned i = block->offsets().size(); i--;) {
             unsigned bytecodeOffset = block->offsets()[i];
             stepOverInstruction(
-                m_graph, bytecodeOffset, out,
+                m_graph, bytecodeOffset,
                 [&] (unsigned index) {
                     // This is for uses.
                     if (out[index])

Modified: trunk/Source/_javascript_Core/bytecode/BytecodeLivenessAnalysis.h (221550 => 221551)


--- trunk/Source/_javascript_Core/bytecode/BytecodeLivenessAnalysis.h	2017-09-03 17:46:48 UTC (rev 221550)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeLivenessAnalysis.h	2017-09-03 17:51:45 UTC (rev 221551)
@@ -35,10 +35,9 @@
 class BytecodeKills;
 class FullBytecodeLiveness;
 
-template<typename DerivedAnalysis>
 class BytecodeLivenessPropagation {
 protected:
-    template<typename Graph, typename UseFunctor, typename DefFunctor> void stepOverInstruction(Graph&, unsigned bytecodeOffset, FastBitVector& out, const UseFunctor&, const DefFunctor&);
+    template<typename Graph, typename UseFunctor, typename DefFunctor> void stepOverInstruction(Graph&, unsigned bytecodeOffset, const UseFunctor&, const DefFunctor&);
 
     template<typename Graph> void stepOverInstruction(Graph&, unsigned bytecodeOffset, FastBitVector& out);
 
@@ -51,11 +50,11 @@
     template<typename Graph> void runLivenessFixpoint(Graph&);
 };
 
-class BytecodeLivenessAnalysis : private BytecodeLivenessPropagation<BytecodeLivenessAnalysis> {
+class BytecodeLivenessAnalysis : private BytecodeLivenessPropagation {
     WTF_MAKE_FAST_ALLOCATED;
     WTF_MAKE_NONCOPYABLE(BytecodeLivenessAnalysis);
 public:
-    friend class BytecodeLivenessPropagation<BytecodeLivenessAnalysis>;
+    friend class BytecodeLivenessPropagation;
     BytecodeLivenessAnalysis(CodeBlock*);
     
     bool operandIsLiveAtBytecodeOffset(int operand, unsigned bytecodeOffset);
@@ -70,9 +69,6 @@
 
     void getLivenessInfoAtBytecodeOffset(unsigned bytecodeOffset, FastBitVector&);
 
-    template<typename Functor> void computeDefsForBytecodeOffset(CodeBlock*, OpcodeID, Instruction*, FastBitVector&, const Functor&);
-    template<typename Functor> void computeUsesForBytecodeOffset(CodeBlock*, OpcodeID, Instruction*, FastBitVector&, const Functor&);
-
     BytecodeGraph<CodeBlock> m_graph;
 };
 

Modified: trunk/Source/_javascript_Core/bytecode/BytecodeLivenessAnalysisInlines.h (221550 => 221551)


--- trunk/Source/_javascript_Core/bytecode/BytecodeLivenessAnalysisInlines.h	2017-09-03 17:46:48 UTC (rev 221550)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeLivenessAnalysisInlines.h	2017-09-03 17:51:45 UTC (rev 221551)
@@ -61,9 +61,8 @@
 
 // Simplified interface to bytecode use/def, which determines defs first and then uses, and includes
 // exception handlers in the uses.
-template<typename DerivedAnalysis>
 template<typename Graph, typename UseFunctor, typename DefFunctor>
-inline void BytecodeLivenessPropagation<DerivedAnalysis>::stepOverInstruction(Graph& graph, unsigned bytecodeOffset, FastBitVector& out, const UseFunctor& use, const DefFunctor& def)
+inline void BytecodeLivenessPropagation::stepOverInstruction(Graph& graph, unsigned bytecodeOffset, const UseFunctor& use, const DefFunctor& def)
 {
     // This abstractly execute the instruction in reverse. Instructions logically first use operands and
     // then define operands. This logical ordering is necessary for operations that use and def the same
@@ -85,15 +84,15 @@
     auto* instruction = &instructionsBegin[bytecodeOffset];
     OpcodeID opcodeID = Interpreter::getOpcodeID(*instruction);
 
-    static_cast<DerivedAnalysis*>(this)->computeDefsForBytecodeOffset(
-        codeBlock, opcodeID, instruction, out,
+    computeDefsForBytecodeOffset(
+        codeBlock, opcodeID, instruction,
         [&] (typename Graph::CodeBlock*, typename Graph::Instruction*, OpcodeID, int operand) {
             if (isValidRegisterForLiveness(operand))
                 def(VirtualRegister(operand).toLocal());
         });
 
-    static_cast<DerivedAnalysis*>(this)->computeUsesForBytecodeOffset(
-        codeBlock, opcodeID, instruction, out,
+    computeUsesForBytecodeOffset(
+        codeBlock, opcodeID, instruction,
         [&] (typename Graph::CodeBlock*, typename Graph::Instruction*, OpcodeID, int operand) {
             if (isValidRegisterForLiveness(operand))
                 use(VirtualRegister(operand).toLocal());
@@ -108,12 +107,11 @@
     }
 }
 
-template<typename DerivedAnalysis>
 template<typename Graph>
-inline void BytecodeLivenessPropagation<DerivedAnalysis>::stepOverInstruction(Graph& graph, unsigned bytecodeOffset, FastBitVector& out)
+inline void BytecodeLivenessPropagation::stepOverInstruction(Graph& graph, unsigned bytecodeOffset, FastBitVector& out)
 {
     stepOverInstruction(
-        graph, bytecodeOffset, out,
+        graph, bytecodeOffset,
         [&] (unsigned bitIndex) {
             // This is the use functor, so we set the bit.
             out[bitIndex] = true;
@@ -124,9 +122,8 @@
         });
 }
 
-template<typename DerivedAnalysis>
 template<typename Graph>
-inline bool BytecodeLivenessPropagation<DerivedAnalysis>::computeLocalLivenessForBytecodeOffset(Graph& graph, BytecodeBasicBlock* block, unsigned targetOffset, FastBitVector& result)
+inline bool BytecodeLivenessPropagation::computeLocalLivenessForBytecodeOffset(Graph& graph, BytecodeBasicBlock* block, unsigned targetOffset, FastBitVector& result)
 {
     ASSERT(!block->isExitBlock());
     ASSERT(!block->isEntryBlock());
@@ -143,9 +140,8 @@
     return result.setAndCheck(out);
 }
 
-template<typename DerivedAnalysis>
 template<typename Graph>
-inline bool BytecodeLivenessPropagation<DerivedAnalysis>::computeLocalLivenessForBlock(Graph& graph, BytecodeBasicBlock* block)
+inline bool BytecodeLivenessPropagation::computeLocalLivenessForBlock(Graph& graph, BytecodeBasicBlock* block)
 {
     if (block->isExitBlock() || block->isEntryBlock())
         return false;
@@ -152,9 +148,8 @@
     return computeLocalLivenessForBytecodeOffset(graph, block, block->leaderOffset(), block->in());
 }
 
-template<typename DerivedAnalysis>
 template<typename Graph>
-inline FastBitVector BytecodeLivenessPropagation<DerivedAnalysis>::getLivenessInfoAtBytecodeOffset(Graph& graph, unsigned bytecodeOffset)
+inline FastBitVector BytecodeLivenessPropagation::getLivenessInfoAtBytecodeOffset(Graph& graph, unsigned bytecodeOffset)
 {
     BytecodeBasicBlock* block = graph.findBasicBlockForBytecodeOffset(bytecodeOffset);
     ASSERT(block);
@@ -166,9 +161,8 @@
     return out;
 }
 
-template<typename DerivedAnalysis>
 template<typename Graph>
-inline void BytecodeLivenessPropagation<DerivedAnalysis>::runLivenessFixpoint(Graph& graph)
+inline void BytecodeLivenessPropagation::runLivenessFixpoint(Graph& graph)
 {
     auto* codeBlock = graph.codeBlock();
     unsigned numberOfVariables = codeBlock->numCalleeLocals();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to