Open github-actions[bot] opened 1 year ago
/js/src/frontend/Stencil.cpp
/js/src/vm/BytecodeUtil.cpp
--- d85e933ffd605cf38d796294b929a0241ab55d62/js/src/frontend/Stencil.cpp +++ 8f9d8bdcc4cc5efe4791263730871d7190181080/js/src/frontend/Stencil.cpp @@ -1823,17 +1823,17 @@ static JSFunction* CreateFunctionFast(JS ImmutableScriptFlagsEnum::IsGenerator)); MOZ_ASSERT(!script.functionFlags.isAsmJSNative()); FunctionFlags flags = script.functionFlags; gc::AllocKind allocKind = flags.isExtended() ? gc::AllocKind::FUNCTION_EXTENDED : gc::AllocKind::FUNCTION; - JSFunction* fun = JSFunction::create(cx, allocKind, gc::TenuredHeap, shape); + JSFunction* fun = JSFunction::create(cx, allocKind, gc::Heap::Tenured, shape); if (!fun) { return nullptr; } fun->setArgCount(scriptExtra.nargs); fun->setFlags(flags); fun->initScript(nullptr); @@ -5211,18 +5211,18 @@ static already_AddRefed<JS::Stencil> Com JS::SourceText<CharT>& srcBuf) { ScopeKind scopeKind = options.nonSyntacticScope ? ScopeKind::NonSyntactic : ScopeKind::Global; AutoReportFrontendContext fc(cx); NoScopeBindingCache scopeCache; Rooted<CompilationInput> input(cx, CompilationInput(options)); RefPtr<JS::Stencil> stencil = js::frontend::CompileGlobalScriptToStencil( - cx, &fc, cx->stackLimitForCurrentPrincipal(), cx->tempLifoAlloc(), - input.get(), &scopeCache, srcBuf, scopeKind); + cx, &fc, cx->tempLifoAlloc(), input.get(), &scopeCache, srcBuf, + scopeKind); if (!stencil) { return nullptr; } // Convert the UniquePtr to a RefPtr and increment the count (to 1). return stencil.forget(); } @@ -5244,18 +5244,17 @@ static already_AddRefed<JS::Stencil> Com JS::SourceText<CharT>& srcBuf) { JS::CompileOptions options(cx, optionsInput); options.setModule(); AutoReportFrontendContext fc(cx); NoScopeBindingCache scopeCache; Rooted<CompilationInput> input(cx, CompilationInput(options)); RefPtr<JS::Stencil> stencil = js::frontend::ParseModuleToStencil( - cx, &fc, cx->stackLimitForCurrentPrincipal(), cx->tempLifoAlloc(), - input.get(), &scopeCache, srcBuf); + cx, &fc, cx->tempLifoAlloc(), input.get(), &scopeCache, srcBuf); if (!stencil) { return nullptr; } // Convert the UniquePtr to a RefPtr and increment the count (to 1). return stencil.forget(); } @@ -5321,26 +5320,33 @@ JS::TranscodeResult JS::EncodeStencil(JS return TranscodeResult::Ok; } JS::TranscodeResult JS::DecodeStencil(JSContext* cx, const JS::DecodeOptions& options, const JS::TranscodeRange& range, JS::Stencil** stencilOut) { AutoReportFrontendContext fc(cx); - RefPtr<ScriptSource> source = fc.getAllocator()->new_<ScriptSource>(); + return JS::DecodeStencil(&fc, options, range, stencilOut); +} + +JS::TranscodeResult JS::DecodeStencil(JS::FrontendContext* fc, + const JS::DecodeOptions& 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)); + fc->getAllocator()->new_<CompilationStencil>(source)); if (!stencil) { return TranscodeResult::Throw; } - XDRStencilDecoder decoder(&fc, range); + XDRStencilDecoder decoder(fc, range); XDRResult res = decoder.codeStencil(options, *stencil); if (res.isErr()) { return res.unwrapErr(); } *stencilOut = stencil.forget().take(); return TranscodeResult::Ok; }
--- 416af93c3205460856a2cae7bee084a656ee2ee9/js/src/vm/BytecodeUtil.cpp +++ 3b2a67b67a5f54e55f8c8ca7cf26eb760d031f0d/js/src/vm/BytecodeUtil.cpp @@ -2918,17 +2918,17 @@ static bool GetPCCountJSON(JSContext* cx ionCounts = ionCounts->previous(); } json.endList(); } json.endObject(); - return true; + return !sp.hadOutOfMemory(); } JSString* JS::GetPCCountScriptContents(JSContext* cx, size_t index) { JSRuntime* rt = cx->runtime(); if (!rt->scriptAndCountsVector || index >= rt->scriptAndCountsVector->length()) { JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
Files
/js/src/frontend/Stencil.cpp
/js/src/vm/BytecodeUtil.cpp
Changesets
Diffs
/js/src/frontend/Stencil.cpp
/js/src/vm/BytecodeUtil.cpp