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_INL_H_ | 5 #ifndef V8_HEAP_SPACES_INL_H_ |
6 #define V8_HEAP_SPACES_INL_H_ | 6 #define V8_HEAP_SPACES_INL_H_ |
7 | 7 |
8 #include "src/heap/incremental-marking.h" | 8 #include "src/heap/incremental-marking.h" |
9 #include "src/heap/spaces.h" | 9 #include "src/heap/spaces.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
(...skipping 147 matching lines...) Loading... |
158 return to_space_.ContainsSlow(a); | 158 return to_space_.ContainsSlow(a); |
159 } | 159 } |
160 | 160 |
161 bool NewSpace::FromSpaceContainsSlow(Address a) { | 161 bool NewSpace::FromSpaceContainsSlow(Address a) { |
162 return from_space_.ContainsSlow(a); | 162 return from_space_.ContainsSlow(a); |
163 } | 163 } |
164 | 164 |
165 bool NewSpace::ToSpaceContains(Object* o) { return to_space_.Contains(o); } | 165 bool NewSpace::ToSpaceContains(Object* o) { return to_space_.Contains(o); } |
166 bool NewSpace::FromSpaceContains(Object* o) { return from_space_.Contains(o); } | 166 bool NewSpace::FromSpaceContains(Object* o) { return from_space_.Contains(o); } |
167 | 167 |
168 size_t NewSpace::AllocatedSinceLastGC() { | |
169 Page* top_page = Page::FromAllocationAreaAddress(top()); | |
170 size_t allocated = 0; | |
171 // If top gets reset to be in the range of pages that are below the age | |
172 // mark, this loop will not trigger and we return 0 (invalid). | |
173 for (Page* current_page = top_page; | |
174 !current_page->InIntermediateGeneration() && | |
175 current_page != to_space_.anchor(); | |
176 current_page = current_page->prev_page()) { | |
177 allocated += (top_page == current_page) | |
178 ? static_cast<size_t>(top() - current_page->area_start()) | |
179 : Page::kAllocatableMemory; | |
180 } | |
181 return allocated; | |
182 } | |
183 | |
184 // -------------------------------------------------------------------------- | 168 // -------------------------------------------------------------------------- |
185 // AllocationResult | 169 // AllocationResult |
186 | 170 |
187 AllocationSpace AllocationResult::RetrySpace() { | 171 AllocationSpace AllocationResult::RetrySpace() { |
188 DCHECK(IsRetry()); | 172 DCHECK(IsRetry()); |
189 return static_cast<AllocationSpace>(Smi::cast(object_)->value()); | 173 return static_cast<AllocationSpace>(Smi::cast(object_)->value()); |
190 } | 174 } |
191 | 175 |
192 Page* Page::Initialize(Heap* heap, MemoryChunk* chunk, Executability executable, | 176 Page* Page::Initialize(Heap* heap, MemoryChunk* chunk, Executability executable, |
193 SemiSpace* owner) { | 177 SemiSpace* owner) { |
(...skipping 457 matching lines...) Loading... |
651 other->allocation_info_.Reset(nullptr, nullptr); | 635 other->allocation_info_.Reset(nullptr, nullptr); |
652 return true; | 636 return true; |
653 } | 637 } |
654 return false; | 638 return false; |
655 } | 639 } |
656 | 640 |
657 } // namespace internal | 641 } // namespace internal |
658 } // namespace v8 | 642 } // namespace v8 |
659 | 643 |
660 #endif // V8_HEAP_SPACES_INL_H_ | 644 #endif // V8_HEAP_SPACES_INL_H_ |
OLD | NEW |