BytecodeBasicBlock::addSuccessor should check if the successor already exists
authorsbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 27 Jun 2020 15:53:41 +0000 (15:53 +0000)
committersbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 27 Jun 2020 15:53:41 +0000 (15:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=213670

Reviewed by Yusuke Suzuki.

It makes it nicer for algorithms using BytecodeGraph to not have to consider
whether or not there are duplicates in the successor list. Also, because of
this, bytecode liveness was doing extra work since it walked the successor list,
including any duplicates in it.

* bytecode/BytecodeBasicBlock.h:
(JSC::BytecodeBasicBlock::addSuccessor):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@263619 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/BytecodeBasicBlock.h

index dd47251..7839485 100644 (file)
@@ -1,5 +1,20 @@
 2020-06-27  Saam Barati  <sbarati@apple.com>
 
+        BytecodeBasicBlock::addSuccessor should check if the  successor already exists
+        https://bugs.webkit.org/show_bug.cgi?id=213670
+
+        Reviewed by Yusuke Suzuki.
+
+        It makes it nicer for algorithms using BytecodeGraph to not have to consider
+        whether or not there are duplicates in the successor list. Also, because of
+        this, bytecode liveness was doing extra work since it walked the successor list,
+        including any duplicates in it.
+
+        * bytecode/BytecodeBasicBlock.h:
+        (JSC::BytecodeBasicBlock::addSuccessor):
+
+2020-06-27  Saam Barati  <sbarati@apple.com>
+
         Change bytecode dumping to dump the bytecode control flow graph
         https://bugs.webkit.org/show_bug.cgi?id=213669
 
index d4f533b..d0a882d 100644 (file)
@@ -77,7 +77,11 @@ private:
     template<typename Block> static BasicBlockVector computeImpl(Block* codeBlock, const InstructionStream& instructions);
     void shrinkToFit();
 
-    void addSuccessor(BytecodeBasicBlock& block) { m_successors.append(block.index()); }
+    void addSuccessor(BytecodeBasicBlock& block)
+    {
+        if (!m_successors.contains(block.index()))
+            m_successors.append(block.index());
+    }
 
     inline void addLength(unsigned);