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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 Zone* zone = &tmp_zone; | 833 Zone* zone = &tmp_zone; |
834 BasicBlock* start = schedule->start(); | 834 BasicBlock* start = schedule->start(); |
835 BasicBlockVector* rpo_order = schedule->rpo_order(); | 835 BasicBlockVector* rpo_order = schedule->rpo_order(); |
836 | 836 |
837 // Verify the RPO order contains only blocks from this schedule. | 837 // Verify the RPO order contains only blocks from this schedule. |
838 CHECK_GE(count, rpo_order->size()); | 838 CHECK_GE(count, rpo_order->size()); |
839 for (BasicBlockVector::iterator b = rpo_order->begin(); b != rpo_order->end(); | 839 for (BasicBlockVector::iterator b = rpo_order->begin(); b != rpo_order->end(); |
840 ++b) { | 840 ++b) { |
841 CHECK_EQ((*b), schedule->GetBlockById((*b)->id())); | 841 CHECK_EQ((*b), schedule->GetBlockById((*b)->id())); |
842 // All predecessors and successors should be in rpo and in this schedule. | 842 // All predecessors and successors should be in rpo and in this schedule. |
843 for (BasicBlock::Predecessors::iterator j = (*b)->predecessors_begin(); | 843 for (BasicBlock const* predecessor : (*b)->predecessors()) { |
844 j != (*b)->predecessors_end(); ++j) { | 844 CHECK_GE(predecessor->rpo_number(), 0); |
845 CHECK_GE((*j)->rpo_number(), 0); | 845 CHECK_EQ(predecessor, schedule->GetBlockById(predecessor->id())); |
846 CHECK_EQ((*j), schedule->GetBlockById((*j)->id())); | |
847 } | 846 } |
848 for (BasicBlock::Successors::iterator j = (*b)->successors_begin(); | 847 for (BasicBlock const* successor : (*b)->successors()) { |
849 j != (*b)->successors_end(); ++j) { | 848 CHECK_GE(successor->rpo_number(), 0); |
850 CHECK_GE((*j)->rpo_number(), 0); | 849 CHECK_EQ(successor, schedule->GetBlockById(successor->id())); |
851 CHECK_EQ((*j), schedule->GetBlockById((*j)->id())); | |
852 } | 850 } |
853 } | 851 } |
854 | 852 |
855 // Verify RPO numbers of blocks. | 853 // Verify RPO numbers of blocks. |
856 CHECK_EQ(start, rpo_order->at(0)); // Start should be first. | 854 CHECK_EQ(start, rpo_order->at(0)); // Start should be first. |
857 for (size_t b = 0; b < rpo_order->size(); b++) { | 855 for (size_t b = 0; b < rpo_order->size(); b++) { |
858 BasicBlock* block = rpo_order->at(b); | 856 BasicBlock* block = rpo_order->at(b); |
859 CHECK_EQ(static_cast<int>(b), block->rpo_number()); | 857 CHECK_EQ(static_cast<int>(b), block->rpo_number()); |
860 BasicBlock* dom = block->dominator(); | 858 BasicBlock* dom = block->dominator(); |
861 if (b == 0) { | 859 if (b == 0) { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 // Check inputs for all nodes in the block. | 991 // Check inputs for all nodes in the block. |
994 for (size_t i = 0; i < block->NodeCount(); i++) { | 992 for (size_t i = 0; i < block->NodeCount(); i++) { |
995 Node* node = block->NodeAt(i); | 993 Node* node = block->NodeAt(i); |
996 CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1); | 994 CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1); |
997 } | 995 } |
998 } | 996 } |
999 } | 997 } |
1000 } | 998 } |
1001 } | 999 } |
1002 } // namespace v8::internal::compiler | 1000 } // namespace v8::internal::compiler |
OLD | NEW |