diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
commit | 59203c63bb777a3bacec32fb8830fba33540e809 (patch) | |
tree | 58298e711c0ff0575818c30485b44a2f21bf28a0 /js/src/wasm/WasmContext.h | |
parent | Adding upstream version 126.0.1. (diff) | |
download | firefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip |
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/wasm/WasmContext.h')
-rw-r--r-- | js/src/wasm/WasmContext.h | 48 |
1 files changed, 43 insertions, 5 deletions
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<SuspenderObject*> activeSuspender_; + // Using double-linked list to avoid allocation in the JIT code. + mozilla::DoublyLinkedList<SuspenderObjectData> 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<uint32_t> suspendableStacksCount; + SuspenderContext promiseIntegration; +#endif }; -} // namespace wasm -} // namespace js +} // namespace js::wasm #endif // wasm_context_h |