mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1199843 - Part 1: Prefer T::traceChildren over tag dispatched TraceChildren; r=jonco
This commit is contained in:
parent
1e07994b39
commit
c0c676b7ac
@ -2591,40 +2591,51 @@ UnmarkGrayTracer::onChild(const JS::GCCellPtr& thing)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
MOZ_ASSERT(!shape->isMarked(js::gc::GRAY));
|
MOZ_ASSERT(!shape->isMarked(js::gc::GRAY));
|
||||||
TraceChildren(&childTracer, shape, JS::TraceKind::Shape);
|
shape->traceChildren(&childTracer);
|
||||||
shape = childTracer.previousShape;
|
shape = childTracer.previousShape;
|
||||||
childTracer.previousShape = nullptr;
|
childTracer.previousShape = nullptr;
|
||||||
} while (shape);
|
} while (shape);
|
||||||
unmarkedAny |= childTracer.unmarkedAny;
|
unmarkedAny |= childTracer.unmarkedAny;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
template <typename T>
|
||||||
js::UnmarkGrayCellRecursively(gc::Cell* cell, JS::TraceKind kind)
|
static bool
|
||||||
|
TypedUnmarkGrayCellRecursively(T* t)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(cell);
|
MOZ_ASSERT(t);
|
||||||
|
|
||||||
JSRuntime* rt = cell->runtimeFromMainThread();
|
JSRuntime* rt = t->runtimeFromMainThread();
|
||||||
MOZ_ASSERT(!rt->isHeapBusy());
|
MOZ_ASSERT(!rt->isHeapBusy());
|
||||||
|
|
||||||
bool unmarkedArg = false;
|
bool unmarkedArg = false;
|
||||||
if (cell->isTenured()) {
|
if (t->isTenured()) {
|
||||||
if (!cell->asTenured().isMarked(GRAY))
|
if (!t->asTenured().isMarked(GRAY))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
cell->asTenured().unmark(GRAY);
|
t->asTenured().unmark(GRAY);
|
||||||
unmarkedArg = true;
|
unmarkedArg = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnmarkGrayTracer trc(rt);
|
UnmarkGrayTracer trc(rt);
|
||||||
TraceChildren(&trc, cell, kind);
|
t->traceChildren(&trc);
|
||||||
|
|
||||||
return unmarkedArg || trc.unmarkedAny;
|
return unmarkedArg || trc.unmarkedAny;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct UnmarkGrayCellRecursivelyFunctor {
|
||||||
|
template <typename T> bool operator()(T* t) { return TypedUnmarkGrayCellRecursively(t); }
|
||||||
|
};
|
||||||
|
|
||||||
|
bool
|
||||||
|
js::UnmarkGrayCellRecursively(Cell* cell, JS::TraceKind kind)
|
||||||
|
{
|
||||||
|
return DispatchTraceKindTyped(UnmarkGrayCellRecursivelyFunctor(), cell, kind);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
js::UnmarkGrayShapeRecursively(Shape* shape)
|
js::UnmarkGrayShapeRecursively(Shape* shape)
|
||||||
{
|
{
|
||||||
return js::UnmarkGrayCellRecursively(shape, JS::TraceKind::Shape);
|
return TypedUnmarkGrayCellRecursively(shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_FRIEND_API(bool)
|
JS_FRIEND_API(bool)
|
||||||
|
Loading…
Reference in New Issue
Block a user