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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 HeapObject* object = AllocateLinearlyAligned(&allocation_size, alignment); | 464 HeapObject* object = AllocateLinearlyAligned(&allocation_size, alignment); |
465 | 465 |
466 if (object == NULL) { | 466 if (object == NULL) { |
467 // 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 |
468 // allocated, so assume the worst case. | 468 // allocated, so assume the worst case. |
469 int filler_size = Heap::GetMaximumFillToAlign(alignment); | 469 int filler_size = Heap::GetMaximumFillToAlign(alignment); |
470 allocation_size += filler_size; | 470 allocation_size += filler_size; |
471 object = free_list_.Allocate(allocation_size); | 471 object = free_list_.Allocate(allocation_size); |
472 if (object == NULL) { | 472 if (object == NULL) { |
473 object = SlowAllocateRaw(allocation_size); | 473 object = SlowAllocateRaw(allocation_size); |
474 if (object != NULL && heap()->incremental_marking()->black_allocation()) { | 474 } |
| 475 if (object != NULL) { |
| 476 if (heap()->incremental_marking()->black_allocation()) { |
475 Address start = object->address(); | 477 Address start = object->address(); |
476 Address end = object->address() + size_in_bytes; | 478 Address end = object->address() + allocation_size; |
477 Page::FromAllocationAreaAddress(start)->CreateBlackArea(start, end); | 479 Page::FromAllocationAreaAddress(start)->CreateBlackArea(start, end); |
478 } | 480 } |
479 } | 481 if (filler_size != 0) { |
480 if (object != NULL && filler_size != 0) { | 482 object = heap()->AlignWithFiller(object, size_in_bytes, allocation_size, |
481 object = heap()->AlignWithFiller(object, size_in_bytes, allocation_size, | 483 alignment); |
482 alignment); | 484 // Filler objects are initialized, so mark only the aligned object |
483 // Filler objects are initialized, so mark only the aligned object memory | 485 // memory as uninitialized. |
484 // as uninitialized. | 486 allocation_size = size_in_bytes; |
485 allocation_size = size_in_bytes; | 487 } |
486 } | 488 } |
487 } | 489 } |
488 | 490 |
489 if (object != NULL) { | 491 if (object != NULL) { |
490 MSAN_ALLOCATED_UNINITIALIZED_MEMORY(object->address(), allocation_size); | 492 MSAN_ALLOCATED_UNINITIALIZED_MEMORY(object->address(), allocation_size); |
491 return object; | 493 return object; |
492 } | 494 } |
493 | 495 |
494 return AllocationResult::Retry(identity()); | 496 return AllocationResult::Retry(identity()); |
495 } | 497 } |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 other->allocation_info_.Reset(nullptr, nullptr); | 639 other->allocation_info_.Reset(nullptr, nullptr); |
638 return true; | 640 return true; |
639 } | 641 } |
640 return false; | 642 return false; |
641 } | 643 } |
642 | 644 |
643 } // namespace internal | 645 } // namespace internal |
644 } // namespace v8 | 646 } // namespace v8 |
645 | 647 |
646 #endif // V8_HEAP_SPACES_INL_H_ | 648 #endif // V8_HEAP_SPACES_INL_H_ |
OLD | NEW |