Bug 1380030 - Refactor isMarked() methods into separate methods for each color and any r=sfink

This commit is contained in:
Jon Coppeard 2017-07-12 18:31:55 +01:00
parent a7a732298b
commit f32b5076be
18 changed files with 131 additions and 101 deletions

View File

@ -67,7 +67,7 @@ static const uint32_t GRAY = 1;
/*
* Two bits determine the mark color as follows:
* BLACK_BIT GRAY_OR_BLACK_BIT color
* BlackBit GrayOrBlackBit color
* 0 0 white
* 0 1 gray
* 1 0 black

View File

@ -38,7 +38,7 @@ IsMarkedBlack(JSObject* obj)
return true;
gc::TenuredCell& tenured = obj->asTenured();
if (tenured.isMarked(gc::BLACK) || tenured.arena()->allocatedDuringIncremental)
if (tenured.isMarkedAny() || tenured.arena()->allocatedDuringIncremental)
return true;
return false;

View File

@ -252,7 +252,9 @@ struct Cell
MOZ_ALWAYS_INLINE const TenuredCell& asTenured() const;
MOZ_ALWAYS_INLINE TenuredCell& asTenured();
MOZ_ALWAYS_INLINE bool isMarked(uint32_t color = BLACK) const;
MOZ_ALWAYS_INLINE bool isMarkedAny() const;
MOZ_ALWAYS_INLINE bool isMarkedBlack() const;
MOZ_ALWAYS_INLINE bool isMarkedGray() const;
inline JSRuntime* runtimeFromActiveCooperatingThread() const;
@ -292,7 +294,10 @@ class TenuredCell : public Cell
static MOZ_ALWAYS_INLINE const TenuredCell* fromPointer(const void* ptr);
// Mark bit management.
MOZ_ALWAYS_INLINE bool isMarked(uint32_t color = BLACK) const;
MOZ_ALWAYS_INLINE bool isMarkedAny() const;
MOZ_ALWAYS_INLINE bool isMarkedBlack() const;
MOZ_ALWAYS_INLINE bool isMarkedGray() const;
// The return value indicates if the cell went from unmarked to marked.
MOZ_ALWAYS_INLINE bool markIfUnmarked(uint32_t color = BLACK) const;
MOZ_ALWAYS_INLINE void markBlack() const;
@ -912,14 +917,16 @@ struct ChunkBitmap
return *word & mask;
}
MOZ_ALWAYS_INLINE MOZ_TSAN_BLACKLIST bool isMarked(const Cell* cell, uint32_t color) {
if (color == BLACK) {
return markBit(cell, ColorBit::BlackBit) ||
markBit(cell, ColorBit::GrayOrBlackBit);
} else {
return !markBit(cell, ColorBit::BlackBit) &&
markBit(cell, ColorBit::GrayOrBlackBit);
}
MOZ_ALWAYS_INLINE MOZ_TSAN_BLACKLIST bool isMarkedAny(const Cell* cell) {
return markBit(cell, ColorBit::BlackBit) || markBit(cell, ColorBit::GrayOrBlackBit);
}
MOZ_ALWAYS_INLINE MOZ_TSAN_BLACKLIST bool isMarkedBlack(const Cell* cell) {
return markBit(cell, ColorBit::BlackBit);
}
MOZ_ALWAYS_INLINE MOZ_TSAN_BLACKLIST bool isMarkedGray(const Cell* cell) {
return !markBit(cell, ColorBit::BlackBit) && markBit(cell, ColorBit::GrayOrBlackBit);
}
// The return value indicates if the cell went from unmarked to marked.
@ -1172,14 +1179,21 @@ Cell::asTenured()
}
MOZ_ALWAYS_INLINE bool
Cell::isMarked(uint32_t color) const
Cell::isMarkedAny() const
{
if (color == BLACK) {
return !isTenured() || asTenured().isMarked(BLACK);
} else {
MOZ_ASSERT(color == GRAY);
return isTenured() && asTenured().isMarked(GRAY);
}
return !isTenured() || asTenured().isMarkedAny();
}
MOZ_ALWAYS_INLINE bool
Cell::isMarkedBlack() const
{
return !isTenured() || asTenured().isMarkedBlack();
}
MOZ_ALWAYS_INLINE bool
Cell::isMarkedGray() const
{
return isTenured() && asTenured().isMarkedGray();
}
inline JSRuntime*
@ -1254,11 +1268,24 @@ TenuredCell::fromPointer(const void* ptr)
}
bool
TenuredCell::isMarked(uint32_t color /* = BLACK */) const
TenuredCell::isMarkedAny() const
{
MOZ_ASSERT(arena()->allocated());
AssertValidColor(this, color);
return chunk()->bitmap.isMarked(this, color);
return chunk()->bitmap.isMarkedAny(this);
}
bool
TenuredCell::isMarkedBlack() const
{
MOZ_ASSERT(arena()->allocated());
return chunk()->bitmap.isMarkedBlack(this);
}
bool
TenuredCell::isMarkedGray() const
{
MOZ_ASSERT(arena()->allocated());
return chunk()->bitmap.isMarkedGray(this);
}
bool
@ -1346,7 +1373,7 @@ TenuredCell::readBarrier(TenuredCell* thing)
MOZ_ASSERT(tmp == thing);
}
if (thing->isMarked(GRAY)) {
if (thing->isMarkedGray()) {
// There shouldn't be anything marked grey unless we're on the active thread.
MOZ_ASSERT(CurrentThreadCanAccessRuntime(thing->runtimeFromAnyThread()));
if (!RuntimeFromActiveCooperatingThreadIsHeapMajorCollecting(shadowZone))

View File

@ -107,7 +107,7 @@ IterateGrayObjects(Zone* zone, GCThingCallback cellCallback, void* data)
{
for (auto kind : ObjectAllocKinds()) {
for (GrayObjectIter obj(zone, kind); !obj.done(); obj.next()) {
if (obj->asTenured().isMarked(GRAY))
if (obj->asTenured().isMarkedGray())
cellCallback(data, JS::GCCellPtr(obj.get()));
}
}

View File

@ -311,9 +311,9 @@ ShouldTraceCrossCompartment(JSTracer* trc, JSObject* src, Cell* cell)
* collector. This can happen if we're collecting a compartment and it
* has an edge to an uncollected compartment: it's possible that the
* source and destination of the cross-compartment edge should be gray,
* but the source was marked black by the conservative scanner.
* but the source was marked black by the write barrier.
*/
if (tenured.isMarked(GRAY)) {
if (tenured.isMarkedGray()) {
MOZ_ASSERT(!zone->isCollecting());
trc->runtime()->gc.setFoundBlackGrayEdges(tenured);
}
@ -325,7 +325,7 @@ ShouldTraceCrossCompartment(JSTracer* trc, JSObject* src, Cell* cell)
* but it will be later, so record the cell so it can be marked gray
* at the appropriate time.
*/
if (!tenured.isMarked())
if (!tenured.isMarkedAny())
DelayCrossCompartmentGrayMarking(src);
return false;
}
@ -1062,7 +1062,9 @@ Shape::traceChildren(JSTracer* trc)
inline void
js::GCMarker::eagerlyMarkChildren(Shape* shape)
{
MOZ_ASSERT(shape->isMarked(this->markColor()));
MOZ_ASSERT_IF(markColor() == GRAY, shape->isMarkedGray());
MOZ_ASSERT_IF(markColor() == BLACK, shape->isMarkedAny());
do {
// Special case: if a base shape has a shape table then all its pointers
// must point to this shape or an anscestor. Since these pointers will
@ -1115,7 +1117,7 @@ inline void
js::GCMarker::eagerlyMarkChildren(JSLinearString* linearStr)
{
AssertShouldMarkInZone(linearStr);
MOZ_ASSERT(linearStr->isMarked());
MOZ_ASSERT(linearStr->isMarkedAny());
MOZ_ASSERT(linearStr->JSString::isLinear());
// Use iterative marking to avoid blowing out the stack.
@ -1178,7 +1180,7 @@ js::GCMarker::eagerlyMarkChildren(JSRope* rope)
JS_DIAGNOSTICS_ASSERT(rope->getTraceKind() == JS::TraceKind::String);
JS_DIAGNOSTICS_ASSERT(rope->JSString::isRope());
AssertShouldMarkInZone(rope);
MOZ_ASSERT(rope->isMarked());
MOZ_ASSERT(rope->isMarkedAny());
JSRope* next = nullptr;
JSString* right = rope->rightChild();
@ -2438,7 +2440,8 @@ GCMarker::pushValueArray(JSObject* obj, HeapSlot* start, HeapSlot* end)
void
GCMarker::repush(JSObject* obj)
{
MOZ_ASSERT(gc::TenuredCell::fromPointer(obj)->isMarked(markColor()));
MOZ_ASSERT_IF(markColor() == GRAY, gc::TenuredCell::fromPointer(obj)->isMarkedGray());
MOZ_ASSERT_IF(markColor() == BLACK, gc::TenuredCell::fromPointer(obj)->isMarkedAny());
pushTaggedPtr(obj);
}
@ -2492,7 +2495,7 @@ GCMarker::markDelayedChildren(Arena* arena)
for (ArenaCellIterUnderGC i(arena); !i.done(); i.next()) {
TenuredCell* t = i.getCell();
if (always || t->isMarked()) {
if (always || t->isMarkedAny()) {
t->markIfUnmarked();
js::TraceChildren(this, t, MapAllocToTraceKind(arena->getAllocKind()));
}
@ -3107,7 +3110,7 @@ IsMarkedInternalCommon(T* thingp)
return true;
}
return thing.isMarked() || thing.arena()->allocatedDuringIncremental;
return thing.isMarkedAny() || thing.arena()->allocatedDuringIncremental;
}
template <typename T>
@ -3158,7 +3161,7 @@ js::gc::IsAboutToBeFinalizedDuringSweep(TenuredCell& tenured)
MOZ_ASSERT(tenured.zoneFromAnyThread()->isGCSweeping());
if (tenured.arena()->allocatedDuringIncremental)
return false;
return !tenured.isMarked();
return !tenured.isMarkedAny();
}
template <typename T>
@ -3317,7 +3320,7 @@ struct AssertNonGrayTracer : public JS::CallbackTracer {
explicit AssertNonGrayTracer(JSRuntime* rt) : JS::CallbackTracer(rt) {}
void onChild(const JS::GCCellPtr& thing) override {
MOZ_ASSERT_IF(thing.asCell()->isTenured(),
!thing.asCell()->asTenured().isMarked(js::gc::GRAY));
!thing.asCell()->asTenured().isMarkedGray());
}
};
#endif
@ -3365,7 +3368,7 @@ UnmarkGrayTracer::onChild(const JS::GCCellPtr& thing)
}
TenuredCell& tenured = cell->asTenured();
if (!tenured.isMarked(GRAY))
if (!tenured.isMarkedGray())
return;
tenured.markBlack();
@ -3443,9 +3446,9 @@ GetMarkInfo(Cell* rawCell)
return MarkInfo::NURSERY;
TenuredCell* cell = &rawCell->asTenured();
if (cell->isMarked(GRAY))
if (cell->isMarkedGray())
return MarkInfo::GRAY;
if (cell->isMarked(BLACK))
if (cell->isMarkedAny())
return MarkInfo::BLACK;
return MarkInfo::UNMARKED;
}

View File

@ -261,7 +261,7 @@ oom:
static bool
IsMarkedOrAllocated(TenuredCell* cell)
{
return cell->isMarked() || cell->arena()->allocatedDuringIncremental;
return cell->isMarkedAny() || cell->arena()->allocatedDuringIncremental;
}
struct CheckEdgeTracer : public JS::CallbackTracer {
@ -653,8 +653,8 @@ CheckGrayMarkingTracer::checkCell(Cell* cell)
TenuredCell* tenuredCell = &cell->asTenured();
TenuredCell* tenuredParent = &parent->asTenured();
if (tenuredParent->isMarked(BLACK) && !tenuredParent->isMarked(GRAY) &&
tenuredCell->isMarked(GRAY))
if (tenuredParent->isMarkedAny() && !tenuredParent->isMarkedGray() &&
tenuredCell->isMarkedGray())
{
failures++;
fprintf(stderr, "Found black to gray edge to %s %p\n",

View File

@ -162,7 +162,7 @@ Zone::sweepBreakpoints(FreeOp* fop)
// live.
MOZ_ASSERT_IF(isGCSweeping() && dbgobj->zone()->isCollecting(),
dbgobj->zone()->isGCSweeping() ||
(!scriptGone && dbgobj->asTenured().isMarked()));
(!scriptGone && dbgobj->asTenured().isMarkedAny()));
bool dying = scriptGone || IsAboutToBeFinalized(&dbgobj);
MOZ_ASSERT_IF(!dying, !IsAboutToBeFinalized(&bp->getHandlerRef()));

View File

@ -817,15 +817,15 @@ static bool
IsMarkedBlack(Cell* cell)
{
TenuredCell* tc = &cell->asTenured();
return tc->isMarked(BLACK) && !tc->isMarked(GRAY);
return tc->isMarkedAny() && !tc->isMarkedGray();
}
static bool
IsMarkedGray(Cell* cell)
{
TenuredCell* tc = &cell->asTenured();
bool isGray = tc->isMarked(GRAY);
MOZ_ASSERT_IF(isGray, tc->isMarked(BLACK));
bool isGray = tc->isMarkedGray();
MOZ_ASSERT_IF(isGray, tc->isMarkedAny());
return isGray;
}

View File

@ -214,8 +214,8 @@ BEGIN_TEST(testUnbarrieredEquality)
TenuredCell* cell2 = &obj2->asTenured();
cell->markIfUnmarked(GRAY);
cell2->markIfUnmarked(GRAY);
MOZ_ASSERT(cell->isMarked(GRAY));
MOZ_ASSERT(cell2->isMarked(GRAY));
MOZ_ASSERT(cell->isMarkedGray());
MOZ_ASSERT(cell2->isMarkedGray());
{
JS::Heap<JSObject*> heap(obj);
@ -246,8 +246,8 @@ BEGIN_TEST(testUnbarrieredEquality)
JS::Heap<JSObject*> heap2(obj2);
heap.get();
heap2.get();
CHECK(cell->isMarked(BLACK));
CHECK(cell2->isMarked(BLACK));
CHECK(cell->isMarkedAny());
CHECK(cell2->isMarkedAny());
}
return true;
@ -264,35 +264,35 @@ TestWrapper(ObjectT obj, ObjectT obj2, WrapperT& wrapper, WrapperT& wrapper2)
int x = 0;
CHECK(cell.isMarked(GRAY));
CHECK(cell2.isMarked(GRAY));
CHECK(cell.isMarkedGray());
CHECK(cell2.isMarkedGray());
x += obj == obj2;
CHECK(cell.isMarked(GRAY));
CHECK(cell2.isMarked(GRAY));
CHECK(cell.isMarkedGray());
CHECK(cell2.isMarkedGray());
x += obj == wrapper2;
CHECK(cell.isMarked(GRAY));
CHECK(cell2.isMarked(GRAY));
CHECK(cell.isMarkedGray());
CHECK(cell2.isMarkedGray());
x += wrapper == obj2;
CHECK(cell.isMarked(GRAY));
CHECK(cell2.isMarked(GRAY));
CHECK(cell.isMarkedGray());
CHECK(cell2.isMarkedGray());
x += wrapper == wrapper2;
CHECK(cell.isMarked(GRAY));
CHECK(cell2.isMarked(GRAY));
CHECK(cell.isMarkedGray());
CHECK(cell2.isMarkedGray());
CHECK(x == 0);
x += obj != obj2;
CHECK(cell.isMarked(GRAY));
CHECK(cell2.isMarked(GRAY));
CHECK(cell.isMarkedGray());
CHECK(cell2.isMarkedGray());
x += obj != wrapper2;
CHECK(cell.isMarked(GRAY));
CHECK(cell2.isMarked(GRAY));
CHECK(cell.isMarkedGray());
CHECK(cell2.isMarkedGray());
x += wrapper != obj2;
CHECK(cell.isMarked(GRAY));
CHECK(cell2.isMarked(GRAY));
CHECK(cell.isMarkedGray());
CHECK(cell2.isMarkedGray());
x += wrapper != wrapper2;
CHECK(cell.isMarked(GRAY));
CHECK(cell2.isMarked(GRAY));
CHECK(cell.isMarkedGray());
CHECK(cell2.isMarkedGray());
CHECK(x == 4);

View File

@ -367,9 +367,9 @@ BEGIN_TEST(testIncrementalRoots)
MOZ_ASSERT(JS::IsIncrementalGCInProgress(cx));
// And assert that the mark bits are as we expect them to be.
MOZ_ASSERT(vec[0]->asTenured().isMarked());
MOZ_ASSERT(!leafHandle->asTenured().isMarked());
MOZ_ASSERT(!leafOwnerHandle->asTenured().isMarked());
MOZ_ASSERT(vec[0]->asTenured().isMarkedAny());
MOZ_ASSERT(!leafHandle->asTenured().isMarkedAny());
MOZ_ASSERT(!leafOwnerHandle->asTenured().isMarkedAny());
#ifdef DEBUG
// Remember the current GC number so we can assert that no GC occurs
@ -387,7 +387,7 @@ BEGIN_TEST(testIncrementalRoots)
if (!JS_SetProperty(cx, vec[0], "newobj", leafValueHandle))
return false;
MOZ_ASSERT(rt->gc.gcNumber() == currentGCNumber);
MOZ_ASSERT(leafHandle->asTenured().isMarked());
MOZ_ASSERT(leafHandle->asTenured().isMarkedAny());
// Also take an unmarked object 'leaf2' from the graph and add an
// additional edge from the root to it. This will not be marked by any
@ -403,11 +403,11 @@ BEGIN_TEST(testIncrementalRoots)
if (!JS_GetProperty(cx, leafOwnerHandle, "leaf2", &leaf2))
return false;
MOZ_ASSERT(rt->gc.gcNumber() == currentGCNumber);
MOZ_ASSERT(!leaf2.toObject().asTenured().isMarked());
MOZ_ASSERT(!leaf2.toObject().asTenured().isMarkedAny());
if (!JS_SetProperty(cx, vec[0], "leafcopy", leaf2))
return false;
MOZ_ASSERT(rt->gc.gcNumber() == currentGCNumber);
MOZ_ASSERT(!leaf2.toObject().asTenured().isMarked());
MOZ_ASSERT(!leaf2.toObject().asTenured().isMarkedAny());
}
// Finish the GC using an unlimited budget.

View File

@ -622,7 +622,7 @@ struct VisitGrayCallbackFunctor {
template <class T>
void operator()(T tp) const {
if ((*tp)->isTenured() && (*tp)->asTenured().isMarked(gc::GRAY))
if ((*tp)->isTenured() && (*tp)->asTenured().isMarkedGray())
callback_(closure_, JS::GCCellPtr(*tp));
}
};
@ -1104,10 +1104,10 @@ static char
MarkDescriptor(void* thing)
{
gc::TenuredCell* cell = gc::TenuredCell::fromPointer(thing);
if (cell->isMarked(gc::BLACK))
return cell->isMarked(gc::GRAY) ? 'G' : 'B';
if (cell->isMarkedAny())
return cell->isMarkedGray() ? 'G' : 'B';
else
return cell->isMarked(gc::GRAY) ? 'X' : 'W';
return cell->isMarkedGray() ? 'X' : 'W';
}
static void

View File

@ -517,14 +517,14 @@ Arena::finalize(FreeOp* fop, AllocKind thingKind, size_t thingSize)
if (MOZ_UNLIKELY(MemProfiler::enabled())) {
for (ArenaCellIterUnderFinalize i(this); !i.done(); i.next()) {
T* t = i.get<T>();
if (t->asTenured().isMarked())
if (t->asTenured().isMarkedAny())
MemProfiler::MarkTenured(reinterpret_cast<void*>(t));
}
}
for (ArenaCellIterUnderFinalize i(this); !i.done(); i.next()) {
T* t = i.get<T>();
if (t->asTenured().isMarked()) {
if (t->asTenured().isMarkedAny()) {
uint_fast16_t thing = uintptr_t(t) & ArenaMask;
if (thing != firstThingOrSuccessorOfLastMarkedThing) {
// We just finished passing over one or more free things,
@ -2047,8 +2047,8 @@ RelocateArena(Arena* arena, SliceBudget& sliceBudget)
TenuredCell* src = i.getCell();
MOZ_ASSERT(RelocationOverlay::isCellForwarded(src));
TenuredCell* dest = Forwarded(src);
MOZ_ASSERT(src->isMarked(BLACK) == dest->isMarked(BLACK));
MOZ_ASSERT(src->isMarked(GRAY) == dest->isMarked(GRAY));
MOZ_ASSERT(src->isMarkedAny() == dest->isMarkedAny());
MOZ_ASSERT(src->isMarkedGray() == dest->isMarkedGray());
}
#endif
}
@ -3627,7 +3627,7 @@ ArenaLists::checkEmptyArenaList(AllocKind kind)
for (Arena* current = arenaLists(kind).head(); current; current = current->next) {
for (ArenaCellIterUnderGC i(current); !i.done(); i.next()) {
TenuredCell* t = i.getCell();
MOZ_ASSERT(t->isMarked(), "unmarked cells should have been finalized");
MOZ_ASSERT(t->isMarkedAny(), "unmarked cells should have been finalized");
if (++num_live <= max_cells) {
fprintf(stderr, "ERROR: GC found live Cell %p of kind %s at shutdown\n",
t, AllocKindToAscii(kind));
@ -4477,16 +4477,16 @@ js::gc::MarkingValidator::validate()
* If a non-incremental GC wouldn't have collected a cell, then
* an incremental GC won't collect it.
*/
if (bitmap->isMarked(cell, BLACK))
MOZ_RELEASE_ASSERT(incBitmap->isMarked(cell, BLACK));
if (bitmap->isMarkedAny(cell))
MOZ_RELEASE_ASSERT(incBitmap->isMarkedAny(cell));
/*
* If the cycle collector isn't allowed to collect an object
* after a non-incremental GC has run, then it isn't allowed to
* collected it after an incremental GC.
*/
if (!bitmap->isMarked(cell, GRAY))
MOZ_RELEASE_ASSERT(!incBitmap->isMarked(cell, GRAY));
if (!bitmap->isMarkedGray(cell))
MOZ_RELEASE_ASSERT(!incBitmap->isMarkedGray(cell));
thing += Arena::thingSize(kind);
}
@ -4592,7 +4592,7 @@ JSCompartment::findOutgoingEdges(ZoneComponentFinder& finder)
bool needsEdge = true;
if (key.is<JSObject*>()) {
TenuredCell& other = key.as<JSObject*>()->asTenured();
needsEdge = !other.isMarked(BLACK) || other.isMarked(GRAY);
needsEdge = !other.isMarkedAny() || other.isMarkedGray();
}
key.applyToWrapped(AddOutgoingEdgeFunctor(needsEdge, finder));
}
@ -4866,11 +4866,11 @@ MarkIncomingCrossCompartmentPointers(JSRuntime* rt, const uint32_t color)
MOZ_ASSERT(dst->compartment() == c);
if (color == GRAY) {
if (IsMarkedUnbarriered(rt, &src) && src->asTenured().isMarked(GRAY))
if (IsMarkedUnbarriered(rt, &src) && src->asTenured().isMarkedGray())
TraceManuallyBarrieredEdge(&rt->gc.marker, &dst,
"cross-compartment gray pointer");
} else {
if (IsMarkedUnbarriered(rt, &src) && !src->asTenured().isMarked(GRAY))
if (IsMarkedUnbarriered(rt, &src) && !src->asTenured().isMarkedGray())
TraceManuallyBarrieredEdge(&rt->gc.marker, &dst,
"cross-compartment black pointer");
}
@ -5516,7 +5516,7 @@ GCRuntime::drainMarkStack(SliceBudget& sliceBudget, gcstats::PhaseKind phase)
static void
SweepThing(Shape* shape)
{
if (!shape->isMarked())
if (!shape->isMarkedAny())
shape->sweep();
}
@ -6905,7 +6905,7 @@ GCRuntime::maybeDoCycleCollection()
for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next()) {
++compartmentsTotal;
GlobalObject* global = c->unsafeUnbarrieredMaybeGlobal();
if (global && global->asTenured().isMarked(GRAY))
if (global && global->asTenured().isMarkedGray())
++compartmentsGray;
}
double grayFraction = double(compartmentsGray) / double(compartmentsTotal);

View File

@ -3486,7 +3486,7 @@ js::detail::CopyScript(JSContext* cx, HandleScript src, HandleScript dst,
/* NB: Keep this in sync with XDRScript. */
/* Some embeddings are not careful to use ExposeObjectToActiveJS as needed. */
MOZ_ASSERT(!src->sourceObject()->asTenured().isMarked(gc::GRAY));
MOZ_ASSERT(!src->sourceObject()->asTenured().isMarkedGray());
uint32_t nconsts = src->hasConsts() ? src->consts()->length : 0;
uint32_t nobjects = src->hasObjects() ? src->objects()->length : 0;

View File

@ -139,7 +139,7 @@ ObjectValueMap::findZoneEdges()
JS::AutoSuppressGCAnalysis nogc;
for (Range r = all(); !r.empty(); r.popFront()) {
JSObject* key = r.front().key();
if (key->asTenured().isMarked(BLACK) && !key->asTenured().isMarked(GRAY))
if (key->asTenured().isMarkedAny() && !key->asTenured().isMarkedGray())
continue;
JSObject* delegate = getDelegate(key);
if (!delegate)

View File

@ -341,9 +341,9 @@ Wrapper::wrappedObject(JSObject* wrapper)
// of black wrappers black but while it is in progress we can observe gray
// targets. Expose rather than returning a gray object in this case.
if (target) {
if (wrapper->isMarked(gc::BLACK) && !wrapper->isMarked(gc::GRAY))
if (wrapper->isMarkedAny() && !wrapper->isMarkedGray())
MOZ_ASSERT(JS::ObjectIsNotGray(target));
if (!wrapper->isMarked(gc::GRAY))
if (!wrapper->isMarkedGray())
JS::ExposeObjectToActiveJS(target);
}

View File

@ -5822,9 +5822,9 @@ GetMarks(JSContext* cx, unsigned argc, Value* vp)
color = "dead";
} else {
gc::TenuredCell* cell = &obj->asTenured();
if (cell->isMarked(gc::GRAY))
if (cell->isMarkedGray())
color = "gray";
else if (cell->isMarked(gc::BLACK))
else if (cell->isMarkedAny())
color = "black";
else
color = "unmarked";

View File

@ -1474,7 +1474,7 @@ PropertyTree::inlinedGetChild(JSContext* cx, Shape* parent, Handle<StackShape> c
if (!zone->isGCSweepingOrCompacting() ||
!IsAboutToBeFinalizedUnbarriered(&existingShape))
{
if (existingShape->isMarked(gc::GRAY))
if (existingShape->isMarkedGray())
UnmarkGrayShapeRecursively(existingShape);
return existingShape;
}
@ -1482,7 +1482,7 @@ PropertyTree::inlinedGetChild(JSContext* cx, Shape* parent, Handle<StackShape> c
* The shape we've found is unreachable and due to be finalized, so
* remove our weak reference to it and don't use it.
*/
MOZ_ASSERT(parent->isMarked());
MOZ_ASSERT(parent->isMarkedAny());
parent->removeChild(existingShape);
}
@ -1515,7 +1515,7 @@ Shape::sweep()
* reallocated, since allocating a cell in a zone that is being marked will
* set the mark bit for that cell.
*/
if (parent && parent->isMarked()) {
if (parent && parent->isMarkedAny()) {
if (inDictionary()) {
if (parent->listp == &parent)
parent->listp = nullptr;

View File

@ -3013,7 +3013,7 @@ ObjectGroup::maybeClearNewScriptOnOOM()
{
MOZ_ASSERT(zone()->isGCSweepingOrCompacting());
if (!isMarked())
if (!isMarkedAny())
return;
TypeNewScript* newScript = anyNewScript();