[tbb-commits] [tor-browser] 243/311: Backed out changeset 00d93cc6125f (bug 1661293) for causing Bug 1758370

gitolite role git at cupani.torproject.org
Tue Apr 26 15:30:43 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 073b00aa6c4f69d35424488983dd6ce664be09b9
Author: donal meehan <dmeehan at mozilla.com>
AuthorDate: Wed Mar 23 17:23:53 2022 -0400

    Backed out changeset 00d93cc6125f (bug 1661293) for causing Bug 1758370
---
 dom/base/CCGCScheduler.cpp            |  8 +++-----
 dom/base/CCGCScheduler.h              | 24 +++++++-----------------
 dom/base/nsJSEnvironment.cpp          |  7 +++----
 dom/base/test/gtest/TestScheduler.cpp |  4 ++--
 js/public/GCAPI.h                     |  9 ++++-----
 js/src/jsapi.cpp                      |  5 ++---
 xpcom/base/CycleCollectedJSRuntime.h  |  3 +--
 7 files changed, 22 insertions(+), 38 deletions(-)

diff --git a/dom/base/CCGCScheduler.cpp b/dom/base/CCGCScheduler.cpp
index ad426b58d6fe6..f361be97baa44 100644
--- a/dom/base/CCGCScheduler.cpp
+++ b/dom/base/CCGCScheduler.cpp
@@ -4,7 +4,6 @@
 
 #include "CCGCScheduler.h"
 
-#include "js/GCAPI.h"
 #include "mozilla/StaticPrefs_javascript.h"
 #include "mozilla/CycleCollectedJSRuntime.h"
 #include "mozilla/ProfilerMarkers.h"
