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 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 break; | 818 break; |
819 } | 819 } |
820 } // NOLINT(readability/fn_size) | 820 } // NOLINT(readability/fn_size) |
821 | 821 |
822 | 822 |
823 void Verifier::Run(Graph* graph, Typing typing) { | 823 void Verifier::Run(Graph* graph, Typing typing) { |
824 CHECK_NOT_NULL(graph->start()); | 824 CHECK_NOT_NULL(graph->start()); |
825 CHECK_NOT_NULL(graph->end()); | 825 CHECK_NOT_NULL(graph->end()); |
826 Zone zone; | 826 Zone zone; |
827 Visitor visitor(&zone, typing); | 827 Visitor visitor(&zone, typing); |
828 for (Node* node : AllNodes(&zone, graph).live) visitor.Check(node); | 828 AllNodes all(&zone, graph); |
| 829 for (Node* node : all.live) visitor.Check(node); |
| 830 |
| 831 // Check the uniqueness of projections. |
| 832 for (Node* proj : all.live) { |
| 833 if (proj->opcode() != IrOpcode::kProjection) continue; |
| 834 Node* node = proj->InputAt(0); |
| 835 for (Node* other : node->uses()) { |
| 836 if (all.IsLive(other) && other != proj && |
| 837 other->opcode() == IrOpcode::kProjection && |
| 838 ProjectionIndexOf(other->op()) == ProjectionIndexOf(proj->op())) { |
| 839 V8_Fatal(__FILE__, __LINE__, |
| 840 "Node #%d:%s has duplicate projections #%d and #%d", |
| 841 node->id(), node->op()->mnemonic(), proj->id(), other->id()); |
| 842 } |
| 843 } |
| 844 } |
829 } | 845 } |
830 | 846 |
831 | 847 |
832 // ----------------------------------------------------------------------------- | 848 // ----------------------------------------------------------------------------- |
833 | 849 |
834 static bool HasDominatingDef(Schedule* schedule, Node* node, | 850 static bool HasDominatingDef(Schedule* schedule, Node* node, |
835 BasicBlock* container, BasicBlock* use_block, | 851 BasicBlock* container, BasicBlock* use_block, |
836 int use_pos) { | 852 int use_pos) { |
837 BasicBlock* block = use_block; | 853 BasicBlock* block = use_block; |
838 while (true) { | 854 while (true) { |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 // Check inputs for all nodes in the block. | 1075 // Check inputs for all nodes in the block. |
1060 for (size_t i = 0; i < block->NodeCount(); i++) { | 1076 for (size_t i = 0; i < block->NodeCount(); i++) { |
1061 Node* node = block->NodeAt(i); | 1077 Node* node = block->NodeAt(i); |
1062 CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1); | 1078 CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1); |
1063 } | 1079 } |
1064 } | 1080 } |
1065 } | 1081 } |
1066 } | 1082 } |
1067 } | 1083 } |
1068 } // namespace v8::internal::compiler | 1084 } // namespace v8::internal::compiler |
OLD | NEW |