Bug 1075591: Make js::gc::TenuredCell::asTenured return a TenuredCell &, not a TenuredCell *. r=terrence

This commit is contained in:
Jim Blandy 2014-10-02 10:19:11 +01:00
parent 14a7495525
commit 573a2cc109
22 changed files with 68 additions and 68 deletions

View File

@ -144,8 +144,8 @@ struct Cell
{
public:
MOZ_ALWAYS_INLINE bool isTenured() const { return !IsInsideNursery(this); }
MOZ_ALWAYS_INLINE const TenuredCell *asTenured() const;
MOZ_ALWAYS_INLINE TenuredCell *asTenured();
MOZ_ALWAYS_INLINE const TenuredCell &asTenured() const;
MOZ_ALWAYS_INLINE TenuredCell &asTenured();
inline JSRuntime *runtimeFromMainThread() const;
inline JS::shadow::Runtime *shadowRuntimeFromMainThread() const;
@ -1146,18 +1146,18 @@ AssertValidColor(const TenuredCell *thing, uint32_t color)
#endif
}
MOZ_ALWAYS_INLINE const TenuredCell *
MOZ_ALWAYS_INLINE const TenuredCell &
Cell::asTenured() const
{
MOZ_ASSERT(isTenured());
return static_cast<const TenuredCell *>(this);
return *static_cast<const TenuredCell *>(this);
}
MOZ_ALWAYS_INLINE TenuredCell *
MOZ_ALWAYS_INLINE TenuredCell &
Cell::asTenured()
{
MOZ_ASSERT(isTenured());
return static_cast<TenuredCell *>(this);
return *static_cast<TenuredCell *>(this);
}
inline JSRuntime *
@ -1383,7 +1383,7 @@ Cell::isAligned() const
{
if (!isTenured())
return true;
return asTenured()->isAligned();
return asTenured().isAligned();
}
bool

View File

@ -119,7 +119,7 @@ js::IterateGrayObjects(Zone *zone, GCThingCallback cellCallback, void *data)
for (size_t finalizeKind = 0; finalizeKind <= FINALIZE_OBJECT_LAST; finalizeKind++) {
for (ZoneCellIterUnderGC i(zone, AllocKind(finalizeKind)); !i.done(); i.next()) {
JSObject *obj = i.get<JSObject>();
if (obj->asTenured()->isMarked(GRAY))
if (obj->asTenured().isMarked(GRAY))
cellCallback(data, obj);
}
}

View File

