diff options
Diffstat (limited to 'js/src/wasm/WasmBuiltins.cpp')
-rw-r--r-- | js/src/wasm/WasmBuiltins.cpp | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/js/src/wasm/WasmBuiltins.cpp b/js/src/wasm/WasmBuiltins.cpp index f0773583ac..342f55598f 100644 --- a/js/src/wasm/WasmBuiltins.cpp +++ b/js/src/wasm/WasmBuiltins.cpp @@ -19,6 +19,7 @@ #include "wasm/WasmBuiltins.h" #include "mozilla/Atomics.h" +#include "mozilla/ScopeExit.h" #include "fdlibm.h" #include "jslibmath.h" @@ -42,6 +43,7 @@ #include "wasm/WasmDebugFrame.h" #include "wasm/WasmGcObject.h" #include "wasm/WasmInstance.h" +#include "wasm/WasmPI.h" #include "wasm/WasmStubs.h" #include "debugger/DebugAPI-inl.h" @@ -404,6 +406,15 @@ const SymbolicAddressSignature SASigArrayCopy = { FOR_EACH_BUILTIN_MODULE_FUNC(VISIT_BUILTIN_FUNC) #undef VISIT_BUILTIN_FUNC +#ifdef ENABLE_WASM_JSPI +const SymbolicAddressSignature SASigUpdateSuspenderState = { + SymbolicAddress::UpdateSuspenderState, + _VOID, + _Infallible, + 3, + {_PTR, _PTR, _I32, _END}}; +#endif + } // namespace wasm } // namespace js @@ -660,12 +671,21 @@ bool wasm::HandleThrow(JSContext* cx, WasmFrameIter& iter, // WasmFrameIter iterates down wasm frames in the activation starting at // JitActivation::wasmExitFP(). Calling WasmFrameIter::startUnwinding pops // JitActivation::wasmExitFP() once each time WasmFrameIter is incremented, - // ultimately leaving exit FP null when the WasmFrameIter is done(). This - // is necessary to prevent a DebugFrame from being observed again after we - // just called onLeaveFrame (which would lead to the frame being re-added + // ultimately leaving no wasm exit FP when the WasmFrameIter is done(). This + // is necessary to prevent a wasm::DebugFrame from being observed again after + // we just called onLeaveFrame (which would lead to the frame being re-added // to the map of live frames, right as it becomes trash). MOZ_ASSERT(CallingActivation(cx) == iter.activation()); +#ifdef DEBUG + auto onExit = mozilla::MakeScopeExit([cx] { + MOZ_ASSERT(!cx->activation()->asJit()->isWasmTrapping(), + "unwinding clears the trapping state"); + MOZ_ASSERT(!cx->activation()->asJit()->hasWasmExitFP(), + "unwinding leaves no wasm exit fp"); + }); +#endif + MOZ_ASSERT(!iter.done()); iter.setUnwind(WasmFrameIter::Unwind::True); @@ -722,6 +742,7 @@ bool wasm::HandleThrow(JSContext* cx, WasmFrameIter& iter, if (activation->isWasmTrapping()) { activation->finishWasmTrap(); } + activation->setWasmExitFP(nullptr); return true; } @@ -761,9 +782,6 @@ bool wasm::HandleThrow(JSContext* cx, WasmFrameIter& iter, frame->leave(cx); } - MOZ_ASSERT(!cx->activation()->asJit()->isWasmTrapping(), - "unwinding clears the trapping state"); - // Assert that any pending exception escaping to non-wasm code is not a // wrapper exception object #ifdef DEBUG @@ -1504,6 +1522,13 @@ void* wasm::AddressOf(SymbolicAddress imm, ABIFunctionType* abiType) { MOZ_ASSERT(*abiType == ToABIType(SASigThrowException)); return FuncCast(Instance::throwException, *abiType); +#ifdef ENABLE_WASM_JSPI + case SymbolicAddress::UpdateSuspenderState: + *abiType = Args_Int32_GeneralGeneralInt32; + MOZ_ASSERT(*abiType == ToABIType(SASigUpdateSuspenderState)); + return FuncCast(UpdateSuspenderState, *abiType); +#endif + #ifdef WASM_CODEGEN_DEBUG case SymbolicAddress::PrintI32: *abiType = Args_General1; @@ -1691,6 +1716,9 @@ bool wasm::NeedsBuiltinThunk(SymbolicAddress sym) { case SymbolicAddress::sa_name: FOR_EACH_BUILTIN_MODULE_FUNC(VISIT_BUILTIN_FUNC) #undef VISIT_BUILTIN_FUNC +#ifdef ENABLE_WASM_JSPI + case SymbolicAddress::UpdateSuspenderState: +#endif return true; case SymbolicAddress::Limit: |