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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 if (node->op()->ValueOutputCount() > 1) { | 171 if (node->op()->ValueOutputCount() > 1) { |
172 for (Edge edge : node->use_edges()) { | 172 for (Edge edge : node->use_edges()) { |
173 Node* use = edge.from(); | 173 Node* use = edge.from(); |
174 CHECK(!NodeProperties::IsValueEdge(edge) || | 174 CHECK(!NodeProperties::IsValueEdge(edge) || |
175 use->opcode() == IrOpcode::kProjection || | 175 use->opcode() == IrOpcode::kProjection || |
176 use->opcode() == IrOpcode::kParameter); | 176 use->opcode() == IrOpcode::kParameter); |
177 } | 177 } |
178 } | 178 } |
179 | 179 |
180 switch (node->opcode()) { | 180 switch (node->opcode()) { |
| 181 case IrOpcode::kAlways: |
| 182 // Always has no inputs. |
| 183 CHECK_EQ(0, input_count); |
| 184 // Always uses are Branch. |
| 185 for (auto use : node->uses()) { |
| 186 CHECK(use->opcode() == IrOpcode::kBranch); |
| 187 } |
| 188 // Type is boolean. |
| 189 CheckUpperIs(node, Type::Boolean()); |
| 190 break; |
181 case IrOpcode::kStart: | 191 case IrOpcode::kStart: |
182 // Start has no inputs. | 192 // Start has no inputs. |
183 CHECK_EQ(0, input_count); | 193 CHECK_EQ(0, input_count); |
184 // Type is a tuple. | 194 // Type is a tuple. |
185 // TODO(rossberg): Multiple outputs are currently typed as Internal. | 195 // TODO(rossberg): Multiple outputs are currently typed as Internal. |
186 CheckUpperIs(node, Type::Internal()); | 196 CheckUpperIs(node, Type::Internal()); |
187 break; | 197 break; |
188 case IrOpcode::kEnd: | 198 case IrOpcode::kEnd: |
189 // End has no outputs. | 199 // End has no outputs. |
190 CHECK(node->op()->ValueOutputCount() == 0); | 200 CHECK(node->op()->ValueOutputCount() == 0); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 case IrOpcode::kReturn: | 236 case IrOpcode::kReturn: |
227 // TODO(rossberg): check successor is End | 237 // TODO(rossberg): check successor is End |
228 // Type is empty. | 238 // Type is empty. |
229 CheckNotTyped(node); | 239 CheckNotTyped(node); |
230 break; | 240 break; |
231 case IrOpcode::kThrow: | 241 case IrOpcode::kThrow: |
232 // TODO(rossberg): what are the constraints on these? | 242 // TODO(rossberg): what are the constraints on these? |
233 // Type is empty. | 243 // Type is empty. |
234 CheckNotTyped(node); | 244 CheckNotTyped(node); |
235 break; | 245 break; |
236 case IrOpcode::kTerminate: | |
237 // Type is empty. | |
238 CheckNotTyped(node); | |
239 CHECK_EQ(1, control_count); | |
240 CHECK_EQ(input_count, 1 + effect_count); | |
241 break; | |
242 case IrOpcode::kOsrNormalEntry: | 246 case IrOpcode::kOsrNormalEntry: |
243 case IrOpcode::kOsrLoopEntry: | 247 case IrOpcode::kOsrLoopEntry: |
244 // Osr entries have | 248 // Osr entries have |
245 CHECK_EQ(1, effect_count); | 249 CHECK_EQ(1, effect_count); |
246 CHECK_EQ(1, control_count); | 250 CHECK_EQ(1, control_count); |
247 // Type is empty. | 251 // Type is empty. |
248 CheckNotTyped(node); | 252 CheckNotTyped(node); |
249 break; | 253 break; |
250 | 254 |
251 // Common operators | 255 // Common operators |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 } | 345 } |
342 case IrOpcode::kEffectPhi: { | 346 case IrOpcode::kEffectPhi: { |
343 // EffectPhi input count matches parent control node. | 347 // EffectPhi input count matches parent control node. |
344 CHECK_EQ(0, value_count); | 348 CHECK_EQ(0, value_count); |
345 CHECK_EQ(1, control_count); | 349 CHECK_EQ(1, control_count); |
346 Node* control = NodeProperties::GetControlInput(node, 0); | 350 Node* control = NodeProperties::GetControlInput(node, 0); |
347 CHECK_EQ(effect_count, control->op()->ControlInputCount()); | 351 CHECK_EQ(effect_count, control->op()->ControlInputCount()); |
348 CHECK_EQ(input_count, 1 + effect_count); | 352 CHECK_EQ(input_count, 1 + effect_count); |
349 break; | 353 break; |
350 } | 354 } |
| 355 case IrOpcode::kEffectSet: { |
| 356 CHECK_EQ(0, value_count); |
| 357 CHECK_EQ(0, control_count); |
| 358 CHECK_LT(1, effect_count); |
| 359 break; |
| 360 } |
351 case IrOpcode::kValueEffect: | 361 case IrOpcode::kValueEffect: |
352 // TODO(rossberg): what are the constraints on these? | 362 // TODO(rossberg): what are the constraints on these? |
353 break; | 363 break; |
354 case IrOpcode::kFinish: { | 364 case IrOpcode::kFinish: { |
355 // TODO(rossberg): what are the constraints on these? | 365 // TODO(rossberg): what are the constraints on these? |
356 // Type must be subsumed by input type. | 366 // Type must be subsumed by input type. |
357 if (typing == TYPED) { | 367 if (typing == TYPED) { |
358 CHECK(bounds(ValueInput(node)).lower->Is(bounds(node).lower)); | 368 CHECK(bounds(ValueInput(node)).lower->Is(bounds(node).lower)); |
359 CHECK(bounds(ValueInput(node)).upper->Is(bounds(node).upper)); | 369 CHECK(bounds(ValueInput(node)).upper->Is(bounds(node).upper)); |
360 } | 370 } |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 // Check inputs for all nodes in the block. | 1000 // Check inputs for all nodes in the block. |
991 for (size_t i = 0; i < block->NodeCount(); i++) { | 1001 for (size_t i = 0; i < block->NodeCount(); i++) { |
992 Node* node = block->NodeAt(i); | 1002 Node* node = block->NodeAt(i); |
993 CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1); | 1003 CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1); |
994 } | 1004 } |
995 } | 1005 } |
996 } | 1006 } |
997 } | 1007 } |
998 } | 1008 } |
999 } // namespace v8::internal::compiler | 1009 } // namespace v8::internal::compiler |
OLD | NEW |