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 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 case IrOpcode::kLoadStackPointer: | 756 case IrOpcode::kLoadStackPointer: |
757 case IrOpcode::kCheckedLoad: | 757 case IrOpcode::kCheckedLoad: |
758 case IrOpcode::kCheckedStore: | 758 case IrOpcode::kCheckedStore: |
759 // TODO(rossberg): Check. | 759 // TODO(rossberg): Check. |
760 break; | 760 break; |
761 } | 761 } |
762 } | 762 } |
763 | 763 |
764 | 764 |
765 void Verifier::Run(Graph* graph, Typing typing) { | 765 void Verifier::Run(Graph* graph, Typing typing) { |
766 CHECK_NE(NULL, graph->start()); | 766 CHECK_NOT_NULL(graph->start()); |
767 CHECK_NE(NULL, graph->end()); | 767 CHECK_NOT_NULL(graph->end()); |
768 Zone zone; | 768 Zone zone; |
769 Visitor visitor(&zone, typing); | 769 Visitor visitor(&zone, typing); |
770 for (Node* node : AllNodes(&zone, graph).live) visitor.Check(node); | 770 for (Node* node : AllNodes(&zone, graph).live) visitor.Check(node); |
771 } | 771 } |
772 | 772 |
773 | 773 |
774 // ----------------------------------------------------------------------------- | 774 // ----------------------------------------------------------------------------- |
775 | 775 |
776 static bool HasDominatingDef(Schedule* schedule, Node* node, | 776 static bool HasDominatingDef(Schedule* schedule, Node* node, |
777 BasicBlock* container, BasicBlock* use_block, | 777 BasicBlock* container, BasicBlock* use_block, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 } | 861 } |
862 | 862 |
863 // Verify RPO numbers of blocks. | 863 // Verify RPO numbers of blocks. |
864 CHECK_EQ(start, rpo_order->at(0)); // Start should be first. | 864 CHECK_EQ(start, rpo_order->at(0)); // Start should be first. |
865 for (size_t b = 0; b < rpo_order->size(); b++) { | 865 for (size_t b = 0; b < rpo_order->size(); b++) { |
866 BasicBlock* block = rpo_order->at(b); | 866 BasicBlock* block = rpo_order->at(b); |
867 CHECK_EQ(static_cast<int>(b), block->rpo_number()); | 867 CHECK_EQ(static_cast<int>(b), block->rpo_number()); |
868 BasicBlock* dom = block->dominator(); | 868 BasicBlock* dom = block->dominator(); |
869 if (b == 0) { | 869 if (b == 0) { |
870 // All blocks except start should have a dominator. | 870 // All blocks except start should have a dominator. |
871 CHECK_EQ(NULL, dom); | 871 CHECK_NULL(dom); |
872 } else { | 872 } else { |
873 // Check that the immediate dominator appears somewhere before the block. | 873 // Check that the immediate dominator appears somewhere before the block. |
874 CHECK_NE(NULL, dom); | 874 CHECK_NOT_NULL(dom); |
875 CHECK_LT(dom->rpo_number(), block->rpo_number()); | 875 CHECK_LT(dom->rpo_number(), block->rpo_number()); |
876 } | 876 } |
877 } | 877 } |
878 | 878 |
879 // Verify that all blocks reachable from start are in the RPO. | 879 // Verify that all blocks reachable from start are in the RPO. |
880 BoolVector marked(static_cast<int>(count), false, zone); | 880 BoolVector marked(static_cast<int>(count), false, zone); |
881 { | 881 { |
882 ZoneQueue<BasicBlock*> queue(zone); | 882 ZoneQueue<BasicBlock*> queue(zone); |
883 queue.push(start); | 883 queue.push(start); |
884 marked[start->id().ToSize()] = true; | 884 marked[start->id().ToSize()] = true; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 // Check inputs for all nodes in the block. | 1001 // Check inputs for all nodes in the block. |
1002 for (size_t i = 0; i < block->NodeCount(); i++) { | 1002 for (size_t i = 0; i < block->NodeCount(); i++) { |
1003 Node* node = block->NodeAt(i); | 1003 Node* node = block->NodeAt(i); |
1004 CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1); | 1004 CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1); |
1005 } | 1005 } |
1006 } | 1006 } |
1007 } | 1007 } |
1008 } | 1008 } |
1009 } | 1009 } |
1010 } // namespace v8::internal::compiler | 1010 } // namespace v8::internal::compiler |
OLD | NEW |