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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 return AllocateRaw(size_in_bytes, alignment); | 583 return AllocateRaw(size_in_bytes, alignment); |
584 } | 584 } |
585 | 585 |
586 LargePage* LargePage::Initialize(Heap* heap, MemoryChunk* chunk, | 586 LargePage* LargePage::Initialize(Heap* heap, MemoryChunk* chunk, |
587 Executability executable, Space* owner) { | 587 Executability executable, Space* owner) { |
588 if (executable && chunk->size() > LargePage::kMaxCodePageSize) { | 588 if (executable && chunk->size() > LargePage::kMaxCodePageSize) { |
589 STATIC_ASSERT(LargePage::kMaxCodePageSize <= TypedSlotSet::kMaxOffset); | 589 STATIC_ASSERT(LargePage::kMaxCodePageSize <= TypedSlotSet::kMaxOffset); |
590 FATAL("Code page is too large."); | 590 FATAL("Code page is too large."); |
591 } | 591 } |
592 heap->incremental_marking()->SetOldSpacePageFlags(chunk); | 592 heap->incremental_marking()->SetOldSpacePageFlags(chunk); |
593 | |
594 // Initialize the owner field for each contained page (except the first, which | |
595 // is initialized by MemoryChunk::Initialize). | |
596 for (size_t i = Page::kPageSize; i < chunk->size(); i += Page::kPageSize) { | |
597 // Clear out kPageHeaderTag. | |
598 Memory::Address_at(chunk->address() + i + Page::kOwnerOffset) = 0; | |
599 } | |
600 | |
601 return static_cast<LargePage*>(chunk); | 593 return static_cast<LargePage*>(chunk); |
602 } | 594 } |
603 | 595 |
604 size_t LargeObjectSpace::Available() { | 596 size_t LargeObjectSpace::Available() { |
605 return ObjectSizeFor(heap()->memory_allocator()->Available()); | 597 return ObjectSizeFor(heap()->memory_allocator()->Available()); |
606 } | 598 } |
607 | 599 |
608 | 600 |
609 LocalAllocationBuffer LocalAllocationBuffer::InvalidBuffer() { | 601 LocalAllocationBuffer LocalAllocationBuffer::InvalidBuffer() { |
610 return LocalAllocationBuffer(nullptr, AllocationInfo(nullptr, nullptr)); | 602 return LocalAllocationBuffer(nullptr, AllocationInfo(nullptr, nullptr)); |
(...skipping 19 matching lines...) Expand all Loading... |
630 other->allocation_info_.Reset(nullptr, nullptr); | 622 other->allocation_info_.Reset(nullptr, nullptr); |
631 return true; | 623 return true; |
632 } | 624 } |
633 return false; | 625 return false; |
634 } | 626 } |
635 | 627 |
636 } // namespace internal | 628 } // namespace internal |
637 } // namespace v8 | 629 } // namespace v8 |
638 | 630 |
639 #endif // V8_HEAP_SPACES_INL_H_ | 631 #endif // V8_HEAP_SPACES_INL_H_ |
OLD | NEW |