Title: [209820] trunk/Source/_javascript_Core
- Revision
- 209820
- Author
- [email protected]
- Date
- 2016-12-14 11:58:27 -0800 (Wed, 14 Dec 2016)
Log Message
BytecodeBasicBlock::computeImpl() should not keep iterating blocks if all jump targets have already been found.
https://bugs.webkit.org/show_bug.cgi?id=165820
Reviewed by Saam Barati.
Currently, if an opcode is a branch type opcode, BytecodeBasicBlock::computeImpl()
will iterate over all basic blocks looking for the block containing the jump
target, and it will continue to do this even when all the jump targets have been
found. This is wasted work, and all the more so given that most branch type
opcodes only have a single jump target.
* bytecode/BytecodeBasicBlock.cpp:
(JSC::BytecodeBasicBlock::computeImpl):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (209819 => 209820)
--- trunk/Source/_javascript_Core/ChangeLog 2016-12-14 19:53:00 UTC (rev 209819)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-12-14 19:58:27 UTC (rev 209820)
@@ -1,3 +1,19 @@
+2016-12-14 Mark Lam <[email protected]>
+
+ BytecodeBasicBlock::computeImpl() should not keep iterating blocks if all jump targets have already been found.
+ https://bugs.webkit.org/show_bug.cgi?id=165820
+
+ Reviewed by Saam Barati.
+
+ Currently, if an opcode is a branch type opcode, BytecodeBasicBlock::computeImpl()
+ will iterate over all basic blocks looking for the block containing the jump
+ target, and it will continue to do this even when all the jump targets have been
+ found. This is wasted work, and all the more so given that most branch type
+ opcodes only have a single jump target.
+
+ * bytecode/BytecodeBasicBlock.cpp:
+ (JSC::BytecodeBasicBlock::computeImpl):
+
2016-12-14 Gavin Barraclough <[email protected]>
MarkedBlock::marksConveyLivenessDuringMarking should take into account collection scope
Modified: trunk/Source/_javascript_Core/bytecode/BytecodeBasicBlock.cpp (209819 => 209820)
--- trunk/Source/_javascript_Core/bytecode/BytecodeBasicBlock.cpp 2016-12-14 19:53:00 UTC (rev 209819)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeBasicBlock.cpp 2016-12-14 19:58:27 UTC (rev 209820)
@@ -151,11 +151,22 @@
Vector<unsigned, 1> bytecodeOffsetsJumpedTo;
findJumpTargetsForBytecodeOffset(codeBlock, instructionsBegin, bytecodeOffset, bytecodeOffsetsJumpedTo);
+ size_t numberOfJumpTargets = bytecodeOffsetsJumpedTo.size();
+ ASSERT(numberOfJumpTargets);
for (unsigned i = 0; i < basicBlocks.size(); i++) {
BytecodeBasicBlock* otherBlock = basicBlocks[i].get();
- if (bytecodeOffsetsJumpedTo.contains(otherBlock->leaderOffset()))
+ if (bytecodeOffsetsJumpedTo.contains(otherBlock->leaderOffset())) {
linkBlocks(block, otherBlock);
+ --numberOfJumpTargets;
+ if (!numberOfJumpTargets)
+ break;
+ }
}
+ // numberOfJumpTargets may not be 0 here if there are multiple jumps targeting the same
+ // basic blocks (e.g. in a switch type opcode). Since we only decrement numberOfJumpTargets
+ // once per basic block, the duplicates are not accounted for. For our purpose here,
+ // that doesn't matter because we only need to link to the target block once regardless
+ // of how many ways this block can jump there.
if (isUnconditionalBranch(opcodeID))
fallsThrough = false;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes