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 16 matching lines...) Expand all Loading... |
27 operator++(); | 27 operator++(); |
28 return tmp; | 28 return tmp; |
29 } | 29 } |
30 | 30 |
31 NewSpacePageRange::NewSpacePageRange(Address start, Address limit) | 31 NewSpacePageRange::NewSpacePageRange(Address start, Address limit) |
32 : range_(Page::FromAddress(start), | 32 : range_(Page::FromAddress(start), |
33 Page::FromAllocationAreaAddress(limit)->next_page()) { | 33 Page::FromAllocationAreaAddress(limit)->next_page()) { |
34 SemiSpace::AssertValidRange(start, limit); | 34 SemiSpace::AssertValidRange(start, limit); |
35 } | 35 } |
36 | 36 |
37 | |
38 // ----------------------------------------------------------------------------- | 37 // ----------------------------------------------------------------------------- |
39 // SemiSpaceIterator | 38 // SemiSpaceIterator |
40 | 39 |
41 HeapObject* SemiSpaceIterator::Next() { | 40 HeapObject* SemiSpaceIterator::Next() { |
42 while (current_ != limit_) { | 41 while (current_ != limit_) { |
43 if (Page::IsAlignedToPageSize(current_)) { | 42 if (Page::IsAlignedToPageSize(current_)) { |
44 Page* page = Page::FromAllocationAreaAddress(current_); | 43 Page* page = Page::FromAllocationAreaAddress(current_); |
45 page = page->next_page(); | 44 page = page->next_page(); |
46 DCHECK(!page->is_anchor()); | 45 DCHECK(!page->is_anchor()); |
47 current_ = page->area_start(); | 46 current_ = page->area_start(); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 234 |
236 void MemoryChunk::ResetLiveBytes() { | 235 void MemoryChunk::ResetLiveBytes() { |
237 if (FLAG_trace_live_bytes) { | 236 if (FLAG_trace_live_bytes) { |
238 PrintIsolate(heap()->isolate(), "live-bytes: reset page=%p %d->0\n", | 237 PrintIsolate(heap()->isolate(), "live-bytes: reset page=%p %d->0\n", |
239 static_cast<void*>(this), live_byte_count_); | 238 static_cast<void*>(this), live_byte_count_); |
240 } | 239 } |
241 live_byte_count_ = 0; | 240 live_byte_count_ = 0; |
242 } | 241 } |
243 | 242 |
244 void MemoryChunk::IncrementLiveBytes(int by) { | 243 void MemoryChunk::IncrementLiveBytes(int by) { |
245 if (IsFlagSet(BLACK_PAGE)) return; | |
246 if (FLAG_trace_live_bytes) { | 244 if (FLAG_trace_live_bytes) { |
247 PrintIsolate( | 245 PrintIsolate( |
248 heap()->isolate(), "live-bytes: update page=%p delta=%d %d->%d\n", | 246 heap()->isolate(), "live-bytes: update page=%p delta=%d %d->%d\n", |
249 static_cast<void*>(this), by, live_byte_count_, live_byte_count_ + by); | 247 static_cast<void*>(this), by, live_byte_count_, live_byte_count_ + by); |
250 } | 248 } |
251 live_byte_count_ += by; | 249 live_byte_count_ += by; |
252 DCHECK_GE(live_byte_count_, 0); | 250 DCHECK_GE(live_byte_count_, 0); |
253 DCHECK_LE(static_cast<size_t>(live_byte_count_), size_); | 251 DCHECK_LE(static_cast<size_t>(live_byte_count_), size_); |
254 } | 252 } |
255 | 253 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 // Raw allocation. | 435 // Raw allocation. |
438 AllocationResult PagedSpace::AllocateRawUnaligned( | 436 AllocationResult PagedSpace::AllocateRawUnaligned( |
439 int size_in_bytes, UpdateSkipList update_skip_list) { | 437 int size_in_bytes, UpdateSkipList update_skip_list) { |
440 HeapObject* object = AllocateLinearly(size_in_bytes); | 438 HeapObject* object = AllocateLinearly(size_in_bytes); |
441 | 439 |
442 if (object == NULL) { | 440 if (object == NULL) { |
443 object = free_list_.Allocate(size_in_bytes); | 441 object = free_list_.Allocate(size_in_bytes); |
444 if (object == NULL) { | 442 if (object == NULL) { |
445 object = SlowAllocateRaw(size_in_bytes); | 443 object = SlowAllocateRaw(size_in_bytes); |
446 } | 444 } |
| 445 if (object != NULL) { |
| 446 if (heap()->incremental_marking()->black_allocation()) { |
| 447 Marking::MarkBlack(ObjectMarking::MarkBitFrom(object)); |
| 448 MemoryChunk::IncrementLiveBytesFromGC(object, size_in_bytes); |
| 449 } |
| 450 } |
447 } | 451 } |
448 | 452 |
449 if (object != NULL) { | 453 if (object != NULL) { |
450 if (update_skip_list == UPDATE_SKIP_LIST && identity() == CODE_SPACE) { | 454 if (update_skip_list == UPDATE_SKIP_LIST && identity() == CODE_SPACE) { |
451 SkipList::Update(object->address(), size_in_bytes); | 455 SkipList::Update(object->address(), size_in_bytes); |
452 } | 456 } |
453 MSAN_ALLOCATED_UNINITIALIZED_MEMORY(object->address(), size_in_bytes); | 457 MSAN_ALLOCATED_UNINITIALIZED_MEMORY(object->address(), size_in_bytes); |
454 return object; | 458 return object; |
455 } | 459 } |
456 | 460 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 other->allocation_info_.Reset(nullptr, nullptr); | 635 other->allocation_info_.Reset(nullptr, nullptr); |
632 return true; | 636 return true; |
633 } | 637 } |
634 return false; | 638 return false; |
635 } | 639 } |
636 | 640 |
637 } // namespace internal | 641 } // namespace internal |
638 } // namespace v8 | 642 } // namespace v8 |
639 | 643 |
640 #endif // V8_HEAP_SPACES_INL_H_ | 644 #endif // V8_HEAP_SPACES_INL_H_ |
OLD | NEW |