| 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/instruction-selector.h" | 5 #include "src/compiler/instruction-selector.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "src/base/adapters.h" | 9 #include "src/base/adapters.h" |
| 10 #include "src/compiler/instruction-selector-impl.h" | 10 #include "src/compiler/instruction-selector-impl.h" |
| (...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1747 &buffer.instruction_args.front()) | 1747 &buffer.instruction_args.front()) |
| 1748 ->MarkAsCall(); | 1748 ->MarkAsCall(); |
| 1749 } | 1749 } |
| 1750 | 1750 |
| 1751 | 1751 |
| 1752 void InstructionSelector::VisitTailCall(Node* node) { | 1752 void InstructionSelector::VisitTailCall(Node* node) { |
| 1753 OperandGenerator g(this); | 1753 OperandGenerator g(this); |
| 1754 CallDescriptor const* descriptor = CallDescriptorOf(node->op()); | 1754 CallDescriptor const* descriptor = CallDescriptorOf(node->op()); |
| 1755 DCHECK_NE(0, descriptor->flags() & CallDescriptor::kSupportsTailCalls); | 1755 DCHECK_NE(0, descriptor->flags() & CallDescriptor::kSupportsTailCalls); |
| 1756 | 1756 |
| 1757 // TODO(turbofan): Relax restriction for stack parameters. | 1757 CallDescriptor* caller = linkage()->GetIncomingDescriptor(); |
| 1758 | 1758 if (caller->CanTailCall(node)) { |
| 1759 int stack_param_delta = 0; | 1759 const CallDescriptor* callee = CallDescriptorOf(node->op()); |
| 1760 if (linkage()->GetIncomingDescriptor()->CanTailCall(node, | 1760 int stack_param_delta = callee->GetStackParameterDelta(caller); |
| 1761 &stack_param_delta)) { | |
| 1762 CallBuffer buffer(zone(), descriptor, nullptr); | 1761 CallBuffer buffer(zone(), descriptor, nullptr); |
| 1763 | 1762 |
| 1764 // Compute InstructionOperands for inputs and outputs. | 1763 // Compute InstructionOperands for inputs and outputs. |
| 1765 CallBufferFlags flags(kCallCodeImmediate | kCallTail); | 1764 CallBufferFlags flags(kCallCodeImmediate | kCallTail); |
| 1766 if (IsTailCallAddressImmediate()) { | 1765 if (IsTailCallAddressImmediate()) { |
| 1767 flags |= kCallAddressImmediate; | 1766 flags |= kCallAddressImmediate; |
| 1768 } | 1767 } |
| 1769 InitializeCallBuffer(node, &buffer, flags, stack_param_delta); | 1768 InitializeCallBuffer(node, &buffer, flags, stack_param_delta); |
| 1770 | 1769 |
| 1771 // Select the appropriate opcode based on the call type. | 1770 // Select the appropriate opcode based on the call type. |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1987 return new (instruction_zone()) FrameStateDescriptor( | 1986 return new (instruction_zone()) FrameStateDescriptor( |
| 1988 instruction_zone(), state_info.type(), state_info.bailout_id(), | 1987 instruction_zone(), state_info.type(), state_info.bailout_id(), |
| 1989 state_info.state_combine(), parameters, locals, stack, | 1988 state_info.state_combine(), parameters, locals, stack, |
| 1990 state_info.shared_info(), outer_state); | 1989 state_info.shared_info(), outer_state); |
| 1991 } | 1990 } |
| 1992 | 1991 |
| 1993 | 1992 |
| 1994 } // namespace compiler | 1993 } // namespace compiler |
| 1995 } // namespace internal | 1994 } // namespace internal |
| 1996 } // namespace v8 | 1995 } // namespace v8 |
| OLD | NEW |