Bug 1461938 part 15 - Move lastAnimationTime from JSCompartment to JS::Realm. r=jonco

This commit is contained in:
Jan de Mooij 2018-05-22 15:03:55 +02:00
Родитель 9e41173598
Коммит 70cdb7fef8
5 изменённых файлов: 8 добавлений и 9 удалений

Просмотреть файл

@ -4037,7 +4037,7 @@ GCRuntime::purgeRuntime()
}
bool
GCRuntime::shouldPreserveJITCode(JSCompartment* comp, int64_t currentTime,
GCRuntime::shouldPreserveJITCode(Realm* realm, int64_t currentTime,
JS::gcreason::Reason reason, bool canAllocateMoreCode)
{
if (cleanUpEverything)
@ -4047,9 +4047,9 @@ GCRuntime::shouldPreserveJITCode(JSCompartment* comp, int64_t currentTime,
if (alwaysPreserveCode)
return true;
if (JS::GetRealmForCompartment(comp)->preserveJitCode())
if (realm->preserveJitCode())
return true;
if (comp->lastAnimationTime + PRMJ_USEC_PER_SEC >= currentTime)
if (realm->lastAnimationTime + PRMJ_USEC_PER_SEC >= currentTime)
return true;
if (reason == JS::gcreason::DEBUG_GC)
return true;

Просмотреть файл

@ -568,7 +568,7 @@ class GCRuntime
MOZ_MUST_USE bool beginMarkPhase(JS::gcreason::Reason reason, AutoTraceSession& session);
bool prepareZonesForCollection(JS::gcreason::Reason reason, bool* isFullOut,
AutoLockForExclusiveAccess& lock);
bool shouldPreserveJITCode(JSCompartment* comp, int64_t currentTime,
bool shouldPreserveJITCode(JS::Realm* realm, int64_t currentTime,
JS::gcreason::Reason reason, bool canAllocateMoreCode);
void traceRuntimeForMajorGC(JSTracer* trc, AutoTraceSession& session);
void traceRuntimeAtoms(JSTracer* trc, AutoLockForExclusiveAccess& lock);

Просмотреть файл

@ -397,7 +397,7 @@ JS_FRIEND_API(void)
js::NotifyAnimationActivity(JSObject* obj)
{
int64_t timeNow = PRMJ_Now();
obj->compartment()->lastAnimationTime = timeNow;
obj->realm()->lastAnimationTime = timeNow;
obj->runtimeFromMainThread()->lastAnimationTime = timeNow;
}

Просмотреть файл

@ -50,7 +50,6 @@ JSCompartment::JSCompartment(Zone* zone)
marked(true),
performanceMonitoring(runtime_),
data(nullptr),
lastAnimationTime(0),
regExps(),
arraySpeciesLookup(),
globalWriteBarriered(0),

Просмотреть файл

@ -646,9 +646,6 @@ struct JSCompartment
}
public:
/* Last time at which an animation was played for a global in this compartment. */
int64_t lastAnimationTime;
js::RegExpCompartment regExps;
js::ArraySpeciesLookup arraySpeciesLookup;
@ -1064,6 +1061,9 @@ class JS::Realm : public JSCompartment
js::ScriptNameMap* scriptNameMap = nullptr;
js::DebugScriptMap* debugScriptMap = nullptr;
// Last time at which an animation was played for this realm.
int64_t lastAnimationTime = 0;
uint32_t warnedAboutStringGenericsMethods = 0;
#ifdef DEBUG
bool firedOnNewGlobalObject = false;