OLD | NEW |
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 Loading... |
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2196 | 2192 |
2197 // The dummy page that anchors the double linked list of pages. | 2193 // The dummy page that anchors the double linked list of pages. |
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 | |
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. | 2202 // Mutex guarding any concurrent access to the space. |
2212 base::Mutex space_mutex_; | 2203 base::Mutex space_mutex_; |
2213 | 2204 |
2214 friend class MarkCompactCollector; | 2205 friend class MarkCompactCollector; |
2215 friend class PageIterator; | 2206 friend class PageIterator; |
2216 | 2207 |
2217 // Used in cctest. | 2208 // Used in cctest. |
2218 friend class HeapTester; | 2209 friend class HeapTester; |
2219 }; | 2210 }; |
2220 | 2211 |
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3220 count = 0; | 3211 count = 0; |
3221 } | 3212 } |
3222 // Must be small, since an iteration is used for lookup. | 3213 // Must be small, since an iteration is used for lookup. |
3223 static const int kMaxComments = 64; | 3214 static const int kMaxComments = 64; |
3224 }; | 3215 }; |
3225 #endif | 3216 #endif |
3226 } // namespace internal | 3217 } // namespace internal |
3227 } // namespace v8 | 3218 } // namespace v8 |
3228 | 3219 |
3229 #endif // V8_HEAP_SPACES_H_ | 3220 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |