Open github-actions[bot] opened 1 year ago
/js/src/frontend/CompilationStencil.h
/js/src/frontend/Stencil.cpp
--- 77899a08642e9af8d4b7bd62e33f794b87923051/js/src/frontend/CompilationStencil.h +++ 6f4e49448f1c68b2a749e5461b60a2a0d153eb42/js/src/frontend/CompilationStencil.h @@ -1247,18 +1247,17 @@ struct CompilationStencil { [[nodiscard]] static bool instantiateStencilAfterPreparation( JSContext* cx, CompilationInput& input, const CompilationStencil& stencil, CompilationGCOutput& gcOutput); [[nodiscard]] static bool prepareForInstantiate( FrontendContext* fc, CompilationAtomCache& atomCache, const CompilationStencil& stencil, CompilationGCOutput& gcOutput); [[nodiscard]] static bool prepareForInstantiate( - FrontendContext* fc, CompilationAtomCache& atomCache, - const CompilationStencil& stencil, + FrontendContext* fc, const CompilationStencil& stencil, PreallocatedCompilationGCOutput& gcOutput); [[nodiscard]] static bool instantiateStencils( JSContext* cx, CompilationInput& input, const CompilationStencil& stencil, CompilationGCOutput& gcOutput); // Decode the special self-hosted stencil [[nodiscard]] bool instantiateSelfHostedAtoms(
--- 77899a08642e9af8d4b7bd62e33f794b87923051/js/src/frontend/Stencil.cpp +++ 6f4e49448f1c68b2a749e5461b60a2a0d153eb42/js/src/frontend/Stencil.cpp @@ -23,21 +23,21 @@ #include "frontend/BytecodeCompiler.h" // CompileGlobalScriptToStencil, InstantiateStencils, CanLazilyParse, ParseModuleToStencil #include "frontend/BytecodeSection.h" // EmitScriptThingsVector #include "frontend/CompilationStencil.h" // CompilationStencil, CompilationState, ExtensibleCompilationStencil, CompilationGCOutput, CompilationStencilMerger #include "frontend/FrontendContext.h" #include "frontend/NameAnalysisTypes.h" // EnvironmentCoordinate #include "frontend/ParserAtom.h" // ParserAtom, ParserAtomIndex, TaggedParserAtomIndex, ParserAtomsTable, Length{1,2,3}StaticParserString, InstantiateMarkedAtoms, InstantiateMarkedAtomsAsPermanent, GetWellKnownAtom #include "frontend/ScopeBindingCache.h" // ScopeBindingCache #include "frontend/SharedContext.h" -#include "frontend/StencilXdr.h" // XDRStencilEncoder, XDRStencilDecoder -#include "gc/AllocKind.h" // gc::AllocKind -#include "gc/Tracer.h" // TraceNullableRoot -#include "js/CallArgs.h" // JSNative -#include "js/CompileOptions.h" // JS::DecodeOptions +#include "frontend/StencilXdr.h" // XDRStencilEncoder, XDRStencilDecoder +#include "gc/AllocKind.h" // gc::AllocKind +#include "gc/Tracer.h" // TraceNullableRoot +#include "js/CallArgs.h" // JSNative +#include "js/CompileOptions.h" // JS::DecodeOptions, JS::ReadOnlyDecodeOptions #include "js/experimental/JSStencil.h" // JS::Stencil #include "js/GCAPI.h" // JS::AutoCheckCannotGC #include "js/Printer.h" // js::Fprinter #include "js/RootingAPI.h" // Rooted #include "js/Transcoding.h" // JS::TranscodeBuffer #include "js/Utility.h" // js_malloc, js_calloc, js_free #include "js/Value.h" // ObjectValue #include "js/WasmModule.h" // JS::WasmModule @@ -2905,25 +2905,20 @@ bool CompilationStencil::prepareForInsta return false; } return atomCache.allocate(fc, stencil.parserAtomData.size()); } /* static */ bool CompilationStencil::prepareForInstantiate( - FrontendContext* fc, CompilationAtomCache& atomCache, - const CompilationStencil& stencil, + FrontendContext* fc, const CompilationStencil& stencil, PreallocatedCompilationGCOutput& gcOutput) { - if (!gcOutput.allocate(fc, stencil.scriptData.size(), - stencil.scopeData.size())) { - return false; - } - - return atomCache.allocate(fc, stencil.parserAtomData.size()); + return gcOutput.allocate(fc, stencil.scriptData.size(), + stencil.scopeData.size()); } bool CompilationStencil::serializeStencils(JSContext* cx, CompilationInput& input, JS::TranscodeBuffer& buf, bool* succeededOut) const { if (succeededOut) { *succeededOut = false; @@ -5537,25 +5532,25 @@ JS::TranscodeResult JS::EncodeStencil(JS XDRResult res = encoder.codeStencil(*stencil); if (res.isErr()) { return res.unwrapErr(); } return TranscodeResult::Ok; } JS::TranscodeResult JS::DecodeStencil(JSContext* cx, - const JS::DecodeOptions& options, + const JS::ReadOnlyDecodeOptions& options, const JS::TranscodeRange& range, JS::Stencil** stencilOut) { AutoReportFrontendContext fc(cx); return JS::DecodeStencil(&fc, options, range, stencilOut); } JS::TranscodeResult JS::DecodeStencil(JS::FrontendContext* fc, - const JS::DecodeOptions& options, + const JS::ReadOnlyDecodeOptions& options, const JS::TranscodeRange& range, JS::Stencil** stencilOut) { RefPtr<ScriptSource> source = fc->getAllocator()->new_<ScriptSource>(); if (!source) { return TranscodeResult::Throw; } RefPtr<JS::Stencil> stencil( fc->getAllocator()->new_<CompilationStencil>(source));
Files
/js/src/frontend/CompilationStencil.h
/js/src/frontend/Stencil.cpp
Changesets
Diffs
/js/src/frontend/CompilationStencil.h
/js/src/frontend/Stencil.cpp