Bug 1724236 - Get encodeBytecode and coerceToString from function arguments instead of members r=arai

Differential Revision: https://phabricator.services.mozilla.com/D218443
This commit is contained in:
Bryan Thrall
2024-10-30 13:41:40 +00:00
parent b6fd76662b
commit 2a63e2261f
4 changed files with 44 additions and 54 deletions

View File

@@ -2751,7 +2751,7 @@ void ScriptLoader::InstantiateClassicScriptFromMaybeEncodedSource(
MOZ_ASSERT(aRequest->IsSource());
CalculateBytecodeCacheFlag(aRequest);
aExec.SetEncodeBytecode(aRequest->PassedConditionForBytecodeEncoding());
bool encodeBytecode = aRequest->PassedConditionForBytecodeEncoding();
if (aRequest->GetScriptLoadContext()->mCompileOrDecodeTask) {
// Off-main-thread parsing.
@@ -2760,7 +2760,8 @@ void ScriptLoader::InstantiateClassicScriptFromMaybeEncodedSource(
"Execute",
aRequest));
MOZ_ASSERT(aRequest->IsTextSource());
aExec.JoinOffThread(aCompileOptions, aRequest->GetScriptLoadContext(), aRv);
aExec.JoinOffThread(aCompileOptions, aRequest->GetScriptLoadContext(), aRv,
encodeBytecode);
} else {
// Main thread parsing (inline and small scripts)
LOG(("ScriptLoadRequest (%p): Compile And Exec", aRequest));
@@ -2774,7 +2775,7 @@ void ScriptLoader::InstantiateClassicScriptFromMaybeEncodedSource(
profilerLabelString);
auto compile = [&](auto& source) {
aExec.Compile(aCompileOptions, source, aRv);
aExec.Compile(aCompileOptions, source, aRv, encodeBytecode);
};
MOZ_ASSERT(!maybeSource.empty());
@@ -2795,11 +2796,10 @@ void ScriptLoader::InstantiateClassicScriptFromCachedStencil(
return;
}
aExec.SetEncodeBytecode(true);
bool incrementalEncodingAlreadyStarted = false;
aExec.InstantiateStencil(aCompileOptions, std::move(stencil),
incrementalEncodingAlreadyStarted, aRv);
incrementalEncodingAlreadyStarted, aRv,
/* aEncodeBytecode */ true);
if (incrementalEncodingAlreadyStarted) {
aRequest->MarkSkippedBytecodeEncoding();
}