This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch geckoview-99.0.1-11.0-1 in repository tor-browser.
commit b2463b119a807755d6a87718091e9416d0db3a4b Author: donal meehan dmeehan@mozilla.com AuthorDate: Wed Mar 23 17:22:48 2022 -0400
Backed out changeset ec817d9e8a17 (bug 1661293) for causing Bug 1758370 --- dom/base/nsJSEnvironment.cpp | 10 ++-------- js/public/GCAPI.h | 4 +--- js/src/gc/GC.cpp | 27 --------------------------- js/src/gc/GCRuntime.h | 1 - js/src/jsapi.cpp | 12 +++--------- xpcom/base/CycleCollectedJSContext.h | 3 +-- xpcom/base/CycleCollectedJSRuntime.h | 2 +- 7 files changed, 8 insertions(+), 51 deletions(-)
diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 82db36d86cbaa..add8c6deb01c3 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -1662,14 +1662,8 @@ void nsJSContext::MaybePokeGC() { }
JSRuntime* rt = CycleCollectedJSRuntime::Get()->Runtime(); - JS::GCReason reason = JS::WantEagerMinorGC(rt); - if (reason != JS::GCReason::NO_REASON) { - MOZ_ASSERT(reason == JS::GCReason::EAGER_NURSERY_COLLECTION); - sScheduler.PokeMinorGC(reason); - } - reason = JS::WantEagerMajorGC(rt); - if (reason != JS::GCReason::NO_REASON) { - PokeGC(reason, nullptr, 0); + if (JS::IsIdleGCTaskNeeded(rt)) { + sScheduler.PokeMinorGC(JS::GCReason::EAGER_NURSERY_COLLECTION); } }
diff --git a/js/public/GCAPI.h b/js/public/GCAPI.h index 00cf87c986eaf..9ba9c3750ade0 100644 --- a/js/public/GCAPI.h +++ b/js/public/GCAPI.h @@ -1237,9 +1237,7 @@ JS_GetExternalStringCallbacks(JSString* str);
namespace JS {
-extern JS_PUBLIC_API GCReason WantEagerMinorGC(JSRuntime* rt); - -extern JS_PUBLIC_API GCReason WantEagerMajorGC(JSRuntime* rt); +extern JS_PUBLIC_API bool IsIdleGCTaskNeeded(JSRuntime* rt);
extern JS_PUBLIC_API void MaybeRunNurseryCollection(JSRuntime* rt, JS::GCReason reason); diff --git a/js/src/gc/GC.cpp b/js/src/gc/GC.cpp index 66cc854009b52..a79195c8d038d 100644 --- a/js/src/gc/GC.cpp +++ b/js/src/gc/GC.cpp @@ -1654,33 +1654,6 @@ void GCRuntime::maybeGC() { } }
-JS::GCReason GCRuntime::wantMajorGC() { - MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); - - // This implementation parallels maybeGC() above. - - // From gcIfRequested(). - if (majorGCRequested()) { - return majorGCTriggerReason; - } - - if (isIncrementalGCInProgress()) { - return JS::GCReason::NO_REASON; - } - - JS::GCReason reason = JS::GCReason::NO_REASON; - for (ZonesIter zone(this, WithAtoms); !zone.done(); zone.next()) { - if (checkEagerAllocTrigger(zone->gcHeapSize, zone->gcHeapThreshold) || - checkEagerAllocTrigger(zone->mallocHeapSize, - zone->mallocHeapThreshold)) { - zone->scheduleGC(); - reason = JS::GCReason::EAGER_ALLOC_TRIGGER; - } - } - - return reason; -} - bool GCRuntime::checkEagerAllocTrigger(const HeapSize& size, const HeapThreshold& threshold) { double thresholdBytes = diff --git a/js/src/gc/GCRuntime.h b/js/src/gc/GCRuntime.h index 778ca7632b56f..77b9daf9de7d0 100644 --- a/js/src/gc/GCRuntime.h +++ b/js/src/gc/GCRuntime.h @@ -330,7 +330,6 @@ class GCRuntime { bool triggerZoneGC(Zone* zone, JS::GCReason reason, size_t usedBytes, size_t thresholdBytes); void maybeGC(); - JS::GCReason wantMajorGC(); bool checkEagerAllocTrigger(const HeapSize& size, const HeapThreshold& threshold); // The return value indicates whether a major GC was performed. diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 3fcb326508f83..db03374c31831 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -1279,15 +1279,9 @@ JS_PUBLIC_API void JS_RemoveExtraGCRootsTracer(JSContext* cx, return cx->runtime()->gc.removeBlackRootsTracer(traceOp, data); }
-JS_PUBLIC_API JS::GCReason JS::WantEagerMinorGC(JSRuntime* rt) { - if (rt->gc.nursery().shouldCollect()) { - return JS::GCReason::EAGER_NURSERY_COLLECTION; - } - return JS::GCReason::NO_REASON; -} - -JS_PUBLIC_API JS::GCReason JS::WantEagerMajorGC(JSRuntime* rt) { - return rt->gc.wantMajorGC(); +JS_PUBLIC_API bool JS::IsIdleGCTaskNeeded(JSRuntime* rt) { + // Currently, we only collect nursery during idle time. + return rt->gc.nursery().shouldCollect(); }
JS_PUBLIC_API void JS::MaybeRunNurseryCollection(JSRuntime* rt, diff --git a/xpcom/base/CycleCollectedJSContext.h b/xpcom/base/CycleCollectedJSContext.h index bb04584b3cbce..4236e58434402 100644 --- a/xpcom/base/CycleCollectedJSContext.h +++ b/xpcom/base/CycleCollectedJSContext.h @@ -210,8 +210,7 @@ class CycleCollectedJSContext : dom::PerThreadAtomCache, private JS::JobQueue { MOZ_CAN_RUN_SCRIPT_BOUNDARY virtual void AfterProcessTask(uint32_t aRecursionDepth);
- // Check whether any eager thresholds have been reached, which would mean - // an idle GC task (minor or major) would be useful. + // Check whether we need an idle minor GC task. virtual void MaybePokeGC();
uint32_t RecursionDepth() const; diff --git a/xpcom/base/CycleCollectedJSRuntime.h b/xpcom/base/CycleCollectedJSRuntime.h index 07deb577f34e1..b1689df042231 100644 --- a/xpcom/base/CycleCollectedJSRuntime.h +++ b/xpcom/base/CycleCollectedJSRuntime.h @@ -376,7 +376,7 @@ class CycleCollectedJSRuntime {
bool IsIdleGCTaskNeeded() { return !HasPendingIdleGCTask() && Runtime() && - JS::WantEagerMinorGC(Runtime()) != JS::GCReason::NO_REASON; + JS::IsIdleGCTaskNeeded(Runtime()); }
public: