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 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1707 | 1707 |
1708 // static | 1708 // static |
1709 void Verifier::VerifyNode(Node* node) { | 1709 void Verifier::VerifyNode(Node* node) { |
1710 CHECK_EQ(OperatorProperties::GetTotalInputCount(node->op()), | 1710 CHECK_EQ(OperatorProperties::GetTotalInputCount(node->op()), |
1711 node->InputCount()); | 1711 node->InputCount()); |
1712 // If this node has no effect or no control outputs, | 1712 // If this node has no effect or no control outputs, |
1713 // we check that none of its uses are effect or control inputs. | 1713 // we check that none of its uses are effect or control inputs. |
1714 bool check_no_control = node->op()->ControlOutputCount() == 0; | 1714 bool check_no_control = node->op()->ControlOutputCount() == 0; |
1715 bool check_no_effect = node->op()->EffectOutputCount() == 0; | 1715 bool check_no_effect = node->op()->EffectOutputCount() == 0; |
1716 bool check_no_frame_state = node->opcode() != IrOpcode::kFrameState; | 1716 bool check_no_frame_state = node->opcode() != IrOpcode::kFrameState; |
| 1717 int effect_edges = 0; |
1717 if (check_no_effect || check_no_control) { | 1718 if (check_no_effect || check_no_control) { |
1718 for (Edge edge : node->use_edges()) { | 1719 for (Edge edge : node->use_edges()) { |
1719 Node* const user = edge.from(); | 1720 Node* const user = edge.from(); |
1720 CHECK(!user->IsDead()); | 1721 CHECK(!user->IsDead()); |
1721 if (NodeProperties::IsControlEdge(edge)) { | 1722 if (NodeProperties::IsControlEdge(edge)) { |
1722 CHECK(!check_no_control); | 1723 CHECK(!check_no_control); |
1723 } else if (NodeProperties::IsEffectEdge(edge)) { | 1724 } else if (NodeProperties::IsEffectEdge(edge)) { |
1724 CHECK(!check_no_effect); | 1725 CHECK(!check_no_effect); |
| 1726 effect_edges++; |
1725 } else if (NodeProperties::IsFrameStateEdge(edge)) { | 1727 } else if (NodeProperties::IsFrameStateEdge(edge)) { |
1726 CHECK(!check_no_frame_state); | 1728 CHECK(!check_no_frame_state); |
1727 } | 1729 } |
1728 } | 1730 } |
1729 } | 1731 } |
1730 // Frame state input should be a frame state (or sentinel). | 1732 // Frame state input should be a frame state (or sentinel). |
1731 if (OperatorProperties::GetFrameStateInputCount(node->op()) > 0) { | 1733 if (OperatorProperties::GetFrameStateInputCount(node->op()) > 0) { |
1732 Node* input = NodeProperties::GetFrameStateInput(node); | 1734 Node* input = NodeProperties::GetFrameStateInput(node); |
1733 CHECK(input->opcode() == IrOpcode::kFrameState || | 1735 CHECK(input->opcode() == IrOpcode::kFrameState || |
1734 input->opcode() == IrOpcode::kStart || | 1736 input->opcode() == IrOpcode::kStart || |
(...skipping 23 matching lines...) Expand all Loading... |
1758 replacement->op()->EffectOutputCount() > 0); | 1760 replacement->op()->EffectOutputCount() > 0); |
1759 DCHECK(!NodeProperties::IsFrameStateEdge(edge) || | 1761 DCHECK(!NodeProperties::IsFrameStateEdge(edge) || |
1760 replacement->opcode() == IrOpcode::kFrameState); | 1762 replacement->opcode() == IrOpcode::kFrameState); |
1761 } | 1763 } |
1762 | 1764 |
1763 #endif // DEBUG | 1765 #endif // DEBUG |
1764 | 1766 |
1765 } // namespace compiler | 1767 } // namespace compiler |
1766 } // namespace internal | 1768 } // namespace internal |
1767 } // namespace v8 | 1769 } // namespace v8 |
OLD | NEW |