| 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 categories_[i].Initialize(static_cast<FreeListCategoryType>(i)); | 304 categories_[i].Initialize(static_cast<FreeListCategoryType>(i)); |
| 305 } | 305 } |
| 306 } | 306 } |
| 307 | 307 |
| 308 void MemoryChunk::IncrementLiveBytesFromGC(HeapObject* object, int by) { | 308 void MemoryChunk::IncrementLiveBytesFromGC(HeapObject* object, int by) { |
| 309 MemoryChunk::FromAddress(object->address())->IncrementLiveBytes(by); | 309 MemoryChunk::FromAddress(object->address())->IncrementLiveBytes(by); |
| 310 } | 310 } |
| 311 | 311 |
| 312 void MemoryChunk::ResetLiveBytes() { | 312 void MemoryChunk::ResetLiveBytes() { |
| 313 if (FLAG_trace_live_bytes) { | 313 if (FLAG_trace_live_bytes) { |
| 314 PrintIsolate(heap()->isolate(), "live-bytes: reset page=%p %d->0\n", this, | 314 PrintIsolate(heap()->isolate(), "live-bytes: reset page=%p %d->0\n", |
| 315 live_byte_count_); | 315 static_cast<void*>(this), live_byte_count_); |
| 316 } | 316 } |
| 317 live_byte_count_ = 0; | 317 live_byte_count_ = 0; |
| 318 } | 318 } |
| 319 | 319 |
| 320 void MemoryChunk::IncrementLiveBytes(int by) { | 320 void MemoryChunk::IncrementLiveBytes(int by) { |
| 321 if (IsFlagSet(BLACK_PAGE)) return; | 321 if (IsFlagSet(BLACK_PAGE)) return; |
| 322 if (FLAG_trace_live_bytes) { | 322 if (FLAG_trace_live_bytes) { |
| 323 PrintIsolate(heap()->isolate(), | 323 PrintIsolate( |
| 324 "live-bytes: update page=%p delta=%d %d->%d\n", this, by, | 324 heap()->isolate(), "live-bytes: update page=%p delta=%d %d->%d\n", |
| 325 live_byte_count_, live_byte_count_ + by); | 325 static_cast<void*>(this), by, live_byte_count_, live_byte_count_ + by); |
| 326 } | 326 } |
| 327 live_byte_count_ += by; | 327 live_byte_count_ += by; |
| 328 DCHECK_GE(live_byte_count_, 0); | 328 DCHECK_GE(live_byte_count_, 0); |
| 329 DCHECK_LE(static_cast<size_t>(live_byte_count_), size_); | 329 DCHECK_LE(static_cast<size_t>(live_byte_count_), size_); |
| 330 } | 330 } |
| 331 | 331 |
| 332 void MemoryChunk::IncrementLiveBytesFromMutator(HeapObject* object, int by) { | 332 void MemoryChunk::IncrementLiveBytesFromMutator(HeapObject* object, int by) { |
| 333 MemoryChunk* chunk = MemoryChunk::FromAddress(object->address()); | 333 MemoryChunk* chunk = MemoryChunk::FromAddress(object->address()); |
| 334 if (!chunk->InNewSpace() && !static_cast<Page*>(chunk)->SweepingDone()) { | 334 if (!chunk->InNewSpace() && !static_cast<Page*>(chunk)->SweepingDone()) { |
| 335 static_cast<PagedSpace*>(chunk->owner())->Allocate(by); | 335 static_cast<PagedSpace*>(chunk->owner())->Allocate(by); |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 other->allocation_info_.Reset(nullptr, nullptr); | 714 other->allocation_info_.Reset(nullptr, nullptr); |
| 715 return true; | 715 return true; |
| 716 } | 716 } |
| 717 return false; | 717 return false; |
| 718 } | 718 } |
| 719 | 719 |
| 720 } // namespace internal | 720 } // namespace internal |
| 721 } // namespace v8 | 721 } // namespace v8 |
| 722 | 722 |
| 723 #endif // V8_HEAP_SPACES_INL_H_ | 723 #endif // V8_HEAP_SPACES_INL_H_ |
| OLD | NEW |