Index: src/compiler/instruction-selector.cc |
diff --git a/src/compiler/instruction-selector.cc b/src/compiler/instruction-selector.cc |
index 4afabb24311f680fe3643e394b7080bb9de45e95..2ab2675658f95bdeb9e9489c9ab732a3dc3585d6 100644 |
--- a/src/compiler/instruction-selector.cc |
+++ b/src/compiler/instruction-selector.cc |
@@ -1788,10 +1788,12 @@ void InstructionSelector::VisitTailCall(Node* node) { |
} |
opcode |= MiscField::encode(descriptor->flags()); |
- buffer.instruction_args.push_back(g.TempImmediate(stack_param_delta)); |
+ Emit(kArchPrepareTailCall, g.NoOutput()); |
- Emit(kArchPrepareTailCall, g.NoOutput(), |
- g.TempImmediate(stack_param_delta)); |
+ int first_unused_stack_slot = |
+ (V8_TARGET_ARCH_STORES_RETURN_ADDRESS_ON_STACK ? 1 : 0) + |
+ stack_param_delta; |
+ buffer.instruction_args.push_back(g.TempImmediate(first_unused_stack_slot)); |
// Emit the tailcall instruction. |
Emit(opcode, 0, nullptr, buffer.instruction_args.size(), |