Bug 852789 - clear the runtime's self-hosting global on destruction of last context. r=sstangl
authorTill Schneidereit <tschneidereit@gmail.com>
Thu, 21 Mar 2013 19:21:13 +0100
changeset 125827 3a81edb20e829e23a6c4b1ce6d8e73bea47d623a
parent 125826 a83cbe4e057688aa01084e0e5578e03fb27425d2
child 125828 eda31d5153fd0c905ccba3e372ed6ade6d20f197
push id25110
push usertschneidereit@gmail.com
push dateThu, 21 Mar 2013 20:02:16 +0000
treeherdermozilla-inbound@3a81edb20e82 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssstangl
bugs852789
milestone22.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 852789 - clear the runtime's self-hosting global on destruction of last context. r=sstangl
js/src/jscntxt.cpp
js/src/jscntxt.h
js/src/vm/SelfHosting.cpp
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -415,16 +415,18 @@ js::DestroyContext(JSContext *cx, Destro
         /* Clear debugging state to remove GC roots. */
         for (CompartmentsIter c(rt); !c.done(); c.next())
             c->clearTraps(rt->defaultFreeOp());
         JS_ClearAllWatchPoints(cx);
 
         /* Clear the statics table to remove GC roots. */
         rt->staticStrings.finish();
 
+        rt->finishSelfHosting();
+
         JS::PrepareForFullGC(rt);
         GC(rt, GC_NORMAL, JS::gcreason::LAST_CONTEXT);
     } else if (mode == DCM_FORCE_GC) {
         JS_ASSERT(!rt->isHeapBusy());
         JS::PrepareForFullGC(rt);
         GC(rt, GC_NORMAL, JS::gcreason::DESTROY_CONTEXT);
     }
     js_delete(cx);
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -748,16 +748,17 @@ struct JSRuntime : js::RuntimeFriendFiel
         return !!ionRuntime_;
     }
 
     //-------------------------------------------------------------------------
     // Self-hosting support
     //-------------------------------------------------------------------------
 
     bool initSelfHosting(JSContext *cx);
+    void finishSelfHosting();
     void markSelfHostingGlobal(JSTracer *trc);
     bool isSelfHostingGlobal(js::HandleObject global) {
         return global == selfHostingGlobal_;
     }
     bool cloneSelfHostedFunctionScript(JSContext *cx, js::Handle<js::PropertyName*> name,
                                        js::Handle<JSFunction*> targetFun);
     bool cloneSelfHostedValue(JSContext *cx, js::Handle<js::PropertyName*> name,
                               js::MutableHandleValue vp);
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -536,16 +536,22 @@ JSRuntime::initSelfHosting(JSContext *cx
         ok = Evaluate(cx, shg, options, src, srcLen, &rv);
     }
     JS_SetErrorReporter(cx, oldReporter);
     JS_SetGlobalObject(cx, savedGlobal);
     return ok;
 }
 
 void
+JSRuntime::finishSelfHosting()
+{
+    selfHostingGlobal_ = NULL;
+}
+
+void
 JSRuntime::markSelfHostingGlobal(JSTracer *trc)
 {
     MarkObjectRoot(trc, &selfHostingGlobal_, "self-hosting global");
 }
 
 typedef AutoObjectObjectHashMap CloneMemory;
 static bool CloneValue(JSContext *cx, MutableHandleValue vp, CloneMemory &clonedObjects);