mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 11:57:32 +09:00
Issue #3049 - Normalize loongarch64 VM wrapper return setup
This commit is contained in:
parent
cc49913ad9
commit
49dc8031ce
1 changed files with 12 additions and 3 deletions
|
|
@ -556,7 +556,6 @@ JitRuntime::generateArgumentsRectifier(JSContext* cx, void** returnAddrOut)
|
||||||
|
|
||||||
// Discard pushed arguments.
|
// Discard pushed arguments.
|
||||||
masm.addPtr(t2, StackPointer);
|
masm.addPtr(t2, StackPointer);
|
||||||
|
|
||||||
masm.ret();
|
masm.ret();
|
||||||
Linker linker(masm);
|
Linker linker(masm);
|
||||||
AutoFlushICache afc("ArgumentsRectifier");
|
AutoFlushICache afc("ArgumentsRectifier");
|
||||||
|
|
@ -676,9 +675,19 @@ JitRuntime::generateVMWrapper(JSContext* cx, const VMFunction& f)
|
||||||
Register cxreg = a0;
|
Register cxreg = a0;
|
||||||
regs.take(cxreg);
|
regs.take(cxreg);
|
||||||
|
|
||||||
// If it isn't a tail call, then the return address needs to be saved
|
// LoongArch callers can arrive here in either style:
|
||||||
if (f.expectTailCall == NonTailCall)
|
// - Non-tail calls keep the return address in |ra| and only push a descriptor.
|
||||||
|
// - Tail calls push a full CommonFrameLayout with the return address on the stack.
|
||||||
|
// Normalize both forms so the wrapper always sees a stack return address.
|
||||||
|
{
|
||||||
|
Label haveStackReturnAddress;
|
||||||
|
Register scratch = regs.getAny();
|
||||||
|
masm.loadPtr(Address(StackPointer, 0), scratch);
|
||||||
|
masm.rshiftPtr(Imm32(32), scratch);
|
||||||
|
masm.branch32(Assembler::NotEqual, scratch, Imm32(0), &haveStackReturnAddress);
|
||||||
masm.pushReturnAddress();
|
masm.pushReturnAddress();
|
||||||
|
masm.bind(&haveStackReturnAddress);
|
||||||
|
}
|
||||||
|
|
||||||
// We're aligned to an exit frame, so link it up.
|
// We're aligned to an exit frame, so link it up.
|
||||||
masm.enterExitFrame(&f);
|
masm.enterExitFrame(&f);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue