Bug 852789 - clear the runtime's self-hosting global on destruction of last context. r=sstangl

--HG--
extra : rebase_source : 719762b9e0647a94b3b31dafefb802952d109725
This commit is contained in:
Till Schneidereit 2013-03-21 19:21:13 +01:00
parent 6f7abe6530
commit 4d056bc6e4
3 changed files with 9 additions and 0 deletions

View File

@ -420,6 +420,8 @@ js::DestroyContext(JSContext *cx, DestroyContextMode mode)
/* 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) {

View File

@ -753,6 +753,7 @@ struct JSRuntime : js::RuntimeFriendFields,
//-------------------------------------------------------------------------
bool initSelfHosting(JSContext *cx);
void finishSelfHosting();
void markSelfHostingGlobal(JSTracer *trc);
bool isSelfHostingGlobal(js::HandleObject global) {
return global == selfHostingGlobal_;

View File

@ -540,6 +540,12 @@ JSRuntime::initSelfHosting(JSContext *cx)
return ok;
}
void
JSRuntime::finishSelfHosting()
{
selfHostingGlobal_ = NULL;
}
void
JSRuntime::markSelfHostingGlobal(JSTracer *trc)
{