Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(998)

Side by Side Diff: src/heap/spaces.h

Issue 1653973003: [heap] Simplify distribution of remaining memory during sweeping & compaction (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove tests for dead code Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/heap/spaces.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HEAP_SPACES_H_ 5 #ifndef V8_HEAP_SPACES_H_
6 #define V8_HEAP_SPACES_H_ 6 #define V8_HEAP_SPACES_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/atomic-utils.h" 9 #include "src/atomic-utils.h"
10 #include "src/base/atomicops.h" 10 #include "src/base/atomicops.h"
(...skipping 2101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2112 2112
2113 // Return size of allocatable area on a page in this space. 2113 // Return size of allocatable area on a page in this space.
2114 inline int AreaSize() { return area_size_; } 2114 inline int AreaSize() { return area_size_; }
2115 2115
2116 virtual bool is_local() { return false; } 2116 virtual bool is_local() { return false; }
2117 2117
2118 // Merges {other} into the current space. Note that this modifies {other}, 2118 // Merges {other} into the current space. Note that this modifies {other},
2119 // e.g., removes its bump pointer area and resets statistics. 2119 // e.g., removes its bump pointer area and resets statistics.
2120 void MergeCompactionSpace(CompactionSpace* other); 2120 void MergeCompactionSpace(CompactionSpace* other);
2121 2121
2122 void DivideUponCompactionSpaces(CompactionSpaceCollection** other, int num,
2123 intptr_t limit = kCompactionMemoryWanted);
2124
2125 // Refills the free list from the corresponding free list filled by the 2122 // Refills the free list from the corresponding free list filled by the
2126 // sweeper. 2123 // sweeper.
2127 virtual void RefillFreeList(); 2124 virtual void RefillFreeList();
2128 2125
2129 protected: 2126 protected:
2130 void AddMemory(Address start, intptr_t size); 2127 void AddMemory(Address start, intptr_t size);
2131 2128
2132 FreeSpace* TryRemoveMemory(intptr_t size_in_bytes);
2133
2134 void MoveOverFreeMemory(PagedSpace* other); 2129 void MoveOverFreeMemory(PagedSpace* other);
2135 2130
2136 // PagedSpaces that should be included in snapshots have different, i.e., 2131 // PagedSpaces that should be included in snapshots have different, i.e.,
2137 // smaller, initial pages. 2132 // smaller, initial pages.
2138 virtual bool snapshotable() { return true; } 2133 virtual bool snapshotable() { return true; }
2139 2134
2140 FreeList* free_list() { return &free_list_; } 2135 FreeList* free_list() { return &free_list_; }
2141 2136
2142 bool HasPages() { return anchor_.next_page() != &anchor_; } 2137 bool HasPages() { return anchor_.next_page() != &anchor_; }
2143 2138
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
2886 }; 2881 };
2887 2882
2888 // ----------------------------------------------------------------------------- 2883 // -----------------------------------------------------------------------------
2889 // Compaction space that is used temporarily during compaction. 2884 // Compaction space that is used temporarily during compaction.
2890 2885
2891 class CompactionSpace : public PagedSpace { 2886 class CompactionSpace : public PagedSpace {
2892 public: 2887 public:
2893 CompactionSpace(Heap* heap, AllocationSpace id, Executability executable) 2888 CompactionSpace(Heap* heap, AllocationSpace id, Executability executable)
2894 : PagedSpace(heap, id, executable) {} 2889 : PagedSpace(heap, id, executable) {}
2895 2890
2896 // Adds external memory starting at {start} of {size_in_bytes} to the space.
2897 void AddExternalMemory(Address start, int size_in_bytes) {
2898 IncreaseCapacity(size_in_bytes);
2899 Free(start, size_in_bytes);
2900 }
2901
2902 bool is_local() override { return true; } 2891 bool is_local() override { return true; }
2903 2892
2904 void RefillFreeList() override; 2893 void RefillFreeList() override;
2905 2894
2906 protected: 2895 protected:
2907 // The space is temporary and not included in any snapshots. 2896 // The space is temporary and not included in any snapshots.
2908 bool snapshotable() override { return false; } 2897 bool snapshotable() override { return false; }
2909 2898
2910 MUST_USE_RESULT HeapObject* SweepAndRetryAllocation( 2899 MUST_USE_RESULT HeapObject* SweepAndRetryAllocation(
2911 int size_in_bytes) override; 2900 int size_in_bytes) override;
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
3128 count = 0; 3117 count = 0;
3129 } 3118 }
3130 // Must be small, since an iteration is used for lookup. 3119 // Must be small, since an iteration is used for lookup.
3131 static const int kMaxComments = 64; 3120 static const int kMaxComments = 64;
3132 }; 3121 };
3133 #endif 3122 #endif
3134 } // namespace internal 3123 } // namespace internal
3135 } // namespace v8 3124 } // namespace v8
3136 3125
3137 #endif // V8_HEAP_SPACES_H_ 3126 #endif // V8_HEAP_SPACES_H_
OLDNEW
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/heap/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698