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/tail-call-optimization.h" | 5 #include "src/compiler/tail-call-optimization.h" |
6 | 6 |
7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
8 #include "src/compiler/graph.h" | 8 #include "src/compiler/graph.h" |
9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // | | | | | 56 // | | | | |
57 // | +--+ +-+ | | 57 // | +--+ +-+ | |
58 // +----------+ | | +------+ | 58 // +----------+ | | +------+ |
59 // \ | | / | 59 // \ | | / |
60 // TailCall[Descriptor] | 60 // TailCall[Descriptor] |
61 // ^ | 61 // ^ |
62 // | | 62 // | |
63 | 63 |
64 DCHECK_EQ(call, NodeProperties::GetControlInput(control, 0)); | 64 DCHECK_EQ(call, NodeProperties::GetControlInput(control, 0)); |
65 DCHECK_EQ(3, node->InputCount()); | 65 DCHECK_EQ(3, node->InputCount()); |
66 node->set_op( | |
67 common()->TailCall(OpParameter<CallDescriptor const*>(call))); | |
68 node->ReplaceInput(0, NodeProperties::GetEffectInput(call)); | 66 node->ReplaceInput(0, NodeProperties::GetEffectInput(call)); |
69 node->ReplaceInput(1, NodeProperties::GetControlInput(call)); | 67 node->ReplaceInput(1, NodeProperties::GetControlInput(call)); |
70 node->RemoveInput(2); | 68 node->RemoveInput(2); |
71 for (int index = 0; index < call->op()->ValueInputCount(); ++index) { | 69 for (int index = 0; index < call->op()->ValueInputCount(); ++index) { |
72 node->InsertInput(graph()->zone(), index, | 70 node->InsertInput(graph()->zone(), index, |
73 NodeProperties::GetValueInput(call, index)); | 71 NodeProperties::GetValueInput(call, index)); |
74 } | 72 } |
| 73 NodeProperties::ChangeOp( |
| 74 node, common()->TailCall(OpParameter<CallDescriptor const*>(call))); |
75 return Changed(node); | 75 return Changed(node); |
76 } | 76 } |
77 } | 77 } |
78 return NoChange(); | 78 return NoChange(); |
79 } | 79 } |
80 | 80 |
81 } // namespace compiler | 81 } // namespace compiler |
82 } // namespace internal | 82 } // namespace internal |
83 } // namespace v8 | 83 } // namespace v8 |
OLD | NEW |