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

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

Issue 1596343004: [heap] Sort sweep pages list by free memory. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed compilation Created 4 years, 11 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-inl.h ('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 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 return !p->IsEvacuationCandidate() && 2109 return !p->IsEvacuationCandidate() &&
2110 !p->IsFlagSet(Page::RESCAN_ON_EVACUATION) && !p->WasSwept(); 2110 !p->IsFlagSet(Page::RESCAN_ON_EVACUATION) && !p->WasSwept();
2111 } 2111 }
2112 2112
2113 // This function tries to steal size_in_bytes memory from the sweeper threads 2113 // This function tries to steal size_in_bytes memory from the sweeper threads
2114 // free-lists. If it does not succeed stealing enough memory, it will wait 2114 // free-lists. If it does not succeed stealing enough memory, it will wait
2115 // for the sweeper threads to finish sweeping. 2115 // for the sweeper threads to finish sweeping.
2116 // It returns true when sweeping is completed and false otherwise. 2116 // It returns true when sweeping is completed and false otherwise.
2117 bool EnsureSweeperProgress(intptr_t size_in_bytes); 2117 bool EnsureSweeperProgress(intptr_t size_in_bytes);
2118 2118
2119 void set_end_of_unswept_pages(Page* page) { end_of_unswept_pages_ = page; }
2120
2121 Page* end_of_unswept_pages() { return end_of_unswept_pages_; }
2122
2123 Page* FirstPage() { return anchor_.next_page(); } 2119 Page* FirstPage() { return anchor_.next_page(); }
2124 Page* LastPage() { return anchor_.prev_page(); } 2120 Page* LastPage() { return anchor_.prev_page(); }
2125 2121
2126 void EvictEvacuationCandidatesFromLinearAllocationArea(); 2122 void EvictEvacuationCandidatesFromLinearAllocationArea();
2127 2123
2128 bool CanExpand(size_t size); 2124 bool CanExpand(size_t size);
2129 2125
2130 // Returns the number of total pages in this space. 2126 // Returns the number of total pages in this space.
2131 int CountTotalPages(); 2127 int CountTotalPages();
2132 2128
2133 // Return size of allocatable area on a page in this space. 2129 // Return size of allocatable area on a page in this space.
2134 inline int AreaSize() { return area_size_; } 2130 inline int AreaSize() { return area_size_; }
2135 2131
2136 virtual bool is_local() { return false; } 2132 virtual bool is_local() { return false; }
2137 2133
2138 // Merges {other} into the current space. Note that this modifies {other}, 2134 // Merges {other} into the current space. Note that this modifies {other},
2139 // e.g., removes its bump pointer area and resets statistics. 2135 // e.g., removes its bump pointer area and resets statistics.
2140 void MergeCompactionSpace(CompactionSpace* other); 2136 void MergeCompactionSpace(CompactionSpace* other);
2141 2137
2142 void DivideUponCompactionSpaces(CompactionSpaceCollection** other, int num, 2138 void DivideUponCompactionSpaces(CompactionSpaceCollection** other, int num,
2143 intptr_t limit = kCompactionMemoryWanted); 2139 intptr_t limit = kCompactionMemoryWanted);
2144 2140
2145 // Refills the free list from the corresponding free list filled by the 2141 // Refills the free list from the corresponding free list filled by the
2146 // sweeper. 2142 // sweeper.
2147 virtual void RefillFreeList(); 2143 virtual void RefillFreeList();
2148 2144
2149 protected: 2145 protected:
2146 static const int kMaxPagesSweptDuringSlowAllocation = 1;
Hannes Payer (out of office) 2016/01/21 10:35:22 This one can be local in the function.
2147
2150 void AddMemory(Address start, intptr_t size); 2148 void AddMemory(Address start, intptr_t size);
2151 2149
2152 FreeSpace* TryRemoveMemory(intptr_t size_in_bytes); 2150 FreeSpace* TryRemoveMemory(intptr_t size_in_bytes);
2153 2151
2154 void MoveOverFreeMemory(PagedSpace* other); 2152 void MoveOverFreeMemory(PagedSpace* other);
2155 2153
2156 // PagedSpaces that should be included in snapshots have different, i.e., 2154 // PagedSpaces that should be included in snapshots have different, i.e.,
2157 // smaller, initial pages. 2155 // smaller, initial pages.
2158 virtual bool snapshotable() { return true; } 2156 virtual bool snapshotable() { return true; }
2159 2157
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2196 2194
2197 // The dummy page that anchors the double linked list of pages. 2195 // The dummy page that anchors the double linked list of pages.
2198 Page anchor_; 2196 Page anchor_;
2199 2197
2200 // The space's free list. 2198 // The space's free list.
2201 FreeList free_list_; 2199 FreeList free_list_;
2202 2200
2203 // Normal allocation information. 2201 // Normal allocation information.
2204 AllocationInfo allocation_info_; 2202 AllocationInfo allocation_info_;
2205 2203
2206 // The sweeper threads iterate over the list of pointer and data space pages
2207 // and sweep these pages concurrently. They will stop sweeping after the
2208 // end_of_unswept_pages_ page.
2209 Page* end_of_unswept_pages_;
2210
2211 // Mutex guarding any concurrent access to the space. 2204 // Mutex guarding any concurrent access to the space.
2212 base::Mutex space_mutex_; 2205 base::Mutex space_mutex_;
2213 2206
2214 friend class MarkCompactCollector; 2207 friend class MarkCompactCollector;
2215 friend class PageIterator; 2208 friend class PageIterator;
2216 2209
2217 // Used in cctest. 2210 // Used in cctest.
2218 friend class HeapTester; 2211 friend class HeapTester;
2219 }; 2212 };
2220 2213
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
3220 count = 0; 3213 count = 0;
3221 } 3214 }
3222 // Must be small, since an iteration is used for lookup. 3215 // Must be small, since an iteration is used for lookup.
3223 static const int kMaxComments = 64; 3216 static const int kMaxComments = 64;
3224 }; 3217 };
3225 #endif 3218 #endif
3226 } // namespace internal 3219 } // namespace internal
3227 } // namespace v8 3220 } // namespace v8
3228 3221
3229 #endif // V8_HEAP_SPACES_H_ 3222 #endif // V8_HEAP_SPACES_H_
OLDNEW
« no previous file with comments | « src/heap/mark-compact-inl.h ('k') | src/heap/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698