Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Unified Diff: src/compiler/instruction.cc

Issue 1668953002: [turbofan] Validate split-edge form (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/instruction.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
}
« no previous file with comments | « src/compiler/instruction.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698