Chromium Code Reviews| Index: src/spaces.h |
| diff --git a/src/spaces.h b/src/spaces.h |
| index 6144c95d14d689876dc2008c5c506ecfd37faa51..b36a2039f955c8baf7a3d98e587a38d4f6e0b47c 100644 |
| --- a/src/spaces.h |
| +++ b/src/spaces.h |
| @@ -1353,6 +1353,7 @@ class AllocationStats BASE_EMBEDDED { |
| // Zero out all the allocation statistics (i.e., no capacity). |
| void Clear() { |
| capacity_ = 0; |
| + max_capacity_ = 0; |
| size_ = 0; |
| waste_ = 0; |
| } |
| @@ -1371,6 +1372,7 @@ class AllocationStats BASE_EMBEDDED { |
| // Accessors for the allocation statistics. |
| intptr_t Capacity() { return capacity_; } |
| + intptr_t MaxCapacity() { return max_capacity_; } |
| intptr_t Size() { return size_; } |
| intptr_t Waste() { return waste_; } |
| @@ -1380,6 +1382,9 @@ class AllocationStats BASE_EMBEDDED { |
| void ExpandSpace(int size_in_bytes) { |
| capacity_ += size_in_bytes; |
| size_ += size_in_bytes; |
| + if (capacity_ > max_capacity_) { |
| + max_capacity_ = capacity_; |
| + } |
| ASSERT(size_ >= 0); |
| } |
| @@ -1413,6 +1418,7 @@ class AllocationStats BASE_EMBEDDED { |
| private: |
| intptr_t capacity_; |
| + intptr_t max_capacity_; |
| intptr_t size_; |
| intptr_t waste_; |
| }; |
| @@ -1654,6 +1660,9 @@ class PagedSpace : public Space { |
| // spaces this equals the capacity. |
| intptr_t CommittedMemory() { return Capacity(); } |
| + // The maximum amount of memory ever committed for this space. |
| + intptr_t MaximumCommittedMemory() { return accounting_stats_.MaxCapacity(); } |
| + |
| // Approximate amount of physical memory committed for this space. |
| size_t CommittedPhysicalMemory(); |
| @@ -1754,9 +1763,7 @@ class PagedSpace : public Space { |
| accounting_stats_.AllocateBytes(bytes); |
| } |
| - void IncreaseCapacity(int size) { |
| - accounting_stats_.ExpandSpace(size); |
| - } |
| + void IncreaseCapacity(int size); |
| // Releases an unused page and shrinks the space. |
| void ReleasePage(Page* page, bool unlink); |
| @@ -2166,6 +2173,9 @@ class SemiSpace : public Space { |
| static void Swap(SemiSpace* from, SemiSpace* to); |
| + // Returns the maximum amount of memory ever committed by the semi space. |
| + size_t MaximumCommittedMemory() { return maximum_committed_; } |
| + |
| // Approximate amount of physical memory committed for this space. |
| size_t CommittedPhysicalMemory(); |
| @@ -2181,6 +2191,8 @@ class SemiSpace : public Space { |
| int maximum_capacity_; |
| int initial_capacity_; |
| + intptr_t maximum_committed_; |
| + |
| // The start address of the space. |
| Address start_; |
| // Used to govern object promotion during mark-compact collection. |
| @@ -2366,6 +2378,13 @@ class NewSpace : public Space { |
| return Capacity(); |
| } |
| + // Return the total amount of memory committed for new space. |
| + intptr_t MaximumCommittedMemory() { |
| + ASSERT(to_space_.MaximumCommittedMemory() == |
| + from_space_.MaximumCommittedMemory()); |
|
Benedikt Meurer
2013/10/22 11:44:10
Nit: indentation
rmcilroy
2013/10/23 14:40:23
Done.
|
| + return 2 * to_space_.MaximumCommittedMemory(); |
| + } |
| + |
| // Approximate amount of physical memory committed for this space. |
| size_t CommittedPhysicalMemory(); |
| @@ -2748,6 +2767,10 @@ class LargeObjectSpace : public Space { |
| return objects_size_; |
| } |
| + intptr_t MaximumCommittedMemory() { |
| + return maximum_committed_; |
| + } |
| + |
| intptr_t CommittedMemory() { |
| return Size(); |
| } |
| @@ -2799,6 +2822,7 @@ class LargeObjectSpace : public Space { |
| private: |
| intptr_t max_capacity_; |
| + intptr_t maximum_committed_; |
| // The head of the linked list of large object chunks. |
| LargePage* first_page_; |
| intptr_t size_; // allocated bytes |