OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/checkpoint-elimination.h" | 5 #include "src/compiler/checkpoint-elimination.h" |
6 | 6 |
7 #include "src/compiler/node-properties.h" | 7 #include "src/compiler/node-properties.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 23 matching lines...) Expand all Loading... |
34 DCHECK_EQ(IrOpcode::kCheckpoint, node->opcode()); | 34 DCHECK_EQ(IrOpcode::kCheckpoint, node->opcode()); |
35 if (IsRedundantCheckpoint(node)) { | 35 if (IsRedundantCheckpoint(node)) { |
36 return Replace(NodeProperties::GetEffectInput(node)); | 36 return Replace(NodeProperties::GetEffectInput(node)); |
37 } | 37 } |
38 return NoChange(); | 38 return NoChange(); |
39 } | 39 } |
40 | 40 |
41 Reduction CheckpointElimination::ReduceReturn(Node* node) { | 41 Reduction CheckpointElimination::ReduceReturn(Node* node) { |
42 DCHECK_EQ(IrOpcode::kReturn, node->opcode()); | 42 DCHECK_EQ(IrOpcode::kReturn, node->opcode()); |
43 Node* effect = NodeProperties::GetEffectInput(node); | 43 Node* effect = NodeProperties::GetEffectInput(node); |
44 if (effect->opcode() == IrOpcode::kCheckpoint && effect->OwnedBy(node)) { | 44 if (effect->opcode() == IrOpcode::kCheckpoint) { |
45 // Any checkpoint that is wholly owned by a {Return} node can never be used | 45 // Any {Return} node can never be used to insert a deoptimization point, |
46 // for an actual bailout and can hence be cut out of the effect chain. | 46 // hence checkpoints can be cut out of the effect chain flowing into it. |
47 Node* replacement = NodeProperties::GetEffectInput(effect); | 47 Node* replacement = NodeProperties::GetEffectInput(effect); |
48 NodeProperties::ReplaceEffectInput(node, replacement); | 48 NodeProperties::ReplaceEffectInput(node, replacement); |
49 return Changed(node); | 49 return Changed(node); |
50 } | 50 } |
51 return NoChange(); | 51 return NoChange(); |
52 } | 52 } |
53 | 53 |
54 Reduction CheckpointElimination::Reduce(Node* node) { | 54 Reduction CheckpointElimination::Reduce(Node* node) { |
55 switch (node->opcode()) { | 55 switch (node->opcode()) { |
56 case IrOpcode::kCheckpoint: | 56 case IrOpcode::kCheckpoint: |
57 return ReduceCheckpoint(node); | 57 return ReduceCheckpoint(node); |
58 case IrOpcode::kReturn: | 58 case IrOpcode::kReturn: |
59 return ReduceReturn(node); | 59 return ReduceReturn(node); |
60 default: | 60 default: |
61 break; | 61 break; |
62 } | 62 } |
63 return NoChange(); | 63 return NoChange(); |
64 } | 64 } |
65 | 65 |
66 } // namespace compiler | 66 } // namespace compiler |
67 } // namespace internal | 67 } // namespace internal |
68 } // namespace v8 | 68 } // namespace v8 |
OLD | NEW |