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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 // Verify number of inputs matches up. | 106 // Verify number of inputs matches up. |
107 int input_count = value_count + context_count + frame_state_count; | 107 int input_count = value_count + context_count + frame_state_count; |
108 if (check_inputs == kAll) { | 108 if (check_inputs == kAll) { |
109 input_count += effect_count + control_count; | 109 input_count += effect_count + control_count; |
110 } | 110 } |
111 CHECK_EQ(input_count, node->InputCount()); | 111 CHECK_EQ(input_count, node->InputCount()); |
112 | 112 |
113 // Verify that frame state has been inserted for the nodes that need it. | 113 // Verify that frame state has been inserted for the nodes that need it. |
114 for (int i = 0; i < frame_state_count; i++) { | 114 for (int i = 0; i < frame_state_count; i++) { |
115 Node* frame_state = NodeProperties::GetFrameStateInput(node, i); | 115 Node* frame_state = NodeProperties::GetFrameStateInput(node); |
116 CHECK(frame_state->opcode() == IrOpcode::kFrameState || | 116 CHECK(frame_state->opcode() == IrOpcode::kFrameState || |
117 // kFrameState uses Start as a sentinel. | 117 // kFrameState uses Start as a sentinel. |
118 (node->opcode() == IrOpcode::kFrameState && | 118 (node->opcode() == IrOpcode::kFrameState && |
119 frame_state->opcode() == IrOpcode::kStart)); | 119 frame_state->opcode() == IrOpcode::kStart)); |
120 } | 120 } |
121 | 121 |
122 // Verify all value inputs actually produce a value. | 122 // Verify all value inputs actually produce a value. |
123 for (int i = 0; i < value_count; ++i) { | 123 for (int i = 0; i < value_count; ++i) { |
124 Node* value = NodeProperties::GetValueInput(node, i); | 124 Node* value = NodeProperties::GetValueInput(node, i); |
125 CheckOutput(value, node, value->op()->ValueOutputCount(), "value"); | 125 CheckOutput(value, node, value->op()->ValueOutputCount(), "value"); |
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1524 CHECK(!user->IsDead()); | 1524 CHECK(!user->IsDead()); |
1525 if (NodeProperties::IsControlEdge(edge)) { | 1525 if (NodeProperties::IsControlEdge(edge)) { |
1526 CHECK(!check_no_control); | 1526 CHECK(!check_no_control); |
1527 } else if (NodeProperties::IsEffectEdge(edge)) { | 1527 } else if (NodeProperties::IsEffectEdge(edge)) { |
1528 CHECK(!check_no_effect); | 1528 CHECK(!check_no_effect); |
1529 } else if (NodeProperties::IsFrameStateEdge(edge)) { | 1529 } else if (NodeProperties::IsFrameStateEdge(edge)) { |
1530 CHECK(!check_no_frame_state); | 1530 CHECK(!check_no_frame_state); |
1531 } | 1531 } |
1532 } | 1532 } |
1533 } | 1533 } |
1534 // Frame state inputs should be frame states (or sentinels). | 1534 // Frame state input should be a frame state (or sentinel). |
1535 for (int i = 0; i < OperatorProperties::GetFrameStateInputCount(node->op()); | 1535 if (OperatorProperties::GetFrameStateInputCount(node->op()) > 0) { |
1536 i++) { | 1536 Node* input = NodeProperties::GetFrameStateInput(node); |
1537 Node* input = NodeProperties::GetFrameStateInput(node, i); | |
1538 CHECK(input->opcode() == IrOpcode::kFrameState || | 1537 CHECK(input->opcode() == IrOpcode::kFrameState || |
1539 input->opcode() == IrOpcode::kStart || | 1538 input->opcode() == IrOpcode::kStart || |
1540 input->opcode() == IrOpcode::kDead); | 1539 input->opcode() == IrOpcode::kDead); |
1541 } | 1540 } |
1542 // Effect inputs should be effect-producing nodes (or sentinels). | 1541 // Effect inputs should be effect-producing nodes (or sentinels). |
1543 for (int i = 0; i < node->op()->EffectInputCount(); i++) { | 1542 for (int i = 0; i < node->op()->EffectInputCount(); i++) { |
1544 Node* input = NodeProperties::GetEffectInput(node, i); | 1543 Node* input = NodeProperties::GetEffectInput(node, i); |
1545 CHECK(input->op()->EffectOutputCount() > 0 || | 1544 CHECK(input->op()->EffectOutputCount() > 0 || |
1546 input->opcode() == IrOpcode::kDead); | 1545 input->opcode() == IrOpcode::kDead); |
1547 } | 1546 } |
(...skipping 15 matching lines...) Expand all Loading... |
1563 replacement->op()->EffectOutputCount() > 0); | 1562 replacement->op()->EffectOutputCount() > 0); |
1564 DCHECK(!NodeProperties::IsFrameStateEdge(edge) || | 1563 DCHECK(!NodeProperties::IsFrameStateEdge(edge) || |
1565 replacement->opcode() == IrOpcode::kFrameState); | 1564 replacement->opcode() == IrOpcode::kFrameState); |
1566 } | 1565 } |
1567 | 1566 |
1568 #endif // DEBUG | 1567 #endif // DEBUG |
1569 | 1568 |
1570 } // namespace compiler | 1569 } // namespace compiler |
1571 } // namespace internal | 1570 } // namespace internal |
1572 } // namespace v8 | 1571 } // namespace v8 |
OLD | NEW |