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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 // Raw allocation. | 423 // Raw allocation. |
424 AllocationResult PagedSpace::AllocateRawUnaligned( | 424 AllocationResult PagedSpace::AllocateRawUnaligned( |
425 int size_in_bytes, UpdateSkipList update_skip_list) { | 425 int size_in_bytes, UpdateSkipList update_skip_list) { |
426 HeapObject* object = AllocateLinearly(size_in_bytes); | 426 HeapObject* object = AllocateLinearly(size_in_bytes); |
427 | 427 |
428 if (object == NULL) { | 428 if (object == NULL) { |
429 object = free_list_.Allocate(size_in_bytes); | 429 object = free_list_.Allocate(size_in_bytes); |
430 if (object == NULL) { | 430 if (object == NULL) { |
431 object = SlowAllocateRaw(size_in_bytes); | 431 object = SlowAllocateRaw(size_in_bytes); |
432 } | 432 } |
433 if (object != NULL) { | 433 if (object != NULL && heap()->incremental_marking()->black_allocation()) { |
434 if (heap()->incremental_marking()->black_allocation()) { | 434 Address start = object->address(); |
435 Marking::MarkBlack(ObjectMarking::MarkBitFrom(object)); | 435 Address end = object->address() + size_in_bytes; |
436 MemoryChunk::IncrementLiveBytes(object, size_in_bytes); | 436 Page::FromAllocationAreaAddress(start)->CreateBlackArea(start, end); |
437 } | |
438 } | 437 } |
439 } | 438 } |
440 | 439 |
441 if (object != NULL) { | 440 if (object != NULL) { |
442 if (update_skip_list == UPDATE_SKIP_LIST && identity() == CODE_SPACE) { | 441 if (update_skip_list == UPDATE_SKIP_LIST && identity() == CODE_SPACE) { |
443 SkipList::Update(object->address(), size_in_bytes); | 442 SkipList::Update(object->address(), size_in_bytes); |
444 } | 443 } |
445 MSAN_ALLOCATED_UNINITIALIZED_MEMORY(object->address(), size_in_bytes); | 444 MSAN_ALLOCATED_UNINITIALIZED_MEMORY(object->address(), size_in_bytes); |
446 return object; | 445 return object; |
447 } | 446 } |
(...skipping 17 matching lines...) Expand all Loading... |
465 HeapObject* object = AllocateLinearlyAligned(&allocation_size, alignment); | 464 HeapObject* object = AllocateLinearlyAligned(&allocation_size, alignment); |
466 | 465 |
467 if (object == NULL) { | 466 if (object == NULL) { |
468 // We don't know exactly how much filler we need to align until space is | 467 // We don't know exactly how much filler we need to align until space is |
469 // allocated, so assume the worst case. | 468 // allocated, so assume the worst case. |
470 int filler_size = Heap::GetMaximumFillToAlign(alignment); | 469 int filler_size = Heap::GetMaximumFillToAlign(alignment); |
471 allocation_size += filler_size; | 470 allocation_size += filler_size; |
472 object = free_list_.Allocate(allocation_size); | 471 object = free_list_.Allocate(allocation_size); |
473 if (object == NULL) { | 472 if (object == NULL) { |
474 object = SlowAllocateRaw(allocation_size); | 473 object = SlowAllocateRaw(allocation_size); |
| 474 if (object != NULL && heap()->incremental_marking()->black_allocation()) { |
| 475 Address start = object->address(); |
| 476 Address end = object->address() + size_in_bytes; |
| 477 Page::FromAllocationAreaAddress(start)->CreateBlackArea(start, end); |
| 478 } |
475 } | 479 } |
476 if (object != NULL && filler_size != 0) { | 480 if (object != NULL && filler_size != 0) { |
477 object = heap()->AlignWithFiller(object, size_in_bytes, allocation_size, | 481 object = heap()->AlignWithFiller(object, size_in_bytes, allocation_size, |
478 alignment); | 482 alignment); |
479 // Filler objects are initialized, so mark only the aligned object memory | 483 // Filler objects are initialized, so mark only the aligned object memory |
480 // as uninitialized. | 484 // as uninitialized. |
481 allocation_size = size_in_bytes; | 485 allocation_size = size_in_bytes; |
482 } | 486 } |
483 } | 487 } |
484 | 488 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 other->allocation_info_.Reset(nullptr, nullptr); | 626 other->allocation_info_.Reset(nullptr, nullptr); |
623 return true; | 627 return true; |
624 } | 628 } |
625 return false; | 629 return false; |
626 } | 630 } |
627 | 631 |
628 } // namespace internal | 632 } // namespace internal |
629 } // namespace v8 | 633 } // namespace v8 |
630 | 634 |
631 #endif // V8_HEAP_SPACES_INL_H_ | 635 #endif // V8_HEAP_SPACES_INL_H_ |
OLD | NEW |