Index: src/compiler/x64/instruction-selector-x64.cc |
diff --git a/src/compiler/x64/instruction-selector-x64.cc b/src/compiler/x64/instruction-selector-x64.cc |
index e0e97acfce5c4ed181ec86efd00639c1f263300b..c0a6175eef3c7aa340bcf3a302c85265680d8be9 100644 |
--- a/src/compiler/x64/instruction-selector-x64.cc |
+++ b/src/compiler/x64/instruction-selector-x64.cc |
@@ -1019,7 +1019,8 @@ void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { |
} |
-void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { |
+void InstructionSelector::VisitCall(Node* node, BasicBlock* handler, |
+ CallMode call_mode) { |
X64OperandGenerator g(this); |
const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node); |
@@ -1052,14 +1053,15 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { |
} |
// Select the appropriate opcode based on the call type. |
+ bool is_tail_call = call_mode == TAIL_CALL; |
InstructionCode opcode; |
switch (descriptor->kind()) { |
case CallDescriptor::kCallCodeObject: { |
- opcode = kArchCallCodeObject; |
+ opcode = is_tail_call ? kArchTailCallCodeObject : kArchCallCodeObject; |
break; |
} |
case CallDescriptor::kCallJSFunction: |
- opcode = kArchCallJSFunction; |
+ opcode = is_tail_call ? kArchTailCallJSFunction : kArchCallJSFunction; |
break; |
default: |
UNREACHABLE(); |
@@ -1068,11 +1070,12 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { |
opcode |= MiscField::encode(flags); |
// Emit the call instruction. |
+ size_t size = is_tail_call ? 0 : buffer.outputs.size(); |
InstructionOperand* first_output = |
- buffer.outputs.size() > 0 ? &buffer.outputs.front() : NULL; |
+ size > 0 ? &buffer.outputs.front() : nullptr; |
Instruction* call_instr = |
- Emit(opcode, buffer.outputs.size(), first_output, |
- buffer.instruction_args.size(), &buffer.instruction_args.front()); |
+ Emit(opcode, size, first_output, buffer.instruction_args.size(), |
+ &buffer.instruction_args.front()); |
call_instr->MarkAsCall(); |
} |