Skip to content

Commit

Permalink
Bug 1913445 - Use AutoForbidPoolsAndNops in tails calls trampoline. r…
Browse files Browse the repository at this point in the history
…=jseward, a=dsmith

Differential Revision: https://phabricator.services.mozilla.com/D219353
  • Loading branch information
yurydelendik committed Sep 4, 2024
1 parent 5fd4ef0 commit 65f6869
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions js/src/jit/MacroAssembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5374,22 +5374,29 @@ struct ReturnCallTrampolineData {
static ReturnCallTrampolineData MakeReturnCallTrampoline(MacroAssembler& masm) {
uint32_t savedPushed = masm.framePushed();

// Build simple trampoline code: load the instance slot from the frame,
// restore FP, and return to prevous caller.
ReturnCallTrampolineData data;

{
# if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64)
AutoForbidPoolsAndNops afp(&masm, 1);
# elif defined(JS_CODEGEN_RISCV64)
BlockTrampolinePoolScope block_trampoline_pool(&masm, 1);
# endif

// Build simple trampoline code: load the instance slot from the frame,
// restore FP, and return to prevous caller.
# ifdef JS_CODEGEN_ARM
data.trampolineOffset = masm.currentOffset();
data.trampolineOffset = masm.currentOffset();
# else
masm.bind(&data.trampoline);
masm.bind(&data.trampoline);
# endif

masm.setFramePushed(
AlignBytes(wasm::FrameWithInstances::sizeOfInstanceFieldsAndShadowStack(),
WasmStackAlignment));
masm.setFramePushed(AlignBytes(
wasm::FrameWithInstances::sizeOfInstanceFieldsAndShadowStack(),
WasmStackAlignment));

# ifdef ENABLE_WASM_TAIL_CALLS
masm.wasmMarkSlowCall();
# endif
masm.wasmMarkSlowCall();
}

masm.loadPtr(
Address(masm.getStackPointer(), WasmCallerInstanceOffsetBeforeCall),
Expand Down

0 comments on commit 65f6869

Please sign in to comment.