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 <deque> | 7 #include <deque> |
8 #include <queue> | 8 #include <queue> |
9 #include <sstream> | 9 #include <sstream> |
10 #include <string> | 10 #include <string> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 return false; | 46 return false; |
47 } | 47 } |
48 | 48 |
49 | 49 |
50 class Verifier::Visitor : public NullNodeVisitor { | 50 class Verifier::Visitor : public NullNodeVisitor { |
51 public: | 51 public: |
52 Visitor(Zone* z, Typing typed) : zone(z), typing(typed) {} | 52 Visitor(Zone* z, Typing typed) : zone(z), typing(typed) {} |
53 | 53 |
54 // Fulfills the PreNodeCallback interface. | 54 // Fulfills the PreNodeCallback interface. |
55 GenericGraphVisit::Control Pre(Node* node); | 55 void Pre(Node* node); |
56 | 56 |
57 Zone* zone; | 57 Zone* zone; |
58 Typing typing; | 58 Typing typing; |
59 | 59 |
60 private: | 60 private: |
61 // TODO(rossberg): Get rid of these once we got rid of NodeProperties. | 61 // TODO(rossberg): Get rid of these once we got rid of NodeProperties. |
62 Bounds bounds(Node* node) { return NodeProperties::GetBounds(node); } | 62 Bounds bounds(Node* node) { return NodeProperties::GetBounds(node); } |
63 Node* ValueInput(Node* node, int i = 0) { | 63 Node* ValueInput(Node* node, int i = 0) { |
64 return NodeProperties::GetValueInput(node, i); | 64 return NodeProperties::GetValueInput(node, i); |
65 } | 65 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 << ") upper bound "; | 113 << ") upper bound "; |
114 bounds(input).upper->PrintTo(str); | 114 bounds(input).upper->PrintTo(str); |
115 str << " is not "; | 115 str << " is not "; |
116 type->PrintTo(str); | 116 type->PrintTo(str); |
117 V8_Fatal(__FILE__, __LINE__, str.str().c_str()); | 117 V8_Fatal(__FILE__, __LINE__, str.str().c_str()); |
118 } | 118 } |
119 } | 119 } |
120 }; | 120 }; |
121 | 121 |
122 | 122 |
123 GenericGraphVisit::Control Verifier::Visitor::Pre(Node* node) { | 123 void Verifier::Visitor::Pre(Node* node) { |
124 int value_count = node->op()->ValueInputCount(); | 124 int value_count = node->op()->ValueInputCount(); |
125 int context_count = OperatorProperties::GetContextInputCount(node->op()); | 125 int context_count = OperatorProperties::GetContextInputCount(node->op()); |
126 int frame_state_count = | 126 int frame_state_count = |
127 OperatorProperties::GetFrameStateInputCount(node->op()); | 127 OperatorProperties::GetFrameStateInputCount(node->op()); |
128 int effect_count = node->op()->EffectInputCount(); | 128 int effect_count = node->op()->EffectInputCount(); |
129 int control_count = node->op()->ControlInputCount(); | 129 int control_count = node->op()->ControlInputCount(); |
130 | 130 |
131 // Verify number of inputs matches up. | 131 // Verify number of inputs matches up. |
132 int input_count = value_count + context_count + frame_state_count + | 132 int input_count = value_count + context_count + frame_state_count + |
133 effect_count + control_count; | 133 effect_count + control_count; |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 case IrOpcode::kChangeUint32ToUint64: | 720 case IrOpcode::kChangeUint32ToUint64: |
721 case IrOpcode::kChangeInt32ToFloat64: | 721 case IrOpcode::kChangeInt32ToFloat64: |
722 case IrOpcode::kChangeUint32ToFloat64: | 722 case IrOpcode::kChangeUint32ToFloat64: |
723 case IrOpcode::kChangeFloat32ToFloat64: | 723 case IrOpcode::kChangeFloat32ToFloat64: |
724 case IrOpcode::kChangeFloat64ToInt32: | 724 case IrOpcode::kChangeFloat64ToInt32: |
725 case IrOpcode::kChangeFloat64ToUint32: | 725 case IrOpcode::kChangeFloat64ToUint32: |
726 case IrOpcode::kLoadStackPointer: | 726 case IrOpcode::kLoadStackPointer: |
727 // TODO(rossberg): Check. | 727 // TODO(rossberg): Check. |
728 break; | 728 break; |
729 } | 729 } |
730 | |
731 return GenericGraphVisit::CONTINUE; | |
732 } | 730 } |
733 | 731 |
734 | 732 |
735 void Verifier::Run(Graph* graph, Typing typing) { | 733 void Verifier::Run(Graph* graph, Typing typing) { |
736 Visitor visitor(graph->zone(), typing); | 734 Visitor visitor(graph->zone(), typing); |
737 CHECK_NE(NULL, graph->start()); | 735 CHECK_NE(NULL, graph->start()); |
738 CHECK_NE(NULL, graph->end()); | 736 CHECK_NE(NULL, graph->end()); |
739 graph->VisitNodeInputsFromEnd(&visitor); | 737 graph->VisitNodeInputsFromEnd(&visitor); |
740 } | 738 } |
741 | 739 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 // Check inputs for all nodes in the block. | 970 // Check inputs for all nodes in the block. |
973 for (size_t i = 0; i < block->NodeCount(); i++) { | 971 for (size_t i = 0; i < block->NodeCount(); i++) { |
974 Node* node = block->NodeAt(i); | 972 Node* node = block->NodeAt(i); |
975 CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1); | 973 CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1); |
976 } | 974 } |
977 } | 975 } |
978 } | 976 } |
979 } | 977 } |
980 } | 978 } |
981 } // namespace v8::internal::compiler | 979 } // namespace v8::internal::compiler |
OLD | NEW |