Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/compiler/verifier.h" | 5 #include "src/compiler/verifier.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 Node* effect = NodeProperties::GetEffectInput(node); | 142 Node* effect = NodeProperties::GetEffectInput(node); |
| 143 CheckOutput(effect, node, effect->op()->EffectOutputCount(), "effect"); | 143 CheckOutput(effect, node, effect->op()->EffectOutputCount(), "effect"); |
| 144 } | 144 } |
| 145 | 145 |
| 146 // Verify all control inputs are control nodes. | 146 // Verify all control inputs are control nodes. |
| 147 for (int i = 0; i < control_count; ++i) { | 147 for (int i = 0; i < control_count; ++i) { |
| 148 Node* control = NodeProperties::GetControlInput(node, i); | 148 Node* control = NodeProperties::GetControlInput(node, i); |
| 149 CheckOutput(control, node, control->op()->ControlOutputCount(), | 149 CheckOutput(control, node, control->op()->ControlOutputCount(), |
| 150 "control"); | 150 "control"); |
| 151 } | 151 } |
| 152 | |
| 153 // Verify that 2 control outputs is either a Branch or is followed by | |
| 154 // IfSuccess/IfException. | |
| 155 if (node->op()->ControlOutputCount() != 1 && | |
| 156 node->opcode() != IrOpcode::kBranch && | |
| 157 node->opcode() != IrOpcode::kSwitch) { | |
|
bgeron
2016/08/11 10:56:18
Changed.
| |
| 158 int count_success = 0, count_exception = 0; | |
| 159 for (Edge edge : node->use_edges()) { | |
| 160 if (!NodeProperties::IsControlEdge(edge)) { | |
| 161 continue; | |
| 162 } | |
| 163 Node* control_use = edge.from(); | |
| 164 CHECK_EXTRA(control_use->opcode() == IrOpcode::kIfSuccess || | |
| 165 control_use->opcode() == IrOpcode::kIfException, | |
| 166 "#%d:%s should be followed by IfSuccess/IfException, but " | |
| 167 "is followed by #%d:%s", | |
| 168 node->id(), node->op()->mnemonic(), control_use->id(), | |
| 169 control_use->op()->mnemonic()); | |
| 170 if (control_use->opcode() == IrOpcode::kIfSuccess) ++count_success; | |
| 171 if (control_use->opcode() == IrOpcode::kIfException) ++count_exception; | |
| 172 CHECK_LE(count_success, 1); | |
| 173 CHECK_LE(count_exception, 1); | |
| 174 } | |
| 175 } | |
| 152 } | 176 } |
| 153 | 177 |
| 154 switch (node->opcode()) { | 178 switch (node->opcode()) { |
| 155 case IrOpcode::kStart: | 179 case IrOpcode::kStart: |
| 156 // Start has no inputs. | 180 // Start has no inputs. |
| 157 CHECK_EQ(0, input_count); | 181 CHECK_EQ(0, input_count); |
| 158 // Type is a tuple. | 182 // Type is a tuple. |
| 159 // TODO(rossberg): Multiple outputs are currently typed as Internal. | 183 // TODO(rossberg): Multiple outputs are currently typed as Internal. |
| 160 CheckUpperIs(node, Type::Internal()); | 184 CheckUpperIs(node, Type::Internal()); |
| 161 break; | 185 break; |
| (...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1576 replacement->op()->EffectOutputCount() > 0); | 1600 replacement->op()->EffectOutputCount() > 0); |
| 1577 DCHECK(!NodeProperties::IsFrameStateEdge(edge) || | 1601 DCHECK(!NodeProperties::IsFrameStateEdge(edge) || |
| 1578 replacement->opcode() == IrOpcode::kFrameState); | 1602 replacement->opcode() == IrOpcode::kFrameState); |
| 1579 } | 1603 } |
| 1580 | 1604 |
| 1581 #endif // DEBUG | 1605 #endif // DEBUG |
| 1582 | 1606 |
| 1583 } // namespace compiler | 1607 } // namespace compiler |
| 1584 } // namespace internal | 1608 } // namespace internal |
| 1585 } // namespace v8 | 1609 } // namespace v8 |
| OLD | NEW |