[tbb-commits] [tor-browser] 245/311: Backed out changeset 04443fa474ac (bug 1661293) for causing Bug 1758370

gitolite role git at cupani.torproject.org
Tue Apr 26 15:30:45 UTC 2022


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 4347f3f73a6804ffb39d66f05837725bae72acd2
Author: donal meehan <dmeehan at mozilla.com>
AuthorDate: Wed Mar 23 17:24:49 2022 -0400

    Backed out changeset 04443fa474ac (bug 1661293) for causing Bug 1758370
---
 dom/base/CCGCScheduler.cpp            | 40 ++++++++---------------------------
 dom/base/CCGCScheduler.h              |  5 ++---
 dom/base/nsJSEnvironment.cpp          |  2 +-
 dom/base/test/gtest/TestScheduler.cpp |  2 +-
 4 files changed, 13 insertions(+), 36 deletions(-)

diff --git a/dom/base/CCGCScheduler.cpp b/dom/base/CCGCScheduler.cpp
index efa5c77720beb..44b12f86699ec 100644
--- a/dom/base/CCGCScheduler.cpp
+++ b/dom/base/CCGCScheduler.cpp
@@ -109,7 +109,7 @@
 
 namespace mozilla {
 
-void CCGCScheduler::NoteGCBegin(JS::GCReason aReason) {
+void CCGCScheduler::NoteGCBegin() {
   // Treat all GC as incremental here; non-incremental GC will just appear to
   // be one slice.
   mInIncrementalGC = true;
@@ -122,19 +122,10 @@ void CCGCScheduler::NoteGCBegin(JS::GCReason aReason) {
   if (child) {
     child->StartedGC();
   }
-
-  // The reason might have come from mMajorReason, mEagerMajorGCReason, or
-  // in the case of an internally-generated GC, it might come from the
-  // internal logic (and be passed in here). It's easier to manage a single
-  // reason state variable, so merge all sources into mMajorGCReason.
-  MOZ_ASSERT(aReason != JS::GCReason::NO_REASON);
-  mMajorGCReason = aReason;
-  mEagerMajorGCReason = JS::GCReason::NO_REASON;
 }
 
 void CCGCScheduler::NoteGCEnd() {
   mMajorGCReason = JS::GCReason::NO_REASON;
-  mEagerMajorGCReason = JS::GCReason::NO_REASON;
 
   mInIncrementalGC = false;
   mCCBlockStart = TimeStamp();
@@ -214,7 +205,6 @@ void CCGCScheduler::NoteCCEnd(TimeStamp aWhen) {
 void CCGCScheduler::NoteWontGC() {
   mReadyForMajorGC = !mAskParentBeforeMajorGC;
   mMajorGCReason = JS::GCReason::NO_REASON;
-  mEagerMajorGCReason = JS::GCReason::NO_REASON;
   mWantAtLeastRegularGC = false;
   // Don't clear the WantFullGC state, we will do a full GC the next time a
   // GC happens for any other reason.
@@ -223,11 +213,10 @@ void CCGCScheduler::NoteWontGC() {
 bool CCGCScheduler::GCRunnerFired(TimeStamp aDeadline) {
   MOZ_ASSERT(!mDidShutdown, "GCRunner still alive during shutdown");
 
-  GCRunnerStep step = GetNextGCRunnerAction(aDeadline);
+  GCRunnerStep step = GetNextGCRunnerAction();
   switch (step.mAction) {
     case GCRunnerAction::None:
-      KillGCRunner();
-      return false;
+      MOZ_CRASH("Unexpected GCRunnerAction");
 
     case GCRunnerAction::WaitToMajorGC: {
       MOZ_ASSERT(!mHaveAskedParent, "GCRunner alive after asking the parent");
@@ -893,29 +882,18 @@ CCRunnerStep CCGCScheduler::AdvanceCCRunner(TimeStamp aDeadline, TimeStamp aNow,
   };
 }
 
-GCRunnerStep CCGCScheduler::GetNextGCRunnerAction(TimeStamp aDeadline) const {
+GCRunnerStep CCGCScheduler::GetNextGCRunnerAction() const {
+  MOZ_ASSERT(mMajorGCReason != JS::GCReason::NO_REASON);
+
   if (InIncrementalGC()) {
-    MOZ_ASSERT(mMajorGCReason != JS::GCReason::NO_REASON);
     return {GCRunnerAction::GCSlice, mMajorGCReason};
   }
 
-  // Service a non-eager GC request first, even if it requires waiting.
-  if (mMajorGCReason != JS::GCReason::NO_REASON) {
-    return {mReadyForMajorGC ? GCRunnerAction::StartMajorGC
-                             : GCRunnerAction::WaitToMajorGC,
-            mMajorGCReason};
-  }
-
-  // Now for eager requests, which are ignored unless we're idle.
-  if (!aDeadline.IsNull()) {
-    if (mEagerMajorGCReason != JS::GCReason::NO_REASON) {
-      return {mReadyForMajorGC ? GCRunnerAction::StartMajorGC
-                               : GCRunnerAction::WaitToMajorGC,
-              mEagerMajorGCReason};
-    }
+  if (mReadyForMajorGC) {
+    return {GCRunnerAction::StartMajorGC, mMajorGCReason};
   }
 
-  return {GCRunnerAction::None, JS::GCReason::NO_REASON};
+  return {GCRunnerAction::WaitToMajorGC, mMajorGCReason};
 }
 
 js::SliceBudget CCGCScheduler::ComputeForgetSkippableBudget(
diff --git a/dom/base/CCGCScheduler.h b/dom/base/CCGCScheduler.h
index 466e5ace9977d..aed3d87ede89f 100644
--- a/dom/base/CCGCScheduler.h
+++ b/dom/base/CCGCScheduler.h
@@ -235,7 +235,7 @@ class CCGCScheduler {
   }
 
   // Starting a major GC (incremental or non-incremental).
-  void NoteGCBegin(JS::GCReason aReason);
+  void NoteGCBegin();
 
   // Major GC completed.
   void NoteGCEnd();
@@ -424,7 +424,7 @@ class CCGCScheduler {
     mCCReason = CCReason::NO_REASON;
   }
 
-  GCRunnerStep GetNextGCRunnerAction(TimeStamp aDeadline) const;
+  GCRunnerStep GetNextGCRunnerAction() const;
 
   CCRunnerStep AdvanceCCRunner(TimeStamp aDeadline, TimeStamp aNow,
                                uint32_t aSuspectedCCObjects);
@@ -496,7 +496,6 @@ class CCGCScheduler {
 
   mozilla::CCReason mCCReason = mozilla::CCReason::NO_REASON;
   JS::GCReason mMajorGCReason = JS::GCReason::NO_REASON;
-  JS::GCReason mEagerMajorGCReason = JS::GCReason::NO_REASON;
 
   bool mIsCompactingOnUserInactive = false;
   bool mIsCollectingCycles = false;
diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp
index eed3705ab33d8..2fa70e2eea7ac 100644
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -1692,7 +1692,7 @@ static void DOMGCSliceCallback(JSContext* aCx, JS::GCProgress aProgress,
   switch (aProgress) {
     case JS::GC_CYCLE_BEGIN: {
       // Prevent cycle collections and shrinking during incremental GC.
-      sScheduler.NoteGCBegin(aDesc.reason_);
+      sScheduler.NoteGCBegin();
       sCurrentGCStartTime = TimeStamp::Now();
       break;
     }
diff --git a/dom/base/test/gtest/TestScheduler.cpp b/dom/base/test/gtest/TestScheduler.cpp
index a60b4fcfcd322..1b68279ff9b52 100644
--- a/dom/base/test/gtest/TestScheduler.cpp
+++ b/dom/base/test/gtest/TestScheduler.cpp
@@ -53,7 +53,7 @@ void TestGC::Run(int aNumSlices) {
   CCReason neededCCAtStartOfGC =
       mScheduler.IsCCNeeded(Now(), SuspectedCCObjects());
 
-  mScheduler.NoteGCBegin(JS::GCReason::API);
+  mScheduler.NoteGCBegin();
 
   for (int slice = 0; slice < aNumSlices; slice++) {
     EXPECT_TRUE(mScheduler.InIncrementalGC());

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list