Bug 1233831 - Part 1: Call the callback on nursery collections; r=terrence

This commit adds the `js::gcstats::Statistics::{begin,end}NurseryCollection`
methods which calls the nursery collection callback, if present, and
additionally handles counting minor GCs (which used to be inline in
js::Nursery::collect).
This commit is contained in:
Nick Fitzgerald 2016-01-19 12:48:22 -08:00
Родитель 445de2814b
Коммит 974eaa8140
2 изменённых файлов: 19 добавлений и 2 удалений

Просмотреть файл

@ -418,8 +418,7 @@ js::Nursery::collect(JSRuntime* rt, JS::gcreason::Reason reason, ObjectGroupList
rt->gc.incMinorGcNumber();
rt->gc.stats.count(gcstats::STAT_MINOR_GC);
rt->gc.stats.beginNurseryCollection(reason);
TraceMinorGCStart();
int64_t timestampStart_total = PRMJ_Now();
@ -563,6 +562,7 @@ js::Nursery::collect(JSRuntime* rt, JS::gcreason::Reason reason, ObjectGroupList
if (totalTime > 1000)
rt->addTelemetry(JS_TELEMETRY_GC_MINOR_REASON_LONG, reason);
rt->gc.stats.endNurseryCollection(reason);
TraceMinorGCEnd();
if (enableProfiling_ && totalTime >= profileThreshold_) {

Просмотреть файл

@ -191,6 +191,23 @@ struct Statistics
counts[s]++;
}
void beginNurseryCollection(JS::gcreason::Reason reason) {
count(STAT_MINOR_GC);
if (nurseryCollectionCallback) {
(*nurseryCollectionCallback)(runtime,
JS::GCNurseryProgress::GC_NURSERY_COLLECTION_START,
reason);
}
}
void endNurseryCollection(JS::gcreason::Reason reason) {
if (nurseryCollectionCallback) {
(*nurseryCollectionCallback)(runtime,
JS::GCNurseryProgress::GC_NURSERY_COLLECTION_END,
reason);
}
}
int64_t beginSCC();
void endSCC(unsigned scc, int64_t start);