author | Nicholas Nethercote <nnethercote@mozilla.com> |
Thu, 18 Jun 2015 15:34:26 -0700 | |
changeset 249679 | 81945c5fa51dbfe019a8e9161823fdb5c9d0d147 |
parent 249678 | 9eed99d204967b603da7eb343dd04e059db4e01f |
child 249680 | 325631a7b72a75d24301ff8f456fba7577119ebd |
push id | 28936 |
push user | ryanvm@gmail.com |
push date | Fri, 19 Jun 2015 20:34:42 +0000 |
treeherder | mozilla-central@c319f262ce3e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mrbkap |
bugs | 1174594 |
milestone | 41.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
|
--- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -106,19 +106,16 @@ xpc::ShouldDiscardSystemSource() { retur #ifdef DEBUG static mozilla::Atomic<bool> sExtraWarningsForSystemJS(false); bool xpc::ExtraWarningsForSystemJS() { return sExtraWarningsForSystemJS; } #else bool xpc::ExtraWarningsForSystemJS() { return false; } #endif -static void * const UNMARK_ONLY = nullptr; -static void * const UNMARK_AND_SWEEP = (void*)1; - // *Some* NativeSets are referenced from mClassInfo2NativeSetMap. // *All* NativeSets are referenced from mNativeSetMap. // So, in mClassInfo2NativeSetMap we just clear references to the unmarked. // In mNativeSetMap we clear the references to the unmarked *and* delete them. bool XPCJSRuntime::CustomContextCallback(JSContext* cx, unsigned operation) { @@ -806,71 +803,62 @@ XPCJSRuntime::FinalizeCallback(JSFreeOp* // marked, so it is not safe to sweep them. We still need to unmark // them, since the ones pointed to by WrappedNativeProtos in a // compartment being collected will be marked. // // Ideally, if NativeInterfaces from different compartments were // kept separate, we could sweep only the ones belonging to // compartments being collected. Currently, though, NativeInterfaces // are shared between compartments. This ought to be fixed. - void* sweepArg = isCompartmentGC ? UNMARK_ONLY : UNMARK_AND_SWEEP; + bool doSweep = !isCompartmentGC; // We don't want to sweep the JSClasses at shutdown time. // At this point there may be JSObjects using them that have // been removed from the other maps. if (!nsXPConnect::XPConnect()->IsShuttingDown()) { for (auto i = self->mNativeScriptableSharedMap->RemovingIter(); !i.Done(); i.Next()) { auto entry = static_cast<XPCNativeScriptableSharedMap::Entry*>(i.Get()); XPCNativeScriptableShared* shared = entry->key; if (shared->IsMarked()) { shared->Unmark(); - continue; + } else if (doSweep) { + delete shared; + i.Remove(); } - if (sweepArg == UNMARK_ONLY) - continue; - - delete shared; - i.Remove(); } } if (!isCompartmentGC) { for (auto i = self->mClassInfo2NativeSetMap->RemovingIter(); !i.Done(); i.Next()) { auto entry = static_cast<ClassInfo2NativeSetMap::Entry*>(i.Get()); if (!entry->value->IsMarked()) i.Remove(); } } for (auto i = self->mNativeSetMap->RemovingIter(); !i.Done(); i.Next()) { auto entry = static_cast<NativeSetMap::Entry*>(i.Get()); XPCNativeSet* set = entry->key_value; if (set->IsMarked()) { set->Unmark(); - continue; + } else if (doSweep) { + XPCNativeSet::DestroyInstance(set); + i.Remove(); } - if (sweepArg == UNMARK_ONLY) - continue; - - XPCNativeSet::DestroyInstance(set); - i.Remove(); } for (auto i = self->mIID2NativeInterfaceMap->RemovingIter(); !i.Done(); i.Next()) { auto entry = static_cast<IID2NativeInterfaceMap::Entry*>(i.Get()); XPCNativeInterface* iface = entry->value; if (iface->IsMarked()) { iface->Unmark(); - continue; + } else if (doSweep) { + XPCNativeInterface::DestroyInstance(iface); + i.Remove(); } - if (sweepArg == UNMARK_ONLY) - continue; - - XPCNativeInterface::DestroyInstance(iface); - i.Remove(); } #ifdef DEBUG XPCWrappedNativeScope::ASSERT_NoInterfaceSetsAreMarked(); #endif // Now we are going to recycle any unused WrappedNativeTearoffs. // We do this by iterating all the live callcontexts