Bug 1509824 - Remove Arena::markOverflow flag r=sfink
authorJon Coppeard <jcoppeard@mozilla.com>
Mon, 26 Nov 2018 13:34:01 +0000
changeset 504418 d7336bdef207654c48c3e0c6c976f3ed65fe5ccd
parent 504417 3785e94a44d084a5698fb86bb1afe4218ee63e02
child 504419 6c10213a8924b377ea37a37385698ebb09773a30
child 504441 6e8d63408d5f47a78606e2fd02bb9ce049da4556
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1509824
milestone65.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 1509824 - Remove Arena::markOverflow flag r=sfink
js/src/gc/GC.cpp
js/src/gc/Heap-inl.h
js/src/gc/Heap.h
js/src/gc/Marking.cpp
--- a/js/src/gc/GC.cpp
+++ b/js/src/gc/GC.cpp
@@ -588,17 +588,16 @@ Arena::finalize(FreeOp* fop, AllocKind t
     MOZ_ASSERT(thingSize % CellAlignBytes == 0);
     MOZ_ASSERT(thingSize >= MinCellSize);
     MOZ_ASSERT(thingSize <= 255);
 
     MOZ_ASSERT(allocated());
     MOZ_ASSERT(thingKind == getAllocKind());
     MOZ_ASSERT(thingSize == getThingSize());
     MOZ_ASSERT(!hasDelayedMarking);
-    MOZ_ASSERT(!markOverflow);
 
     uint_fast16_t firstThing = firstThingOffset(thingKind);
     uint_fast16_t firstThingOrSuccessorOfLastMarkedThing = firstThing;
     uint_fast16_t lastThing = ArenaSize - thingSize;
 
     FreeSpan newListHead;
     FreeSpan* newListTail = &newListHead;
     size_t nmarked = 0;
@@ -2202,17 +2201,16 @@ GCMarker::delayMarkingArena(Arena* arena
     markLaterArenas++;
 #endif
 }
 
 void
 GCMarker::delayMarkingChildren(const void* thing)
 {
     const TenuredCell* cell = TenuredCell::fromPointer(thing);
-    cell->arena()->markOverflow = 1;
     delayMarkingArena(cell->arena());
 }
 
 /* Compacting GC */
 
 bool
 GCRuntime::shouldCompact()
 {
@@ -2427,17 +2425,16 @@ RelocateCell(Zone* zone, TenuredCell* sr
     overlay->forwardTo(dst);
 }
 
 static void
 RelocateArena(Arena* arena, SliceBudget& sliceBudget)
 {
     MOZ_ASSERT(arena->allocated());
     MOZ_ASSERT(!arena->hasDelayedMarking);
-    MOZ_ASSERT(!arena->markOverflow);
     MOZ_ASSERT(arena->bufferedCells()->isEmpty());
 
     Zone* zone = arena->zone;
 
     AllocKind thingKind = arena->getAllocKind();
     size_t thingSize = arena->getThingSize();
 
     for (ArenaCellIterUnderGC i(arena); !i.done(); i.next()) {
--- a/js/src/gc/Heap-inl.h
+++ b/js/src/gc/Heap-inl.h
@@ -14,25 +14,23 @@
 
 inline void
 js::gc::Arena::init(JS::Zone* zoneArg, AllocKind kind, const AutoLockGC& lock)
 {
     MOZ_ASSERT(firstFreeSpan.isEmpty());
     MOZ_ASSERT(!zone);
     MOZ_ASSERT(!allocated());
     MOZ_ASSERT(!hasDelayedMarking);
-    MOZ_ASSERT(!markOverflow);
     MOZ_ASSERT(!auxNextLink);
 
     MOZ_MAKE_MEM_UNDEFINED(this, ArenaSize);
 
     zone = zoneArg;
     allocKind = size_t(kind);
     hasDelayedMarking = 0;
-    markOverflow = 0;
     auxNextLink = 0;
     if (zone->isAtomsZone()) {
         zone->runtimeFromAnyThread()->gc.atomMarking.registerArena(this, lock);
     } else {
         bufferedCells() = &ArenaCellSet::Empty;
     }
 
     setAsFullyUnused();
--- a/js/src/gc/Heap.h
+++ b/js/src/gc/Heap.h
@@ -235,31 +235,23 @@ class Arena
      *
      * We use 8 bits for the alloc kind so the compiler can use byte-level
      * memory instructions to access it.
      */
     size_t allocKind : 8;
 
   public:
     /*
-     * When collecting we sometimes need to keep an auxillary list of arenas,
-     * for which we use the following fields. This happens for several reasons:
-     *
-     * When recursive marking uses too much stack, the marking is delayed and
-     * the corresponding arenas are put into a stack. To distinguish the bottom
-     * of the stack from the arenas not present in the stack we use the
-     * markOverflow flag to tag arenas on the stack.
-     *
-     * To minimize the size of the header fields we record the next linkage as
-     * address() >> ArenaShift and pack it with the allocKind and the flags.
+     * When recursive marking uses too much stack we delay marking of
+     * arenas and link them into a list for later processing. This
+     * uses the following fields.
      */
     size_t hasDelayedMarking : 1;
-    size_t markOverflow : 1;
-    size_t auxNextLink : JS_BITS_PER_WORD - 8 - 1 - 1;
-    static_assert(ArenaShift >= 8 + 1 + 1,
+    size_t auxNextLink : JS_BITS_PER_WORD - 8 - 1;
+    static_assert(ArenaShift >= 8 + 1,
                   "Arena::auxNextLink packing assumes that ArenaShift has "
                   "enough bits to cover allocKind and hasDelayedMarking.");
 
   private:
     union {
         /*
          * For arenas in zones other than the atoms zone, if non-null, points
          * to an ArenaCellSet that represents the set of cells in this arena
@@ -299,17 +291,16 @@ class Arena
 
     // Initialize an arena to its unallocated state. For arenas that were
     // previously allocated for some zone, use release() instead.
     void setAsNotAllocated() {
         firstFreeSpan.initAsEmpty();
         zone = nullptr;
         allocKind = size_t(AllocKind::LIMIT);
         hasDelayedMarking = 0;
-        markOverflow = 0;
         auxNextLink = 0;
         bufferedCells_ = nullptr;
     }
 
     // Return an allocated arena to its unallocated state.
     inline void release(const AutoLockGC& lock);
 
     uintptr_t address() const {
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -2545,17 +2545,16 @@ GCMarker::reset()
     MOZ_ASSERT(isMarkStackEmpty());
 
     while (unmarkedArenaStackTop) {
         Arena* arena = unmarkedArenaStackTop;
         MOZ_ASSERT(arena->hasDelayedMarking);
         MOZ_ASSERT(markLaterArenas);
         unmarkedArenaStackTop = arena->getNextDelayedMarking();
         arena->unsetDelayedMarking();
-        arena->markOverflow = 0;
 
 #ifdef DEBUG
         markLaterArenas--;
 #endif
     }
     MOZ_ASSERT(isDrained());
     MOZ_ASSERT(!markLaterArenas);
 }
@@ -2667,19 +2666,16 @@ GCMarker::leaveWeakMarkingMode()
             oomUnsafe.crash("clearing weak keys in GCMarker::leaveWeakMarkingMode()");
         }
     }
 }
 
 void
 GCMarker::markDelayedChildren(Arena* arena)
 {
-    MOZ_ASSERT(arena->markOverflow);
-    arena->markOverflow = 0;
-
     JS::TraceKind kind = MapAllocToTraceKind(arena->getAllocKind());
 
     // Whether we need to mark children of gray or black cells in the arena
     // depends on which kind of marking we were doing when the arena as pushed
     // onto the list.  We never change mark color without draining the mark
     // stack though so this is the same as the current color.
     bool markGrayCells = markColor() == MarkColor::Gray && TraceKindParticipatesInCC(kind);