summaryrefslogtreecommitdiffstats
path: root/js/public/experimental/CompileScript.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /js/public/experimental/CompileScript.h
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-adbda400be353e676059e335c3c0aaf99e719475.tar.xz
firefox-adbda400be353e676059e335c3c0aaf99e719475.zip
Adding upstream version 125.0.1.upstream/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.h58
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,