Skip to content

Commit 0927910

Browse files
committed
[JSC] Tail-call restore frame copy starts one restoreFrameSize too low
https://bugs.webkit.org/show_bug.cgi?id=329002 rdar://191056110 Reviewed by Dan Hecht. We already moved sp with restoreFrameSize, so we do not need to start from sp to move. We change the starting cursor to sp + restoreFrameSize. * Source/JavaScriptCore/wasm/WasmIRGeneratorHelpers.h: (JSC::Wasm::emitRestoreInstanceFrameIfNeeded): Canonical link: https://commits.webkit.org/324798@main
1 parent 01fe2c7 commit 0927910

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎Source/JavaScriptCore/wasm/WasmIRGeneratorHelpers.h‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,14 +262,14 @@ inline void emitRestoreInstanceFrameIfNeeded(CCallHelpers& jit, GPRReg currentIn
262262
jit.subPtr(CCallHelpers::TrustedImm32(restoreFrameSize), MacroAssembler::stackPointerRegister);
263263

264264
if (needsCopy) {
265-
// Copy [sp, cfr + topSourceOffsetFromFP) down by restoreFrameSize bytes.
266-
// The range above cfr is the caller's argument area. OMG may reference
267-
// these slots via positive-FP-offset ValueReps, so they must shift too.
268-
jit.move(MacroAssembler::stackPointerRegister, scratch1);
265+
// Copy [sp, cfr + topSourceOffsetFromFP) down by restoreFrameSize bytes, where sp is its
266+
// value before the adjustment above. The range above cfr is the caller's argument area.
267+
// OMG may reference these slots via positive-FP-offset ValueReps, so they must shift too.
268+
jit.addPtr(CCallHelpers::TrustedImm32(restoreFrameSize), MacroAssembler::stackPointerRegister, scratch1);
269269

270270
jit.jitAssert([&] {
271271
jit.addPtr(CCallHelpers::TrustedImm32(topSourceOffsetFromFP), GPRInfo::callFrameRegister, scratch2);
272-
return jit.branchPtr(CCallHelpers::AboveOrEqual, scratch2, MacroAssembler::stackPointerRegister);
272+
return jit.branchPtr(CCallHelpers::Above, scratch2, scratch1);
273273
});
274274

275275
JIT_COMMENT(jit, "Copy loop start");

0 commit comments

Comments
 (0)