Bug 1470793: Stop eagerly XDR encoding scripts in the preloader cache. r?erahm draft
authorKris Maglione <maglione.k@gmail.com>
Sun, 24 Jun 2018 18:37:50 -0700
changeset 810044 4706148f4844738162435bee4f80e3f753303295
parent 810043 701fc22d0b559f73f4c4b122e97ac883960de553
child 810053 34a6812b3fb3113f8bbb9c763f73aa2ff31496e0
push id113867
push usermaglione.k@gmail.com
push dateMon, 25 Jun 2018 01:38:15 +0000
reviewerserahm
bugs1470793
milestone62.0a1
Bug 1470793: Stop eagerly XDR encoding scripts in the preloader cache. r?erahm MozReview-Commit-ID: 2e85c34zt8v
js/xpconnect/loader/ScriptPreloader.cpp
--- 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)