Commit 3f84955b authored by Hannes Payer's avatar Hannes Payer Committed by Commit Bot

[heap] Add accounting for committed memory of the Unmapper.

Change-Id: I26c2ba8d22aecac0e1d6a406eb90521ff52e1ec4
Reviewed-on: https://chromium-review.googlesource.com/1097119
Commit-Queue: Hannes Payer <hpayer@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53689}
parent 7ebbda48
......@@ -290,6 +290,13 @@ size_t Heap::CommittedOldGenerationMemory() {
return total + lo_space_->Size();
}
size_t Heap::CommittedMemoryOfHeapAndUnmapper() {
if (!HasBeenSetUp()) return 0;
return CommittedMemory() +
memory_allocator()->unmapper()->CommittedBufferedMemory();
}
size_t Heap::CommittedMemory() {
if (!HasBeenSetUp()) return 0;
......@@ -439,6 +446,10 @@ void Heap::PrintShortHeapStatistics() {
", committed: %6" PRIuS " KB\n",
lo_space_->SizeOfObjects() / KB, lo_space_->Available() / KB,
lo_space_->CommittedMemory() / KB);
PrintIsolate(isolate_,
"Unmapper buffering %d chunks of committed: %6" PRIuS " KB\n",
memory_allocator()->unmapper()->NumberOfChunks(),
CommittedMemoryOfHeapAndUnmapper() / KB);
PrintIsolate(isolate_, "All spaces, used: %6" PRIuS
" KB"
", available: %6" PRIuS
......
......@@ -1451,6 +1451,10 @@ class Heap {
// Returns the capacity of the old generation.
size_t OldGenerationCapacity();
// Returns the amount of memory currently committed for the heap and memory
// held alive by the unmapper.
size_t CommittedMemoryOfHeapAndUnmapper();
// Returns the amount of memory currently committed for the heap.
size_t CommittedMemory();
......
......@@ -439,6 +439,21 @@ int MemoryAllocator::Unmapper::NumberOfChunks() {
return static_cast<int>(result);
}
size_t MemoryAllocator::Unmapper::CommittedBufferedMemory() {
base::LockGuard<base::Mutex> guard(&mutex_);
size_t sum = 0;
// kPooled chunks are already uncommited. We only have to account for
// kRegular and kNonRegular chunks.
for (auto& chunk : chunks_[kRegular]) {
sum += chunk->size();
}
for (auto& chunk : chunks_[kNonRegular]) {
sum += chunk->size();
}
return sum;
}
bool MemoryAllocator::CommitMemory(Address base, size_t size) {
if (!SetPermissions(base, size, PageAllocator::kReadWrite)) {
return false;
......
......@@ -1210,6 +1210,7 @@ class V8_EXPORT_PRIVATE MemoryAllocator {
void EnsureUnmappingCompleted();
void TearDown();
int NumberOfChunks();
size_t CommittedBufferedMemory();
private:
static const int kReservedQueueingSlots = 64;
......
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