Bug 1470793: Stop eagerly XDR encoding scripts in the preloader cache. r?erahm
MozReview-Commit-ID: 2e85c34zt8v
--- a/js/xpconnect/loader/ScriptPreloader.cpp
+++ b/js/xpconnect/loader/ScriptPreloader.cpp
@@ -771,31 +771,16 @@ ScriptPreloader::NoteScript(const nsCStr
auto script = mScripts.LookupOrAdd(cachePath, *this, url, cachePath, jsscript);
if (!script->mScript) {
MOZ_ASSERT(jsscript);
script->mScript = jsscript;
script->mReadyToExecute = true;
}
- // If we don't already have bytecode for this script, and it doesn't already
- // exist in the child cache, encode it now, before it's ever executed.
- //
- // Ideally, we would like to do the encoding lazily, during idle slices.
- // There are subtle issues with encoding scripts which have already been
- // executed, though, which makes that somewhat risky. So until that
- // situation is improved, and thoroughly tested, we need to encode eagerly.
- //
- // (See also the TranscodeResult_Failure_RunOnceNotSupported failure case in
- // js::XDRScript)
- if (!script->mSize && !(mChildCache && mChildCache->mScripts.Get(cachePath))) {
- AutoSafeJSAPI jsapi;
- Unused << script->XDREncode(jsapi.cx());
- }
-
script->UpdateLoadTime(TimeStamp::Now());
script->mProcessTypes += CurrentProcessType();
}
void
ScriptPreloader::NoteScript(const nsCString& url, const nsCString& cachePath,
ProcessType processType, nsTArray<uint8_t>&& xdrData,
TimeStamp loadTime)