Bug 1233831 - Part 2: Expose JS::gcreason::ExplainReason to embedders; r=terrence

This renames the internal function `js::gcstats::ExplainReason` to
`JS::gcreason::ExplainReason` and publicly exposes it to embedders.
This commit is contained in:
Nick Fitzgerald 2016-01-19 12:48:22 -08:00
Родитель 974eaa8140
Коммит 59008f94c6
5 изменённых файлов: 10 добавлений и 5 удалений

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

@ -128,6 +128,12 @@ enum Reason {
NUM_TELEMETRY_REASONS = 100
};
/**
* Get a statically allocated C string explaining the given GC reason.
*/
extern JS_PUBLIC_API(const char*)
ExplainReason(JS::gcreason::Reason reason);
} /* namespace gcreason */
/*

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

@ -600,7 +600,7 @@ js::Nursery::collect(JSRuntime* rt, JS::gcreason::Reason reason, ObjectGroupList
}
#define FMT " %6" PRIu64
fprintf(stderr, "MinorGC: %20s %5.1f%% %4d " FMT, js::gcstats::ExplainReason(reason),
fprintf(stderr, "MinorGC: %20s %5.1f%% %4d " FMT, JS::gcreason::ExplainReason(reason),
promotionRate * 100, numActiveChunks_, totalTime);
for (auto &entry : PrintList) {
fprintf(stderr, FMT, entry.time);

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

@ -48,8 +48,8 @@ js::gcstats::ExplainInvocationKind(JSGCInvocationKind gckind)
return "Shrinking";
}
const char*
js::gcstats::ExplainReason(JS::gcreason::Reason reason)
JS_PUBLIC_API(const char*)
JS::gcreason::ExplainReason(JS::gcreason::Reason reason)
{
switch (reason) {
#define SWITCH_REASON(name) \

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

@ -423,7 +423,6 @@ struct MOZ_RAII AutoSCC
};
const char* ExplainInvocationKind(JSGCInvocationKind gckind);
const char* ExplainReason(JS::gcreason::Reason reason);
} /* namespace gcstats */
} /* namespace js */

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

@ -8519,7 +8519,7 @@ GarbageCollectionEvent::Create(JSRuntime* rt, ::js::gcstats::Statistics& stats,
// reasons this data is stored and replicated on each slice. Each
// slice used to have its own GCReason, but now they are all the
// same.
data->reason = gcstats::ExplainReason(range.front().reason);
data->reason = gcreason::ExplainReason(range.front().reason);
MOZ_ASSERT(data->reason);
}