Bug 1788977 - Consolidate methods for finishing off-thread JS parse/decode. r=arai

Off-thread parse and decode all generate JS::Stencils so the various
specializations are not needed for methods that collect the results back to
main-thread.

Depends on D156335

Differential Revision: https://phabricator.services.mozilla.com/D156336
This commit is contained in:
Ted Campbell
2022-09-06 12:01:35 +00:00
parent db4c7cad42
commit d2f16d6095
13 changed files with 44 additions and 179 deletions

View File

@@ -149,18 +149,9 @@ nsresult ModuleLoader::CompileFetchedModule(
ModuleLoadRequest* aRequest, JS::MutableHandle<JSObject*> aModuleOut) {
if (aRequest->GetScriptLoadContext()->mWasCompiledOMT) {
JS::Rooted<JS::InstantiationStorage> storage(aCx);
RefPtr<JS::Stencil> stencil;
if (aRequest->IsTextSource()) {
stencil = JS::FinishCompileModuleToStencilOffThread(
aCx, aRequest->GetScriptLoadContext()->mOffThreadToken,
storage.address());
} else {
MOZ_ASSERT(aRequest->IsBytecode());
stencil = JS::FinishDecodeStencilOffThread(
aCx, aRequest->GetScriptLoadContext()->mOffThreadToken,
storage.address());
}
RefPtr<JS::Stencil> stencil = JS::FinishOffThreadStencil(
aCx, aRequest->GetScriptLoadContext()->mOffThreadToken,
storage.address());
aRequest->GetScriptLoadContext()->mOffThreadToken = nullptr;