@ -230,7 +230,7 @@ CheckMarkedThing(JSTracer *trc, T **thingp)
* ArenaHeader may not be synced with the real one in ArenaLists.
*/
MOZ_ASSERT_IF(IsThingPoisoned(thing) && rt->isHeapBusy(),
!InFreeList(thing->asTenured()->arenaHeader(), thing));
!InFreeList(thing->asTenured().arenaHeader(), thing));
#endif
}
@ -450,14 +450,14 @@ IsMarked(T **thingp)
}
}
#endif // JSGC_GENERATIONAL
Zone *zone = (*thingp)->asTenured()->zone();
Zone *zone = (*thingp)->asTenured().zone();
if (!zone->isCollecting() || zone->isGCFinished())
return true;
#ifdef JSGC_COMPACTING
if (zone->isGCCompacting() && IsForwarded(*thingp))
*thingp = Forwarded(*thingp);
#endif
return (*thingp)->asTenured()->isMarked();
return (*thingp)->asTenured().isMarked();
}
template <typename T>
@ -495,7 +495,7 @@ IsAboutToBeFinalized(T **thingp)
}
#endif // JSGC_GENERATIONAL
Zone *zone = thing->asTenured()->zone();
Zone *zone = thing->asTenured().zone();
if (zone->isGCSweeping()) {
/*
* We should return false for things that have been allocated during
@ -505,9 +505,9 @@ IsAboutToBeFinalized(T **thingp)
* we just assert that it's not necessary.
*/
MOZ_ASSERT_IF(!rt->isHeapMinorCollecting(),
!thing->asTenured()->arenaHeader()->allocatedDuringIncremental);
!thing->asTenured().arenaHeader()->allocatedDuringIncremental);
return !thing->asTenured()->isMarked();
return !thing->asTenured().isMarked();
}
#ifdef JSGC_COMPACTING
else if (zone->isGCCompacting() && IsForwarded(thing)) {
@ -666,7 +666,7 @@ gc::MarkKind(JSTracer *trc, void **thingp, JSGCTraceKind kind)
MOZ_ASSERT(*thingp);
DebugOnly<Cell *> cell = static_cast<Cell *>(*thingp);
MOZ_ASSERT_IF(cell->isTenured(),
kind == MapAllocToTraceKind(cell->asTenured()->getAllocKind()));
kind == MapAllocToTraceKind(cell->asTenured().getAllocKind()));
switch (kind) {
case JSTRACE_OBJECT:
MarkInternal(trc, reinterpret_cast<JSObject **>(thingp));
@ -948,9 +948,9 @@ ShouldMarkCrossCompartment(JSTracer *trc, JSObject *src, Cell *cell)
MOZ_ASSERT(color == BLACK);
return false;
}
TenuredCell *tenured = cell->asTenured();
TenuredCell &tenured = cell->asTenured();
JS::Zone *zone = tenured->zone();
JS::Zone *zone = tenured.zone();
if (color == BLACK) {
/*
* Having black->gray edges violates our promise to the cycle
@ -959,7 +959,7 @@ ShouldMarkCrossCompartment(JSTracer *trc, JSObject *src, Cell *cell)
* source and destination of the cross-compartment edge should be gray,
* but the source was marked black by the conservative scanner.
*/
if (tenured->isMarked(GRAY)) {
if (tenured.isMarked(GRAY)) {
MOZ_ASSERT(!zone->isCollecting());
trc->runtime()->gc.setFoundBlackGrayEdges();
}
@ -971,7 +971,7 @@ ShouldMarkCrossCompartment(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.isMarked())
DelayCrossCompartmentGrayMarking(src);
return false;
}
@ -1041,7 +1041,7 @@ PushMarkStack(GCMarker *gcmarker, ObjectImpl *thing)
JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing);
MOZ_ASSERT(!IsInsideNursery(thing));
if (thing->asTenured()->markIfUnmarked(gcmarker->getMarkColor()))
if (thing->asTenured().markIfUnmarked(gcmarker->getMarkColor()))
gcmarker->pushObject(thing);
}
@ -1059,7 +1059,7 @@ MaybePushMarkStackBetweenSlices(GCMarker *gcmarker, JSObject *thing)
JS_COMPARTMENT_ASSERT(rt, thing);
MOZ_ASSERT_IF(rt->isHeapBusy(), !IsInsideNursery(thing));
if (!IsInsideNursery(thing) && thing->asTenured()->markIfUnmarked(gcmarker->getMarkColor()))
if (!IsInsideNursery(thing) && thing->asTenured().markIfUnmarked(gcmarker->getMarkColor()))
gcmarker->pushObject(thing);
}
@ -1069,7 +1069,7 @@ PushMarkStack(GCMarker *gcmarker, JSFunction *thing)
JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing);
MOZ_ASSERT(!IsInsideNursery(thing));
if (thing->asTenured()->markIfUnmarked(gcmarker->getMarkColor()))
if (thing->asTenured().markIfUnmarked(gcmarker->getMarkColor()))
gcmarker->pushObject(thing);
}
@ -1709,7 +1709,7 @@ GCMarker::processMarkStackTop(SliceBudget &budget)
JSObject *obj2 = &v.toObject();
JS_COMPARTMENT_ASSERT(runtime(), obj2);
MOZ_ASSERT(obj->compartment() == obj2->compartment());
if (obj2->asTenured()->markIfUnmarked(getMarkColor())) {
if (obj2->asTenured().markIfUnmarked(getMarkColor())) {
pushValueArray(obj, vp, end);
obj = obj2;
goto scan_obj;

View File

@ -587,7 +587,7 @@ GCMarker::checkZone(void *p)
{
MOZ_ASSERT(started);
DebugOnly<Cell *> cell = static_cast<Cell *>(p);
MOZ_ASSERT_IF(cell->isTenured(), cell->asTenured()->zone()->isCollecting());
MOZ_ASSERT_IF(cell->isTenured(), cell->asTenured().zone()->isCollecting());
}
#endif

View File

@ -4011,7 +4011,7 @@ CodeGenerator::emitAllocateGCThingPar(LInstruction *lir, Register objReg, Regist
MOZ_ASSERT(lir->mirRaw());
MOZ_ASSERT(lir->mirRaw()->isInstruction());
gc::AllocKind allocKind = templateObj->asTenured()->getAllocKind();
gc::AllocKind allocKind = templateObj->asTenured().getAllocKind();
#ifdef JSGC_FJGENERATIONAL
OutOfLineCode *ool = oolCallVM(NewGCThingParInfo, lir,
(ArgList(), Imm32(allocKind)), StoreRegisterTo(objReg));
@ -4193,7 +4193,7 @@ bool
CodeGenerator::visitCreateThisWithTemplate(LCreateThisWithTemplate *lir)
{
JSObject *templateObject = lir->mir()->templateObject();
gc::AllocKind allocKind = templateObject->asTenured()->getAllocKind();
gc::AllocKind allocKind = templateObject->asTenured().getAllocKind();
gc::InitialHeap initialHeap = lir->mir()->initialHeap();
Register objReg = ToRegister(lir->output());
Register tempReg = ToRegister(lir->temp());

View File

@ -6777,7 +6777,7 @@ NumFixedSlots(JSObject *object)
// shape and can race with the main thread if we are building off thread.
// The allocation kind and object class (which goes through the type) can
// be read freely, however.
gc::AllocKind kind = object->asTenured()->getAllocKind();
gc::AllocKind kind = object->asTenured().getAllocKind();
return gc::GetGCKindSlots(kind, object->getClass());
}

View File

@ -595,7 +595,7 @@ MacroAssembler::newGCThing(Register result, Register temp, JSObject *templateObj
// frees them. Instead just assert this case does not happen.
MOZ_ASSERT(!templateObj->numDynamicSlots());
gc::AllocKind allocKind = templateObj->asTenured()->getAllocKind();
gc::AllocKind allocKind = templateObj->asTenured().getAllocKind();
MOZ_ASSERT(allocKind >= gc::FINALIZE_OBJECT0 && allocKind <= gc::FINALIZE_OBJECT_LAST);
allocateObject(result, temp, allocKind, templateObj->numDynamicSlots(), initialHeap, fail);
@ -606,7 +606,7 @@ MacroAssembler::createGCObject(Register obj, Register temp, JSObject *templateOb
gc::InitialHeap initialHeap, Label *fail, bool initFixedSlots)
{
uint32_t nDynamicSlots = templateObj->numDynamicSlots();
gc::AllocKind allocKind = templateObj->asTenured()->getAllocKind();
gc::AllocKind allocKind = templateObj->asTenured().getAllocKind();
MOZ_ASSERT(allocKind >= gc::FINALIZE_OBJECT0 && allocKind <= gc::FINALIZE_OBJECT_LAST);
// Arrays with copy on write elements do not need fixed space for an
@ -736,7 +736,7 @@ void
MacroAssembler::newGCThingPar(Register result, Register cx, Register tempReg1, Register tempReg2,
JSObject *templateObject, Label *fail)
{
gc::AllocKind allocKind = templateObject->asTenured()->getAllocKind();
gc::AllocKind allocKind = templateObject->asTenured().getAllocKind();
MOZ_ASSERT(allocKind >= gc::FINALIZE_OBJECT0 && allocKind <= gc::FINALIZE_OBJECT_LAST);
MOZ_ASSERT(!templateObject->numDynamicSlots());

View File

@ -3244,7 +3244,7 @@ MNewArray::shouldUseVM() const
MOZ_ASSERT(count() < JSObject::NELEMENTS_LIMIT);
size_t arraySlots =
gc::GetGCKindSlots(templateObject()->asTenured()->getAllocKind()) - ObjectElements::VALUES_PER_HEADER;
gc::GetGCKindSlots(templateObject()->asTenured().getAllocKind()) - ObjectElements::VALUES_PER_HEADER;
// Allocate space using the VMCall when mir hints it needs to get allocated
// immediately, but only when data doesn't fit the available array slots.

View File

@ -1120,7 +1120,7 @@ RCreateThisWithTemplate::recover(JSContext *cx, SnapshotIterator &iter) const
types::AutoEnterAnalysis enter(cx);
// See CodeGenerator::visitCreateThisWithTemplate
gc::AllocKind allocKind = templateObject->asTenured()->getAllocKind();
gc::AllocKind allocKind = templateObject->asTenured().getAllocKind();
gc::InitialHeap initialHeap = tenuredHeap_ ? gc::TenuredHeap : gc::DefaultHeap;
JSObject *resultObject = JSObject::copy(cx, allocKind, initialHeap, templateObject);
if (!resultObject)

View File

@ -1132,9 +1132,9 @@ AssertValidObjectPtr(JSContext *cx, JSObject *obj)
if (obj->isTenured()) {
MOZ_ASSERT(obj->isAligned());
gc::AllocKind kind = obj->asTenured()->getAllocKind();
gc::AllocKind kind = obj->asTenured().getAllocKind();
MOZ_ASSERT(kind >= js::gc::FINALIZE_OBJECT0 && kind <= js::gc::FINALIZE_OBJECT_LAST);
MOZ_ASSERT(obj->asTenured()->zone() == cx->zone());
MOZ_ASSERT(obj->asTenured().zone() == cx->zone());
}
}

View File

@ -652,7 +652,7 @@ js::VisitGrayWrapperTargets(Zone *zone, GCThingCallback callback, void *closure)
for (CompartmentsInZoneIter comp(zone); !comp.done(); comp.next()) {
for (JSCompartment::WrapperEnum e(comp); !e.empty(); e.popFront()) {
gc::Cell *thing = e.front().key().wrapped;
if (thing->isTenured() && thing->asTenured()->isMarked(gc::GRAY))
if (thing->isTenured() && thing->asTenured().isMarked(gc::GRAY))
callback(closure, thing);
}
}
@ -1189,7 +1189,7 @@ JS::IncrementalReferenceBarrier(void *ptr, JSGCTraceKind kind)
#ifdef DEBUG
Zone *zone = kind == JSTRACE_OBJECT
? static_cast<JSObject *>(cell)->zone()
: cell->asTenured()->zone();
: cell->asTenured().zone();
MOZ_ASSERT(!zone->runtimeFromMainThread()->isHeapMajorCollecting());
#endif

View File

@ -461,7 +461,7 @@ class JSFunction : public JSObject
public:
inline bool isExtended() const {
JS_STATIC_ASSERT(FinalizeKind != ExtendedFinalizeKind);
MOZ_ASSERT_IF(isTenured(), !!(flags() & EXTENDED) == (asTenured()->getAllocKind() == ExtendedFinalizeKind));
MOZ_ASSERT_IF(isTenured(), !!(flags() & EXTENDED) == (asTenured().getAllocKind() == ExtendedFinalizeKind));
return !!(flags() & EXTENDED);
}
@ -484,7 +484,7 @@ class JSFunction : public JSObject
js::gc::AllocKind kind = FinalizeKind;
if (isExtended())
kind = ExtendedFinalizeKind;
MOZ_ASSERT_IF(isTenured(), kind == asTenured()->getAllocKind());
MOZ_ASSERT_IF(isTenured(), kind == asTenured().getAllocKind());
return kind;
}
};

View File

@ -503,7 +503,7 @@ Arena::finalize(FreeOp *fop, AllocKind thingKind, size_t thingSize)
for (ArenaCellIterUnderFinalize i(&aheader); !i.done(); i.next()) {
T *t = i.get<T>();
if (t->asTenured()->isMarked()) {
if (t->asTenured().isMarked()) {
uintptr_t thing = reinterpret_cast<uintptr_t>(t);
if (thing != firstThingOrSuccessorOfLastMarkedThing) {
// We just finished passing over one or more free things,
@ -4199,15 +4199,15 @@ JSCompartment::findOutgoingEdges(ComponentFinder<JS::Zone> &finder)
for (js::WrapperMap::Enum e(crossCompartmentWrappers); !e.empty(); e.popFront()) {
CrossCompartmentKey::Kind kind = e.front().key().kind;
MOZ_ASSERT(kind != CrossCompartmentKey::StringWrapper);
TenuredCell *other = e.front().key().wrapped->asTenured();
TenuredCell &other = e.front().key().wrapped->asTenured();
if (kind == CrossCompartmentKey::ObjectWrapper) {
/*
* Add edge to wrapped object compartment if wrapped object is not
* marked black to indicate that wrapper compartment not be swept
* after wrapped compartment.
*/
if (!other->isMarked(BLACK) || other->isMarked(GRAY)) {
JS::Zone *w = other->zone();
if (!other.isMarked(BLACK) || other.isMarked(GRAY)) {
JS::Zone *w = other.zone();
if (w->isGCMarking())
finder.addEdgeTo(w);
}
@ -4221,7 +4221,7 @@ JSCompartment::findOutgoingEdges(ComponentFinder<JS::Zone> &finder)
* with call to Debugger::findCompartmentEdges below) that debugger
* and debuggee objects are always swept in the same group.
*/
JS::Zone *w = other->zone();
JS::Zone *w = other.zone();
if (w->isGCMarking())
finder.addEdgeTo(w);
}
@ -4462,11 +4462,11 @@ MarkIncomingCrossCompartmentPointers(JSRuntime *rt, const uint32_t color)
MOZ_ASSERT(dst->compartment() == c);
if (color == GRAY) {
if (IsObjectMarked(&src) && src->asTenured()->isMarked(GRAY))
if (IsObjectMarked(&src) && src->asTenured().isMarked(GRAY))
MarkGCThingUnbarriered(&rt->gc.marker, (void**)&dst,
"cross-compartment gray pointer");
} else {
if (IsObjectMarked(&src) && !src->asTenured()->isMarked(GRAY))
if (IsObjectMarked(&src) && !src->asTenured().isMarked(GRAY))
MarkGCThingUnbarriered(&rt->gc.marker, (void**)&dst,
"cross-compartment black pointer");
}
@ -6341,7 +6341,7 @@ JS_FRIEND_API(void)
JS::AssertGCThingMustBeTenured(JSObject *obj)
{
MOZ_ASSERT(obj->isTenured() &&
(!IsNurseryAllocable(obj->asTenured()->getAllocKind()) || obj->getClass()->finalize));
(!IsNurseryAllocable(obj->asTenured().getAllocKind()) || obj->getClass()->finalize));
}
JS_FRIEND_API(void)
@ -6351,7 +6351,7 @@ js::gc::AssertGCThingHasType(js::gc::Cell *cell, JSGCTraceKind kind)
if (IsInsideNursery(cell))
MOZ_ASSERT(kind == JSTRACE_OBJECT);
else
MOZ_ASSERT(MapAllocToTraceKind(cell->asTenured()->getAllocKind()) == kind);
MOZ_ASSERT(MapAllocToTraceKind(cell->asTenured().getAllocKind()) == kind);
}
JS_FRIEND_API(size_t)

View File

@ -41,7 +41,7 @@ ThreadSafeContext::isThreadLocal(T thing) const
MOZ_ASSERT(!IsInsideNursery(thing));
// The thing is not in the nursery, but is it in the private tenured area?
if (allocator_->arenas.containsArena(runtime_, thing->asTenured()->arenaHeader()))
if (allocator_->arenas.containsArena(runtime_, thing->asTenured().arenaHeader()))
{
// GC should be suppressed in preparation for mutating thread local
// objects, as we don't want to trip any barriers.
@ -92,7 +92,7 @@ GetGCThingTraceKind(const void *thing)
if (IsInsideNursery(cell))
return JSTRACE_OBJECT;
#endif
return MapAllocToTraceKind(cell->asTenured()->getAllocKind());
return MapAllocToTraceKind(cell->asTenured().getAllocKind());
}
inline void
@ -546,7 +546,7 @@ CheckIncrementalZoneState(ThreadSafeContext *cx, T *t)
Zone *zone = cx->asJSContext()->zone();
MOZ_ASSERT_IF(t && zone->wasGCStarted() && (zone->isGCMarking() || zone->isGCSweeping()),
t->asTenured()->arenaHeader()->allocatedDuringIncremental);
t->asTenured().arenaHeader()->allocatedDuringIncremental);
#endif
}

View File

@ -2055,7 +2055,7 @@ js::DeepCloneObjectLiteral(JSContext *cx, HandleObject obj, NewObjectKind newKin
} else {
// Object literals are tenured by default as holded by the JSScript.
MOZ_ASSERT(obj->isTenured());
AllocKind kind = obj->asTenured()->getAllocKind();
AllocKind kind = obj->asTenured().getAllocKind();
Rooted<TypeObject*> typeObj(cx, obj->getType(cx));
if (!typeObj)
return nullptr;
@ -2163,7 +2163,7 @@ js::XDRObjectLiteral(XDRState<mode> *xdr, MutableHandleObject obj)
if (mode == XDR_ENCODE) {
MOZ_ASSERT(obj->getClass() == &JSObject::class_);
MOZ_ASSERT(obj->isTenured());
kind = obj->asTenured()->getAllocKind();
kind = obj->asTenured().getAllocKind();
}
if (!xdr->codeEnum32(&kind))
@ -2361,7 +2361,7 @@ js::CloneObjectLiteral(JSContext *cx, HandleObject parent, HandleObject srcObj)
{
if (srcObj->getClass() == &JSObject::class_) {
AllocKind kind = GetBackgroundAllocKind(GuessObjectGCKind(srcObj->numFixedSlots()));
MOZ_ASSERT_IF(srcObj->isTenured(), kind == srcObj->asTenured()->getAllocKind());
MOZ_ASSERT_IF(srcObj->isTenured(), kind == srcObj->asTenured().getAllocKind());
JSObject *proto = cx->global()->getOrCreateObjectPrototype(cx);
if (!proto)
@ -2391,7 +2391,7 @@ js::CloneObjectLiteral(JSContext *cx, HandleObject parent, HandleObject srcObj)
value = srcObj->getDenseElement(i);
MOZ_ASSERT_IF(value.isMarkable(),
value.toGCThing()->isTenured() &&
cx->runtime()->isAtomsZone(value.toGCThing()->asTenured()->zone()));
cx->runtime()->isAtomsZone(value.toGCThing()->asTenured().zone()));
id = INT_TO_JSID(i);
if (!JSObject::defineGeneric(cx, res, id, value, nullptr, nullptr, JSPROP_ENUMERATE))
@ -2476,7 +2476,7 @@ JSObject::ReserveForTradeGuts(JSContext *cx, JSObject *aArg, JSObject *bArg,
MOZ_CRASH();
} else {
reserved.newbshape = EmptyShape::getInitialShape(cx, aClass, aProto, a->getParent(), a->getMetadata(),
b->asTenured()->getAllocKind());
b->asTenured().getAllocKind());
if (!reserved.newbshape)
MOZ_CRASH();
}
@ -2485,7 +2485,7 @@ JSObject::ReserveForTradeGuts(JSContext *cx, JSObject *aArg, JSObject *bArg,
MOZ_CRASH();
} else {
reserved.newashape = EmptyShape::getInitialShape(cx, bClass, bProto, b->getParent(), b->getMetadata(),
a->asTenured()->getAllocKind());
a->asTenured().getAllocKind());
if (!reserved.newashape)
MOZ_CRASH();
}
@ -2685,8 +2685,8 @@ bool
JSObject::swap(JSContext *cx, HandleObject a, HandleObject b)
{
// Ensure swap doesn't cause a finalizer to not be run.
MOZ_ASSERT(IsBackgroundFinalized(a->asTenured()->getAllocKind()) ==
IsBackgroundFinalized(b->asTenured()->getAllocKind()));
MOZ_ASSERT(IsBackgroundFinalized(a->asTenured().getAllocKind()) ==
IsBackgroundFinalized(b->asTenured().getAllocKind()));
MOZ_ASSERT(a->compartment() == b->compartment());
unsigned r = NotifyGCPreSwap(a, b);

View File

@ -84,7 +84,7 @@ JSObject::finalize(js::FreeOp *fop)
#ifdef DEBUG
MOZ_ASSERT(isTenured());
if (!IsBackgroundFinalized(asTenured()->getAllocKind())) {
if (!IsBackgroundFinalized(asTenured().getAllocKind())) {
/* Assert we're on the main thread. */
MOZ_ASSERT(CurrentThreadCanAccessRuntime(fop->runtime()));
}
@ -1099,7 +1099,7 @@ CopyInitializerObject(JSContext *cx, HandleObject baseobj, NewObjectKind newKind
gc::AllocKind allocKind = gc::GetGCObjectFixedSlotsKind(baseobj->numFixedSlots());
allocKind = gc::GetBackgroundAllocKind(allocKind);
MOZ_ASSERT_IF(baseobj->isTenured(), allocKind == baseobj->asTenured()->getAllocKind());
MOZ_ASSERT_IF(baseobj->isTenured(), allocKind == baseobj->asTenured().getAllocKind());
RootedObject obj(cx);
obj = NewBuiltinClassInstance(cx, &JSObject::class_, allocKind, newKind);
if (!obj)

View File

@ -2916,7 +2916,7 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
/* 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().isMarked(gc::GRAY));
uint32_t nconsts = src->hasConsts() ? src->consts()->length : 0;
uint32_t nobjects = src->hasObjects() ? src->objects()->length : 0;

View File

@ -180,7 +180,7 @@ ObjectValueMap::findZoneEdges()
Zone *mapZone = compartment->zone();
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().isMarked(BLACK) && !key->asTenured().isMarked(GRAY))
continue;
JSWeakmapKeyDelegateOp op = key->getClass()->ext.weakmapKeyDelegateOp;
if (!op)

View File

@ -165,5 +165,5 @@ bool Wrapper::finalizeInBackground(Value priv) const
*/
if (IsInsideNursery(&priv.toObject()))
return true;
return IsBackgroundFinalized(priv.toObject().asTenured()->getAllocKind());
return IsBackgroundFinalized(priv.toObject().asTenured().getAllocKind());
}

View File

@ -824,7 +824,7 @@ class ObjectImpl : public gc::Cell
/* Memory usage functions. */
size_t tenuredSizeOfThis() const {
MOZ_ASSERT(isTenured());
return js::gc::Arena::thingSize(asTenured()->getAllocKind());
return js::gc::Arena::thingSize(asTenured().getAllocKind());
}
/* Elements accessors. */
@ -984,14 +984,14 @@ class ObjectImpl : public gc::Cell
ObjectImpl::readBarrier(ObjectImpl *obj)
{
if (!isNullLike(obj) && obj->isTenured())
obj->asTenured()->readBarrier(obj->asTenured());
obj->asTenured().readBarrier(&obj->asTenured());
}
/* static */ MOZ_ALWAYS_INLINE void
ObjectImpl::writeBarrierPre(ObjectImpl *obj)
{
if (!isNullLike(obj) && obj->isTenured())
obj->asTenured()->writeBarrierPre(obj->asTenured());
obj->asTenured().writeBarrierPre(&obj->asTenured());
}
/* static */ MOZ_ALWAYS_INLINE void

View File

@ -252,7 +252,7 @@ RegExpObject::trace(JSTracer *trc, JSObject *obj)
// isHeapBusy() will be false.
if (trc->runtime()->isHeapBusy() &&
IS_GC_MARKING_TRACER(trc) &&
!obj->asTenured()->zone()->isPreservingCode())
!obj->asTenured().zone()->isPreservingCode())
{
obj->setPrivate(nullptr);
} else {

View File

@ -1289,7 +1289,7 @@ CloneObject(JSContext *cx, HandleObject selfHostedObject)
} else {
MOZ_ASSERT(selfHostedObject->isNative());
clone = NewObjectWithGivenProto(cx, selfHostedObject->getClass(), TaggedProto(nullptr), cx->global(),
selfHostedObject->asTenured()->getAllocKind(),
selfHostedObject->asTenured().getAllocKind(),
SingletonObject);
}
if (!clone)