Chromium Code Reviews| Index: src/compiler/verifier.cc |
| diff --git a/src/compiler/verifier.cc b/src/compiler/verifier.cc |
| index eabd99dcf479dbb93bc5c2834aac32509a08bf7a..5af425c2c99c19a98121431c6da1692258737364 100644 |
| --- a/src/compiler/verifier.cc |
| +++ b/src/compiler/verifier.cc |
| @@ -149,6 +149,30 @@ void Verifier::Visitor::Check(Node* node) { |
| CheckOutput(control, node, control->op()->ControlOutputCount(), |
| "control"); |
| } |
| + |
| + // Verify that 2 control outputs is either a Branch or is followed by |
| + // IfSuccess/IfException. |
| + if (node->op()->ControlOutputCount() != 1 && |
| + node->opcode() != IrOpcode::kBranch && |
| + node->opcode() != IrOpcode::kSwitch) { |
|
bgeron
2016/08/11 10:56:18
Changed.
|
| + int count_success = 0, count_exception = 0; |
| + for (Edge edge : node->use_edges()) { |
| + if (!NodeProperties::IsControlEdge(edge)) { |
| + continue; |
| + } |
| + Node* control_use = edge.from(); |
| + CHECK_EXTRA(control_use->opcode() == IrOpcode::kIfSuccess || |
| + control_use->opcode() == IrOpcode::kIfException, |
| + "#%d:%s should be followed by IfSuccess/IfException, but " |
| + "is followed by #%d:%s", |
| + node->id(), node->op()->mnemonic(), control_use->id(), |
| + control_use->op()->mnemonic()); |
| + if (control_use->opcode() == IrOpcode::kIfSuccess) ++count_success; |
| + if (control_use->opcode() == IrOpcode::kIfException) ++count_exception; |
| + CHECK_LE(count_success, 1); |
| + CHECK_LE(count_exception, 1); |
| + } |
| + } |
| } |
| switch (node->opcode()) { |