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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 return to_space_.ContainsSlow(a); | 236 return to_space_.ContainsSlow(a); |
237 } | 237 } |
238 | 238 |
239 bool NewSpace::FromSpaceContainsSlow(Address a) { | 239 bool NewSpace::FromSpaceContainsSlow(Address a) { |
240 return from_space_.ContainsSlow(a); | 240 return from_space_.ContainsSlow(a); |
241 } | 241 } |
242 | 242 |
243 bool NewSpace::ToSpaceContains(Object* o) { return to_space_.Contains(o); } | 243 bool NewSpace::ToSpaceContains(Object* o) { return to_space_.Contains(o); } |
244 bool NewSpace::FromSpaceContains(Object* o) { return from_space_.Contains(o); } | 244 bool NewSpace::FromSpaceContains(Object* o) { return from_space_.Contains(o); } |
245 | 245 |
| 246 size_t NewSpace::AllocatedSinceLastGC() { |
| 247 const intptr_t age_mark_offset = |
| 248 NewSpacePage::OffsetInPage(to_space_.age_mark()); |
| 249 const intptr_t top_offset = |
| 250 NewSpacePage::OffsetInPage(allocation_info_.top()); |
| 251 const intptr_t age_mark_delta = |
| 252 age_mark_offset >= NewSpacePage::kObjectStartOffset |
| 253 ? age_mark_offset - NewSpacePage::kObjectStartOffset |
| 254 : NewSpacePage::kAllocatableMemory; |
| 255 const intptr_t top_delta = top_offset >= NewSpacePage::kObjectStartOffset |
| 256 ? top_offset - NewSpacePage::kObjectStartOffset |
| 257 : NewSpacePage::kAllocatableMemory; |
| 258 DCHECK((allocated_since_last_gc_ > 0) || |
| 259 (NewSpacePage::FromLimit(allocation_info_.top()) == |
| 260 NewSpacePage::FromLimit(to_space_.age_mark()))); |
| 261 return static_cast<size_t>(allocated_since_last_gc_ + top_delta - |
| 262 age_mark_delta); |
| 263 } |
| 264 |
246 // -------------------------------------------------------------------------- | 265 // -------------------------------------------------------------------------- |
247 // AllocationResult | 266 // AllocationResult |
248 | 267 |
249 AllocationSpace AllocationResult::RetrySpace() { | 268 AllocationSpace AllocationResult::RetrySpace() { |
250 DCHECK(IsRetry()); | 269 DCHECK(IsRetry()); |
251 return static_cast<AllocationSpace>(Smi::cast(object_)->value()); | 270 return static_cast<AllocationSpace>(Smi::cast(object_)->value()); |
252 } | 271 } |
253 | 272 |
254 NewSpacePage* NewSpacePage::Initialize(Heap* heap, MemoryChunk* chunk, | 273 NewSpacePage* NewSpacePage::Initialize(Heap* heap, MemoryChunk* chunk, |
255 Executability executable, | 274 Executability executable, |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 other->allocation_info_.Reset(nullptr, nullptr); | 729 other->allocation_info_.Reset(nullptr, nullptr); |
711 return true; | 730 return true; |
712 } | 731 } |
713 return false; | 732 return false; |
714 } | 733 } |
715 | 734 |
716 } // namespace internal | 735 } // namespace internal |
717 } // namespace v8 | 736 } // namespace v8 |
718 | 737 |
719 #endif // V8_HEAP_SPACES_INL_H_ | 738 #endif // V8_HEAP_SPACES_INL_H_ |
OLD | NEW |