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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 return OpParameter<FieldAccess>(node); | 61 return OpParameter<FieldAccess>(node); |
62 } | 62 } |
63 ElementAccess Element(Node* node) { | 63 ElementAccess Element(Node* node) { |
64 DCHECK(node->opcode() == IrOpcode::kLoadElement || | 64 DCHECK(node->opcode() == IrOpcode::kLoadElement || |
65 node->opcode() == IrOpcode::kStoreElement); | 65 node->opcode() == IrOpcode::kStoreElement); |
66 return OpParameter<ElementAccess>(node); | 66 return OpParameter<ElementAccess>(node); |
67 } | 67 } |
68 void CheckNotTyped(Node* node) { | 68 void CheckNotTyped(Node* node) { |
69 if (NodeProperties::IsTyped(node)) { | 69 if (NodeProperties::IsTyped(node)) { |
70 std::ostringstream str; | 70 std::ostringstream str; |
71 str << "TypeError: node #" << node->opcode() << ":" | 71 str << "TypeError: node #" << node->id() << ":" << *node->op() |
72 << node->op()->mnemonic() << " should never have a type"; | 72 << " should never have a type"; |
73 V8_Fatal(__FILE__, __LINE__, str.str().c_str()); | 73 FATAL(str.str().c_str()); |
74 } | 74 } |
75 } | 75 } |
76 void CheckUpperIs(Node* node, Type* type) { | 76 void CheckUpperIs(Node* node, Type* type) { |
77 if (typing == TYPED && !bounds(node).upper->Is(type)) { | 77 if (typing == TYPED && !bounds(node).upper->Is(type)) { |
78 std::ostringstream str; | 78 std::ostringstream str; |
79 str << "TypeError: node #" << node->opcode() << ":" | 79 str << "TypeError: node #" << node->id() << ":" << *node->op() |
80 << node->op()->mnemonic() << " upper bound "; | 80 << " upper bound "; |
81 bounds(node).upper->PrintTo(str); | 81 bounds(node).upper->PrintTo(str); |
82 str << " is not "; | 82 str << " is not "; |
83 type->PrintTo(str); | 83 type->PrintTo(str); |
84 V8_Fatal(__FILE__, __LINE__, str.str().c_str()); | 84 FATAL(str.str().c_str()); |
85 } | 85 } |
86 } | 86 } |
87 void CheckUpperMaybe(Node* node, Type* type) { | 87 void CheckUpperMaybe(Node* node, Type* type) { |
88 if (typing == TYPED && !bounds(node).upper->Maybe(type)) { | 88 if (typing == TYPED && !bounds(node).upper->Maybe(type)) { |
89 std::ostringstream str; | 89 std::ostringstream str; |
90 str << "TypeError: node #" << node->opcode() << ":" | 90 str << "TypeError: node #" << node->id() << ":" << *node->op() |
91 << node->op()->mnemonic() << " upper bound "; | 91 << " upper bound "; |
92 bounds(node).upper->PrintTo(str); | 92 bounds(node).upper->PrintTo(str); |
93 str << " must intersect "; | 93 str << " must intersect "; |
94 type->PrintTo(str); | 94 type->PrintTo(str); |
95 V8_Fatal(__FILE__, __LINE__, str.str().c_str()); | 95 FATAL(str.str().c_str()); |
96 } | 96 } |
97 } | 97 } |
98 void CheckValueInputIs(Node* node, int i, Type* type) { | 98 void CheckValueInputIs(Node* node, int i, Type* type) { |
99 Node* input = ValueInput(node, i); | 99 Node* input = ValueInput(node, i); |
100 if (typing == TYPED && !bounds(input).upper->Is(type)) { | 100 if (typing == TYPED && !bounds(input).upper->Is(type)) { |
101 std::ostringstream str; | 101 std::ostringstream str; |
102 str << "TypeError: node #" << node->opcode() << ":" | 102 str << "TypeError: node #" << node->id() << ":" << *node->op() |
103 << node->op()->mnemonic() << "(input @" << i << " = " | 103 << "(input @" << i << " = " << input->opcode() << ":" |
104 << input->opcode() << ":" << input->op()->mnemonic() | 104 << input->op()->mnemonic() << ") upper bound "; |
105 << ") upper bound "; | |
106 bounds(input).upper->PrintTo(str); | 105 bounds(input).upper->PrintTo(str); |
107 str << " is not "; | 106 str << " is not "; |
108 type->PrintTo(str); | 107 type->PrintTo(str); |
109 V8_Fatal(__FILE__, __LINE__, str.str().c_str()); | 108 FATAL(str.str().c_str()); |
110 } | 109 } |
111 } | 110 } |
112 }; | 111 }; |
113 | 112 |
114 | 113 |
115 void Verifier::Visitor::Check(Node* node) { | 114 void Verifier::Visitor::Check(Node* node) { |
116 int value_count = node->op()->ValueInputCount(); | 115 int value_count = node->op()->ValueInputCount(); |
117 int context_count = OperatorProperties::GetContextInputCount(node->op()); | 116 int context_count = OperatorProperties::GetContextInputCount(node->op()); |
118 int frame_state_count = | 117 int frame_state_count = |
119 OperatorProperties::GetFrameStateInputCount(node->op()); | 118 OperatorProperties::GetFrameStateInputCount(node->op()); |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 // Check inputs for all nodes in the block. | 1040 // Check inputs for all nodes in the block. |
1042 for (size_t i = 0; i < block->NodeCount(); i++) { | 1041 for (size_t i = 0; i < block->NodeCount(); i++) { |
1043 Node* node = block->NodeAt(i); | 1042 Node* node = block->NodeAt(i); |
1044 CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1); | 1043 CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1); |
1045 } | 1044 } |
1046 } | 1045 } |
1047 } | 1046 } |
1048 } | 1047 } |
1049 } | 1048 } |
1050 } // namespace v8::internal::compiler | 1049 } // namespace v8::internal::compiler |
OLD | NEW |