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 Address& owner_addr = | |
598 Memory::Address_at(chunk->address() + i + Page::kOwnerOffset); | |
599 const Address new_owner_value = reinterpret_cast<Address>( | |
600 reinterpret_cast<intptr_t>(owner_addr) & ~kPageHeaderTagMask); | |
601 owner_addr = new_owner_value; | |
Michael Lippautz
2016/12/09 20:09:40
Please just write
// Clear out kPageHeaderTag.
jgruber
2016/12/12 12:48:07
Done.
| |
602 } | |
603 | |
593 return static_cast<LargePage*>(chunk); | 604 return static_cast<LargePage*>(chunk); |
594 } | 605 } |
595 | 606 |
596 size_t LargeObjectSpace::Available() { | 607 size_t LargeObjectSpace::Available() { |
597 return ObjectSizeFor(heap()->memory_allocator()->Available()); | 608 return ObjectSizeFor(heap()->memory_allocator()->Available()); |
598 } | 609 } |
599 | 610 |
600 | 611 |
601 LocalAllocationBuffer LocalAllocationBuffer::InvalidBuffer() { | 612 LocalAllocationBuffer LocalAllocationBuffer::InvalidBuffer() { |
602 return LocalAllocationBuffer(nullptr, AllocationInfo(nullptr, nullptr)); | 613 return LocalAllocationBuffer(nullptr, AllocationInfo(nullptr, nullptr)); |
(...skipping 19 matching lines...) Expand all Loading... | |
622 other->allocation_info_.Reset(nullptr, nullptr); | 633 other->allocation_info_.Reset(nullptr, nullptr); |
623 return true; | 634 return true; |
624 } | 635 } |
625 return false; | 636 return false; |
626 } | 637 } |
627 | 638 |
628 } // namespace internal | 639 } // namespace internal |
629 } // namespace v8 | 640 } // namespace v8 |
630 | 641 |
631 #endif // V8_HEAP_SPACES_INL_H_ | 642 #endif // V8_HEAP_SPACES_INL_H_ |
OLD | NEW |