Index: src/spaces.cc |
diff --git a/src/spaces.cc b/src/spaces.cc |
index ce62877dfab6d9a97af317430c5e750939046db3..2c1de1bb5bf13fa3c9f903c297d37a37ae3a4bfe 100644 |
--- a/src/spaces.cc |
+++ b/src/spaces.cc |
@@ -447,6 +447,7 @@ MemoryChunk* MemoryChunk::Initialize(Heap* heap, |
chunk->InitializeReservedMemory(); |
chunk->slots_buffer_ = NULL; |
chunk->skip_list_ = NULL; |
+ chunk->high_water_mark_ = area_start - base; |
chunk->ResetLiveBytes(); |
Bitmap::Clear(chunk); |
chunk->initialize_scan_on_scavenge(false); |
@@ -819,6 +820,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()); |
@@ -866,6 +879,7 @@ bool PagedSpace::Expand() { |
ASSERT(Capacity() <= max_capacity_); |
p->InsertAfter(anchor_.prev_page()); |
+ MemoryChunk::UpdateHighWaterMark(allocation_info_.top); |
Michael Starzinger
2012/10/16 13:01:06
This function is called by PagedSpace::SlowAllocat
alph
2012/10/16 13:44:41
Done.
|
return true; |
} |
@@ -1125,6 +1139,7 @@ void NewSpace::TearDown() { |
void NewSpace::Flip() { |
+ MemoryChunk::UpdateHighWaterMark(allocation_info_.top); |
Michael Starzinger
2012/10/16 13:01:06
I think this one is better bottle-necked in NewSpa
alph
2012/10/16 13:44:41
Done.
|
SemiSpace::Swap(&from_space_, &to_space_); |
} |
@@ -1209,6 +1224,7 @@ bool NewSpace::AddFreshPage() { |
// from happening (all such allocations should go directly to LOSpace). |
return false; |
} |
+ MemoryChunk::UpdateHighWaterMark(allocation_info_.top); |
Michael Starzinger
2012/10/16 13:01:06
This one will also be covered by NewSpace::UpdateA
alph
2012/10/16 13:44:41
Done.
|
if (!to_space_.AdvancePage()) { |
// Failed to get a new page in to-space. |
return false; |
@@ -1384,6 +1400,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; |
@@ -1816,6 +1843,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 |
@@ -2690,6 +2728,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); |