diff --git a/js/src/gc/Allocator.cpp b/js/src/gc/Allocator.cpp index be9924db02..395c39adaa 100644 --- a/js/src/gc/Allocator.cpp +++ b/js/src/gc/Allocator.cpp @@ -215,18 +215,6 @@ js::Allocate(ExclusiveContext* cx) AllocKind kind = MapTypeToFinalizeKind::kind; size_t thingSize = sizeof(T); - // === ADD DETAILED DIAGNOSTIC OUTPUT HERE === - size_t arenaSize = Arena::thingSize(kind); - - fprintf(stderr, "\n=== GC Allocation Debug ===\n"); - fprintf(stderr, "Type name: %s\n", typeid(T).name()); - fprintf(stderr, "sizeof(T): %zu bytes\n", thingSize); - fprintf(stderr, "Arena::thingSize(kind): %zu bytes\n", arenaSize); - fprintf(stderr, "CellAlignBytes: %zu bytes\n", CellAlignBytes); - fprintf(stderr, "Match: %s\n", (thingSize == arenaSize) ? "YES" : "NO - MISMATCH!"); - fprintf(stderr, "Size difference: %zd bytes\n", (size_t)thingSize - (size_t)arenaSize); - fprintf(stderr, "========================\n\n"); - MOZ_ASSERT(thingSize == Arena::thingSize(kind)); if (cx->isJSContext()) { diff --git a/js/src/gc/GCInternals.h b/js/src/gc/GCInternals.h index 7d2340e36a..0997401deb 100644 --- a/js/src/gc/GCInternals.h +++ b/js/src/gc/GCInternals.h @@ -147,6 +147,22 @@ struct MOZ_RAII AutoAssertNoNurseryAlloc #endif }; +// Note that this class does not suppress buffer allocation/reallocation in the +// nursery, only Cells themselves. +class MOZ_RAII AutoSuppressNurseryCellAlloc +{ + JSContext* cx_; + + public: + + explicit AutoSuppressNurseryCellAlloc(JSContext* cx) : cx_(cx) { + cx_->nurserySuppressions_++; + } + ~AutoSuppressNurseryCellAlloc() { + cx_->nurserySuppressions_--; + } +}; + /* * There are a couple of classes here that serve mostly as "tokens" indicating * that a condition holds. Some functions force the caller to possess such a diff --git a/js/src/gc/Marking.cpp b/js/src/gc/Marking.cpp index 03a50b89e8..21abe014b0 100644 --- a/js/src/gc/Marking.cpp +++ b/js/src/gc/Marking.cpp @@ -1774,7 +1774,9 @@ GCMarker::processMarkStackTop(SliceBudget& budget) } else if (v.isBigInt()) { traverseEdge(obj, v.toBigInt()); } else if (v.isPrivateGCThing()) { - traverseEdge(obj, v.toGCCellPtr()); + // v.toGCCellPtr cannot be inlined, so construct one manually. + Cell* cell = v.toGCThing(); + traverseEdge(obj, JS::GCCellPtr(cell, cell->getTraceKind())); } } return; @@ -2713,6 +2715,7 @@ inline void js::TenuringTracer::traceSlots(JS::Value* vp, uint32_t nslots) { traceSlots(vp, vp + nslots); +} void js::TenuringTracer::traceString(JSString* str) diff --git a/js/src/gc/Nursery.cpp b/js/src/gc/Nursery.cpp index 4b0f8c0702..2084f16290 100644 --- a/js/src/gc/Nursery.cpp +++ b/js/src/gc/Nursery.cpp @@ -840,9 +840,9 @@ js::Nursery::doCollection(JS::gcreason::Reason reason, } endProfile(ProfileKey::MarkDebugger); - maybeStartProfile(ProfileKey::SweepCaches); + startProfile(ProfileKey::SweepCaches); rt->gc.purgeRuntimeForMinorGC(); - maybeEndProfile(ProfileKey::SweepCaches); + endProfile(ProfileKey::SweepCaches); // Most of the work is done here. This loop iterates over objects that have // been moved to the major heap. If these objects have any outgoing pointers diff --git a/js/src/gc/Verifier.cpp b/js/src/gc/Verifier.cpp index 41839bf47e..60e933ad8b 100644 --- a/js/src/gc/Verifier.cpp +++ b/js/src/gc/Verifier.cpp @@ -540,7 +540,7 @@ CheckHeapTracer::onChild(const JS::GCCellPtr& thing) else zone = cell->asTenured().zone(); - if (zone->group() && zone->group()->usedByHelperThread) + if (zone->group() && zone->group()->usedByHelperThread()) return; } diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index d6d9e091c6..9fdb9bc45b 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -4782,7 +4782,7 @@ NextIncomingCrossCompartmentPointer(JSObject* prev, bool unlink) } void -js::DelayCrossCompartmentGrayMarking(JSObject* src) +js::gc::DelayCrossCompartmentGrayMarking(JSObject* src) { MOZ_ASSERT(IsGrayListObject(src));