| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/branch-elimination.h" | 5 #include "src/compiler/branch-elimination.h" |
| 6 | 6 |
| 7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
| 8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
| 9 #include "src/compiler/simplified-operator.h" | 9 #include "src/compiler/simplified-operator.h" |
| 10 | 10 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // Here we rely on having only reducible loops: | 136 // Here we rely on having only reducible loops: |
| 137 // The loop entry edge always dominates the header, so we can just use | 137 // The loop entry edge always dominates the header, so we can just use |
| 138 // the information from the loop entry edge. | 138 // the information from the loop entry edge. |
| 139 return TakeConditionsFromFirstControl(node); | 139 return TakeConditionsFromFirstControl(node); |
| 140 } | 140 } |
| 141 | 141 |
| 142 | 142 |
| 143 Reduction BranchElimination::ReduceMerge(Node* node) { | 143 Reduction BranchElimination::ReduceMerge(Node* node) { |
| 144 // Shortcut for the case when we do not know anything about some | 144 // Shortcut for the case when we do not know anything about some |
| 145 // input. | 145 // input. |
| 146 for (int i = 0; i < node->InputCount(); i++) { | 146 for (Node* input : node->inputs()) { |
| 147 if (node_conditions_.Get(node->InputAt(i)) == nullptr) { | 147 if (node_conditions_.Get(input) == nullptr) { |
| 148 return UpdateConditions(node, nullptr); | 148 return UpdateConditions(node, nullptr); |
| 149 } | 149 } |
| 150 } | 150 } |
| 151 | 151 |
| 152 const ControlPathConditions* first = node_conditions_.Get(node->InputAt(0)); | 152 const ControlPathConditions* first = node_conditions_.Get(node->InputAt(0)); |
| 153 // Make a copy of the first input's conditions and merge with the conditions | 153 // Make a copy of the first input's conditions and merge with the conditions |
| 154 // from other inputs. | 154 // from other inputs. |
| 155 ControlPathConditions* conditions = | 155 ControlPathConditions* conditions = |
| 156 new (zone_->New(sizeof(ControlPathConditions))) | 156 new (zone_->New(sizeof(ControlPathConditions))) |
| 157 ControlPathConditions(*first); | 157 ControlPathConditions(*first); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 | 304 |
| 305 Graph* BranchElimination::graph() const { return jsgraph()->graph(); } | 305 Graph* BranchElimination::graph() const { return jsgraph()->graph(); } |
| 306 | 306 |
| 307 CommonOperatorBuilder* BranchElimination::common() const { | 307 CommonOperatorBuilder* BranchElimination::common() const { |
| 308 return jsgraph()->common(); | 308 return jsgraph()->common(); |
| 309 } | 309 } |
| 310 | 310 |
| 311 } // namespace compiler | 311 } // namespace compiler |
| 312 } // namespace internal | 312 } // namespace internal |
| 313 } // namespace v8 | 313 } // namespace v8 |
| OLD | NEW |