mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 1380030 - Simplify and refactor use of isMarked*() methods r=sfink
This commit is contained in:
parent
f32b5076be
commit
6302159903
@ -1063,7 +1063,7 @@ inline void
|
||||
js::GCMarker::eagerlyMarkChildren(Shape* shape)
|
||||
{
|
||||
MOZ_ASSERT_IF(markColor() == GRAY, shape->isMarkedGray());
|
||||
MOZ_ASSERT_IF(markColor() == BLACK, shape->isMarkedAny());
|
||||
MOZ_ASSERT_IF(markColor() == BLACK, shape->isMarkedBlack());
|
||||
|
||||
do {
|
||||
// Special case: if a base shape has a shape table then all its pointers
|
||||
@ -2441,7 +2441,7 @@ void
|
||||
GCMarker::repush(JSObject* obj)
|
||||
{
|
||||
MOZ_ASSERT_IF(markColor() == GRAY, gc::TenuredCell::fromPointer(obj)->isMarkedGray());
|
||||
MOZ_ASSERT_IF(markColor() == BLACK, gc::TenuredCell::fromPointer(obj)->isMarkedAny());
|
||||
MOZ_ASSERT_IF(markColor() == BLACK, gc::TenuredCell::fromPointer(obj)->isMarkedBlack());
|
||||
pushTaggedPtr(obj);
|
||||
}
|
||||
|
||||
@ -3319,8 +3319,7 @@ FOR_EACH_PUBLIC_TAGGED_GC_POINTER_TYPE(INSTANTIATE_ALL_VALID_HEAP_TRACE_FUNCTION
|
||||
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().isMarkedGray());
|
||||
MOZ_ASSERT(!thing.asCell()->isMarkedGray());
|
||||
}
|
||||
};
|
||||
#endif
|
||||
@ -3448,7 +3447,7 @@ GetMarkInfo(Cell* rawCell)
|
||||
TenuredCell* cell = &rawCell->asTenured();
|
||||
if (cell->isMarkedGray())
|
||||
return MarkInfo::GRAY;
|
||||
if (cell->isMarkedAny())
|
||||
if (cell->isMarkedBlack())
|
||||
return MarkInfo::BLACK;
|
||||
return MarkInfo::UNMARKED;
|
||||
}
|
||||
|
@ -653,8 +653,7 @@ CheckGrayMarkingTracer::checkCell(Cell* cell)
|
||||
|
||||
TenuredCell* tenuredCell = &cell->asTenured();
|
||||
TenuredCell* tenuredParent = &parent->asTenured();
|
||||
if (tenuredParent->isMarkedAny() && !tenuredParent->isMarkedGray() &&
|
||||
tenuredCell->isMarkedGray())
|
||||
if (tenuredParent->isMarkedBlack() && tenuredCell->isMarkedGray())
|
||||
{
|
||||
failures++;
|
||||
fprintf(stderr, "Found black to gray edge to %s %p\n",
|
||||
|
@ -817,7 +817,7 @@ static bool
|
||||
IsMarkedBlack(Cell* cell)
|
||||
{
|
||||
TenuredCell* tc = &cell->asTenured();
|
||||
return tc->isMarkedAny() && !tc->isMarkedGray();
|
||||
return tc->isMarkedBlack();
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -246,8 +246,8 @@ BEGIN_TEST(testUnbarrieredEquality)
|
||||
JS::Heap<JSObject*> heap2(obj2);
|
||||
heap.get();
|
||||
heap2.get();
|
||||
CHECK(cell->isMarkedAny());
|
||||
CHECK(cell2->isMarkedAny());
|
||||
CHECK(cell->isMarkedBlack());
|
||||
CHECK(cell2->isMarkedBlack());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -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().isMarkedAny());
|
||||
MOZ_ASSERT(!leafHandle->asTenured().isMarkedAny());
|
||||
MOZ_ASSERT(!leafOwnerHandle->asTenured().isMarkedAny());
|
||||
MOZ_ASSERT(vec[0]->asTenured().isMarkedBlack());
|
||||
MOZ_ASSERT(!leafHandle->asTenured().isMarkedBlack());
|
||||
MOZ_ASSERT(!leafOwnerHandle->asTenured().isMarkedBlack());
|
||||
|
||||
#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().isMarkedAny());
|
||||
MOZ_ASSERT(leafHandle->asTenured().isMarkedBlack());
|
||||
|
||||
// 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().isMarkedAny());
|
||||
MOZ_ASSERT(!leaf2.toObject().asTenured().isMarkedBlack());
|
||||
if (!JS_SetProperty(cx, vec[0], "leafcopy", leaf2))
|
||||
return false;
|
||||
MOZ_ASSERT(rt->gc.gcNumber() == currentGCNumber);
|
||||
MOZ_ASSERT(!leaf2.toObject().asTenured().isMarkedAny());
|
||||
MOZ_ASSERT(!leaf2.toObject().asTenured().isMarkedBlack());
|
||||
}
|
||||
|
||||
// Finish the GC using an unlimited budget.
|
||||
|
@ -622,7 +622,7 @@ struct VisitGrayCallbackFunctor {
|
||||
|
||||
template <class T>
|
||||
void operator()(T tp) const {
|
||||
if ((*tp)->isTenured() && (*tp)->asTenured().isMarkedGray())
|
||||
if ((*tp)->isMarkedGray())
|
||||
callback_(closure_, JS::GCCellPtr(*tp));
|
||||
}
|
||||
};
|
||||
@ -1104,10 +1104,13 @@ static char
|
||||
MarkDescriptor(void* thing)
|
||||
{
|
||||
gc::TenuredCell* cell = gc::TenuredCell::fromPointer(thing);
|
||||
if (cell->isMarkedBlack())
|
||||
return 'B';
|
||||
if (cell->isMarkedGray())
|
||||
return 'G';
|
||||
if (cell->isMarkedAny())
|
||||
return cell->isMarkedGray() ? 'G' : 'B';
|
||||
else
|
||||
return cell->isMarkedGray() ? 'X' : 'W';
|
||||
return 'X';
|
||||
return 'W';
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2047,7 +2047,7 @@ RelocateArena(Arena* arena, SliceBudget& sliceBudget)
|
||||
TenuredCell* src = i.getCell();
|
||||
MOZ_ASSERT(RelocationOverlay::isCellForwarded(src));
|
||||
TenuredCell* dest = Forwarded(src);
|
||||
MOZ_ASSERT(src->isMarkedAny() == dest->isMarkedAny());
|
||||
MOZ_ASSERT(src->isMarkedBlack() == dest->isMarkedBlack());
|
||||
MOZ_ASSERT(src->isMarkedGray() == dest->isMarkedGray());
|
||||
}
|
||||
#endif
|
||||
@ -4592,7 +4592,7 @@ JSCompartment::findOutgoingEdges(ZoneComponentFinder& finder)
|
||||
bool needsEdge = true;
|
||||
if (key.is<JSObject*>()) {
|
||||
TenuredCell& other = key.as<JSObject*>()->asTenured();
|
||||
needsEdge = !other.isMarkedAny() || other.isMarkedGray();
|
||||
needsEdge = !other.isMarkedBlack();
|
||||
}
|
||||
key.applyToWrapped(AddOutgoingEdgeFunctor(needsEdge, finder));
|
||||
}
|
||||
@ -6905,7 +6905,7 @@ GCRuntime::maybeDoCycleCollection()
|
||||
for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next()) {
|
||||
++compartmentsTotal;
|
||||
GlobalObject* global = c->unsafeUnbarrieredMaybeGlobal();
|
||||
if (global && global->asTenured().isMarkedGray())
|
||||
if (global && global->isMarkedGray())
|
||||
++compartmentsGray;
|
||||
}
|
||||
double grayFraction = double(compartmentsGray) / double(compartmentsTotal);
|
||||
|
@ -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().isMarkedGray());
|
||||
MOZ_ASSERT(!src->sourceObject()->isMarkedGray());
|
||||
|
||||
uint32_t nconsts = src->hasConsts() ? src->consts()->length : 0;
|
||||
uint32_t nobjects = src->hasObjects() ? src->objects()->length : 0;
|
||||
|
@ -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().isMarkedAny() && !key->asTenured().isMarkedGray())
|
||||
if (key->asTenured().isMarkedBlack())
|
||||
continue;
|
||||
JSObject* delegate = getDelegate(key);
|
||||
if (!delegate)
|
||||
|
@ -341,7 +341,7 @@ 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->isMarkedAny() && !wrapper->isMarkedGray())
|
||||
if (wrapper->isMarkedBlack())
|
||||
MOZ_ASSERT(JS::ObjectIsNotGray(target));
|
||||
if (!wrapper->isMarkedGray())
|
||||
JS::ExposeObjectToActiveJS(target);
|
||||
|
@ -5824,7 +5824,7 @@ GetMarks(JSContext* cx, unsigned argc, Value* vp)
|
||||
gc::TenuredCell* cell = &obj->asTenured();
|
||||
if (cell->isMarkedGray())
|
||||
color = "gray";
|
||||
else if (cell->isMarkedAny())
|
||||
else if (cell->isMarkedBlack())
|
||||
color = "black";
|
||||
else
|
||||
color = "unmarked";
|
||||
|
Loading…
Reference in New Issue
Block a user