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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // Branch uses are IfTrue and IfFalse. | 200 // Branch uses are IfTrue and IfFalse. |
201 int count_true = 0, count_false = 0; | 201 int count_true = 0, count_false = 0; |
202 for (const Node* use : node->uses()) { | 202 for (const Node* use : node->uses()) { |
203 CHECK(use->opcode() == IrOpcode::kIfTrue || | 203 CHECK(use->opcode() == IrOpcode::kIfTrue || |
204 use->opcode() == IrOpcode::kIfFalse); | 204 use->opcode() == IrOpcode::kIfFalse); |
205 if (use->opcode() == IrOpcode::kIfTrue) ++count_true; | 205 if (use->opcode() == IrOpcode::kIfTrue) ++count_true; |
206 if (use->opcode() == IrOpcode::kIfFalse) ++count_false; | 206 if (use->opcode() == IrOpcode::kIfFalse) ++count_false; |
207 } | 207 } |
208 CHECK_EQ(1, count_true); | 208 CHECK_EQ(1, count_true); |
209 CHECK_EQ(1, count_false); | 209 CHECK_EQ(1, count_false); |
| 210 // The condition must be a Boolean. |
| 211 CheckValueInputIs(node, 0, Type::Boolean()); |
210 // Type is empty. | 212 // Type is empty. |
211 CheckNotTyped(node); | 213 CheckNotTyped(node); |
212 break; | 214 break; |
213 } | 215 } |
214 case IrOpcode::kIfTrue: | 216 case IrOpcode::kIfTrue: |
215 case IrOpcode::kIfFalse: | 217 case IrOpcode::kIfFalse: |
216 CHECK_EQ(IrOpcode::kBranch, | 218 CHECK_EQ(IrOpcode::kBranch, |
217 NodeProperties::GetControlInput(node, 0)->opcode()); | 219 NodeProperties::GetControlInput(node, 0)->opcode()); |
218 // Type is empty. | 220 // Type is empty. |
219 CheckNotTyped(node); | 221 CheckNotTyped(node); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 // Type can be anything. | 403 // Type can be anything. |
402 // TODO(rossberg): Introduce tuple types for this. | 404 // TODO(rossberg): Introduce tuple types for this. |
403 // TODO(titzer): Convince rossberg not to. | 405 // TODO(titzer): Convince rossberg not to. |
404 CheckTypeIs(node, Type::Any()); | 406 CheckTypeIs(node, Type::Any()); |
405 break; | 407 break; |
406 } | 408 } |
407 case IrOpcode::kSelect: { | 409 case IrOpcode::kSelect: { |
408 CHECK_EQ(0, effect_count); | 410 CHECK_EQ(0, effect_count); |
409 CHECK_EQ(0, control_count); | 411 CHECK_EQ(0, control_count); |
410 CHECK_EQ(3, value_count); | 412 CHECK_EQ(3, value_count); |
| 413 // The condition must be a Boolean. |
| 414 CheckValueInputIs(node, 0, Type::Boolean()); |
| 415 // Type can be anything. |
| 416 CheckTypeIs(node, Type::Any()); |
411 break; | 417 break; |
412 } | 418 } |
413 case IrOpcode::kPhi: { | 419 case IrOpcode::kPhi: { |
414 // Phi input count matches parent control node. | 420 // Phi input count matches parent control node. |
415 CHECK_EQ(0, effect_count); | 421 CHECK_EQ(0, effect_count); |
416 CHECK_EQ(1, control_count); | 422 CHECK_EQ(1, control_count); |
417 Node* control = NodeProperties::GetControlInput(node, 0); | 423 Node* control = NodeProperties::GetControlInput(node, 0); |
418 CHECK_EQ(value_count, control->op()->ControlInputCount()); | 424 CHECK_EQ(value_count, control->op()->ControlInputCount()); |
419 CHECK_EQ(input_count, 1 + value_count); | 425 CHECK_EQ(input_count, 1 + value_count); |
420 // Type must be subsumed by all input types. | 426 // Type must be subsumed by all input types. |
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1701 replacement->op()->EffectOutputCount() > 0); | 1707 replacement->op()->EffectOutputCount() > 0); |
1702 DCHECK(!NodeProperties::IsFrameStateEdge(edge) || | 1708 DCHECK(!NodeProperties::IsFrameStateEdge(edge) || |
1703 replacement->opcode() == IrOpcode::kFrameState); | 1709 replacement->opcode() == IrOpcode::kFrameState); |
1704 } | 1710 } |
1705 | 1711 |
1706 #endif // DEBUG | 1712 #endif // DEBUG |
1707 | 1713 |
1708 } // namespace compiler | 1714 } // namespace compiler |
1709 } // namespace internal | 1715 } // namespace internal |
1710 } // namespace v8 | 1716 } // namespace v8 |
OLD | NEW |