Closed github-actions[bot] closed 1 year ago
/js/src/frontend/Stencil.cpp
/js/src/vm/SharedStencil.h
--- 7284cca9b5383e03ea15e36f2a899c854169a9cd/js/src/frontend/Stencil.cpp +++ df1b8cb586de7e1bff2f9068ddd3382164c1d26f/js/src/frontend/Stencil.cpp @@ -3986,16 +3986,19 @@ void js::DumpImmutableScriptFlags(js::JS json.value("ShouldDeclareArguments"); break; case ImmutableScriptFlagsEnum::NeedsArgsObj: json.value("NeedsArgsObj"); break; case ImmutableScriptFlagsEnum::HasMappedArgsObj: json.value("HasMappedArgsObj"); break; + case ImmutableScriptFlagsEnum::IsInlinableLargeFunction: + json.value("IsInlinableLargeFunction"); + break; case ImmutableScriptFlagsEnum::FunctionHasNewTargetBinding: json.value("FunctionHasNewTargetBinding"); break; default: json.value("Unknown(%x)", i); break; } } @@ -4070,16 +4073,19 @@ void js::DumpFunctionFlagsItems(js::JSON json.value("ATOM_EXTRA_FLAG"); break; case FunctionFlags::Flags::RESOLVED_NAME: json.value("RESOLVED_NAME"); break; case FunctionFlags::Flags::RESOLVED_LENGTH: json.value("RESOLVED_LENGTH"); break; + case FunctionFlags::Flags::GHOST_FUNCTION: + json.value("GHOST_FUNCTION"); + break; default: json.value("Unknown(%x)", i); break; } } } } @@ -5264,79 +5270,52 @@ already_AddRefed<JS::Stencil> JS::Compil already_AddRefed<JS::Stencil> JS::CompileModuleScriptToStencil( JSContext* cx, const JS::ReadOnlyCompileOptions& options, JS::SourceText<char16_t>& srcBuf) { return CompileModuleScriptToStencilImpl(cx, options, srcBuf); } JS_PUBLIC_API JSScript* JS::InstantiateGlobalStencil( - JSContext* cx, const JS::InstantiateOptions& options, - JS::Stencil* stencil) { - CompileOptions compileOptions(cx); - options.copyTo(compileOptions); - Rooted<CompilationInput> input(cx, CompilationInput(compileOptions)); - Rooted<CompilationGCOutput> gcOutput(cx); - if (!InstantiateStencils(cx, input.get(), *stencil, gcOutput.get())) { - return nullptr; - } - - return gcOutput.get().script; -} - -JS_PUBLIC_API JSScript* JS::InstantiateGlobalStencil( JSContext* cx, const JS::InstantiateOptions& options, JS::Stencil* stencil, JS::InstantiationStorage* storage) { - MOZ_ASSERT(storage->isValid()); + MOZ_ASSERT_IF(storage, storage->isValid()); CompileOptions compileOptions(cx); options.copyTo(compileOptions); Rooted<CompilationInput> input(cx, CompilationInput(compileOptions)); - if (!InstantiateStencils(cx, input.get(), *stencil, *storage->gcOutput_)) { + Rooted<CompilationGCOutput> gcOutput(cx); + CompilationGCOutput& output = storage ? *storage->gcOutput_ : gcOutput.get(); + + if (!InstantiateStencils(cx, input.get(), *stencil, output)) { return nullptr; } - - return storage->gcOutput_->script; + return output.script; } JS_PUBLIC_API bool JS::StencilIsBorrowed(Stencil* stencil) { return stencil->storageType == CompilationStencil::StorageType::Borrowed; } JS_PUBLIC_API JSObject* JS::InstantiateModuleStencil( - JSContext* cx, const JS::InstantiateOptions& options, - JS::Stencil* stencil) { - CompileOptions compileOptions(cx); - options.copyTo(compileOptions); - compileOptions.setModule(); - - Rooted<CompilationInput> input(cx, CompilationInput(compileOptions)); - Rooted<CompilationGCOutput> gcOutput(cx); - if (!InstantiateStencils(cx, input.get(), *stencil, gcOutput.get())) { - return nullptr; - } - - return gcOutput.get().module; -} - -JS_PUBLIC_API JSObject* JS::InstantiateModuleStencil( JSContext* cx, const JS::InstantiateOptions& options, JS::Stencil* stencil, JS::InstantiationStorage* storage) { - MOZ_ASSERT(storage->isValid()); + MOZ_ASSERT_IF(storage, storage->isValid()); CompileOptions compileOptions(cx); options.copyTo(compileOptions); compileOptions.setModule(); - Rooted<CompilationInput> input(cx, CompilationInput(compileOptions)); - if (!InstantiateStencils(cx, input.get(), *stencil, *storage->gcOutput_)) { + Rooted<CompilationGCOutput> gcOutput(cx); + CompilationGCOutput& output = storage ? *storage->gcOutput_ : gcOutput.get(); + + if (!InstantiateStencils(cx, input.get(), *stencil, output)) { return nullptr; } - - return storage->gcOutput_->module; + return output.module; } JS::TranscodeResult JS::EncodeStencil(JSContext* cx, JS::Stencil* stencil, TranscodeBuffer& buffer) { MainThreadErrorContext ec(cx); XDRStencilEncoder encoder(cx, &ec, buffer); XDRResult res = encoder.codeStencil(*stencil); if (res.isErr()) {
--- 1fb01ce743b3c8bac67a091af0bac9a121661a43/js/src/vm/SharedStencil.h +++ bb6b001abe51f600efa4dc9ddd5e19835b7a831b/js/src/vm/SharedStencil.h @@ -689,21 +689,21 @@ class SharedImmutableScriptData { } } static constexpr size_t offsetOfISD() { return offsetof(SharedImmutableScriptData, isd_); } private: - static SharedImmutableScriptData* create(JSContext* cx); + static SharedImmutableScriptData* create(ErrorContext* ec); public: static SharedImmutableScriptData* createWith( - JSContext* cx, js::UniquePtr<ImmutableScriptData>&& isd); + ErrorContext* ec, js::UniquePtr<ImmutableScriptData>&& isd); size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) { size_t isdSize = isExternal ? 0 : mallocSizeOf(isd_); return mallocSizeOf(this) + isdSize; } // SharedImmutableScriptData has trailing data so isn't copyable or movable. SharedImmutableScriptData(const SharedImmutableScriptData&) = delete;
Files
/js/src/frontend/Stencil.cpp
/js/src/vm/SharedStencil.h
Changesets
Diffs
/js/src/frontend/Stencil.cpp
/js/src/vm/SharedStencil.h