Bug 1564932 - Fix XDRScript handling of lazy scripts. r=jandem
authorTed Campbell <tcampbell@mozilla.com>
Fri, 12 Jul 2019 08:20:36 +0000
changeset 482591 9223ff1024a67d3d160b75481905a7079031223f
parent 482590 fce18a9477b0edc750db2c289c93c1ba10537483
child 482592 5f93b343bff5fbf3895c83e86a3aa1f7268b1a0b
push id89852
push usertcampbell@mozilla.com
push dateFri, 12 Jul 2019 11:54:18 +0000
treeherderautoland@9223ff1024a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1564932
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1564932 - Fix XDRScript handling of lazy scripts. r=jandem XDR should be a structural clone, so check if we have a lazy script directly when deciding if it should be coded. Whether relazification should be supported is a VM decision, not an XDR decision. This gives a cleaner round-trip of data when using XDR. Differential Revision: https://phabricator.services.mozilla.com/D37578
js/src/vm/JSScript.cpp
--- a/js/src/vm/JSScript.cpp
+++ b/js/src/vm/JSScript.cpp
@@ -262,18 +262,17 @@ static XDRResult XDRLazyClosedOverBindin
 }
 
 // Code the missing part needed to re-create a LazyScript from a JSScript.
 template <XDRMode mode>
 static XDRResult XDRRelazificationInfo(XDRState<mode>* xdr, HandleFunction fun,
                                        HandleScript script,
                                        HandleScope enclosingScope,
                                        MutableHandle<LazyScript*> lazy) {
-  MOZ_ASSERT_IF(mode == XDR_ENCODE, script->isRelazifiableIgnoringJitCode() &&
-                                        script->maybeLazyScript());
+  MOZ_ASSERT_IF(mode == XDR_ENCODE, script->maybeLazyScript());
   MOZ_ASSERT_IF(mode == XDR_ENCODE, !lazy->numInnerFunctions());
 
   JSContext* cx = xdr->cx();
 
   uint32_t immutableFlags;
   uint32_t numClosedOverBindings;
   {
     uint32_t sourceStart = script->sourceStart();
@@ -1020,17 +1019,17 @@ XDRResult js::XDRScript(XDRState<mode>* 
           !realm->behaviors().getSingletonsAsTemplates()) {
         return xdr->fail(JS::TranscodeResult_Failure_RunOnceNotSupported);
       }
     }
 
     if (!sourceObjectArg) {
       xdrScriptFlags |= (1 << OwnSource);
     }
-    if (script->isRelazifiableIgnoringJitCode()) {
+    if (script->maybeLazyScript()) {
       xdrScriptFlags |= (1 << HasLazyScript);
     }
   }
 
   MOZ_TRY(xdr->codeUint8(&xdrScriptFlags));
 
   if (mode == XDR_ENCODE) {
     lineno = script->lineno();