mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1105069 - Part 11: Convert UnmarkGrayGCThingRecursively to GCCellPtr; r=jonco, r=mccr8
--HG-- extra : rebase_source : da3b54ac1300838bbe66dbd74af89ff56302ba23
This commit is contained in:
parent
04e0cb95e1
commit
151dacd151
@ -486,7 +486,7 @@ class JS_PUBLIC_API(AutoCheckCannotGC) : public AutoAssertOnGC
|
|||||||
* JSTRACE_SHAPE. |thing| should be non-null.
|
* JSTRACE_SHAPE. |thing| should be non-null.
|
||||||
*/
|
*/
|
||||||
extern JS_FRIEND_API(bool)
|
extern JS_FRIEND_API(bool)
|
||||||
UnmarkGrayGCThingRecursively(void *thing, JSGCTraceKind kind);
|
UnmarkGrayGCThingRecursively(GCCellPtr thing);
|
||||||
|
|
||||||
} /* namespace JS */
|
} /* namespace JS */
|
||||||
|
|
||||||
@ -509,7 +509,7 @@ ExposeGCThingToActiveJS(JS::GCCellPtr thing)
|
|||||||
if (IsIncrementalBarrierNeededOnTenuredGCThing(rt, thing))
|
if (IsIncrementalBarrierNeededOnTenuredGCThing(rt, thing))
|
||||||
JS::IncrementalReferenceBarrier(thing);
|
JS::IncrementalReferenceBarrier(thing);
|
||||||
else if (JS::GCThingIsMarkedGray(thing.asCell()))
|
else if (JS::GCThingIsMarkedGray(thing.asCell()))
|
||||||
JS::UnmarkGrayGCThingRecursively(thing.asCell(), thing.kind());
|
JS::UnmarkGrayGCThingRecursively(thing);
|
||||||
}
|
}
|
||||||
|
|
||||||
static MOZ_ALWAYS_INLINE void
|
static MOZ_ALWAYS_INLINE void
|
||||||
|
@ -196,6 +196,7 @@ class TenuredCell : public Cell
|
|||||||
// Access to the arena header.
|
// Access to the arena header.
|
||||||
inline ArenaHeader *arenaHeader() const;
|
inline ArenaHeader *arenaHeader() const;
|
||||||
inline AllocKind getAllocKind() const;
|
inline AllocKind getAllocKind() const;
|
||||||
|
inline JSGCTraceKind getTraceKind() const;
|
||||||
inline JS::Zone *zone() const;
|
inline JS::Zone *zone() const;
|
||||||
inline JS::Zone *zoneFromAnyThread() const;
|
inline JS::Zone *zoneFromAnyThread() const;
|
||||||
inline bool isInsideZone(JS::Zone *zone) const;
|
inline bool isInsideZone(JS::Zone *zone) const;
|
||||||
@ -1312,6 +1313,12 @@ TenuredCell::getAllocKind() const
|
|||||||
return arenaHeader()->getAllocKind();
|
return arenaHeader()->getAllocKind();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSGCTraceKind
|
||||||
|
TenuredCell::getTraceKind() const
|
||||||
|
{
|
||||||
|
return MapAllocToTraceKind(getAllocKind());
|
||||||
|
}
|
||||||
|
|
||||||
JS::Zone *
|
JS::Zone *
|
||||||
TenuredCell::zone() const
|
TenuredCell::zone() const
|
||||||
{
|
{
|
||||||
@ -1346,8 +1353,9 @@ TenuredCell::readBarrier(TenuredCell *thing)
|
|||||||
MapAllocToTraceKind(thing->getAllocKind()));
|
MapAllocToTraceKind(thing->getAllocKind()));
|
||||||
MOZ_ASSERT(tmp == thing);
|
MOZ_ASSERT(tmp == thing);
|
||||||
}
|
}
|
||||||
|
JS::GCCellPtr cellptr(thing, thing->getTraceKind());
|
||||||
if (JS::GCThingIsMarkedGray(thing))
|
if (JS::GCThingIsMarkedGray(thing))
|
||||||
JS::UnmarkGrayGCThingRecursively(thing, MapAllocToTraceKind(thing->getAllocKind()));
|
JS::UnmarkGrayGCThingRecursively(cellptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ MOZ_ALWAYS_INLINE void
|
/* static */ MOZ_ALWAYS_INLINE void
|
||||||
|
@ -2110,10 +2110,12 @@ UnmarkGrayChildren(JSTracer *trc, void **thingp, JSGCTraceKind kind)
|
|||||||
tracer->unmarkedAny |= childTracer.unmarkedAny;
|
tracer->unmarkedAny |= childTracer.unmarkedAny;
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_FRIEND_API(bool)
|
static bool
|
||||||
JS::UnmarkGrayGCThingRecursively(void *thing, JSGCTraceKind kind)
|
UnmarkGrayCellRecursively(gc::Cell *cell, JSGCTraceKind kind)
|
||||||
{
|
{
|
||||||
JSRuntime *rt = static_cast<Cell *>(thing)->runtimeFromMainThread();
|
MOZ_ASSERT(cell);
|
||||||
|
|
||||||
|
JSRuntime *rt = cell->runtimeFromMainThread();
|
||||||
|
|
||||||
// When the ReadBarriered type is used in a HashTable, it is difficult or
|
// When the ReadBarriered type is used in a HashTable, it is difficult or
|
||||||
// impossible to suppress the implicit cast operator while iterating for GC.
|
// impossible to suppress the implicit cast operator while iterating for GC.
|
||||||
@ -2121,16 +2123,28 @@ JS::UnmarkGrayGCThingRecursively(void *thing, JSGCTraceKind kind)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool unmarkedArg = false;
|
bool unmarkedArg = false;
|
||||||
if (!IsInsideNursery(static_cast<Cell *>(thing))) {
|
if (cell->isTenured()) {
|
||||||
if (!JS::GCThingIsMarkedGray(thing))
|
if (!cell->asTenured().isMarked(GRAY))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TenuredCell::fromPointer(thing)->unmark(js::gc::GRAY);
|
cell->asTenured().unmark(GRAY);
|
||||||
unmarkedArg = true;
|
unmarkedArg = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnmarkGrayTracer trc(rt);
|
UnmarkGrayTracer trc(rt);
|
||||||
JS_TraceChildren(&trc, thing, kind);
|
JS_TraceChildren(&trc, cell, kind);
|
||||||
|
|
||||||
return unmarkedArg || trc.unmarkedAny;
|
return unmarkedArg || trc.unmarkedAny;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
js::UnmarkGrayShapeRecursively(Shape *shape)
|
||||||
|
{
|
||||||
|
return UnmarkGrayCellRecursively(shape, JSTRACE_SHAPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
JS_FRIEND_API(bool)
|
||||||
|
JS::UnmarkGrayGCThingRecursively(JS::GCCellPtr thing)
|
||||||
|
{
|
||||||
|
return UnmarkGrayCellRecursively(thing.asCell(), thing.kind());
|
||||||
|
}
|
||||||
|
@ -410,6 +410,9 @@ ToMarkable(Cell *cell)
|
|||||||
void
|
void
|
||||||
TraceChildren(JSTracer *trc, void *thing, JSGCTraceKind kind);
|
TraceChildren(JSTracer *trc, void *thing, JSGCTraceKind kind);
|
||||||
|
|
||||||
|
bool
|
||||||
|
UnmarkGrayShapeRecursively(Shape *shape);
|
||||||
|
|
||||||
} /* namespace js */
|
} /* namespace js */
|
||||||
|
|
||||||
#endif /* gc_Marking_h */
|
#endif /* gc_Marking_h */
|
||||||
|
@ -172,7 +172,7 @@ PropertyTree::getChild(ExclusiveContext *cx, Shape *parentArg, StackShape &unroo
|
|||||||
parent->removeChild(existingShape);
|
parent->removeChild(existingShape);
|
||||||
existingShape = nullptr;
|
existingShape = nullptr;
|
||||||
} else if (existingShape->isMarked(gc::GRAY)) {
|
} else if (existingShape->isMarked(gc::GRAY)) {
|
||||||
JS::UnmarkGrayGCThingRecursively(existingShape, JSTRACE_SHAPE);
|
UnmarkGrayShapeRecursively(existingShape);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ private:
|
|||||||
if (delegateMightNeedMarking && aKey.isObject()) {
|
if (delegateMightNeedMarking && aKey.isObject()) {
|
||||||
JSObject* kdelegate = js::GetWeakmapKeyDelegate(aKey.toObject());
|
JSObject* kdelegate = js::GetWeakmapKeyDelegate(aKey.toObject());
|
||||||
if (kdelegate && !xpc_IsGrayGCThing(kdelegate)) {
|
if (kdelegate && !xpc_IsGrayGCThing(kdelegate)) {
|
||||||
if (JS::UnmarkGrayGCThingRecursively(aKey.asCell(), JSTRACE_OBJECT)) {
|
if (JS::UnmarkGrayGCThingRecursively(aKey)) {
|
||||||
tracer->mAnyMarked = true;
|
tracer->mAnyMarked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -287,7 +287,7 @@ private:
|
|||||||
(!aKey || !xpc_IsGrayGCThing(aKey.asCell())) &&
|
(!aKey || !xpc_IsGrayGCThing(aKey.asCell())) &&
|
||||||
(!aMap || !xpc_IsGrayGCThing(aMap)) &&
|
(!aMap || !xpc_IsGrayGCThing(aMap)) &&
|
||||||
aValue.kind() != JSTRACE_SHAPE) {
|
aValue.kind() != JSTRACE_SHAPE) {
|
||||||
if (JS::UnmarkGrayGCThingRecursively(aValue.asCell(), aValue.kind())) {
|
if (JS::UnmarkGrayGCThingRecursively(aValue)) {
|
||||||
tracer->mAnyMarked = true;
|
tracer->mAnyMarked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user