Bug 1436400 - Part 8: Add code path for bytecode encoding module scripts. r=nbp
The module scripts are scanned immediately before executing, and if the module script is not yet executed, and it matches the requirement for encoding (size, fetch count, etc), it's marked as encode, and they're scanned again immediately after executing, and marked scripts are queued for bytecode encoding. This patch doesn't actually enable the encoding, given ShouldCacheBytecode returns false because the caching is not enabled for the channel and GetCacheTokenFetchCount fails. Differential Revision: https://phabricator.services.mozilla.com/D140296
This commit is contained in:
@@ -460,6 +460,12 @@ nsresult ModuleLoader::CompileOrFinishModuleScript(
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (ScriptLoader::ShouldCacheBytecode(aRequest)) {
|
||||
if (!JS::StartIncrementalEncoding(aCx, std::move(stencil))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -487,6 +493,12 @@ nsresult ModuleLoader::CompileOrFinishModuleScript(
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (ScriptLoader::ShouldCacheBytecode(aRequest)) {
|
||||
if (!JS::StartIncrementalEncoding(aCx, std::move(stencil))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user