OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 <deque> | 5 #include <deque> |
6 #include <queue> | 6 #include <queue> |
7 | 7 |
8 #include "src/compiler/scheduler.h" | 8 #include "src/compiler/scheduler.h" |
9 | 9 |
10 #include "src/bit-vector.h" | 10 #include "src/bit-vector.h" |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 os << ")"; | 917 os << ")"; |
918 } | 918 } |
919 os << ":\n"; | 919 os << ":\n"; |
920 | 920 |
921 for (BlockList* l = order_; l != NULL; l = l->next) { | 921 for (BlockList* l = order_; l != NULL; l = l->next) { |
922 BasicBlock* block = l->block; | 922 BasicBlock* block = l->block; |
923 BasicBlock::Id bid = block->id(); | 923 BasicBlock::Id bid = block->id(); |
924 // TODO(jarin,svenpanne): Add formatting here once we have support for | 924 // TODO(jarin,svenpanne): Add formatting here once we have support for |
925 // that in streams (we want an equivalent of PrintF("%5d:", x) here). | 925 // that in streams (we want an equivalent of PrintF("%5d:", x) here). |
926 os << " " << block->rpo_number() << ":"; | 926 os << " " << block->rpo_number() << ":"; |
927 for (size_t j = 0; j < loops_.size(); j++) { | 927 for (size_t i = 0; i < loops_.size(); i++) { |
928 bool membership = loops_[j].members->Contains(bid.ToInt()); | 928 bool range = loops_[i].header->LoopContains(block); |
929 bool range = loops_[j].header->LoopContains(block); | 929 bool membership = loops_[i].header != block && range; |
930 os << (membership ? " |" : " "); | 930 os << (membership ? " |" : " "); |
931 os << (range ? "x" : " "); | 931 os << (range ? "x" : " "); |
932 } | 932 } |
933 os << " B" << bid << ": "; | 933 os << " B" << bid << ": "; |
934 if (block->loop_end() != NULL) { | 934 if (block->loop_end() != NULL) { |
935 os << " range: [" << block->rpo_number() << ", " | 935 os << " range: [" << block->rpo_number() << ", " |
936 << block->loop_end()->rpo_number() << ")"; | 936 << block->loop_end()->rpo_number() << ")"; |
937 } | 937 } |
938 if (block->loop_header() != NULL) { | 938 if (block->loop_header() != NULL) { |
939 os << " header: B" << block->loop_header()->id(); | 939 os << " header: B" << block->loop_header()->id(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 DCHECK(l->block->rpo_number() == links + loop->header->rpo_number()); | 977 DCHECK(l->block->rpo_number() == links + loop->header->rpo_number()); |
978 links++; | 978 links++; |
979 l = l->next; | 979 l = l->next; |
980 DCHECK(links < static_cast<int>(2 * order->size())); // cycle? | 980 DCHECK(links < static_cast<int>(2 * order->size())); // cycle? |
981 } | 981 } |
982 DCHECK(links > 0); | 982 DCHECK(links > 0); |
983 DCHECK(links == end->rpo_number() - header->rpo_number()); | 983 DCHECK(links == end->rpo_number() - header->rpo_number()); |
984 DCHECK(end_found); | 984 DCHECK(end_found); |
985 | 985 |
986 // Check the contiguousness of loops. | 986 // Check the contiguousness of loops. |
987 // TODO(mstarzinger): Loop membership bit-vector becomes stale. | 987 int count = 0; |
988 /*int count = 0; | |
989 for (int j = 0; j < static_cast<int>(order->size()); j++) { | 988 for (int j = 0; j < static_cast<int>(order->size()); j++) { |
990 BasicBlock* block = order->at(j); | 989 BasicBlock* block = order->at(j); |
991 DCHECK(block->rpo_number() == j); | 990 DCHECK(block->rpo_number() == j); |
992 if (j < header->rpo_number() || j >= end->rpo_number()) { | 991 if (j < header->rpo_number() || j >= end->rpo_number()) { |
993 DCHECK(!loop->members->Contains(block->id().ToInt())); | 992 DCHECK(!header->LoopContains(block)); |
994 } else { | 993 } else { |
995 if (block == header) { | 994 DCHECK(header->LoopContains(block)); |
996 DCHECK(!loop->members->Contains(block->id().ToInt())); | |
997 } else { | |
998 DCHECK(loop->members->Contains(block->id().ToInt())); | |
999 } | |
1000 count++; | 995 count++; |
1001 } | 996 } |
1002 } | 997 } |
1003 DCHECK(links == count);*/ | 998 DCHECK(links == count); |
1004 } | 999 } |
1005 } | 1000 } |
1006 #endif // DEBUG | 1001 #endif // DEBUG |
1007 | 1002 |
1008 Zone* zone_; | 1003 Zone* zone_; |
1009 Schedule* schedule_; | 1004 Schedule* schedule_; |
1010 BlockList* order_; | 1005 BlockList* order_; |
1011 ZoneVector<LoopInfo> loops_; | 1006 ZoneVector<LoopInfo> loops_; |
1012 BasicBlock* beyond_end_; | 1007 BasicBlock* beyond_end_; |
1013 }; | 1008 }; |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1461 for (NodeVectorIter i = nodes->begin(); i != nodes->end(); ++i) { | 1456 for (NodeVectorIter i = nodes->begin(); i != nodes->end(); ++i) { |
1462 schedule_->SetBlockForNode(to, *i); | 1457 schedule_->SetBlockForNode(to, *i); |
1463 scheduled_nodes_[to->id().ToSize()].push_back(*i); | 1458 scheduled_nodes_[to->id().ToSize()].push_back(*i); |
1464 } | 1459 } |
1465 nodes->clear(); | 1460 nodes->clear(); |
1466 } | 1461 } |
1467 | 1462 |
1468 } // namespace compiler | 1463 } // namespace compiler |
1469 } // namespace internal | 1464 } // namespace internal |
1470 } // namespace v8 | 1465 } // namespace v8 |
OLD | NEW |