Bug 1839396 part 14 - GC: Bubble-up infallible print functions. r=jonco

Now that Sprinter::put and Sprinter::jsprintf functions are infallible, there is
no need to return a boolean from Nursery::printProfileDurations and
Statistics::printProfileTimes functions.

Differential Revision: https://phabricator.services.mozilla.com/D181499
This commit is contained in:
Nicolas B. Pierron 2023-09-20 17:00:08 +00:00
parent 13454e29f9
commit 755f14a255
4 changed files with 7 additions and 16 deletions

View File

@ -967,7 +967,7 @@ void js::Nursery::printProfileHeader() {
}
// static
bool js::Nursery::printProfileDurations(const ProfileDurations& times,
void js::Nursery::printProfileDurations(const ProfileDurations& times,
Sprinter& sprinter) {
for (auto time : times) {
int64_t micros = int64_t(time.ToMicroseconds());
@ -975,7 +975,6 @@ bool js::Nursery::printProfileDurations(const ProfileDurations& times,
}
sprinter.put("\n");
return true;
}
static constexpr size_t NurserySliceMetadataFormatWidth() {
@ -1024,9 +1023,7 @@ void js::Nursery::printTotalProfileTimes() {
size_t width = NurserySliceMetadataFormatWidth();
sprinter.jsprintf(" %-*s", int(width), collections);
if (!printProfileDurations(totalDurations_, sprinter)) {
return;
}
printProfileDurations(totalDurations_, sprinter);
JS::UniqueChars str = sprinter.release();
if (!str) {

View File

@ -699,7 +699,7 @@ class Nursery {
void maybeClearProfileDurations();
void startProfile(ProfileKey key);
void endProfile(ProfileKey key);
static bool printProfileDurations(const ProfileDurations& times,
static void printProfileDurations(const ProfileDurations& times,
Sprinter& sprinter);
mozilla::TimeStamp collectionStartTime() const;

View File

@ -1702,9 +1702,7 @@ void Statistics::printSliceProfile() {
FOR_EACH_GC_PROFILE_METADATA(PRINT_FIELD_VALUE)
#undef PRINT_FIELD_VALUE
if (!printProfileTimes(times, sprinter)) {
return;
}
printProfileTimes(times, sprinter);
JS::UniqueChars str = sprinter.release();
if (!str) {
@ -1775,7 +1773,7 @@ const char* Statistics::formatBudget(const SliceData& slice) {
}
/* static */
bool Statistics::printProfileTimes(const ProfileDurations& times,
void Statistics::printProfileTimes(const ProfileDurations& times,
Sprinter& sprinter) {
for (auto time : times) {
int64_t millis = int64_t(time.ToMilliseconds());
@ -1783,7 +1781,6 @@ bool Statistics::printProfileTimes(const ProfileDurations& times,
}
sprinter.put("\n");
return true;
}
constexpr size_t SliceMetadataFormatWidth() {
@ -1826,10 +1823,7 @@ void Statistics::printTotalProfileTimes() {
// totals that follow line up.
size_t width = SliceMetadataFormatWidth();
sprinter.jsprintf(" %-*s", int(width), formatTotalSlices());
if (!printProfileTimes(totalTimes_, sprinter)) {
return;
}
printProfileTimes(totalTimes_, sprinter);
JS::UniqueChars str = sprinter.release();
if (!str) {

View File

@ -497,7 +497,7 @@ struct Statistics {
const char* formatGCFlags(const SliceData& slice);
const char* formatBudget(const SliceData& slice);
const char* formatTotalSlices();
static bool printProfileTimes(const ProfileDurations& times,
static void printProfileTimes(const ProfileDurations& times,
Sprinter& sprinter);
};