Bug 1461938 part 26 - Move performanceMonitoring from JSCompartment to JS::Realm. r=luke

This commit is contained in:
Jan de Mooij 2018-05-23 15:27:36 +02:00
parent e9f0432b1a
commit e98e8c8cef
3 changed files with 7 additions and 8 deletions

View File

@ -44,7 +44,6 @@ using mozilla::PodArrayZero;
JSCompartment::JSCompartment(Zone* zone)
: zone_(zone),
runtime_(zone->runtimeFromAnyThread()),
performanceMonitoring(runtime_),
data(nullptr),
regExps(),
globalWriteBarriered(0),
@ -69,7 +68,8 @@ Realm::Realm(JS::Zone* zone, const JS::RealmOptions& options)
behaviors_(options.behaviors()),
global_(nullptr),
randomKeyGenerator_(runtime_->forkRandomKeyGenerator()),
wasm(zone->runtimeFromMainThread())
wasm(zone->runtimeFromMainThread()),
performanceMonitoring(runtime_)
{
MOZ_ASSERT_IF(creationOptions_.mergeable(),
creationOptions_.invisibleToDebugger());

View File

@ -561,8 +561,6 @@ struct JSCompartment
friend struct JSContext;
public:
js::PerformanceGroupHolder performanceMonitoring;
JS::Zone* zone() { return zone_; }
const JS::Zone* zone() const { return zone_; }
@ -857,6 +855,8 @@ class JS::Realm : public JSCompartment
js::NewProxyCache newProxyCache;
js::ArraySpeciesLookup arraySpeciesLookup;
js::PerformanceGroupHolder performanceMonitoring;
js::UniquePtr<js::ScriptCountsMap> scriptCountsMap;
js::UniquePtr<js::ScriptNameMap> scriptNameMap;
js::UniquePtr<js::DebugScriptMap> debugScriptMap;

View File

@ -194,9 +194,8 @@ void
PerformanceMonitoring::dispose(JSRuntime* rt)
{
reset();
for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next()) {
c->performanceMonitoring.unlink();
}
for (RealmsIter r(rt, SkipAtoms); !r.done(); r.next())
r->performanceMonitoring.unlink();
}
PerformanceGroupHolder::~PerformanceGroupHolder()
@ -244,7 +243,7 @@ AutoStopwatch::AutoStopwatch(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IM
JSRuntime* runtime = cx_->runtime();
iteration_ = runtime->performanceMonitoring().iteration();
const PerformanceGroupVector* groups = compartment->performanceMonitoring.getGroups(cx);
const PerformanceGroupVector* groups = cx_->realm()->performanceMonitoring.getGroups(cx);
if (!groups) {
// Either the embedding has not provided any performance
// monitoring logistics or there was an error that prevents