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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 CheckTypeIs(node, Type::Any()); | 732 CheckTypeIs(node, Type::Any()); |
733 break; | 733 break; |
734 case IrOpcode::kJSStoreModule: | 734 case IrOpcode::kJSStoreModule: |
735 CheckNotTyped(node); | 735 CheckNotTyped(node); |
736 break; | 736 break; |
737 | 737 |
738 case IrOpcode::kJSGeneratorStore: | 738 case IrOpcode::kJSGeneratorStore: |
739 CheckNotTyped(node); | 739 CheckNotTyped(node); |
740 break; | 740 break; |
741 | 741 |
| 742 case IrOpcode::kJSCreateGeneratorObject: |
| 743 CheckTypeIs(node, Type::OtherObject()); |
| 744 break; |
| 745 |
742 case IrOpcode::kJSGeneratorRestoreContinuation: | 746 case IrOpcode::kJSGeneratorRestoreContinuation: |
743 CheckTypeIs(node, Type::SignedSmall()); | 747 CheckTypeIs(node, Type::SignedSmall()); |
744 break; | 748 break; |
745 | 749 |
746 case IrOpcode::kJSGeneratorRestoreRegister: | 750 case IrOpcode::kJSGeneratorRestoreRegister: |
747 CheckTypeIs(node, Type::Any()); | 751 CheckTypeIs(node, Type::Any()); |
748 break; | 752 break; |
749 | 753 |
750 case IrOpcode::kJSStackCheck: | 754 case IrOpcode::kJSStackCheck: |
751 case IrOpcode::kJSDebugger: | 755 case IrOpcode::kJSDebugger: |
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1699 } | 1703 } |
1700 | 1704 |
1701 | 1705 |
1702 #ifdef DEBUG | 1706 #ifdef DEBUG |
1703 | 1707 |
1704 // static | 1708 // static |
1705 void Verifier::VerifyNode(Node* node) { | 1709 void Verifier::VerifyNode(Node* node) { |
1706 CHECK_EQ(OperatorProperties::GetTotalInputCount(node->op()), | 1710 CHECK_EQ(OperatorProperties::GetTotalInputCount(node->op()), |
1707 node->InputCount()); | 1711 node->InputCount()); |
1708 // If this node has no effect or no control outputs, | 1712 // If this node has no effect or no control outputs, |
1709 // we check that no its uses are effect or control inputs. | 1713 // we check that none of its uses are effect or control inputs. |
1710 bool check_no_control = node->op()->ControlOutputCount() == 0; | 1714 bool check_no_control = node->op()->ControlOutputCount() == 0; |
1711 bool check_no_effect = node->op()->EffectOutputCount() == 0; | 1715 bool check_no_effect = node->op()->EffectOutputCount() == 0; |
1712 bool check_no_frame_state = node->opcode() != IrOpcode::kFrameState; | 1716 bool check_no_frame_state = node->opcode() != IrOpcode::kFrameState; |
| 1717 int effect_edges = 0; |
1713 if (check_no_effect || check_no_control) { | 1718 if (check_no_effect || check_no_control) { |
1714 for (Edge edge : node->use_edges()) { | 1719 for (Edge edge : node->use_edges()) { |
1715 Node* const user = edge.from(); | 1720 Node* const user = edge.from(); |
1716 CHECK(!user->IsDead()); | 1721 CHECK(!user->IsDead()); |
1717 if (NodeProperties::IsControlEdge(edge)) { | 1722 if (NodeProperties::IsControlEdge(edge)) { |
1718 CHECK(!check_no_control); | 1723 CHECK(!check_no_control); |
1719 } else if (NodeProperties::IsEffectEdge(edge)) { | 1724 } else if (NodeProperties::IsEffectEdge(edge)) { |
1720 CHECK(!check_no_effect); | 1725 CHECK(!check_no_effect); |
| 1726 effect_edges++; |
1721 } else if (NodeProperties::IsFrameStateEdge(edge)) { | 1727 } else if (NodeProperties::IsFrameStateEdge(edge)) { |
1722 CHECK(!check_no_frame_state); | 1728 CHECK(!check_no_frame_state); |
1723 } | 1729 } |
1724 } | 1730 } |
1725 } | 1731 } |
1726 // Frame state input should be a frame state (or sentinel). | 1732 // Frame state input should be a frame state (or sentinel). |
1727 if (OperatorProperties::GetFrameStateInputCount(node->op()) > 0) { | 1733 if (OperatorProperties::GetFrameStateInputCount(node->op()) > 0) { |
1728 Node* input = NodeProperties::GetFrameStateInput(node); | 1734 Node* input = NodeProperties::GetFrameStateInput(node); |
1729 CHECK(input->opcode() == IrOpcode::kFrameState || | 1735 CHECK(input->opcode() == IrOpcode::kFrameState || |
1730 input->opcode() == IrOpcode::kStart || | 1736 input->opcode() == IrOpcode::kStart || |
(...skipping 23 matching lines...) Expand all Loading... |
1754 replacement->op()->EffectOutputCount() > 0); | 1760 replacement->op()->EffectOutputCount() > 0); |
1755 DCHECK(!NodeProperties::IsFrameStateEdge(edge) || | 1761 DCHECK(!NodeProperties::IsFrameStateEdge(edge) || |
1756 replacement->opcode() == IrOpcode::kFrameState); | 1762 replacement->opcode() == IrOpcode::kFrameState); |
1757 } | 1763 } |
1758 | 1764 |
1759 #endif // DEBUG | 1765 #endif // DEBUG |
1760 | 1766 |
1761 } // namespace compiler | 1767 } // namespace compiler |
1762 } // namespace internal | 1768 } // namespace internal |
1763 } // namespace v8 | 1769 } // namespace v8 |
OLD | NEW |