| 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 <functional> | 5 #include <functional> |
| 6 #include <limits> | 6 #include <limits> |
| 7 | 7 |
| 8 #include "src/compiler/graph.h" | 8 #include "src/compiler/graph.h" |
| 9 #include "src/compiler/graph-reducer.h" | 9 #include "src/compiler/graph-reducer.h" |
| 10 #include "src/compiler/node.h" | 10 #include "src/compiler/node.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 entry.input_index = i + 1; | 133 entry.input_index = i + 1; |
| 134 if (input != node && Recurse(input)) return; | 134 if (input != node && Recurse(input)) return; |
| 135 } | 135 } |
| 136 for (int i = 0; i < start; i++) { | 136 for (int i = 0; i < start; i++) { |
| 137 Node* input = node->InputAt(i); | 137 Node* input = node->InputAt(i); |
| 138 entry.input_index = i + 1; | 138 entry.input_index = i + 1; |
| 139 if (input != node && Recurse(input)) return; | 139 if (input != node && Recurse(input)) return; |
| 140 } | 140 } |
| 141 | 141 |
| 142 // Remember the max node id before reduction. | 142 // Remember the max node id before reduction. |
| 143 NodeId const max_id = graph()->NodeCount() - 1; | 143 NodeId const max_id = static_cast<NodeId>(graph()->NodeCount() - 1); |
| 144 | 144 |
| 145 // All inputs should be visited or on stack. Apply reductions to node. | 145 // All inputs should be visited or on stack. Apply reductions to node. |
| 146 Reduction reduction = Reduce(node); | 146 Reduction reduction = Reduce(node); |
| 147 | 147 |
| 148 // If there was no reduction, pop {node} and continue. | 148 // If there was no reduction, pop {node} and continue. |
| 149 if (!reduction.Changed()) return Pop(); | 149 if (!reduction.Changed()) return Pop(); |
| 150 | 150 |
| 151 // Check if the reduction is an in-place update of the {node}. | 151 // Check if the reduction is an in-place update of the {node}. |
| 152 Node* const replacement = reduction.replacement(); | 152 Node* const replacement = reduction.replacement(); |
| 153 if (replacement == node) { | 153 if (replacement == node) { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 void GraphReducer::Revisit(Node* node) { | 275 void GraphReducer::Revisit(Node* node) { |
| 276 if (state_.Get(node) == State::kVisited) { | 276 if (state_.Get(node) == State::kVisited) { |
| 277 state_.Set(node, State::kRevisit); | 277 state_.Set(node, State::kRevisit); |
| 278 revisit_.push(node); | 278 revisit_.push(node); |
| 279 } | 279 } |
| 280 } | 280 } |
| 281 | 281 |
| 282 } // namespace compiler | 282 } // namespace compiler |
| 283 } // namespace internal | 283 } // namespace internal |
| 284 } // namespace v8 | 284 } // namespace v8 |
| OLD | NEW |