Skip to content

Commit c199226

Browse files
committed
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): Canonical link: https://commits.webkit.org/226484@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@263619 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent cbcdc1a commit c199226

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

‎Source/JavaScriptCore/ChangeLog‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
2020-06-27 Saam Barati <sbarati@apple.com>
2+
3+
BytecodeBasicBlock::addSuccessor should check if the successor already exists
4+
https://bugs.webkit.org/show_bug.cgi?id=213670
5+
6+
Reviewed by Yusuke Suzuki.
7+
8+
It makes it nicer for algorithms using BytecodeGraph to not have to consider
9+
whether or not there are duplicates in the successor list. Also, because of
10+
this, bytecode liveness was doing extra work since it walked the successor list,
11+
including any duplicates in it.
12+
13+
* bytecode/BytecodeBasicBlock.h:
14+
(JSC::BytecodeBasicBlock::addSuccessor):
15+
116
2020-06-27 Saam Barati <sbarati@apple.com>
217

318
Change bytecode dumping to dump the bytecode control flow graph

‎Source/JavaScriptCore/bytecode/BytecodeBasicBlock.h‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ class BytecodeBasicBlock {
7777
template<typename Block> static BasicBlockVector computeImpl(Block* codeBlock, const InstructionStream& instructions);
7878
void shrinkToFit();
7979

80-
void addSuccessor(BytecodeBasicBlock& block) { m_successors.append(block.index()); }
80+
void addSuccessor(BytecodeBasicBlock& block)
81+
{
82+
if (!m_successors.contains(block.index()))
83+
m_successors.append(block.index());
84+
}
8185

8286
inline void addLength(unsigned);
8387

0 commit comments

Comments
 (0)