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

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: 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
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
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2198 Page anchor_; 2194 Page anchor_;
2199 2195
2200 // The space's free list. 2196 // The space's free list.
2201 FreeList free_list_; 2197 FreeList free_list_;
2202 2198
2203 // Normal allocation information. 2199 // Normal allocation information.
2204 AllocationInfo allocation_info_; 2200 AllocationInfo allocation_info_;
2205 2201
2206 // The sweeper threads iterate over the list of pointer and data space pages 2202 // 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 2203 // and sweep these pages concurrently. They will stop sweeping after the
2208 // end_of_unswept_pages_ page. 2204 // end_of_unswept_pages_ page.
Hannes Payer (out of office) 2016/01/20 09:25:03 Good by, end_of_unswept_pages_.
Michael Lippautz 2016/01/20 11:11:16 Done.
2209 Page* end_of_unswept_pages_; 2205 Page* end_of_unswept_pages_;
2210 2206
2211 // Mutex guarding any concurrent access to the space. 2207 // Mutex guarding any concurrent access to the space.
2212 base::Mutex space_mutex_; 2208 base::Mutex space_mutex_;
2213 2209
2214 friend class MarkCompactCollector; 2210 friend class MarkCompactCollector;
2215 friend class PageIterator; 2211 friend class PageIterator;
2216 2212
2217 // Used in cctest. 2213 // Used in cctest.
2218 friend class HeapTester; 2214 friend class HeapTester;
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
3220 count = 0; 3216 count = 0;
3221 } 3217 }
3222 // Must be small, since an iteration is used for lookup. 3218 // Must be small, since an iteration is used for lookup.
3223 static const int kMaxComments = 64; 3219 static const int kMaxComments = 64;
3224 }; 3220 };
3225 #endif 3221 #endif
3226 } // namespace internal 3222 } // namespace internal
3227 } // namespace v8 3223 } // namespace v8
3228 3224
3229 #endif // V8_HEAP_SPACES_H_ 3225 #endif // V8_HEAP_SPACES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698