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

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

Issue 2311963002: [heap,snapshot] Replace first page size from snapshots with page trimming (Closed)
Patch Set: Remove debugging print Created 4 years, 3 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/heap.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 <list> 8 #include <list>
9 #include <memory> 9 #include <memory>
10 #include <unordered_set> 10 #include <unordered_set>
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 810
811 bool is_anchor() { return IsFlagSet(Page::ANCHOR); } 811 bool is_anchor() { return IsFlagSet(Page::ANCHOR); }
812 812
813 intptr_t wasted_memory() { return wasted_memory_.Value(); } 813 intptr_t wasted_memory() { return wasted_memory_.Value(); }
814 void add_wasted_memory(intptr_t waste) { wasted_memory_.Increment(waste); } 814 void add_wasted_memory(intptr_t waste) { wasted_memory_.Increment(waste); }
815 intptr_t available_in_free_list() { return available_in_free_list_.Value(); } 815 intptr_t available_in_free_list() { return available_in_free_list_.Value(); }
816 void add_available_in_free_list(intptr_t available) { 816 void add_available_in_free_list(intptr_t available) {
817 available_in_free_list_.Increment(available); 817 available_in_free_list_.Increment(available);
818 } 818 }
819 819
820 size_t ShrinkToHighWaterMark();
821
820 #ifdef DEBUG 822 #ifdef DEBUG
821 void Print(); 823 void Print();
822 #endif // DEBUG 824 #endif // DEBUG
823 825
824 private: 826 private:
825 enum InitializationMode { kFreeMemory, kDoNotFreeMemory }; 827 enum InitializationMode { kFreeMemory, kDoNotFreeMemory };
826 828
827 template <InitializationMode mode = kFreeMemory> 829 template <InitializationMode mode = kFreeMemory>
828 static inline Page* Initialize(Heap* heap, MemoryChunk* chunk, 830 static inline Page* Initialize(Heap* heap, MemoryChunk* chunk,
829 Executability executable, PagedSpace* owner); 831 Executability executable, PagedSpace* owner);
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 void ReportStatistics(); 1300 void ReportStatistics();
1299 #endif 1301 #endif
1300 1302
1301 // Returns a MemoryChunk in which the memory region from commit_area_size to 1303 // Returns a MemoryChunk in which the memory region from commit_area_size to
1302 // reserve_area_size of the chunk area is reserved but not committed, it 1304 // reserve_area_size of the chunk area is reserved but not committed, it
1303 // could be committed later by calling MemoryChunk::CommitArea. 1305 // could be committed later by calling MemoryChunk::CommitArea.
1304 MemoryChunk* AllocateChunk(intptr_t reserve_area_size, 1306 MemoryChunk* AllocateChunk(intptr_t reserve_area_size,
1305 intptr_t commit_area_size, 1307 intptr_t commit_area_size,
1306 Executability executable, Space* space); 1308 Executability executable, Space* space);
1307 1309
1310 void ShrinkChunk(MemoryChunk* chunk, size_t bytes_to_shrink);
1311
1308 Address ReserveAlignedMemory(size_t requested, size_t alignment, 1312 Address ReserveAlignedMemory(size_t requested, size_t alignment,
1309 base::VirtualMemory* controller); 1313 base::VirtualMemory* controller);
1310 Address AllocateAlignedMemory(size_t reserve_size, size_t commit_size, 1314 Address AllocateAlignedMemory(size_t reserve_size, size_t commit_size,
1311 size_t alignment, Executability executable, 1315 size_t alignment, Executability executable,
1312 base::VirtualMemory* controller); 1316 base::VirtualMemory* controller);
1313 1317
1314 bool CommitMemory(Address addr, size_t size, Executability executable); 1318 bool CommitMemory(Address addr, size_t size, Executability executable);
1315 1319
1316 void FreeMemory(base::VirtualMemory* reservation, Executability executable); 1320 void FreeMemory(base::VirtualMemory* reservation, Executability executable);
1317 void PartialFreeMemory(MemoryChunk* chunk, Address start_free); 1321 void PartialFreeMemory(MemoryChunk* chunk, Address start_free);
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
2179 FreeList* free_list() { return &free_list_; } 2183 FreeList* free_list() { return &free_list_; }
2180 2184
2181 base::Mutex* mutex() { return &space_mutex_; } 2185 base::Mutex* mutex() { return &space_mutex_; }
2182 2186
2183 inline void UnlinkFreeListCategories(Page* page); 2187 inline void UnlinkFreeListCategories(Page* page);
2184 inline intptr_t RelinkFreeListCategories(Page* page); 2188 inline intptr_t RelinkFreeListCategories(Page* page);
2185 2189
2186 iterator begin() { return iterator(anchor_.next_page()); } 2190 iterator begin() { return iterator(anchor_.next_page()); }
2187 iterator end() { return iterator(&anchor_); } 2191 iterator end() { return iterator(&anchor_); }
2188 2192
2193 // Shrink immortal immovable pages of the space to be exactly the size needed
2194 // using the high water mark.
2195 void ShrinkImmortalImmovablePages();
2196
2189 protected: 2197 protected:
2190 // PagedSpaces that should be included in snapshots have different, i.e., 2198 // PagedSpaces that should be included in snapshots have different, i.e.,
2191 // smaller, initial pages. 2199 // smaller, initial pages.
2192 virtual bool snapshotable() { return true; } 2200 virtual bool snapshotable() { return true; }
2193 2201
2194 bool HasPages() { return anchor_.next_page() != &anchor_; } 2202 bool HasPages() { return anchor_.next_page() != &anchor_; }
2195 2203
2196 // Cleans up the space, frees all pages in this space except those belonging 2204 // Cleans up the space, frees all pages in this space except those belonging
2197 // to the initial chunk, uncommits addresses in the initial chunk. 2205 // to the initial chunk, uncommits addresses in the initial chunk.
2198 void TearDown(); 2206 void TearDown();
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
3031 count = 0; 3039 count = 0;
3032 } 3040 }
3033 // Must be small, since an iteration is used for lookup. 3041 // Must be small, since an iteration is used for lookup.
3034 static const int kMaxComments = 64; 3042 static const int kMaxComments = 64;
3035 }; 3043 };
3036 #endif 3044 #endif
3037 } // namespace internal 3045 } // namespace internal
3038 } // namespace v8 3046 } // namespace v8
3039 3047
3040 #endif // V8_HEAP_SPACES_H_ 3048 #endif // V8_HEAP_SPACES_H_
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698