Chromium Code Reviews| Index: src/heap/spaces.h |
| diff --git a/src/heap/spaces.h b/src/heap/spaces.h |
| index b635f4f2efcace5b4493c9527b7f263d36619b8f..0dd2a94cbbf3292026355e1d573620b8bf0afe14 100644 |
| --- a/src/heap/spaces.h |
| +++ b/src/heap/spaces.h |
| @@ -841,6 +841,15 @@ class Space : public Malloced { |
| // (e.g. see LargeObjectSpace). |
| virtual intptr_t SizeOfObjects() { return Size(); } |
| + // Return the total amount of memory committed for new space. |
| + virtual intptr_t CommittedMemory() = 0; |
| + |
| + // Approximate amount of physical memory committed for this space. |
| + virtual size_t CommittedPhysicalMemory() = 0; |
| + |
| + // Return the available bytes without growing. |
| + virtual intptr_t Available() = 0; |
| + |
| virtual int RoundSizeDownToObjectAlignment(int size) { |
| if (id_ == CODE_SPACE) { |
| return RoundDown(size, kCodeAlignment); |
| @@ -1682,13 +1691,13 @@ class PagedSpace : public Space { |
| // Total amount of memory committed for this space. For paged |
| // spaces this equals the capacity. |
| - intptr_t CommittedMemory() { return Capacity(); } |
| + intptr_t CommittedMemory() override { 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(); |
| + size_t CommittedPhysicalMemory() override; |
| struct SizeStats { |
| intptr_t Total() { |
| @@ -1723,17 +1732,17 @@ class PagedSpace : public Space { |
| // The bytes in the linear allocation area are not included in this total |
| // because updating the stats would slow down allocation. New pages are |
| // immediately added to the free list so they show up here. |
| - intptr_t Available() { return free_list_.available(); } |
| + intptr_t Available() override { return free_list_.available(); } |
| // Allocated bytes in this space. Garbage bytes that were not found due to |
| // concurrent sweeping are counted as being allocated! The bytes in the |
| // current linear allocation area (between top and limit) are also counted |
| // here. |
| - virtual intptr_t Size() { return accounting_stats_.Size(); } |
| + virtual intptr_t Size() override { return accounting_stats_.Size(); } |
|
rmcilroy
2015/04/16 13:49:05
Only one of 'virtual' or 'override' [1], so in thi
ssid
2015/04/16 16:40:29
Thanks, done.
|
| // As size, but the bytes in lazily swept pages are estimated and the bytes |
| // in the current linear allocation area are not included. |
| - virtual intptr_t SizeOfObjects(); |
| + virtual intptr_t SizeOfObjects() override; |
| // Wasted bytes in this space. These are just the bytes that were thrown away |
| // due to being too small to use for allocation. They do not include the |
| @@ -1808,7 +1817,7 @@ class PagedSpace : public Space { |
| #ifdef DEBUG |
| // Print meta info and objects in this space. |
| - virtual void Print(); |
| + virtual void Print() override; |
| // Reports statistics for the space |
| void ReportStatistics(); |
| @@ -2133,12 +2142,26 @@ class SemiSpace : public Space { |
| } |
| // If we don't have these here then SemiSpace will be abstract. However |
| - // they should never be called. |
| - virtual intptr_t Size() { |
| + // they should never be called: |
| + |
| + virtual intptr_t Size() override { |
| UNREACHABLE(); |
| return 0; |
| } |
| + virtual intptr_t SizeOfObjects() override { return Size(); } |
| + |
| + virtual intptr_t CommittedMemory() override { |
| + UNREACHABLE(); |
| + return 0; |
| + } |
| + |
| + virtual intptr_t Available() override { |
| + UNREACHABLE(); |
| + return 0; |
| + } |
| + |
| + |
| bool is_committed() { return committed_; } |
| bool Commit(); |
| bool Uncommit(); |
| @@ -2151,7 +2174,7 @@ class SemiSpace : public Space { |
| #endif |
| #ifdef DEBUG |
| - virtual void Print(); |
| + virtual void Print() override; |
|
rmcilroy
2015/04/16 13:49:05
I don't think you intended to change this.
ssid
2015/04/16 16:40:29
This was needed to maintain consistency in the fil
|
| // Validate a range of of addresses in a SemiSpace. |
| // The "from" address must be on a page prior to the "to" address, |
| // in the linked page order, or it must be earlier on the same page. |
| @@ -2181,7 +2204,7 @@ class SemiSpace : public Space { |
| size_t MaximumCommittedMemory() { return maximum_committed_; } |
| // Approximate amount of physical memory committed for this space. |
| - size_t CommittedPhysicalMemory(); |
| + size_t CommittedPhysicalMemory() override; |
| private: |
| // Flips the semispace between being from-space and to-space. |
| @@ -2360,7 +2383,7 @@ class NewSpace : public Space { |
| } |
| // Return the allocated bytes in the active semispace. |
| - virtual intptr_t Size() { |
| + virtual intptr_t Size() override { |
| return pages_used_ * NewSpacePage::kAreaSize + |
| static_cast<int>(top() - to_space_.page_low()); |
| } |
| @@ -2385,7 +2408,7 @@ class NewSpace : public Space { |
| } |
| // Return the total amount of memory committed for new space. |
| - intptr_t CommittedMemory() { |
| + intptr_t CommittedMemory() override { |
| if (from_space_.is_committed()) return 2 * Capacity(); |
| return TotalCapacity(); |
| } |
| @@ -2397,10 +2420,10 @@ class NewSpace : public Space { |
| } |
| // Approximate amount of physical memory committed for this space. |
| - size_t CommittedPhysicalMemory(); |
| + size_t CommittedPhysicalMemory() override; |
| // Return the available bytes without growing. |
| - intptr_t Available() { return Capacity() - Size(); } |
| + intptr_t Available() override { return Capacity() - Size(); } |
| // Return the maximum capacity of a semispace. |
| int MaximumCapacity() { |
| @@ -2517,7 +2540,7 @@ class NewSpace : public Space { |
| #ifdef DEBUG |
| // Print the active semispace. |
| - virtual void Print() { to_space_.Print(); } |
| + virtual void Print() override { to_space_.Print(); } |
| #endif |
| // Iterates the active semispace to collect statistics. |
| @@ -2688,18 +2711,18 @@ class LargeObjectSpace : public Space { |
| bool CanAllocateSize(int size) { return Size() + size <= max_capacity_; } |
| // Available bytes for objects in this space. |
| - inline intptr_t Available(); |
| + inline intptr_t Available() override; |
| - virtual intptr_t Size() { return size_; } |
| + virtual intptr_t Size() override { return size_; } |
| - virtual intptr_t SizeOfObjects() { return objects_size_; } |
| + virtual intptr_t SizeOfObjects() override { return objects_size_; } |
| intptr_t MaximumCommittedMemory() { return maximum_committed_; } |
| - intptr_t CommittedMemory() { return Size(); } |
| + intptr_t CommittedMemory() override { return Size(); } |
| // Approximate amount of physical memory committed for this space. |
| - size_t CommittedPhysicalMemory(); |
| + size_t CommittedPhysicalMemory() override; |
| int PageCount() { return page_count_; } |