зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1466083 part 2 - Replace JSRuntime::numCompartments with JSRuntime::numRealms. r=luke
This commit is contained in:
Родитель
e1029c5394
Коммит
030c2bbfd2
|
@ -678,13 +678,12 @@ js::RemapAllWrappersForObject(JSContext* cx, JSObject* oldTargetArg,
|
|||
RootedObject newTarget(cx, newTargetArg);
|
||||
|
||||
AutoWrapperVector toTransplant(cx);
|
||||
if (!toTransplant.reserve(cx->runtime()->numCompartments))
|
||||
return false;
|
||||
|
||||
for (CompartmentsIter c(cx->runtime()); !c.done(); c.next()) {
|
||||
if (WrapperMap::Ptr wp = c->lookupWrapper(origv)) {
|
||||
// We found a wrapper. Remember and root it.
|
||||
toTransplant.infallibleAppend(WrapperValue(wp));
|
||||
if (!toTransplant.append(WrapperValue(wp)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,9 +44,7 @@ using mozilla::PodArrayZero;
|
|||
JSCompartment::JSCompartment(Zone* zone)
|
||||
: zone_(zone),
|
||||
runtime_(zone->runtimeFromAnyThread())
|
||||
{
|
||||
runtime_->numCompartments++;
|
||||
}
|
||||
{}
|
||||
|
||||
ObjectRealm::ObjectRealm(JS::Zone* zone)
|
||||
: innerViews(zone)
|
||||
|
@ -69,6 +67,8 @@ Realm::Realm(JS::Zone* zone, const JS::RealmOptions& options)
|
|||
{
|
||||
MOZ_ASSERT_IF(creationOptions_.mergeable(),
|
||||
creationOptions_.invisibleToDebugger());
|
||||
|
||||
runtime_->numRealms++;
|
||||
}
|
||||
|
||||
Realm::~Realm()
|
||||
|
@ -84,11 +84,9 @@ Realm::~Realm()
|
|||
if (!runtime_->gc.shutdownCollectedEverything())
|
||||
objectGroups_.unboxedLayouts.clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
JSCompartment::~JSCompartment()
|
||||
{
|
||||
runtime_->numCompartments--;
|
||||
MOZ_ASSERT(runtime_->numRealms > 0);
|
||||
runtime_->numRealms--;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -618,7 +618,6 @@ struct JSCompartment
|
|||
|
||||
protected:
|
||||
explicit JSCompartment(JS::Zone* zone);
|
||||
~JSCompartment();
|
||||
|
||||
MOZ_MUST_USE bool init(JSContext* cx);
|
||||
|
||||
|
|
|
@ -762,7 +762,7 @@ CollectRuntimeStatsHelper(JSContext* cx, RuntimeStats* rtStats, ObjectPrivateVis
|
|||
bool anonymize, IterateCellCallback statsCellCallback)
|
||||
{
|
||||
JSRuntime* rt = cx->runtime();
|
||||
if (!rtStats->realmStatsVector.reserve(rt->numCompartments))
|
||||
if (!rtStats->realmStatsVector.reserve(rt->numRealms))
|
||||
return false;
|
||||
|
||||
size_t totalZones = rt->gc.zones().length() + 1; // + 1 for the atoms zone.
|
||||
|
|
|
@ -133,7 +133,7 @@ JSRuntime::JSRuntime(JSRuntime* parentRuntime)
|
|||
activeThreadHasScriptDataAccess(false),
|
||||
#endif
|
||||
numActiveHelperThreadZones(0),
|
||||
numCompartments(0),
|
||||
numRealms(0),
|
||||
localeCallbacks(nullptr),
|
||||
defaultLocale(nullptr),
|
||||
profilingScripts(false),
|
||||
|
|
|
@ -511,10 +511,10 @@ struct JSRuntime : public js::MallocProvider<JSRuntime>
|
|||
}
|
||||
#endif
|
||||
|
||||
// How many compartments there are across all zones. This number includes
|
||||
// off thread context compartments, so it isn't necessarily equal to the
|
||||
// number of compartments visited by CompartmentsIter.
|
||||
js::MainThreadData<size_t> numCompartments;
|
||||
// How many realms there are across all zones. This number includes
|
||||
// off-thread context realms, so it isn't necessarily equal to the
|
||||
// number of realms visited by RealmsIter.
|
||||
js::MainThreadData<size_t> numRealms;
|
||||
|
||||
/* Locale-specific callbacks for string conversion. */
|
||||
js::MainThreadData<const JSLocaleCallbacks*> localeCallbacks;
|
||||
|
|
Загрузка…
Ссылка в новой задаче