| 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" |
| 11 #include "src/msan.h" | 11 #include "src/msan.h" |
| 12 #include "src/profiler/heap-profiler.h" | 12 #include "src/profiler/heap-profiler.h" |
| 13 #include "src/v8memory.h" | 13 #include "src/v8memory.h" |
| 14 | 14 |
| 15 namespace v8 { | 15 namespace v8 { |
| 16 namespace internal { | 16 namespace internal { |
| 17 | 17 |
| 18 | 18 |
| 19 // ----------------------------------------------------------------------------- | 19 // ----------------------------------------------------------------------------- |
| 20 // Bitmap | 20 // Bitmap |
| 21 | 21 |
| 22 void Bitmap::Clear(MemoryChunk* chunk) { | 22 void Bitmap::Clear(MemoryChunk* chunk) { |
| 23 Bitmap* bitmap = chunk->markbits(); | 23 Bitmap* bitmap = chunk->markbits(); |
| 24 for (int i = 0; i < bitmap->CellsCount(); i++) bitmap->cells()[i] = 0; | 24 for (int i = 0; i < bitmap->CellsCount(); i++) bitmap->cells()[i] = 0; |
| 25 chunk->ResetLiveBytes(); | 25 chunk->ResetLiveBytes(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void Bitmap::SetAllBits(MemoryChunk* chunk) { |
| 29 Bitmap* bitmap = chunk->markbits(); |
| 30 for (int i = 0; i < bitmap->CellsCount(); i++) |
| 31 bitmap->cells()[i] = 0xffffffff; |
| 32 } |
| 28 | 33 |
| 29 // ----------------------------------------------------------------------------- | 34 // ----------------------------------------------------------------------------- |
| 30 // PageIterator | 35 // PageIterator |
| 31 | 36 |
| 32 PageIterator::PageIterator(PagedSpace* space) | 37 PageIterator::PageIterator(PagedSpace* space) |
| 33 : space_(space), | 38 : space_(space), |
| 34 prev_page_(&space->anchor_), | 39 prev_page_(&space->anchor_), |
| 35 next_page_(prev_page_->next_page()) {} | 40 next_page_(prev_page_->next_page()) {} |
| 36 | 41 |
| 37 | 42 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 | 262 |
| 258 void MemoryChunk::ResetLiveBytes() { | 263 void MemoryChunk::ResetLiveBytes() { |
| 259 if (FLAG_trace_live_bytes) { | 264 if (FLAG_trace_live_bytes) { |
| 260 PrintIsolate(heap()->isolate(), "live-bytes: reset page=%p %d->0\n", this, | 265 PrintIsolate(heap()->isolate(), "live-bytes: reset page=%p %d->0\n", this, |
| 261 live_byte_count_); | 266 live_byte_count_); |
| 262 } | 267 } |
| 263 live_byte_count_ = 0; | 268 live_byte_count_ = 0; |
| 264 } | 269 } |
| 265 | 270 |
| 266 void MemoryChunk::IncrementLiveBytes(int by) { | 271 void MemoryChunk::IncrementLiveBytes(int by) { |
| 272 if (IsFlagSet(BLACK_PAGE)) return; |
| 267 if (FLAG_trace_live_bytes) { | 273 if (FLAG_trace_live_bytes) { |
| 268 PrintIsolate(heap()->isolate(), | 274 PrintIsolate(heap()->isolate(), |
| 269 "live-bytes: update page=%p delta=%d %d->%d\n", this, by, | 275 "live-bytes: update page=%p delta=%d %d->%d\n", this, by, |
| 270 live_byte_count_, live_byte_count_ + by); | 276 live_byte_count_, live_byte_count_ + by); |
| 271 } | 277 } |
| 272 live_byte_count_ += by; | 278 live_byte_count_ += by; |
| 273 DCHECK_GE(live_byte_count_, 0); | 279 DCHECK_GE(live_byte_count_, 0); |
| 274 DCHECK_LE(static_cast<size_t>(live_byte_count_), size_); | 280 DCHECK_LE(static_cast<size_t>(live_byte_count_), size_); |
| 275 } | 281 } |
| 276 | 282 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 other->allocation_info_.Reset(nullptr, nullptr); | 617 other->allocation_info_.Reset(nullptr, nullptr); |
| 612 return true; | 618 return true; |
| 613 } | 619 } |
| 614 return false; | 620 return false; |
| 615 } | 621 } |
| 616 | 622 |
| 617 } // namespace internal | 623 } // namespace internal |
| 618 } // namespace v8 | 624 } // namespace v8 |
| 619 | 625 |
| 620 #endif // V8_HEAP_SPACES_INL_H_ | 626 #endif // V8_HEAP_SPACES_INL_H_ |
| OLD | NEW |