| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 if (node->op()->ValueOutputCount() > 1) { | 161 if (node->op()->ValueOutputCount() > 1) { |
| 162 for (Edge edge : node->use_edges()) { | 162 for (Edge edge : node->use_edges()) { |
| 163 Node* use = edge.from(); | 163 Node* use = edge.from(); |
| 164 CHECK(!NodeProperties::IsValueEdge(edge) || | 164 CHECK(!NodeProperties::IsValueEdge(edge) || |
| 165 use->opcode() == IrOpcode::kProjection || | 165 use->opcode() == IrOpcode::kProjection || |
| 166 use->opcode() == IrOpcode::kParameter); | 166 use->opcode() == IrOpcode::kParameter); |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 | 169 |
| 170 switch (node->opcode()) { | 170 switch (node->opcode()) { |
| 171 case IrOpcode::kAlways: | |
| 172 // Always has no inputs. | |
| 173 CHECK_EQ(0, input_count); | |
| 174 // Always uses are Branch. | |
| 175 for (auto use : node->uses()) { | |
| 176 CHECK(use->opcode() == IrOpcode::kBranch); | |
| 177 } | |
| 178 // Type is boolean. | |
| 179 CheckUpperIs(node, Type::Boolean()); | |
| 180 break; | |
| 181 case IrOpcode::kStart: | 171 case IrOpcode::kStart: |
| 182 // Start has no inputs. | 172 // Start has no inputs. |
| 183 CHECK_EQ(0, input_count); | 173 CHECK_EQ(0, input_count); |
| 184 // Type is a tuple. | 174 // Type is a tuple. |
| 185 // TODO(rossberg): Multiple outputs are currently typed as Internal. | 175 // TODO(rossberg): Multiple outputs are currently typed as Internal. |
| 186 CheckUpperIs(node, Type::Internal()); | 176 CheckUpperIs(node, Type::Internal()); |
| 187 break; | 177 break; |
| 188 case IrOpcode::kEnd: | 178 case IrOpcode::kEnd: |
| 189 // End has no outputs. | 179 // End has no outputs. |
| 190 CHECK(node->op()->ValueOutputCount() == 0); | 180 CHECK(node->op()->ValueOutputCount() == 0); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 case IrOpcode::kReturn: | 276 case IrOpcode::kReturn: |
| 287 // TODO(rossberg): check successor is End | 277 // TODO(rossberg): check successor is End |
| 288 // Type is empty. | 278 // Type is empty. |
| 289 CheckNotTyped(node); | 279 CheckNotTyped(node); |
| 290 break; | 280 break; |
| 291 case IrOpcode::kThrow: | 281 case IrOpcode::kThrow: |
| 292 // TODO(rossberg): what are the constraints on these? | 282 // TODO(rossberg): what are the constraints on these? |
| 293 // Type is empty. | 283 // Type is empty. |
| 294 CheckNotTyped(node); | 284 CheckNotTyped(node); |
| 295 break; | 285 break; |
| 286 case IrOpcode::kTerminate: |
| 287 CHECK_EQ(IrOpcode::kLoop, |
| 288 NodeProperties::GetControlInput(node)->opcode()); |
| 289 // Type is empty. |
| 290 CheckNotTyped(node); |
| 291 CHECK_EQ(1, control_count); |
| 292 CHECK_EQ(1, effect_count); |
| 293 CHECK_EQ(2, input_count); |
| 294 break; |
| 296 case IrOpcode::kOsrNormalEntry: | 295 case IrOpcode::kOsrNormalEntry: |
| 297 case IrOpcode::kOsrLoopEntry: | 296 case IrOpcode::kOsrLoopEntry: |
| 298 // Osr entries have | 297 // Osr entries have |
| 299 CHECK_EQ(1, effect_count); | 298 CHECK_EQ(1, effect_count); |
| 300 CHECK_EQ(1, control_count); | 299 CHECK_EQ(1, control_count); |
| 301 // Type is empty. | 300 // Type is empty. |
| 302 CheckNotTyped(node); | 301 CheckNotTyped(node); |
| 303 break; | 302 break; |
| 304 | 303 |
| 305 // Common operators | 304 // Common operators |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 // Check inputs for all nodes in the block. | 1096 // Check inputs for all nodes in the block. |
| 1098 for (size_t i = 0; i < block->NodeCount(); i++) { | 1097 for (size_t i = 0; i < block->NodeCount(); i++) { |
| 1099 Node* node = block->NodeAt(i); | 1098 Node* node = block->NodeAt(i); |
| 1100 CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1); | 1099 CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1); |
| 1101 } | 1100 } |
| 1102 } | 1101 } |
| 1103 } | 1102 } |
| 1104 } | 1103 } |
| 1105 } | 1104 } |
| 1106 } // namespace v8::internal::compiler | 1105 } // namespace v8::internal::compiler |
| OLD | NEW |