From 6e12af80d7bcbd1014b609210b566284414f8820 Mon Sep 17 00:00:00 2001 From: Paul Bone Date: Fri, 20 Jul 2018 15:09:01 +1000 Subject: [PATCH] Bug 1473213 (Part 1) - Track the number of tenured cells r=jonco --HG-- extra : rebase_source : 96739a13fe0d44bcb00819cf7422ef97bc97f812 extra : intermediate-source : 8a10fc261acb99c7e8bb4fcb4ee0975c5166990d extra : source : 445b672aa024fdfca38a2e819f54bcbf28e922dd --- js/src/gc/Marking.cpp | 3 +++ js/src/gc/Nursery.cpp | 4 ++++ js/src/gc/Nursery.h | 3 +++ 3 files changed, 10 insertions(+) diff --git a/js/src/gc/Marking.cpp b/js/src/gc/Marking.cpp index 364cfacc3746..83dc5799a744 100644 --- a/js/src/gc/Marking.cpp +++ b/js/src/gc/Marking.cpp @@ -3002,6 +3002,7 @@ js::TenuringTracer::moveToTenuredSlow(JSObject* src) } tenuredSize += dstSize; + tenuredCells++; // Copy the Cell contents. MOZ_ASSERT(OffsetToChunkEnd(src) >= ptrdiff_t(srcSize)); @@ -3050,6 +3051,7 @@ js::TenuringTracer::movePlainObjectToTenured(PlainObject* src) size_t srcSize = Arena::thingSize(dstKind); tenuredSize += srcSize; + tenuredCells++; // Copy the Cell contents. MOZ_ASSERT(OffsetToChunkEnd(src) >= ptrdiff_t(srcSize)); @@ -3166,6 +3168,7 @@ js::TenuringTracer::moveToTenured(JSString* src) JSString* dst = allocTenured(zone, dstKind); tenuredSize += moveStringToTenured(dst, src, dstKind); + tenuredCells++; RelocationOverlay* overlay = RelocationOverlay::fromCell(src); overlay->forwardTo(dst); diff --git a/js/src/gc/Nursery.cpp b/js/src/gc/Nursery.cpp index c8bca8890366..a9508bd67593 100644 --- a/js/src/gc/Nursery.cpp +++ b/js/src/gc/Nursery.cpp @@ -540,6 +540,7 @@ js::TenuringTracer::TenuringTracer(JSRuntime* rt, Nursery* nursery) : JSTracer(rt, JSTracer::TracerKindTag::Tenuring, TraceWeakMapKeysValues) , nursery_(*nursery) , tenuredSize(0) + , tenuredCells(0) , objHead(nullptr) , objTail(&objHead) , stringHead(nullptr) @@ -599,6 +600,7 @@ js::Nursery::renderProfileJSON(JSONPrinter& json) const json.property("reason", JS::gcreason::ExplainReason(previousGC.reason)); json.property("bytes_tenured", previousGC.tenuredBytes); + json.property("cells_tenured", previousGC.tenuredCells); json.property("bytes_used", previousGC.nurseryUsedBytes); json.property("cur_capacity", previousGC.nurseryCapacity); const size_t newCapacity = spaceToEnd(maxChunkCount()); @@ -741,6 +743,7 @@ js::Nursery::collect(JS::gcreason::Reason reason) previousGC.nurseryCapacity = spaceToEnd(maxChunkCount()); previousGC.nurseryLazyCapacity = spaceToEnd(allocatedChunkCount()); previousGC.tenuredBytes = 0; + previousGC.tenuredCells = 0; } // Resize the nursery. @@ -954,6 +957,7 @@ js::Nursery::doCollection(JS::gcreason::Reason reason, TenureCountCache& tenureC previousGC.nurseryLazyCapacity = spaceToEnd(allocatedChunkCount()); previousGC.nurseryUsedBytes = initialNurseryUsedBytes; previousGC.tenuredBytes = mover.tenuredSize; + previousGC.tenuredCells = mover.tenuredCells; } void diff --git a/js/src/gc/Nursery.h b/js/src/gc/Nursery.h index 228f41147900..17222fb5f4a6 100644 --- a/js/src/gc/Nursery.h +++ b/js/src/gc/Nursery.h @@ -76,6 +76,8 @@ class TenuringTracer : public JSTracer // Amount of data moved to the tenured generation during collection. size_t tenuredSize; + // Number of cells moved to the tenured generation. + size_t tenuredCells; // These lists are threaded through the Nursery using the space from // already moved things. The lists are used to fix up the moved things and @@ -438,6 +440,7 @@ class Nursery size_t nurseryLazyCapacity = 0; size_t nurseryUsedBytes = 0; size_t tenuredBytes = 0; + size_t tenuredCells = 0; } previousGC; /*