[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser] 240/311: Backed out changeset 8f4d646a4bf6 (bug 1661293) for causing Bug 1758370



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 85eda8cef999ff6c9f8331926126cb4a61d2dd6d
Author: donal meehan <dmeehan@xxxxxxxxxxx>
AuthorDate: Wed Mar 23 17:22:26 2022 -0400

    Backed out changeset 8f4d646a4bf6 (bug 1661293) for causing Bug 1758370
---
 js/src/gc/GC.cpp      | 51 +++++++++++++++++++++++++++++++++++++--------------
 js/src/gc/GCRuntime.h | 21 +++------------------
 js/src/jsapi.cpp      |  2 +-
 3 files changed, 41 insertions(+), 33 deletions(-)

diff --git a/js/src/gc/GC.cpp b/js/src/gc/GC.cpp
index 4102a9c6f4238..66cc854009b52 100644
--- a/js/src/gc/GC.cpp
+++ b/js/src/gc/GC.cpp
@@ -1630,17 +1630,41 @@ void GCRuntime::maybeGC() {
   }
 #endif
 
-  (void)gcIfRequestedImpl(/* eagerOk = */ true);
+  if (gcIfRequested()) {
+    return;
+  }
+
+  if (isIncrementalGCInProgress()) {
+    return;
+  }
+
+  bool scheduledZones = false;
+  for (ZonesIter zone(this, WithAtoms); !zone.done(); zone.next()) {
+    if (checkEagerAllocTrigger(zone->gcHeapSize, zone->gcHeapThreshold) ||
+        checkEagerAllocTrigger(zone->mallocHeapSize,
+                               zone->mallocHeapThreshold)) {
+      zone->scheduleGC();
+      scheduledZones = true;
+    }
+  }
+
+  if (scheduledZones) {
+    SliceBudget budget = defaultBudget(JS::GCReason::EAGER_ALLOC_TRIGGER, 0);
+    startGC(JS::GCOptions::Normal, JS::GCReason::EAGER_ALLOC_TRIGGER, budget);
+  }
 }
 
-JS::GCReason GCRuntime::wantMajorGC(bool eagerOk) {
+JS::GCReason GCRuntime::wantMajorGC() {
   MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt));
 
+  // This implementation parallels maybeGC() above.
+
+  // From gcIfRequested().
   if (majorGCRequested()) {
     return majorGCTriggerReason;
   }
 
-  if (isIncrementalGCInProgress() || !eagerOk) {
+  if (isIncrementalGCInProgress()) {
     return JS::GCReason::NO_REASON;
   }
 
@@ -4163,25 +4187,24 @@ void GCRuntime::startBackgroundFreeAfterMinorGC() {
   startBackgroundFree();
 }
 
-bool GCRuntime::gcIfRequestedImpl(bool eagerOk) {
+bool GCRuntime::gcIfRequested() {
   // This method returns whether a major GC was performed.
 
   if (nursery().minorGCRequested()) {
     minorGC(nursery().minorGCTriggerReason());
   }
 
-  JS::GCReason reason = wantMajorGC(eagerOk);
-  if (reason == JS::GCReason::NO_REASON) {
-    return false;
+  if (majorGCRequested()) {
+    SliceBudget budget = defaultBudget(majorGCTriggerReason, 0);
+    if (!isIncrementalGCInProgress()) {
+      startGC(JS::GCOptions::Normal, majorGCTriggerReason, budget);
+    } else {
+      gcSlice(majorGCTriggerReason, budget);
+    }
+    return true;
   }
 
-  SliceBudget budget = defaultBudget(reason, 0);
-  if (!isIncrementalGCInProgress()) {
-    startGC(JS::GCOptions::Normal, reason, budget);
-  } else {
-    gcSlice(reason, budget);
-  }
-  return true;
+  return false;
 }
 
 void js::gc::FinishGC(JSContext* cx, JS::GCReason reason) {
diff --git a/js/src/gc/GCRuntime.h b/js/src/gc/GCRuntime.h
index 2cecf1b891ff4..778ca7632b56f 100644
--- a/js/src/gc/GCRuntime.h
+++ b/js/src/gc/GCRuntime.h
@@ -329,27 +329,12 @@ class GCRuntime {
   // The return value indicates if we were able to do the GC.
   bool triggerZoneGC(Zone* zone, JS::GCReason reason, size_t usedBytes,
                      size_t thresholdBytes);
-
   void maybeGC();
-
-  // Return whether we want to run a major GC. If eagerOk is true, include eager
-  // triggers (eg EAGER_ALLOC_TRIGGER) in this determination, and schedule all
-  // zones that exceed the eager thresholds.
-  JS::GCReason wantMajorGC(bool eagerOk);
+  JS::GCReason wantMajorGC();
   bool checkEagerAllocTrigger(const HeapSize& size,
                               const HeapThreshold& threshold);
-
-  // Do a minor GC if requested, followed by a major GC if requested. The return
-  // value indicates whether a major GC was performed.
-  bool gcIfRequested() { return gcIfRequestedImpl(false); }
-
-  // Internal function to do a GC if previously requested. But if not and
-  // eagerOk, do an eager GC for all Zones that have exceeded the eager
-  // thresholds.
-  //
-  // Return whether a major GC was performed or started.
-  bool gcIfRequestedImpl(bool eagerOk);
-
+  // The return value indicates whether a major GC was performed.
+  bool gcIfRequested();
   void gc(JS::GCOptions options, JS::GCReason reason);
   void startGC(JS::GCOptions options, JS::GCReason reason,
                const SliceBudget& budget);
diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp
index 53bd6862cfdf3..3fcb326508f83 100644
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -1287,7 +1287,7 @@ JS_PUBLIC_API JS::GCReason JS::WantEagerMinorGC(JSRuntime* rt) {
 }
 
 JS_PUBLIC_API JS::GCReason JS::WantEagerMajorGC(JSRuntime* rt) {
-  return rt->gc.wantMajorGC(true);
+  return rt->gc.wantMajorGC();
 }
 
 JS_PUBLIC_API void JS::MaybeRunNurseryCollection(JSRuntime* rt,

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits