Chromium Code Reviews| Index: src/heap/spaces.h |
| diff --git a/src/heap/spaces.h b/src/heap/spaces.h |
| index 69a8d89fccba5c5aa06f91d2a1995870b70ef033..f6da3c81533d25e6d27348283ed6f1d9f856b226 100644 |
| --- a/src/heap/spaces.h |
| +++ b/src/heap/spaces.h |
| @@ -19,6 +19,7 @@ |
| namespace v8 { |
| namespace internal { |
| +class CompactionSpaceCollection; |
| class Isolate; |
| // ----------------------------------------------------------------------------- |
| @@ -1726,6 +1727,14 @@ class FreeList { |
| // The size should be a non-zero multiple of the word size. |
| MUST_USE_RESULT HeapObject* Allocate(int size_in_bytes); |
| + // The method tries to find a {FreeSpace} node of at least {size_in_bytes} |
| + // size in the appropriate free list category. If no suitable node could be |
|
Hannes Payer (out of office)
2015/10/12 16:38:25
What is appropriate?
Michael Lippautz
2015/10/12 17:16:46
Done.
|
| + // found, the method falls back to retrieving a {FreeSpace} not from the |
| + // large or huge free list category. |
| + // |
| + // Can be used concurrently. |
| + MUST_USE_RESULT FreeSpace* TryRemoveMemory(intptr_t hint_size_in_bytes); |
| + |
| bool IsEmpty() { |
| return small_list_.IsEmpty() && medium_list_.IsEmpty() && |
| large_list_.IsEmpty() && huge_list_.IsEmpty(); |
| @@ -1780,7 +1789,6 @@ class FreeList { |
| return nullptr; |
| } |
| - |
| PagedSpace* owner_; |
| Heap* heap_; |
| base::Mutex mutex_; |
| @@ -1839,6 +1847,8 @@ STATIC_ASSERT(sizeof(AllocationResult) == kPointerSize); |
| class PagedSpace : public Space { |
| public: |
| + static const intptr_t kCompactionMemoryWanted = 500 * KB; |
| + |
| // Creates a space with an id. |
| PagedSpace(Heap* heap, AllocationSpace id, Executability executable); |
| @@ -2040,15 +2050,26 @@ class PagedSpace : public Space { |
| // Return size of allocatable area on a page in this space. |
| inline int AreaSize() { return area_size_; } |
| + virtual bool is_local() { return false; } |
| + |
| // Merges {other} into the current space. Note that this modifies {other}, |
| // e.g., removes its bump pointer area and resets statistics. |
| void MergeCompactionSpace(CompactionSpace* other); |
| - void MoveOverFreeMemory(PagedSpace* other); |
| + void DivideUponCompactionSpaces(CompactionSpaceCollection** other, int num, |
| + intptr_t limit = kCompactionMemoryWanted); |
| - virtual bool is_local() { return false; } |
| + // Refills the free list from the corresponding free list filled by the |
| + // sweeper. |
| + virtual void RefillFreeList(); |
| protected: |
| + void AddMemory(Address start, intptr_t size); |
| + |
| + FreeSpace* TryRemoveMemory(intptr_t size_in_bytes); |
| + |
| + void MoveOverFreeMemory(PagedSpace* other); |
| + |
| // PagedSpaces that should be included in snapshots have different, i.e., |
| // smaller, initial pages. |
| virtual bool snapshotable() { return true; } |
| @@ -2109,6 +2130,9 @@ class PagedSpace : public Space { |
| friend class MarkCompactCollector; |
| friend class PageIterator; |
| + |
| + // Used in cctest. |
| + friend class HeapTester; |
| }; |
| @@ -2786,11 +2810,13 @@ class CompactionSpace : public PagedSpace { |
| Free(start, size_in_bytes); |
| } |
| - virtual bool is_local() { return true; } |
| + virtual bool is_local() override { return true; } |
| + |
| + virtual void RefillFreeList() override; |
| protected: |
| // The space is temporary and not included in any snapshots. |
| - virtual bool snapshotable() { return false; } |
| + virtual bool snapshotable() override { return false; } |
| }; |