Bug 1212356 - Make IsAboutToBeFinalized check for finalization by incremental GC even within a minor GC r=terrence a=gchang
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -2442,17 +2442,16 @@ IsMarkedInternal(T* thingp)
*thingp = DispatchTyped(IsMarkedFunctor<T>(), *thingp, &rv);
return rv;
}
bool
js::gc::IsAboutToBeFinalizedDuringSweep(TenuredCell& tenured)
{
MOZ_ASSERT(!IsInsideNursery(&tenured));
- MOZ_ASSERT(!tenured.runtimeFromAnyThread()->isHeapMinorCollecting());
MOZ_ASSERT(tenured.zoneFromAnyThread()->isGCSweeping());
if (tenured.arena()->allocatedDuringIncremental)
return false;
return !tenured.isMarked();
}
template <typename T>
static bool
@@ -2462,21 +2461,19 @@ IsAboutToBeFinalizedInternal(T** thingp)
T* thing = *thingp;
JSRuntime* rt = thing->runtimeFromAnyThread();
/* Permanent atoms are never finalized by non-owning runtimes. */
if (ThingIsPermanentAtomOrWellKnownSymbol(thing) && !TlsPerThreadData.get()->associatedWith(rt))
return false;
Nursery& nursery = rt->gc.nursery;
- MOZ_ASSERT_IF(!rt->isHeapMinorCollecting(), !IsInsideNursery(thing));
- if (rt->isHeapMinorCollecting()) {
- if (IsInsideNursery(thing))
- return !nursery.getForwardedPointer(reinterpret_cast<JSObject**>(thingp));
- return false;
+ if (IsInsideNursery(thing)) {
+ MOZ_ASSERT(rt->isHeapMinorCollecting());
+ return !nursery.getForwardedPointer(reinterpret_cast<JSObject**>(thingp));
}
Zone* zone = thing->asTenured().zoneFromAnyThread();
if (zone->isGCSweeping()) {
return IsAboutToBeFinalizedDuringSweep(thing->asTenured());
} else if (zone->isGCCompacting() && IsForwarded(thing)) {
*thingp = Forwarded(thing);
return false;