Index: src/compiler/verifier.cc |
diff --git a/src/compiler/verifier.cc b/src/compiler/verifier.cc |
index 3d6bd16ecba448e39de8bff51fdebe70133b2a46..4c28f3521a9b93cee27bac6f98f744b6315587d5 100644 |
--- a/src/compiler/verifier.cc |
+++ b/src/compiler/verifier.cc |
@@ -271,6 +271,19 @@ static bool HasDominatingDef(Schedule* schedule, Node* node, |
} |
+static bool Dominates(Schedule* schedule, Node* dominator, Node* dominatee) { |
+ BasicBlock* dom = schedule->block(dominator); |
+ BasicBlock* sub = schedule->block(dominatee); |
+ while (sub != NULL) { |
+ if (sub == dom) { |
+ return true; |
+ } |
+ sub = sub->dominator(); |
+ } |
+ return false; |
+} |
+ |
+ |
static void CheckInputsDominate(Schedule* schedule, BasicBlock* block, |
Node* node, int use_pos) { |
for (int j = OperatorProperties::GetValueInputCount(node->op()) - 1; j >= 0; |
@@ -289,6 +302,19 @@ static void CheckInputsDominate(Schedule* schedule, BasicBlock* block, |
input->id(), input->op()->mnemonic()); |
} |
} |
+ // Ensure that nodes are dominated by their control inputs; |
+ // kEnd is an exception, as unreachable blocks resulting from kMerge |
+ // are not in the RPO. |
+ if (OperatorProperties::GetControlInputCount(node->op()) == 1 && |
+ node->opcode() != IrOpcode::kEnd) { |
+ Node* ctl = NodeProperties::GetControlInput(node); |
+ if (!Dominates(schedule, ctl, node)) { |
+ V8_Fatal(__FILE__, __LINE__, |
+ "Node #%d:%s in B%d is not dominated by control input #%d:%s", |
+ node->id(), node->op()->mnemonic(), block->id(), ctl->id(), |
+ ctl->op()->mnemonic()); |
+ } |
+ } |
} |