Index: src/spaces.cc |
diff --git a/src/spaces.cc b/src/spaces.cc |
index bc1d7b09ccaa97751c50e1083c3067340a1a93ab..d8d92efa86402e8176fcfead4b16d9e3feef83fe 100644 |
--- a/src/spaces.cc |
+++ b/src/spaces.cc |
@@ -448,6 +448,7 @@ MemoryChunk* MemoryChunk::Initialize(Heap* heap, |
chunk->slots_buffer_ = NULL; |
chunk->skip_list_ = NULL; |
chunk->write_barrier_counter_ = kWriteBarrierCounterGranularity; |
+ chunk->high_water_mark_ = area_start - base; |
chunk->ResetLiveBytes(); |
Bitmap::Clear(chunk); |
chunk->initialize_scan_on_scavenge(false); |
@@ -820,6 +821,18 @@ void PagedSpace::TearDown() { |
} |
+size_t PagedSpace::CommittedPhysicalMemory() { |
+ if (!VirtualMemory::HasLazyCommits()) return CommittedMemory(); |
+ MemoryChunk::UpdateHighWaterMark(allocation_info_.top); |
+ 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()); |
@@ -1173,6 +1186,7 @@ void NewSpace::Shrink() { |
void NewSpace::UpdateAllocationInfo() { |
+ MemoryChunk::UpdateHighWaterMark(allocation_info_.top); |
allocation_info_.top = to_space_.page_low(); |
allocation_info_.limit = to_space_.page_high(); |
@@ -1385,6 +1399,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; |
@@ -1817,6 +1842,17 @@ void NewSpace::RecordPromotion(HeapObject* obj) { |
promoted_histogram_[type].increment_bytes(obj->Size()); |
} |
+ |
+size_t NewSpace::CommittedPhysicalMemory() { |
+ if (!VirtualMemory::HasLazyCommits()) return CommittedMemory(); |
+ MemoryChunk::UpdateHighWaterMark(allocation_info_.top); |
+ size_t size = to_space_.CommittedPhysicalMemory(); |
+ if (from_space_.is_committed()) { |
+ size += from_space_.CommittedPhysicalMemory(); |
+ } |
+ return size; |
+} |
+ |
// ----------------------------------------------------------------------------- |
// Free lists for old object spaces implementation |
@@ -2691,6 +2727,18 @@ MaybeObject* LargeObjectSpace::AllocateRaw(int object_size, |
} |
+size_t LargeObjectSpace::CommittedPhysicalMemory() { |
+ if (!VirtualMemory::HasLazyCommits()) return CommittedMemory(); |
+ 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); |