| 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-reducer.h" | 5 #include "src/compiler/common-operator-reducer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
| 10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 if (condition->opcode() == IrOpcode::kBooleanNot) { | 135 if (condition->opcode() == IrOpcode::kBooleanNot) { |
| 136 NodeProperties::ReplaceValueInput(node, condition->InputAt(0), 0); | 136 NodeProperties::ReplaceValueInput(node, condition->InputAt(0), 0); |
| 137 NodeProperties::ChangeOp(node, condition_is_true | 137 NodeProperties::ChangeOp(node, condition_is_true |
| 138 ? common()->DeoptimizeIf() | 138 ? common()->DeoptimizeIf() |
| 139 : common()->DeoptimizeUnless()); | 139 : common()->DeoptimizeUnless()); |
| 140 return Changed(node); | 140 return Changed(node); |
| 141 } | 141 } |
| 142 Decision const decision = DecideCondition(condition); | 142 Decision const decision = DecideCondition(condition); |
| 143 if (decision == Decision::kUnknown) return NoChange(); | 143 if (decision == Decision::kUnknown) return NoChange(); |
| 144 if (condition_is_true == (decision == Decision::kTrue)) { | 144 if (condition_is_true == (decision == Decision::kTrue)) { |
| 145 return Replace(control); | 145 ReplaceWithValue(node, dead(), effect, control); |
| 146 } else { |
| 147 control = graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager), |
| 148 frame_state, effect, control); |
| 149 // TODO(bmeurer): This should be on the AdvancedReducer somehow. |
| 150 NodeProperties::MergeControlToEnd(graph(), common(), control); |
| 151 Revisit(graph()->end()); |
| 146 } | 152 } |
| 147 control = graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager), | |
| 148 frame_state, effect, control); | |
| 149 // TODO(bmeurer): This should be on the AdvancedReducer somehow. | |
| 150 NodeProperties::MergeControlToEnd(graph(), common(), control); | |
| 151 Revisit(graph()->end()); | |
| 152 return Replace(dead()); | 153 return Replace(dead()); |
| 153 } | 154 } |
| 154 | 155 |
| 155 Reduction CommonOperatorReducer::ReduceMerge(Node* node) { | 156 Reduction CommonOperatorReducer::ReduceMerge(Node* node) { |
| 156 DCHECK_EQ(IrOpcode::kMerge, node->opcode()); | 157 DCHECK_EQ(IrOpcode::kMerge, node->opcode()); |
| 157 // | 158 // |
| 158 // Check if this is a merge that belongs to an unused diamond, which means | 159 // Check if this is a merge that belongs to an unused diamond, which means |
| 159 // that: | 160 // that: |
| 160 // | 161 // |
| 161 // a) the {Merge} has no {Phi} or {EffectPhi} uses, and | 162 // a) the {Merge} has no {Phi} or {EffectPhi} uses, and |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 node->ReplaceInput(0, a); | 405 node->ReplaceInput(0, a); |
| 405 node->ReplaceInput(1, b); | 406 node->ReplaceInput(1, b); |
| 406 node->TrimInputCount(2); | 407 node->TrimInputCount(2); |
| 407 NodeProperties::ChangeOp(node, op); | 408 NodeProperties::ChangeOp(node, op); |
| 408 return Changed(node); | 409 return Changed(node); |
| 409 } | 410 } |
| 410 | 411 |
| 411 } // namespace compiler | 412 } // namespace compiler |
| 412 } // namespace internal | 413 } // namespace internal |
| 413 } // namespace v8 | 414 } // namespace v8 |
| OLD | NEW |