| 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/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
| 6 #include "src/compiler/control-reducer.h" | 6 #include "src/compiler/control-reducer.h" |
| 7 #include "src/compiler/graph.h" | 7 #include "src/compiler/graph.h" |
| 8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
| 9 #include "src/compiler/node-marker.h" | 9 #include "src/compiler/node-marker.h" |
| 10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 if (!marked.IsReachableFromEnd(use)) { | 284 if (!marked.IsReachableFromEnd(use)) { |
| 285 TRACE(("DeadLink: #%d:%s(%d) -> #%d:%s\n", use->id(), | 285 TRACE(("DeadLink: #%d:%s(%d) -> #%d:%s\n", use->id(), |
| 286 use->op()->mnemonic(), edge.index(), node->id(), | 286 use->op()->mnemonic(), edge.index(), node->id(), |
| 287 node->op()->mnemonic())); | 287 node->op()->mnemonic())); |
| 288 edge.UpdateTo(NULL); | 288 edge.UpdateTo(NULL); |
| 289 } | 289 } |
| 290 } | 290 } |
| 291 } | 291 } |
| 292 #if DEBUG | 292 #if DEBUG |
| 293 // Verify that no inputs to live nodes are NULL. | 293 // Verify that no inputs to live nodes are NULL. |
| 294 for (size_t j = 0; j < nodes.size(); j++) { | 294 for (Node* node : nodes) { |
| 295 Node* node = nodes[j]; | 295 for (int index = 0; index < node->InputCount(); index++) { |
| 296 for (Node* const input : node->inputs()) { | 296 Node* input = node->InputAt(index); |
| 297 CHECK(input); | 297 if (input == nullptr) { |
| 298 std::ostringstream str; |
| 299 str << "GraphError: node #" << node->id() << ":" << *node->op() |
| 300 << "(input @" << index << ") == null"; |
| 301 FATAL(str.str().c_str()); |
| 302 } |
| 303 if (input->opcode() == IrOpcode::kDead) { |
| 304 std::ostringstream str; |
| 305 str << "GraphError: node #" << node->id() << ":" << *node->op() |
| 306 << "(input @" << index << ") == dead"; |
| 307 FATAL(str.str().c_str()); |
| 308 } |
| 298 } | 309 } |
| 299 for (Node* const use : node->uses()) { | 310 for (Node* use : node->uses()) { |
| 300 CHECK(marked.IsReachableFromEnd(use)); | 311 CHECK(marked.IsReachableFromEnd(use)); |
| 301 } | 312 } |
| 302 } | 313 } |
| 303 #endif | 314 #endif |
| 304 } | 315 } |
| 305 | 316 |
| 306 // Reduce the node on the top of the stack. | 317 // Reduce the node on the top of the stack. |
| 307 // If an input {i} is not yet visited or needs to be revisited, push {i} onto | 318 // If an input {i} is not yet visited or needs to be revisited, push {i} onto |
| 308 // the stack and return. Otherwise, all inputs are visited, so apply | 319 // the stack and return. Otherwise, all inputs are visited, so apply |
| 309 // reductions for {node} and pop it off the stack. | 320 // reductions for {node} and pop it off the stack. |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 return impl.ReduceIfTrue(node); | 650 return impl.ReduceIfTrue(node); |
| 640 case IrOpcode::kIfFalse: | 651 case IrOpcode::kIfFalse: |
| 641 return impl.ReduceIfFalse(node); | 652 return impl.ReduceIfFalse(node); |
| 642 default: | 653 default: |
| 643 return node; | 654 return node; |
| 644 } | 655 } |
| 645 } | 656 } |
| 646 } | 657 } |
| 647 } | 658 } |
| 648 } // namespace v8::internal::compiler | 659 } // namespace v8::internal::compiler |
| OLD | NEW |