From d6be2c71b240f57f6f063aef011dfbe7e5787210 Mon Sep 17 00:00:00 2001 From: Terrence Cole Date: Wed, 20 May 2015 09:14:29 -0700 Subject: [PATCH] Bug 1165384 - Add a typedef for the statistics phase table; r=sfink --- js/src/gc/Statistics.cpp | 10 +++++----- js/src/gc/Statistics.h | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/js/src/gc/Statistics.cpp b/js/src/gc/Statistics.cpp index d1f2d9ceb24..a53ea956c0c 100644 --- a/js/src/gc/Statistics.cpp +++ b/js/src/gc/Statistics.cpp @@ -397,7 +397,7 @@ struct AllPhaseIterator { size_t activeSlot; mozilla::Vector::Range descendants; - explicit AllPhaseIterator(int64_t (*table)[PHASE_LIMIT]) + explicit AllPhaseIterator(Statistics::PhaseTimeTable table) : current(0) , baseLevel(0) , activeSlot(PHASE_DAG_NONE) @@ -444,7 +444,7 @@ struct AllPhaseIterator { }; static void -FormatPhaseTimes(StatisticsSerializer& ss, const char* name, int64_t (*times)[PHASE_LIMIT]) +FormatPhaseTimes(StatisticsSerializer& ss, const char* name, Statistics::PhaseTimeTable times) { ss.beginObject(name); @@ -674,7 +674,7 @@ Statistics::formatTotals() } static int64_t -SumChildTimes(size_t phaseSlot, Phase phase, int64_t (*phaseTimes)[PHASE_LIMIT]) +SumChildTimes(size_t phaseSlot, Phase phase, Statistics::PhaseTimeTable phaseTimes) { // Sum the contributions from single-parented children. int64_t total = 0; @@ -697,7 +697,7 @@ SumChildTimes(size_t phaseSlot, Phase phase, int64_t (*phaseTimes)[PHASE_LIMIT]) } UniqueChars -Statistics::formatPhaseTimes(int64_t (*phaseTimes)[PHASE_LIMIT]) +Statistics::formatPhaseTimes(PhaseTimeTable phaseTimes) { static const char* LevelToIndent[] = { "", " ", " ", " " }; static const int64_t MaxUnaccountedChildTimeUS = 50; @@ -900,7 +900,7 @@ Statistics::getMaxGCPauseSinceClear() } static int64_t -SumPhase(Phase phase, int64_t (*times)[PHASE_LIMIT]) +SumPhase(Phase phase, Statistics::PhaseTimeTable times) { int64_t sum = 0; for (size_t i = 0; i < Statistics::MAX_MULTIPARENT_PHASES + 1; i++) diff --git a/js/src/gc/Statistics.h b/js/src/gc/Statistics.h index 09d1f2ca1db..55306d67e54 100644 --- a/js/src/gc/Statistics.h +++ b/js/src/gc/Statistics.h @@ -232,6 +232,9 @@ struct Statistics SliceRange sliceRange() const { return slices.all(); } size_t slicesLength() const { return slices.length(); } + /* Create a convenient typedef for referring tables of phase times. */ + typedef int64_t (*PhaseTimeTable)[PHASE_LIMIT]; + private: JSRuntime* runtime; @@ -314,7 +317,7 @@ struct Statistics UniqueChars formatDescription(); UniqueChars formatSliceDescription(unsigned i, const SliceData& slice); UniqueChars formatTotals(); - UniqueChars formatPhaseTimes(int64_t (*phaseTimes)[PHASE_LIMIT]); + UniqueChars formatPhaseTimes(PhaseTimeTable phaseTimes); double computeMMU(int64_t resolution); };