diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
commit | 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch) | |
tree | a4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /js/public/experimental/CompileScript.h | |
parent | Adding debian version 124.0.1-1. (diff) | |
download | firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/public/experimental/CompileScript.h')
-rw-r--r-- | js/public/experimental/CompileScript.h | 58 |
1 files changed, 4 insertions, 54 deletions
diff --git a/js/public/experimental/CompileScript.h b/js/public/experimental/CompileScript.h index 308a5848d9..ebb87e6227 100644 --- a/js/public/experimental/CompileScript.h +++ b/js/public/experimental/CompileScript.h @@ -105,71 +105,21 @@ JS_PUBLIC_API const JSErrorReport* GetFrontendWarningAt( JS::FrontendContext* fc, size_t index, const JS::ReadOnlyCompileOptions& options); -// Temporary storage used during compiling and preparing to instantiate a -// Stencil. -// -// Off-thread consumers can allocate this instance off main thread, and pass it -// back to the main thread, in order to reduce the main thread allocation. -struct CompilationStorage { - private: - // Owned CompilationInput. - // - // This uses raw pointer instead of UniquePtr because CompilationInput - // is opaque. - JS_HAZ_NON_GC_POINTER js::frontend::CompilationInput* input_ = nullptr; - bool isBorrowed_ = false; - - public: - CompilationStorage() = default; - explicit CompilationStorage(js::frontend::CompilationInput* input) - : input_(input), isBorrowed_(true) {} - CompilationStorage(CompilationStorage&& other) - : input_(other.input_), isBorrowed_(other.isBorrowed_) { - other.input_ = nullptr; - } - - ~CompilationStorage(); - - private: - CompilationStorage(const CompilationStorage& other) = delete; - void operator=(const CompilationStorage& aOther) = delete; - - public: - bool hasInput() { return !!input_; } - - // Internal function that initializes the CompilationInput. It should only be - // called once. - bool allocateInput(FrontendContext* fc, - const JS::ReadOnlyCompileOptions& options); - - js::frontend::CompilationInput& getInput() { - MOZ_ASSERT(hasInput()); - return *input_; - } - - // Size of dynamic data. Note that GC data is counted by GC and not here. - size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const; - - void trace(JSTracer* trc); -}; - extern JS_PUBLIC_API already_AddRefed<JS::Stencil> CompileGlobalScriptToStencil( JS::FrontendContext* fc, const JS::ReadOnlyCompileOptions& options, - JS::SourceText<mozilla::Utf8Unit>& srcBuf, - JS::CompilationStorage& compileStorage); + JS::SourceText<mozilla::Utf8Unit>& srcBuf); extern JS_PUBLIC_API already_AddRefed<JS::Stencil> CompileGlobalScriptToStencil( JS::FrontendContext* fc, const JS::ReadOnlyCompileOptions& options, - JS::SourceText<char16_t>& srcBuf, JS::CompilationStorage& compileStorage); + JS::SourceText<char16_t>& srcBuf); extern JS_PUBLIC_API already_AddRefed<JS::Stencil> CompileModuleScriptToStencil( JS::FrontendContext* fc, const JS::ReadOnlyCompileOptions& options, - JS::SourceText<mozilla::Utf8Unit>& srcBuf, - JS::CompilationStorage& compileStorage); + JS::SourceText<mozilla::Utf8Unit>& srcBuf); extern JS_PUBLIC_API already_AddRefed<JS::Stencil> CompileModuleScriptToStencil( JS::FrontendContext* fc, const JS::ReadOnlyCompileOptions& options, - JS::SourceText<char16_t>& srcBuf, JS::CompilationStorage& compileStorage); + JS::SourceText<char16_t>& srcBuf); extern JS_PUBLIC_API bool PrepareForInstantiate( JS::FrontendContext* fc, JS::Stencil& stencil, |