summaryrefslogtreecommitdiffstats
path: root/js/public/experimental/CompileScript.h
diff options
context:
space:
mode:
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,