forked from mirrors/gecko-dev
Bug 1831072 - Part 3: Add a forceDiscardJitCode method and refactor GC callers r=jandem
I didn't update ReleaseAllJITCode out of an abundance of caution, but maybe this should call forceDiscardJitCode too. Differential Revision: https://phabricator.services.mozilla.com/D177038
This commit is contained in:
parent
9375b42233
commit
ce9fb10c21
5 changed files with 13 additions and 13 deletions
|
|
@ -3291,10 +3291,7 @@ void GCRuntime::maybeStopPretenuring() {
|
||||||
double rate = double(zone->finalizedStrings) / double(numStrings);
|
double rate = double(zone->finalizedStrings) / double(numStrings);
|
||||||
if (rate > tunables.stopPretenureStringThreshold()) {
|
if (rate > tunables.stopPretenureStringThreshold()) {
|
||||||
CancelOffThreadIonCompile(zone);
|
CancelOffThreadIonCompile(zone);
|
||||||
bool preserving = zone->isPreservingCode();
|
zone->forceDiscardJitCode(rt->gcContext());
|
||||||
zone->setPreservingCode(false);
|
|
||||||
zone->discardJitCode(rt->gcContext());
|
|
||||||
zone->setPreservingCode(preserving);
|
|
||||||
for (RealmsInZoneIter r(zone); !r.done(); r.next()) {
|
for (RealmsInZoneIter r(zone); !r.done(); r.next()) {
|
||||||
if (jit::JitRealm* jitRealm = r->jitRealm()) {
|
if (jit::JitRealm* jitRealm = r->jitRealm()) {
|
||||||
jitRealm->discardStubs();
|
jitRealm->discardStubs();
|
||||||
|
|
|
||||||
|
|
@ -95,8 +95,7 @@ void js::ReleaseAllJITCode(JS::GCContext* gcx) {
|
||||||
js::CancelOffThreadIonCompile(gcx->runtime());
|
js::CancelOffThreadIonCompile(gcx->runtime());
|
||||||
|
|
||||||
for (ZonesIter zone(gcx->runtime(), SkipAtoms); !zone.done(); zone.next()) {
|
for (ZonesIter zone(gcx->runtime(), SkipAtoms); !zone.done(); zone.next()) {
|
||||||
zone->setPreservingCode(false);
|
zone->forceDiscardJitCode(gcx);
|
||||||
zone->discardJitCode(gcx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (RealmsIter realm(gcx->runtime()); !realm.done(); realm.next()) {
|
for (RealmsIter realm(gcx->runtime()); !realm.done(); realm.next()) {
|
||||||
|
|
|
||||||
|
|
@ -1564,10 +1564,7 @@ size_t js::Nursery::doPretenuring(JSRuntime* rt, JS::GCReason reason,
|
||||||
zone->tenuredBigInts >= 30 * 1000;
|
zone->tenuredBigInts >= 30 * 1000;
|
||||||
if (disableNurseryStrings || disableNurseryBigInts) {
|
if (disableNurseryStrings || disableNurseryBigInts) {
|
||||||
CancelOffThreadIonCompile(zone);
|
CancelOffThreadIonCompile(zone);
|
||||||
bool preserving = zone->isPreservingCode();
|
zone->forceDiscardJitCode(rt->gcContext());
|
||||||
zone->setPreservingCode(false);
|
|
||||||
zone->discardJitCode(rt->gcContext());
|
|
||||||
zone->setPreservingCode(preserving);
|
|
||||||
for (RealmsInZoneIter r(zone); !r.done(); r.next()) {
|
for (RealmsInZoneIter r(zone); !r.done(); r.next()) {
|
||||||
if (jit::JitRealm* jitRealm = r->jitRealm()) {
|
if (jit::JitRealm* jitRealm = r->jitRealm()) {
|
||||||
jitRealm->discardStubs();
|
jitRealm->discardStubs();
|
||||||
|
|
|
||||||
|
|
@ -385,11 +385,14 @@ void Zone::checkStringWrappersAfterMovingGC() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Zone::discardJitCode(JS::GCContext* gcx, const DiscardOptions& options) {
|
void Zone::discardJitCode(JS::GCContext* gcx, const DiscardOptions& options) {
|
||||||
if (!jitZone()) {
|
if (!isPreservingCode()) {
|
||||||
return;
|
forceDiscardJitCode(gcx, options);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPreservingCode()) {
|
void Zone::forceDiscardJitCode(JS::GCContext* gcx,
|
||||||
|
const DiscardOptions& options) {
|
||||||
|
if (!jitZone()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -327,6 +327,10 @@ class Zone : public js::ZoneAllocator, public js::gc::GraphNodeBase<JS::Zone> {
|
||||||
void discardJitCode(JS::GCContext* gcx,
|
void discardJitCode(JS::GCContext* gcx,
|
||||||
const DiscardOptions& options = DiscardOptions());
|
const DiscardOptions& options = DiscardOptions());
|
||||||
|
|
||||||
|
// Discard JIT code regardless of isPreservingCode().
|
||||||
|
void forceDiscardJitCode(JS::GCContext* gcx,
|
||||||
|
const DiscardOptions& options = DiscardOptions());
|
||||||
|
|
||||||
void resetAllocSitesAndInvalidate(bool resetNurserySites,
|
void resetAllocSitesAndInvalidate(bool resetNurserySites,
|
||||||
bool resetPretenuredSites);
|
bool resetPretenuredSites);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue