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 no-no-throw nodes only have IfSuccess/IfException control |
| 154 // uses. |
| 155 if (!node->op()->HasProperty(Operator::kNoThrow)) { |
| 156 int count_success = 0, count_exception = 0; |
| 157 for (Edge edge : node->use_edges()) { |
| 158 if (!NodeProperties::IsControlEdge(edge)) { |
| 159 continue; |
| 160 } |
| 161 Node* control_use = edge.from(); |
| 162 if (control_use->opcode() != IrOpcode::kIfSuccess && |
| 163 control_use->opcode() != IrOpcode::kIfException) { |
| 164 V8_Fatal(__FILE__, __LINE__, |
| 165 "#%d:%s should be followed by IfSuccess/IfException, but is " |
| 166 "followed by #%d:%s", |
| 167 node->id(), node->op()->mnemonic(), control_use->id(), |
| 168 control_use->op()->mnemonic()); |
| 169 } |
| 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 |