Commit e6799023 authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

[cleanup] Add a name() helper to Space in heap

There is no point calling AllocationSpaceName manually every time. We
could get rid of AllocationSpaceName entirely, except that the
serializer calls it directly on ints that are casted to AllocationSpace
objects first.

Change-Id: I26b2181347dba960c8523d5dcecf8128208c59a2
Reviewed-on: https://chromium-review.googlesource.com/1107816Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53888}
parent a76ce4f8
......@@ -423,8 +423,7 @@ static void TraceFragmentation(PagedSpace* space) {
int number_of_pages = space->CountTotalPages();
intptr_t reserved = (number_of_pages * space->AreaSize());
intptr_t free = reserved - space->SizeOfObjects();
PrintF("[%s]: %d pages, %d (%.1f%%) free\n",
AllocationSpaceName(space->identity()), number_of_pages,
PrintF("[%s]: %d pages, %d (%.1f%%) free\n", space->name(), number_of_pages,
static_cast<int>(free), static_cast<double>(free) * 100 / reserved);
}
......@@ -712,9 +711,9 @@ void MarkCompactCollector::CollectEvacuationCandidates(PagedSpace* space) {
"fragmentation_limit_kb=%" PRIuS
" fragmentation_limit_percent=%d sum_compaction_kb=%zu "
"compaction_limit_kb=%zu\n",
AllocationSpaceName(space->identity()), free_bytes / KB,
free_bytes_threshold / KB, target_fragmentation_percent,
total_live_bytes / KB, max_evacuated_bytes / KB);
space->name(), free_bytes / KB, free_bytes_threshold / KB,
target_fragmentation_percent, total_live_bytes / KB,
max_evacuated_bytes / KB);
}
}
// How many pages we will allocated for the evacuated objects
......@@ -736,8 +735,8 @@ void MarkCompactCollector::CollectEvacuationCandidates(PagedSpace* space) {
PrintIsolate(isolate(),
"compaction-selection: space=%s reduce_memory=%d pages=%d "
"total_live_bytes=%zu\n",
AllocationSpaceName(space->identity()), reduce_memory,
candidate_count, total_live_bytes / KB);
space->name(), reduce_memory, candidate_count,
total_live_bytes / KB);
}
}
......@@ -3349,7 +3348,7 @@ void MarkCompactCollector::StartSweepSpace(PagedSpace* space) {
if (FLAG_gc_verbose) {
PrintIsolate(isolate(), "sweeping: space=%s initialized_for_sweeping=%d",
AllocationSpaceName(space->identity()), will_be_swept);
space->name(), will_be_swept);
}
}
......
......@@ -3515,7 +3515,7 @@ void LargeObjectSpace::Print() {
void Page::Print() {
// Make a best-effort to print the objects in the page.
PrintF("Page@%p in %s\n", reinterpret_cast<void*>(this->address()),
AllocationSpaceName(this->owner()->identity()));
this->owner()->name());
printf(" --------------------------------------\n");
HeapObjectIterator objects(this);
unsigned mark_size = 0;
......
......@@ -897,6 +897,8 @@ class Space : public Malloced {
// Identity used in error reporting.
AllocationSpace identity() { return id_; }
const char* name() { return AllocationSpaceName(id_); }
V8_EXPORT_PRIVATE virtual void AddAllocationObserver(
AllocationObserver* observer);
......
......@@ -59,7 +59,7 @@ static void DumpMaps(i::PagedSpace* space) {
STRUCT_LIST(STRUCT_LIST_CASE)
ALLOCATION_SITE_LIST(ALLOCATION_SITE_LIST_CASE)
if (n == NULL) continue;
const char* sname = AllocationSpaceName(space->identity());
const char* sname = space->name();
i::PrintF(" (\"%s\", 0x%05" V8PRIxPTR "): (%d, \"%s\"),\n", sname, p, t,
n);
}
......@@ -109,7 +109,7 @@ static int DumpHeapConstants(const char* argv0) {
// Code objects are generally platform-dependent.
if (s->identity() == i::CODE_SPACE || s->identity() == i::MAP_SPACE)
continue;
const char* sname = AllocationSpaceName(s->identity());
const char* sname = s->name();
for (i::Object* o = it.Next(); o != NULL; o = it.Next()) {
// Skip maps in RO_SPACE since they will be reported elsewhere.
if (o->IsMap()) continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment