From 59203c63bb777a3bacec32fb8830fba33540e809 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:35:29 +0200 Subject: Adding upstream version 127.0. Signed-off-by: Daniel Baumann --- js/src/wasm/WasmContext.h | 48 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 5 deletions(-) (limited to 'js/src/wasm/WasmContext.h') diff --git a/js/src/wasm/WasmContext.h b/js/src/wasm/WasmContext.h index 5064401a81..873f98f1a2 100644 --- a/js/src/wasm/WasmContext.h +++ b/js/src/wasm/WasmContext.h @@ -19,23 +19,61 @@ #ifndef wasm_context_h #define wasm_context_h -namespace js { -namespace wasm { +#include "mozilla/DoublyLinkedList.h" + +namespace js::wasm { + +#ifdef ENABLE_WASM_JSPI + +class SuspenderObject; +class SuspenderObjectData; + +class SuspenderContext { + private: + HeapPtr activeSuspender_; + // Using double-linked list to avoid allocation in the JIT code. + mozilla::DoublyLinkedList suspendedStacks_; + + public: + SuspenderContext(); + ~SuspenderContext(); + SuspenderObject* activeSuspender(); + void setActiveSuspender(SuspenderObject* obj); + void trace(JSTracer* trc); + void traceRoots(JSTracer* trc); + + friend class SuspenderObject; +}; +#endif // ENABLE_WASM_JSPI // wasm::Context lives in JSContext and contains the wasm-related per-context // state. class Context { public: - Context() : triedToInstallSignalHandlers(false), haveSignalHandlers(false) {} + Context() + : triedToInstallSignalHandlers(false), + haveSignalHandlers(false) +#ifdef ENABLE_WASM_JSPI + , + suspendableStackLimit(JS::NativeStackLimitMin), + suspendableStacksCount(0) +#endif + { + } // Used by wasm::EnsureThreadSignalHandlers(cx) to install thread signal // handlers once per JSContext/thread. bool triedToInstallSignalHandlers; bool haveSignalHandlers; + +#ifdef ENABLE_WASM_JSPI + JS::NativeStackLimit suspendableStackLimit; + mozilla::Atomic suspendableStacksCount; + SuspenderContext promiseIntegration; +#endif }; -} // namespace wasm -} // namespace js +} // namespace js::wasm #endif // wasm_context_h -- cgit v1.2.3