@@ -232,8 +231,7 @@ bool CCGCScheduler::GCRunnerFired(TimeStamp aDeadline) {
       return false;
 
     case GCRunnerAction::MinorGC:
-      JS::MaybeRunNurseryCollection(CycleCollectedJSRuntime::Get()->Runtime(),
-                                    step.mReason);
+      JS::RunIdleTimeGCTask(CycleCollectedJSRuntime::Get()->Runtime());
       NoteMinorGCEnd();
       return HasMoreIdleGCRunnerWork();
 
@@ -808,7 +806,7 @@ CCRunnerStep CCGCScheduler::AdvanceCCRunner(TimeStamp aDeadline, TimeStamp aNow,
   }
 
   if (mEagerMinorGCReason != JS::GCReason::NO_REASON && !aDeadline.IsNull()) {
-    return {CCRunnerAction::MinorGC, Continue, mEagerMinorGCReason};
+    return {CCRunnerAction::MinorGC, Continue};
   }
 
   switch (mCCRunnerState) {
@@ -895,7 +893,7 @@ CCRunnerStep CCGCScheduler::AdvanceCCRunner(TimeStamp aDeadline, TimeStamp aNow,
       // CycleCollecting: continue running slices until done.
     case CCRunnerState::CycleCollecting: {
       CCRunnerStep step{CCRunnerAction::CycleCollect, Yield};
-      step.mParam.mCCReason = mCCReason;
+      step.mCCReason = mCCReason;
       mCCReason = CCReason::SLICE;  // Set reason for following slices.
       return step;
     }
diff --git a/dom/base/CCGCScheduler.h b/dom/base/CCGCScheduler.h
index 393d0125a317d..cf9c2c90aee20 100644
--- a/dom/base/CCGCScheduler.h
+++ b/dom/base/CCGCScheduler.h
@@ -111,23 +111,13 @@ struct CCRunnerStep {
   // callback.
   CCRunnerYield mYield;
 
-  union ActionData {
-    // If the action is ForgetSkippable, then whether to remove childless nodes
-    // or not.
-    CCRunnerForgetSkippableRemoveChildless mRemoveChildless;
-
-    // If the action is CycleCollect, the reason for the collection.
-    CCReason mCCReason;
-
-    // If the action is MinorGC, the reason for the GC.
-    JS::GCReason mReason;
-
-    MOZ_IMPLICIT ActionData(CCRunnerForgetSkippableRemoveChildless v)
-        : mRemoveChildless(v) {}
-    MOZ_IMPLICIT ActionData(CCReason v) : mCCReason(v) {}
-    MOZ_IMPLICIT ActionData(JS::GCReason v) : mReason(v) {}
-    ActionData() = default;
-  } mParam;
+  // If the action is ForgetSkippable, then whether to remove childless nodes
+  // or not. (ForgetSkippable is the only action requiring a parameter; if
+  // that changes, this will become a union.)
+  CCRunnerForgetSkippableRemoveChildless mRemoveChildless;
+
+  // If the action is CycleCollect, the reason for the collection.
+  CCReason mCCReason;
 };
 
 class CCGCScheduler {
diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp
index c4f42f3ab2da9..3af7d18feac13 100644
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -1548,14 +1548,13 @@ bool CCGCScheduler::CCRunnerFired(TimeStamp aDeadline) {
         break;
 
       case CCRunnerAction::MinorGC:
-        JS::MaybeRunNurseryCollection(CycleCollectedJSRuntime::Get()->Runtime(),
-                                      step.mParam.mReason);
+        JS::RunIdleTimeGCTask(CycleCollectedJSRuntime::Get()->Runtime());
         sScheduler.NoteMinorGCEnd();
         break;
 
       case CCRunnerAction::ForgetSkippable:
         // 'Forget skippable' only, then end this invocation.
-        FireForgetSkippable(bool(step.mParam.mRemoveChildless), aDeadline);
+        FireForgetSkippable(bool(step.mRemoveChildless), aDeadline);
         break;
 
       case CCRunnerAction::CleanupContentUnbinder:
@@ -1570,7 +1569,7 @@ bool CCGCScheduler::CCRunnerFired(TimeStamp aDeadline) {
 
       case CCRunnerAction::CycleCollect:
         // Cycle collection slice.
-        nsJSContext::RunCycleCollectorSlice(step.mParam.mCCReason, aDeadline);
+        nsJSContext::RunCycleCollectorSlice(step.mCCReason, aDeadline);
         break;
 
       case CCRunnerAction::StopRunning:
diff --git a/dom/base/test/gtest/TestScheduler.cpp b/dom/base/test/gtest/TestScheduler.cpp
index 367bcd9e7def6..a60b4fcfcd322 100644
--- a/dom/base/test/gtest/TestScheduler.cpp
+++ b/dom/base/test/gtest/TestScheduler.cpp
@@ -125,7 +125,7 @@ void TestCC::TimerFires(int aNumSlices) {
         mScheduler.AdvanceCCRunner(idleDeadline, Now(), SuspectedCCObjects());
     // Should first see a series of ForgetSkippable actions.
     if (step.mAction != CCRunnerAction::ForgetSkippable ||
-        step.mParam.mRemoveChildless != KeepChildless) {
+        step.mRemoveChildless != KeepChildless) {
       break;
     }
     EXPECT_EQ(step.mYield, Yield);
@@ -138,7 +138,7 @@ void TestCC::TimerFires(int aNumSlices) {
         mScheduler.AdvanceCCRunner(idleDeadline, Now(), SuspectedCCObjects());
   }
   EXPECT_EQ(step.mAction, CCRunnerAction::ForgetSkippable);
-  EXPECT_EQ(step.mParam.mRemoveChildless, RemoveChildless);
+  EXPECT_EQ(step.mRemoveChildless, RemoveChildless);
   ForgetSkippable();
 
   TimeStamp idleDeadline = Now() + kOneSecond;
diff --git a/js/public/GCAPI.h b/js/public/GCAPI.h
index 9ba9c3750ade0..a92b9589104a4 100644
--- a/js/public/GCAPI.h
+++ b/js/public/GCAPI.h
@@ -416,8 +416,8 @@ typedef enum JSGCParamKey {
   JSGC_MINOR_GC_NUMBER = 45,
 
   /**
-   * JS::MaybeRunNurseryCollection will collect the nursery if it hasn't been
-   * collected in this many milliseconds.
+   * JS::RunIdleTimeGCTask will collect the nursery if it hasn't been collected
+   * in this many milliseconds.
    *
    * Default: 5000
    * Pref: None
@@ -551,7 +551,7 @@ namespace JS {
   D(OUT_OF_NURSERY, 10)                                                \
   D(EVICT_NURSERY, 11)                                                 \
   D(SHARED_MEMORY_LIMIT, 13)                                           \
-  D(EAGER_NURSERY_COLLECTION, 14)                                      \
+  D(IDLE_TIME_COLLECTION, 14)                                          \
   D(BG_TASK_FINISHED, 15)                                              \
   D(ABORT_GC, 16)                                                      \
   D(FULL_WHOLE_CELL_BUFFER, 17)                                        \
@@ -1239,8 +1239,7 @@ namespace JS {
 
 extern JS_PUBLIC_API bool IsIdleGCTaskNeeded(JSRuntime* rt);
 
-extern JS_PUBLIC_API void MaybeRunNurseryCollection(JSRuntime* rt,
-                                                    JS::GCReason reason);
+extern JS_PUBLIC_API void RunIdleTimeGCTask(JSRuntime* rt);
 
 extern JS_PUBLIC_API void SetHostCleanupFinalizationRegistryCallback(
     JSContext* cx, JSHostCleanupFinalizationRegistryCallback cb, void* data);
diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp
index db03374c31831..827e04a3dec7e 100644
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -1284,11 +1284,10 @@ JS_PUBLIC_API bool JS::IsIdleGCTaskNeeded(JSRuntime* rt) {
   return rt->gc.nursery().shouldCollect();
 }
 
-JS_PUBLIC_API void JS::MaybeRunNurseryCollection(JSRuntime* rt,
-                                                 JS::GCReason reason) {
+JS_PUBLIC_API void JS::RunIdleTimeGCTask(JSRuntime* rt) {
   gc::GCRuntime& gc = rt->gc;
   if (gc.nursery().shouldCollect()) {
-    gc.minorGC(reason);
+    gc.minorGC(JS::GCReason::IDLE_TIME_COLLECTION);
   }
 }
 
diff --git a/xpcom/base/CycleCollectedJSRuntime.h b/xpcom/base/CycleCollectedJSRuntime.h
index b1689df042231..db21eb102991b 100644
--- a/xpcom/base/CycleCollectedJSRuntime.h
+++ b/xpcom/base/CycleCollectedJSRuntime.h
@@ -368,8 +368,7 @@ class CycleCollectedJSRuntime {
 
   void RunIdleTimeGCTask() {
     if (HasPendingIdleGCTask()) {
-      JS::MaybeRunNurseryCollection(Runtime(),
-                                    JS::GCReason::EAGER_NURSERY_COLLECTION);
+      JS::RunIdleTimeGCTask(Runtime());
       ClearPendingIdleGCTask();
     }
   }

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


More information about the tbb-commits mailing list