| Index: src/heap/spaces.h
|
| diff --git a/src/heap/spaces.h b/src/heap/spaces.h
|
| index b8fc9b7efe0845d4852b6660c8465abdda18f115..9a9a9a739511d8e7b9e38c337bb08ba90f41fad2 100644
|
| --- a/src/heap/spaces.h
|
| +++ b/src/heap/spaces.h
|
| @@ -1694,6 +1694,8 @@ class FreeList {
|
| PagedSpace* owner() { return owner_; }
|
|
|
| private:
|
| + enum FreeListCategoryType { kSmall, kMedium, kLarge, kHuge };
|
| +
|
| // The size range of blocks, in bytes.
|
| static const int kMinBlockSize = 3 * kPointerSize;
|
| static const int kMaxBlockSize = Page::kMaxRegularHeapObjectSize;
|
| @@ -1707,6 +1709,27 @@ class FreeList {
|
| static const int kLargeAllocationMax = kMediumListMax;
|
|
|
| FreeSpace* FindNodeFor(int size_in_bytes, int* node_size);
|
| + FreeSpace* FindNodeIn(FreeListCategoryType category, int* node_size);
|
| +
|
| + FreeListCategory* GetFreeListCategory(FreeListCategoryType category) {
|
| + switch (category) {
|
| + case kSmall:
|
| + return &small_list_;
|
| + case kMedium:
|
| + return &medium_list_;
|
| + case kLarge:
|
| + return &large_list_;
|
| + case kHuge:
|
| + return &huge_list_;
|
| + default:
|
| + UNREACHABLE();
|
| + }
|
| + UNREACHABLE();
|
| + return nullptr;
|
| + }
|
| +
|
| + void UpdateFragmentationStats(FreeListCategoryType category, Address address,
|
| + int size);
|
|
|
| PagedSpace* owner_;
|
| Heap* heap_;
|
| @@ -1715,6 +1738,8 @@ class FreeList {
|
| FreeListCategory large_list_;
|
| FreeListCategory huge_list_;
|
|
|
| + friend class PagedSpace;
|
| +
|
| DISALLOW_IMPLICIT_CONSTRUCTORS(FreeList);
|
| };
|
|
|
| @@ -1997,6 +2022,22 @@ class PagedSpace : public Space {
|
|
|
| virtual bool is_local() { return false; }
|
|
|
| + // Divide {this} free lists up among {other_free_lists} up to some certain
|
| + // {limit} of bytes. Note that this operation eventually needs to iterate
|
| + // over nodes one-by-one, making it a potentially slow operation.
|
| + void DivideFreeLists(FreeList** other_free_lists, int num, intptr_t limit);
|
| +
|
| + // Adds memory starting at {start} of {size_in_bytes} to the space.
|
| + void AddMemory(Address start, int size_in_bytes) {
|
| + IncreaseCapacity(size_in_bytes);
|
| + Free(start, size_in_bytes);
|
| + }
|
| +
|
| + // Tries to remove some memory from {this} free lists. We try to remove
|
| + // as much memory as possible, i.e., we check the free lists from huge
|
| + // to small.
|
| + FreeSpace* TryRemoveMemory();
|
| +
|
| protected:
|
| // PagedSpaces that should be included in snapshots have different, i.e.,
|
| // smaller, initial pages.
|
| @@ -2744,12 +2785,6 @@ class CompactionSpace : public PagedSpace {
|
| CompactionSpace(Heap* heap, AllocationSpace id, Executability executable)
|
| : PagedSpace(heap, id, executable) {}
|
|
|
| - // Adds external memory starting at {start} of {size_in_bytes} to the space.
|
| - void AddExternalMemory(Address start, int size_in_bytes) {
|
| - IncreaseCapacity(size_in_bytes);
|
| - Free(start, size_in_bytes);
|
| - }
|
| -
|
| virtual bool is_local() { return true; }
|
|
|
| protected:
|
|
|