Bug 884194 - Update fun->isHeavyweight() when replacing a lazy script with a preexisting script, r=luke.
authorBrian Hackett <bhackett1024@gmail.com>
Thu, 20 Jun 2013 13:24:44 -0600
changeset 135848 208bb59549380f1a9a1fd2d7ceee14872320e03f
parent 135847 4fb8fa8668c5efe4eb7b046192bfe0559b6064f4
child 135849 f7c30b1d5c3593904a7f89bb19c12a696124cb1b
push id29844
push userbhackett@mozilla.com
push dateThu, 20 Jun 2013 19:24:50 +0000
treeherdermozilla-inbound@208bb5954938 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs884194
milestone24.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 884194 - Update fun->isHeavyweight() when replacing a lazy script with a preexisting script, r=luke.
js/src/ion/BaselineBailouts.cpp
js/src/ion/IonFrames.cpp
js/src/jscompartment.cpp
js/src/jsfun.h
js/src/jsfuninlines.h
--- a/js/src/ion/BaselineBailouts.cpp
+++ b/js/src/ion/BaselineBailouts.cpp
@@ -1068,17 +1068,17 @@ ion::BailoutIonToBaseline(JSContext *cx,
         return BAILOUT_RETURN_FATAL_ERROR;
     IonSpew(IonSpew_BaselineBailouts, "  Incoming frame ptr = %p", builder.startFrame());
 
     SnapshotIterator snapIter(iter);
 
     RootedFunction callee(cx, iter.maybeCallee());
     if (callee) {
         IonSpew(IonSpew_BaselineBailouts, "  Callee function (%s:%u)",
-                callee->getExistingScript()->filename(), callee->getExistingScript()->lineno);
+                callee->existingScript()->filename(), callee->existingScript()->lineno);
     } else {
         IonSpew(IonSpew_BaselineBailouts, "  No callee!");
     }
 
     if (iter.isConstructing())
         IonSpew(IonSpew_BaselineBailouts, "  Constructing!");
     else
         IonSpew(IonSpew_BaselineBailouts, "  Not constructing!");
@@ -1106,17 +1106,17 @@ ion::BailoutIonToBaseline(JSContext *cx,
             break;
         }
 
         JS_ASSERT(nextCallee);
         JS_ASSERT(callPC);
         caller = scr;
         callerPC = callPC;
         fun = nextCallee;
-        scr = fun->getExistingScript();
+        scr = fun->existingScript();
         snapIter.nextFrame();
 
         frameNo++;
     }
     IonSpew(IonSpew_BaselineBailouts, "  Done restoring frames");
     BailoutKind bailoutKind = snapIter.bailoutKind();
 
     // Take the reconstructed baseline stack so it doesn't get freed when builder destructs.
--- a/js/src/ion/IonFrames.cpp
+++ b/js/src/ion/IonFrames.cpp
@@ -1275,17 +1275,17 @@ InlineFrameIteratorMaybeGC<allowGC>::fin
 
         si_.nextFrame();
 
         callee_ = funval.toObject().toFunction();
 
         // Inlined functions may be clones that still point to the lazy script
         // for the executed script, if they are clones. The actual script
         // exists though, just make sure the function points to it.
-        script_ = callee_->getExistingScript();
+        script_ = callee_->existingScript();
 
         pc_ = script_->code + si_.pcOffset();
     }
 
     framesRead_++;
 }
 template void InlineFrameIteratorMaybeGC<NoGC>::findNextFrame();
 template void InlineFrameIteratorMaybeGC<CanGC>::findNextFrame();
--- a/js/src/jscompartment.cpp
+++ b/js/src/jscompartment.cpp
@@ -664,17 +664,17 @@ CreateLazyScriptsForCompartment(JSContex
     // Repoint any clones of the original functions to their new script.
     for (gc::CellIter i(cx->zone(), JSFunction::FinalizeKind); !i.done(); i.next()) {
         JSObject *obj = i.get<JSObject>();
         if (obj->compartment() == cx->compartment() && obj->isFunction()) {
             JSFunction *fun = obj->toFunction();
             if (fun->isInterpretedLazy()) {
                 LazyScript *lazy = fun->lazyScriptOrNull();
                 if (lazy && lazy->maybeScript())
-                    fun->getExistingScript();
+                    fun->existingScript();
             }
         }
     }
 
     return true;
 }
 
 bool
--- a/js/src/jsfun.h
+++ b/js/src/jsfun.h
@@ -216,17 +216,17 @@ class JSFunction : public JSObject
     //
     // There are several methods to get the script of an interpreted function:
     //
     // - For all interpreted functions, getOrCreateScript() will get the
     //   JSScript, delazifying the function if necessary. This is the safest to
     //   use, but has extra checks, requires a cx and may trigger a GC.
     //
     // - For functions which may have a LazyScript but whose JSScript is known
-    //   to exist, getExistingScript() will get the script and delazify the
+    //   to exist, existingScript() will get the script and delazify the
     //   function if necessary.
     //
     // - For functions known to have a JSScript, nonLazyScript() will get it.
 
     JSScript *getOrCreateScript(JSContext *cx) {
         JS_ASSERT(isInterpreted());
         JS_ASSERT(cx);
         if (isInterpretedLazy()) {
@@ -235,17 +235,17 @@ class JSFunction : public JSObject
                 return NULL;
             JS_ASSERT(self->hasScript());
             return self->u.i.s.script_;
         }
         JS_ASSERT(hasScript());
         return u.i.s.script_;
     }
 
-    inline JSScript *getExistingScript();
+    inline JSScript *existingScript();
 
     JSScript *nonLazyScript() const {
         JS_ASSERT(hasScript());
         return JS::HandleScript::fromMarkedLocation(&u.i.s.script_);
     }
 
     js::HeapPtrScript &mutableScript() {
         JS_ASSERT(isInterpreted());
--- a/js/src/jsfuninlines.h
+++ b/js/src/jsfuninlines.h
@@ -219,29 +219,34 @@ CloneFunctionObjectIfNotSingleton(JSCont
                          ? extendedFinalizeKind
                          : finalizeKind;
     return CloneFunctionObject(cx, fun, parent, kind, newKind);
 }
 
 } /* namespace js */
 
 inline JSScript *
-JSFunction::getExistingScript()
+JSFunction::existingScript()
 {
     JS_ASSERT(isInterpreted());
     if (isInterpretedLazy()) {
         js::LazyScript *lazy = lazyScript();
-        JS_ASSERT(lazy->maybeScript());
+        JSScript *script = lazy->maybeScript();
+        JS_ASSERT(script);
 
         if (zone()->needsBarrier())
             js::LazyScript::writeBarrierPre(lazy);
 
         flags &= ~INTERPRETED_LAZY;
         flags |= INTERPRETED;
-        initScript(lazy->maybeScript());
+        initScript(script);
+
+        if (script->function()->isHeavyweight())
+            setIsHeavyweight();
+        nargs = script->function()->nargs;
     }
     JS_ASSERT(hasScript());
     return u.i.s.script_;
 }
 
 inline void
 JSFunction::setScript(JSScript *script_)
 {