Index: src/compiler/instruction.cc |
diff --git a/src/compiler/instruction.cc b/src/compiler/instruction.cc |
index 1b787c1cef0a640a3fd7c36944ac334a19afbcd1..d19764b1f71d9a4fdf8948c1e6b12a84f8726922 100644 |
--- a/src/compiler/instruction.cc |
+++ b/src/compiler/instruction.cc |
@@ -615,6 +615,20 @@ InstructionBlocks* InstructionSequence::InstructionBlocksFor( |
return blocks; |
} |
+void InstructionSequence::Validate() { |
+ // Validate blocks are in edge-split form: no block with multiple successors |
+ // has an edge to a block (== a successor) with more than one predecessors. |
+ for (const InstructionBlock* block : instruction_blocks()) { |
+ if (block->SuccessorCount() > 1) { |
+ for (const RpoNumber& successor_id : block->successors()) { |
+ const InstructionBlock* successor = InstructionBlockAt(successor_id); |
+ // Expect precisely one predecessor: "block". |
+ CHECK(successor->PredecessorCount() == 1 && |
+ successor->predecessors()[0] == block->rpo_number()); |
+ } |
+ } |
+ } |
+} |
void InstructionSequence::ComputeAssemblyOrder(InstructionBlocks* blocks) { |
int ao = 0; |
@@ -648,6 +662,10 @@ InstructionSequence::InstructionSequence(Isolate* isolate, |
representations_(zone()), |
deoptimization_entries_(zone()) { |
block_starts_.reserve(instruction_blocks_->size()); |
+ |
+#if DEBUG |
+ Validate(); |
+#endif |
} |