Index: src/spaces.cc |
diff --git a/src/spaces.cc b/src/spaces.cc |
index ce62877dfab6d9a97af317430c5e750939046db3..e9885f4d854d79a30fa0d08f0ac4cb073b42d03c 100644 |
--- a/src/spaces.cc |
+++ b/src/spaces.cc |
@@ -487,6 +487,18 @@ void MemoryChunk::Unlink() { |
} |
+size_t MemoryChunk::CommittedPhysicalMemory() { |
+ size_t physical; |
+ size_t size = area_size(); |
+ if (VirtualMemory::CommittedPhysicalSizeInRegion( |
+ area_start_, size, &physical)) { |
+ return physical; |
+ } else { |
+ return size; |
+ } |
+} |
+ |
+ |
MemoryChunk* MemoryAllocator::AllocateChunk(intptr_t body_size, |
Executability executable, |
Space* owner) { |
@@ -819,6 +831,16 @@ void PagedSpace::TearDown() { |
} |
+size_t PagedSpace::CommittedPhysicalMemory() { |
+ size_t size = 0; |
+ PageIterator it(this); |
+ while (it.has_next()) { |
+ size += it.next()->CommittedPhysicalMemory(); |
+ } |
+ return size; |
+} |
+ |
+ |
MaybeObject* PagedSpace::FindObject(Address addr) { |
// Note: this function can only be called on precisely swept spaces. |
ASSERT(!heap()->mark_compact_collector()->in_use()); |
@@ -1384,6 +1406,17 @@ bool SemiSpace::Uncommit() { |
} |
+size_t SemiSpace::CommittedPhysicalMemory() { |
+ if (!is_committed()) return 0; |
+ size_t size = 0; |
+ NewSpacePageIterator it(this); |
+ while (it.has_next()) { |
+ size += it.next()->CommittedPhysicalMemory(); |
+ } |
+ return size; |
+} |
+ |
+ |
bool SemiSpace::GrowTo(int new_capacity) { |
if (!is_committed()) { |
if (!Commit()) return false; |
@@ -2690,6 +2723,17 @@ MaybeObject* LargeObjectSpace::AllocateRaw(int object_size, |
} |
+size_t LargeObjectSpace::CommittedPhysicalMemory() { |
+ size_t size = 0; |
+ LargePage* current = first_page_; |
+ while (current != NULL) { |
+ size += current->CommittedPhysicalMemory(); |
+ current = current->next_page(); |
+ } |
+ return size; |
+} |
+ |
+ |
// GC support |
MaybeObject* LargeObjectSpace::FindObject(Address a) { |
LargePage* page = FindPage(a); |