Commit 94b294b3 authored by Victor Gomes's avatar Victor Gomes Committed by Commit Bot

[debug] Fix extra arguments when restarting frame

Before the removal of the arguments adaptor frame, we could set {actual arguments count} = {formal parameter count} before restarting a live frame to avoid re-entering in the adaptor frame trampoline.
This does not work anymore, since we now need the correct value of the {actual argument count} to be pushed in the callee frame to be used in its epilogue.

This CL calls InvokeCall with the correct argument count and the kDontAdaptArgumentsSentinel to skip arguments adaptation.

Bug: v8:11431, v8:11441
Change-Id: I3698891f07274e8ab95c82b9dd35f53bd78632d9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2675927Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72704}
parent b309b9ae
......@@ -37,13 +37,12 @@ void DebugCodegen::GenerateFrameDropperTrampoline(MacroAssembler* masm) {
// - Restart the frame by calling the function.
__ mov(fp, r1);
__ ldr(r1, MemOperand(fp, StandardFrameConstants::kFunctionOffset));
__ ldr(r0, MemOperand(fp, StandardFrameConstants::kArgCOffset));
__ LeaveFrame(StackFrame::INTERNAL);
__ ldr(r0, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
__ ldrh(r0,
FieldMemOperand(r0, SharedFunctionInfo::kFormalParameterCountOffset));
__ mov(r2, r0);
// The arguments are already in the stack (including any necessary padding),
// we should not try to massage the arguments again.
__ mov(r2, Operand(kDontAdaptArgumentsSentinel));
__ InvokeFunction(r1, r2, r0, JUMP_FUNCTION);
}
......
......@@ -36,16 +36,14 @@ void DebugCodegen::GenerateFrameDropperTrampoline(MacroAssembler* masm) {
// - Restart the frame by calling the function.
__ Mov(fp, x1);
__ Ldr(x1, MemOperand(fp, StandardFrameConstants::kFunctionOffset));
__ ldr(x0, MemOperand(fp, StandardFrameConstants::kArgCOffset));
__ Mov(sp, fp);
__ Pop<TurboAssembler::kAuthLR>(fp, lr);
__ LoadTaggedPointerField(
x0, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset));
__ Ldrh(x0,
FieldMemOperand(x0, SharedFunctionInfo::kFormalParameterCountOffset));
__ mov(x3, x0);
// The arguments are already in the stack (including any necessary padding),
// we should not try to massage the arguments again.
__ Mov(x3, kDontAdaptArgumentsSentinel);
__ InvokeFunctionWithNewTarget(x1, x3, x0, JUMP_FUNCTION);
}
......
......@@ -34,16 +34,14 @@ void DebugCodegen::GenerateFrameDropperTrampoline(MacroAssembler* masm) {
// - Restart the frame by calling the function.
__ mov(ebp, eax);
__ mov(edi, Operand(ebp, StandardFrameConstants::kFunctionOffset));
__ mov(eax, Operand(ebp, StandardFrameConstants::kArgCOffset));
__ leave();
__ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
__ movzx_w(
eax, FieldOperand(eax, SharedFunctionInfo::kFormalParameterCountOffset));
// The expected and actual argument counts don't matter as long as they match
// and we don't enter the ArgumentsAdaptorTrampoline.
// The arguments are already in the stack (including any necessary padding),
// we should not try to massage the arguments again.
__ mov(ecx, Immediate(kDontAdaptArgumentsSentinel));
__ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
__ InvokeFunctionCode(edi, no_reg, eax, eax, JUMP_FUNCTION);
__ InvokeFunctionCode(edi, no_reg, ecx, eax, JUMP_FUNCTION);
}
const bool LiveEdit::kFrameDropperSupported = true;
......
......@@ -34,17 +34,15 @@ void DebugCodegen::GenerateFrameDropperTrampoline(MacroAssembler* masm) {
// - Look up current function on the frame.
// - Leave the frame.
// - Restart the frame by calling the function.
__ movq(rbp, rbx);
__ movq(rdi, Operand(rbp, StandardFrameConstants::kFunctionOffset));
__ movq(rax, Operand(rbp, StandardFrameConstants::kArgCOffset));
__ leave();
__ LoadTaggedPointerField(
rbx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
__ movzxwq(
rbx, FieldOperand(rbx, SharedFunctionInfo::kFormalParameterCountOffset));
__ InvokeFunction(rdi, no_reg, rbx, rbx, JUMP_FUNCTION);
// The arguments are already in the stack (including any necessary padding),
// we should not try to massage the arguments again.
__ movq(rbx, Immediate(kDontAdaptArgumentsSentinel));
__ InvokeFunction(rdi, no_reg, rbx, rax, JUMP_FUNCTION);
}
const bool LiveEdit::kFrameDropperSupported = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment