Chromium Code Reviews| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 280 if (input != value) return NoChange(); | 280 if (input != value) return NoChange(); |
| 281 } | 281 } |
| 282 // We might now be able to further reduce the {merge} node. | 282 // We might now be able to further reduce the {merge} node. |
| 283 Revisit(merge); | 283 Revisit(merge); |
| 284 return Replace(value); | 284 return Replace(value); |
| 285 } | 285 } |
| 286 | 286 |
| 287 | 287 |
| 288 Reduction CommonOperatorReducer::ReduceReturn(Node* node) { | 288 Reduction CommonOperatorReducer::ReduceReturn(Node* node) { |
| 289 DCHECK_EQ(IrOpcode::kReturn, node->opcode()); | 289 DCHECK_EQ(IrOpcode::kReturn, node->opcode()); |
| 290 Node* const value = node->InputAt(1); | |
| 291 Node* effect = NodeProperties::GetEffectInput(node); | 290 Node* effect = NodeProperties::GetEffectInput(node); |
| 292 Node* const control = NodeProperties::GetControlInput(node); | 291 Node* const control = NodeProperties::GetControlInput(node); |
| 293 bool changed = false; | 292 bool changed = false; |
| 294 if (effect->opcode() == IrOpcode::kCheckpoint) { | 293 if (effect->opcode() == IrOpcode::kCheckpoint) { |
| 295 // Any {Return} node can never be used to insert a deoptimization point, | 294 // Any {Return} node can never be used to insert a deoptimization point, |
| 296 // hence checkpoints can be cut out of the effect chain flowing into it. | 295 // hence checkpoints can be cut out of the effect chain flowing into it. |
| 297 effect = NodeProperties::GetEffectInput(effect); | 296 effect = NodeProperties::GetEffectInput(effect); |
| 298 NodeProperties::ReplaceEffectInput(node, effect); | 297 NodeProperties::ReplaceEffectInput(node, effect); |
| 299 changed = true; | 298 changed = true; |
| 300 } | 299 } |
| 300 if (NodeProperties::PastValueIndex(node) != 2) { | |
|
titzer
2017/01/17 16:08:22
This is worth a comment and a TODO. This is doing
titzer
2017/01/17 16:43:21
Please also use the value input count to make this
ahaas
2017/01/17 17:35:54
I added the TODO.
PTAL: I added a helper function
| |
| 301 return NoChange(); | |
| 302 } | |
| 303 Node* const value = node->InputAt(1); | |
| 301 if (value->opcode() == IrOpcode::kPhi && | 304 if (value->opcode() == IrOpcode::kPhi && |
| 302 NodeProperties::GetControlInput(value) == control && | 305 NodeProperties::GetControlInput(value) == control && |
| 303 effect->opcode() == IrOpcode::kEffectPhi && | 306 effect->opcode() == IrOpcode::kEffectPhi && |
| 304 NodeProperties::GetControlInput(effect) == control && | 307 NodeProperties::GetControlInput(effect) == control && |
| 305 control->opcode() == IrOpcode::kMerge) { | 308 control->opcode() == IrOpcode::kMerge) { |
| 306 Node::Inputs control_inputs = control->inputs(); | 309 Node::Inputs control_inputs = control->inputs(); |
| 307 Node::Inputs value_inputs = value->inputs(); | 310 Node::Inputs value_inputs = value->inputs(); |
| 308 Node::Inputs effect_inputs = effect->inputs(); | 311 Node::Inputs effect_inputs = effect->inputs(); |
| 309 DCHECK_NE(0, control_inputs.count()); | 312 DCHECK_NE(0, control_inputs.count()); |
| 310 DCHECK_EQ(control_inputs.count(), value_inputs.count() - 1); | 313 DCHECK_EQ(control_inputs.count(), value_inputs.count() - 1); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 node->ReplaceInput(0, a); | 390 node->ReplaceInput(0, a); |
| 388 node->ReplaceInput(1, b); | 391 node->ReplaceInput(1, b); |
| 389 node->TrimInputCount(2); | 392 node->TrimInputCount(2); |
| 390 NodeProperties::ChangeOp(node, op); | 393 NodeProperties::ChangeOp(node, op); |
| 391 return Changed(node); | 394 return Changed(node); |
| 392 } | 395 } |
| 393 | 396 |
| 394 } // namespace compiler | 397 } // namespace compiler |
| 395 } // namespace internal | 398 } // namespace internal |
| 396 } // namespace v8 | 399 } // namespace v8 |
| OLD | NEW |