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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 275 |
271 void MemoryChunk::ResetLiveBytes() { | 276 void MemoryChunk::ResetLiveBytes() { |
272 if (FLAG_trace_live_bytes) { | 277 if (FLAG_trace_live_bytes) { |
273 PrintIsolate(heap()->isolate(), "live-bytes: reset page=%p %d->0\n", this, | 278 PrintIsolate(heap()->isolate(), "live-bytes: reset page=%p %d->0\n", this, |
274 live_byte_count_); | 279 live_byte_count_); |
275 } | 280 } |
276 live_byte_count_ = 0; | 281 live_byte_count_ = 0; |
277 } | 282 } |
278 | 283 |
279 void MemoryChunk::IncrementLiveBytes(int by) { | 284 void MemoryChunk::IncrementLiveBytes(int by) { |
| 285 if (IsFlagSet(BLACK_PAGE)) return; |
280 if (FLAG_trace_live_bytes) { | 286 if (FLAG_trace_live_bytes) { |
281 PrintIsolate(heap()->isolate(), | 287 PrintIsolate(heap()->isolate(), |
282 "live-bytes: update page=%p delta=%d %d->%d\n", this, by, | 288 "live-bytes: update page=%p delta=%d %d->%d\n", this, by, |
283 live_byte_count_, live_byte_count_ + by); | 289 live_byte_count_, live_byte_count_ + by); |
284 } | 290 } |
285 live_byte_count_ += by; | 291 live_byte_count_ += by; |
286 DCHECK_GE(live_byte_count_, 0); | 292 DCHECK_GE(live_byte_count_, 0); |
287 DCHECK_LE(static_cast<size_t>(live_byte_count_), size_); | 293 DCHECK_LE(static_cast<size_t>(live_byte_count_), size_); |
288 } | 294 } |
289 | 295 |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 other->allocation_info_.Reset(nullptr, nullptr); | 631 other->allocation_info_.Reset(nullptr, nullptr); |
626 return true; | 632 return true; |
627 } | 633 } |
628 return false; | 634 return false; |
629 } | 635 } |
630 | 636 |
631 } // namespace internal | 637 } // namespace internal |
632 } // namespace v8 | 638 } // namespace v8 |
633 | 639 |
634 #endif // V8_HEAP_SPACES_INL_H_ | 640 #endif // V8_HEAP_SPACES_INL_H_ |
OLD | NEW |