Bug 1640977 - Tidy the ArenaLists class definition to put all data members in one place r=sfink
authorJon Coppeard <jcoppeard@mozilla.com>
Tue, 26 May 2020 17:39:39 +0000
changeset 532345 ff13d34e8f7749bb0afc8e5a96c4df35fc892051
parent 532344 2348767fd355b47baf252d0e42187c15995d453b
child 532346 c9e6c7008ec907f4f86237df0757f2cb307f0190
push id117157
push userjcoppeard@mozilla.com
push dateWed, 27 May 2020 08:06:34 +0000
treeherderautoland@ff13d34e8f77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1640977
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1640977 - Tidy the ArenaLists class definition to put all data members in one place r=sfink Depends on D76876 Differential Revision: https://phabricator.services.mozilla.com/D76877
js/src/gc/ArenaList.h
--- a/js/src/gc/ArenaList.h
+++ b/js/src/gc/ArenaList.h
@@ -239,48 +239,36 @@ class FreeLists {
   inline void unmarkPreMarkedFreeCells(AllocKind kind);
 
   FreeSpan** addressOfFreeList(AllocKind thingKind) {
     return &freeLists_[thingKind];
   }
 };
 
 class ArenaLists {
-  JS::Zone* zone_;
-
-  ZoneData<FreeLists> freeLists_;
-
-  ArenaListData<AllAllocKindArray<ArenaList>> arenaLists_;
-
-  ArenaList& arenaList(AllocKind i) { return arenaLists_.ref()[i]; }
-  const ArenaList& arenaList(AllocKind i) const { return arenaLists_.ref()[i]; }
-
   enum class ConcurrentUse : uint32_t {
     None,
     BackgroundFinalize,
     ParallelAlloc
   };
 
   using ConcurrentUseState =
       mozilla::Atomic<ConcurrentUse, mozilla::SequentiallyConsistent>;
 
+  JS::Zone* zone_;
+
   // Whether this structure can be accessed by other threads.
   UnprotectedData<AllAllocKindArray<ConcurrentUseState>> concurrentUseState_;
 
-  ConcurrentUseState& concurrentUse(AllocKind i) {
-    return concurrentUseState_.ref()[i];
-  }
-  ConcurrentUse concurrentUse(AllocKind i) const {
-    return concurrentUseState_.ref()[i];
-  }
+  ZoneData<FreeLists> freeLists_;
+
+  ArenaListData<AllAllocKindArray<ArenaList>> arenaLists_;
 
   /* For each arena kind, a list of arenas remaining to be swept. */
   MainThreadOrGCTaskData<AllAllocKindArray<Arena*>> arenasToSweep_;
-  Arena*& arenasToSweep(AllocKind i) { return arenasToSweep_.ref()[i]; }
-  Arena* arenasToSweep(AllocKind i) const { return arenasToSweep_.ref()[i]; }
 
   /* During incremental sweeping, a list of the arenas already swept. */
   ZoneOrGCTaskData<AllocKind> incrementalSweptArenaKind;
   ZoneOrGCTaskData<ArenaList> incrementalSweptArenas;
 
   // Arena lists which have yet to be swept, but need additional foreground
   // processing before they are swept.
   ZoneData<Arena*> gcShapeArenasToUpdate;
@@ -346,16 +334,29 @@ class ArenaLists {
 
   void setParallelAllocEnabled(bool enabled);
 
   void checkSweepStateNotInUse();
   void checkNoArenasToUpdate();
   void checkNoArenasToUpdateForKind(AllocKind kind);
 
  private:
+  ArenaList& arenaList(AllocKind i) { return arenaLists_.ref()[i]; }
+  const ArenaList& arenaList(AllocKind i) const { return arenaLists_.ref()[i]; }
+
+  ConcurrentUseState& concurrentUse(AllocKind i) {
+    return concurrentUseState_.ref()[i];
+  }
+  ConcurrentUse concurrentUse(AllocKind i) const {
+    return concurrentUseState_.ref()[i];
+  }
+
+  Arena*& arenasToSweep(AllocKind i) { return arenasToSweep_.ref()[i]; }
+  Arena* arenasToSweep(AllocKind i) const { return arenasToSweep_.ref()[i]; }
+
   inline JSRuntime* runtime();
   inline JSRuntime* runtimeFromAnyThread();
 
   inline void queueForForegroundSweep(JSFreeOp* fop,
                                       const FinalizePhase& phase);
   inline void queueForBackgroundSweep(JSFreeOp* fop,
                                       const FinalizePhase& phase);
   inline void queueForForegroundSweep(AllocKind thingKind);