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 | 9 |
10 #include "src/compiler/generic-algorithm.h" | 10 #include "src/compiler/generic-algorithm.h" |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 Zone tmp_zone(schedule->zone()->isolate()); | 297 Zone tmp_zone(schedule->zone()->isolate()); |
298 Zone* zone = &tmp_zone; | 298 Zone* zone = &tmp_zone; |
299 BasicBlock* start = schedule->start(); | 299 BasicBlock* start = schedule->start(); |
300 BasicBlockVector* rpo_order = schedule->rpo_order(); | 300 BasicBlockVector* rpo_order = schedule->rpo_order(); |
301 | 301 |
302 // Verify the RPO order contains only blocks from this schedule. | 302 // Verify the RPO order contains only blocks from this schedule. |
303 CHECK_GE(count, static_cast<int>(rpo_order->size())); | 303 CHECK_GE(count, static_cast<int>(rpo_order->size())); |
304 for (BasicBlockVector::iterator b = rpo_order->begin(); b != rpo_order->end(); | 304 for (BasicBlockVector::iterator b = rpo_order->begin(); b != rpo_order->end(); |
305 ++b) { | 305 ++b) { |
306 CHECK_EQ((*b), schedule->GetBlockById((*b)->id())); | 306 CHECK_EQ((*b), schedule->GetBlockById((*b)->id())); |
| 307 // All predecessors and successors should be in rpo and in this schedule. |
| 308 BasicBlock::Predecessors p = (*b)->predecessors(); |
| 309 for (BasicBlock::Predecessors::iterator j = p.begin(); j != p.end(); ++j) { |
| 310 CHECK_GE((*j)->rpo_number_, 0); |
| 311 CHECK_EQ((*j), schedule->GetBlockById((*j)->id())); |
| 312 } |
| 313 BasicBlock::Successors s = (*b)->successors(); |
| 314 for (BasicBlock::Successors::iterator j = s.begin(); j != s.end(); ++j) { |
| 315 CHECK_GE((*j)->rpo_number_, 0); |
| 316 CHECK_EQ((*j), schedule->GetBlockById((*j)->id())); |
| 317 } |
307 } | 318 } |
308 | 319 |
309 // Verify RPO numbers of blocks. | 320 // Verify RPO numbers of blocks. |
310 CHECK_EQ(start, rpo_order->at(0)); // Start should be first. | 321 CHECK_EQ(start, rpo_order->at(0)); // Start should be first. |
311 for (size_t b = 0; b < rpo_order->size(); b++) { | 322 for (size_t b = 0; b < rpo_order->size(); b++) { |
312 BasicBlock* block = rpo_order->at(b); | 323 BasicBlock* block = rpo_order->at(b); |
313 CHECK_EQ(static_cast<int>(b), block->rpo_number_); | 324 CHECK_EQ(static_cast<int>(b), block->rpo_number_); |
314 BasicBlock* dom = block->dominator_; | 325 BasicBlock* dom = block->dominator_; |
315 if (b == 0) { | 326 if (b == 0) { |
316 // All blocks except start should have a dominator. | 327 // All blocks except start should have a dominator. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 // Check inputs for all nodes in the block. | 457 // Check inputs for all nodes in the block. |
447 for (size_t i = 0; i < block->nodes_.size(); i++) { | 458 for (size_t i = 0; i < block->nodes_.size(); i++) { |
448 Node* node = block->nodes_[i]; | 459 Node* node = block->nodes_[i]; |
449 CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1); | 460 CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1); |
450 } | 461 } |
451 } | 462 } |
452 } | 463 } |
453 } | 464 } |
454 } | 465 } |
455 } // namespace v8::internal::compiler | 466 } // namespace v8::internal::compiler |
OLD | NEW |