Skip to content

Commit

Permalink
Backed out 2 changesets (bug 1580888) for build bustage. CLOSED TREE
Browse files Browse the repository at this point in the history
Backed out changeset 1589fa5ffccb (bug 1580888)
Backed out changeset b4a752751ba0 (bug 1580888)
  • Loading branch information
dgluca committed Oct 30, 2019
1 parent c04d9be commit 4409bd1
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 146 deletions.
13 changes: 2 additions & 11 deletions js/src/gc/GC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4362,12 +4362,10 @@ void js::gc::MarkingValidator::nonIncrementalMark(AutoGCSession& session) {
zone->changeGCState(Zone::MarkBlackOnly, Zone::MarkBlackAndGray);
}

AutoSetMarkColor setColorGray(*gcmarker, MarkColor::Gray);
gcmarker->setMainStackColor(MarkColor::Gray);
AutoSetMarkColor setColorGray(gc->marker, MarkColor::Gray);

gc->markAllGrayReferences(gcstats::PhaseKind::SWEEP_MARK_GRAY);
gc->markAllWeakReferences(gcstats::PhaseKind::SWEEP_MARK_GRAY_WEAK);
gc->marker.setMainStackColor(MarkColor::Black);

/* Restore zone state. */
for (GCZonesIter zone(gc); !zone.done(); zone.next()) {
Expand Down Expand Up @@ -5013,7 +5011,6 @@ IncrementalProgress GCRuntime::markGrayReferencesInCurrentGroup(
}

AutoSetMarkColor setColorGray(marker, MarkColor::Gray);
marker.setMainStackColor(MarkColor::Gray);

// Mark incoming gray pointers from previously swept compartments.
markIncomingCrossCompartmentPointers(MarkColor::Gray);
Expand All @@ -5028,12 +5025,7 @@ IncrementalProgress GCRuntime::markGrayReferencesInCurrentGroup(
}
#endif

if (markUntilBudgetExhausted(budget, gcstats::PhaseKind::SWEEP_MARK_GRAY) ==
NotFinished) {
return NotFinished;
}
marker.setMainStackColor(MarkColor::Black);
return Finished;
return markUntilBudgetExhausted(budget, gcstats::PhaseKind::SWEEP_MARK_GRAY);
}

IncrementalProgress GCRuntime::endMarkingSweepGroup(JSFreeOp* fop,
Expand All @@ -5052,7 +5044,6 @@ IncrementalProgress GCRuntime::endMarkingSweepGroup(JSFreeOp* fop,
markWeakReferencesInCurrentGroup(gcstats::PhaseKind::SWEEP_MARK_WEAK);

AutoSetMarkColor setColorGray(marker, MarkColor::Gray);
marker.setMainStackColor(MarkColor::Gray);

// Mark transitively inside the current compartment group.
markWeakReferencesInCurrentGroup(gcstats::PhaseKind::SWEEP_MARK_GRAY_WEAK);
Expand Down
58 changes: 10 additions & 48 deletions js/src/gc/GCMarker.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#define gc_GCMarker_h

#include "mozilla/Maybe.h"
#include "mozilla/Unused.h"

#include "ds/OrderedHashTable.h"
#include "js/SliceBudget.h"
Expand All @@ -22,7 +21,6 @@ class WeakMapBase;

static const size_t NON_INCREMENTAL_MARK_STACK_BASE_CAPACITY = 4096;
static const size_t INCREMENTAL_MARK_STACK_BASE_CAPACITY = 32768;
static const size_t SMALL_MARK_STACK_BASE_CAPACITY = 256;

namespace gc {

Expand Down Expand Up @@ -137,10 +135,9 @@ class MarkStack {

size_t position() const { return topIndex_; }

enum StackType { MainStack, AuxiliaryStack };
MOZ_MUST_USE bool init(JSGCMode gcMode, StackType which);
MOZ_MUST_USE bool init(JSGCMode gcMode);

MOZ_MUST_USE bool setCapacityForMode(JSGCMode mode, StackType which);
MOZ_MUST_USE bool setCapacityForMode(JSGCMode mode);

size_t maxCapacity() const { return maxCapacity_; }
void setMaxCapacity(size_t maxCapacity);
Expand All @@ -163,13 +160,7 @@ class MarkStack {
ValueArray popValueArray();
SavedValueArray popSavedValueArray();

void clear() {
// Fall back to the smaller initial capacity so we don't hold on to excess
// memory between GCs.
stack().clearAndFree();
mozilla::Unused << stack().resize(NON_INCREMENTAL_MARK_STACK_BASE_CAPACITY);
topIndex_ = 0;
}
void clear() { topIndex_ = 0; }

void setGCMode(JSGCMode gcMode);

Expand Down Expand Up @@ -280,10 +271,6 @@ class GCMarker : public JSTracer {
void setMarkColor(gc::MarkColor newColor);
gc::MarkColor markColor() const { return color; }

// Declare which color the main mark stack will be used for. The whole stack
// must be empty when this is called.
void setMainStackColor(gc::MarkColor newColor);

// Return whether a cell is marked relative to the current marking color. If
// the cell is black then this returns true, but if it's gray it will return
// false if the mark color is black.
Expand Down Expand Up @@ -321,10 +308,7 @@ class GCMarker : public JSTracer {

MOZ_MUST_USE bool markUntilBudgetExhausted(SliceBudget& budget);

void setGCMode(JSGCMode mode) {
// Ignore failure to resize the stack and keep using the existing stack.
mozilla::Unused << stack.setCapacityForMode(mode, gc::MarkStack::MainStack);
}
void setGCMode(JSGCMode mode) { stack.setGCMode(mode); }

size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;

Expand Down Expand Up @@ -386,15 +370,11 @@ class GCMarker : public JSTracer {

inline void pushValueArray(JSObject* obj, HeapSlot* start, HeapSlot* end);

bool isMarkStackEmpty() { return stack.isEmpty() && auxStack.isEmpty(); }
bool isMarkStackEmpty() { return stack.isEmpty(); }

bool hasBlackEntries() const {
return !getStack(gc::MarkColor::Black).isEmpty();
}
bool hasBlackEntries() const { return stack.position() > grayPosition; }

bool hasGrayEntries() const {
return !getStack(gc::MarkColor::Gray).isEmpty();
}
bool hasGrayEntries() const { return grayPosition > 0 && !stack.isEmpty(); }

MOZ_MUST_USE bool restoreValueArray(
const gc::MarkStack::SavedValueArray& array, HeapSlot** vpp,
Expand All @@ -418,33 +398,15 @@ class GCMarker : public JSTracer {
template <typename F>
void forEachDelayedMarkingArena(F&& f);

/*
* The mark stack. Pointers in this stack are "gray" in the GC sense, but may
* mark the contained items either black or gray (in the CC sense) depending
* on mainStackColor.
*/
/* The mark stack. Pointers in this stack are "gray" in the GC sense. */
gc::MarkStack stack;

/*
* A smaller, auxiliary stack, currently only used to accumulate the rare
* objects that need to be marked black during gray marking.
*/
gc::MarkStack auxStack;
/* Stack entries at positions below this are considered gray. */
MainThreadOrGCTaskData<size_t> grayPosition;

/* The color is only applied to objects and functions. */
MainThreadOrGCTaskData<gc::MarkColor> color;

MainThreadData<gc::MarkColor> mainStackColor;

gc::MarkStack& getStack(gc::MarkColor which) {
return which == mainStackColor ? stack : auxStack;
}
const gc::MarkStack& getStack(gc::MarkColor which) const {
return which == mainStackColor ? stack : auxStack;
}

gc::MarkStack& currentStack() { return getStack(color); }

/* Pointer to the top of the stack of arenas we are delaying marking on. */
MainThreadOrGCTaskData<js::gc::Arena*> delayedMarkingList;

Expand Down
Loading

0 comments on commit 4409bd1

Please sign in to comment.