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 #include "src/heap/spaces.h" | 5 #include "src/heap/spaces.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 } | 501 } |
502 | 502 |
503 controller->TakeControl(&reservation); | 503 controller->TakeControl(&reservation); |
504 return base; | 504 return base; |
505 } | 505 } |
506 | 506 |
507 void Page::InitializeAsAnchor(Space* space) { | 507 void Page::InitializeAsAnchor(Space* space) { |
508 set_owner(space); | 508 set_owner(space); |
509 set_next_chunk(this); | 509 set_next_chunk(this); |
510 set_prev_chunk(this); | 510 set_prev_chunk(this); |
511 SetFlags(0, ~0); | 511 SetFlags(0, static_cast<uintptr_t>(~0)); |
512 SetFlag(ANCHOR); | 512 SetFlag(ANCHOR); |
513 } | 513 } |
514 | 514 |
515 MemoryChunk* MemoryChunk::Initialize(Heap* heap, Address base, size_t size, | 515 MemoryChunk* MemoryChunk::Initialize(Heap* heap, Address base, size_t size, |
516 Address area_start, Address area_end, | 516 Address area_start, Address area_end, |
517 Executability executable, Space* owner, | 517 Executability executable, Space* owner, |
518 base::VirtualMemory* reservation) { | 518 base::VirtualMemory* reservation) { |
519 MemoryChunk* chunk = FromAddress(base); | 519 MemoryChunk* chunk = FromAddress(base); |
520 | 520 |
521 DCHECK(base == chunk->address()); | 521 DCHECK(base == chunk->address()); |
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 while (actual_pages < expected_pages) { | 1630 while (actual_pages < expected_pages) { |
1631 actual_pages++; | 1631 actual_pages++; |
1632 current_page = | 1632 current_page = |
1633 heap()->memory_allocator()->AllocatePage<MemoryAllocator::kPooled>( | 1633 heap()->memory_allocator()->AllocatePage<MemoryAllocator::kPooled>( |
1634 Page::kAllocatableMemory, this, executable()); | 1634 Page::kAllocatableMemory, this, executable()); |
1635 if (current_page == nullptr) return false; | 1635 if (current_page == nullptr) return false; |
1636 DCHECK_NOT_NULL(current_page); | 1636 DCHECK_NOT_NULL(current_page); |
1637 current_page->InsertAfter(anchor()); | 1637 current_page->InsertAfter(anchor()); |
1638 current_page->ClearLiveness(); | 1638 current_page->ClearLiveness(); |
1639 current_page->SetFlags(anchor()->prev_page()->GetFlags(), | 1639 current_page->SetFlags(anchor()->prev_page()->GetFlags(), |
1640 Page::kCopyAllFlags); | 1640 static_cast<uintptr_t>(Page::kCopyAllFlags)); |
1641 heap()->CreateFillerObjectAt(current_page->area_start(), | 1641 heap()->CreateFillerObjectAt(current_page->area_start(), |
1642 static_cast<int>(current_page->area_size()), | 1642 static_cast<int>(current_page->area_size()), |
1643 ClearRecordedSlots::kNo); | 1643 ClearRecordedSlots::kNo); |
1644 } | 1644 } |
1645 } | 1645 } |
1646 return true; | 1646 return true; |
1647 } | 1647 } |
1648 | 1648 |
1649 AllocationInfo LocalAllocationBuffer::Close() { | 1649 AllocationInfo LocalAllocationBuffer::Close() { |
1650 if (IsValid()) { | 1650 if (IsValid()) { |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2087 } | 2087 } |
2088 | 2088 |
2089 void SemiSpace::RemovePage(Page* page) { | 2089 void SemiSpace::RemovePage(Page* page) { |
2090 if (current_page_ == page) { | 2090 if (current_page_ == page) { |
2091 current_page_ = page->prev_page(); | 2091 current_page_ = page->prev_page(); |
2092 } | 2092 } |
2093 page->Unlink(); | 2093 page->Unlink(); |
2094 } | 2094 } |
2095 | 2095 |
2096 void SemiSpace::PrependPage(Page* page) { | 2096 void SemiSpace::PrependPage(Page* page) { |
2097 page->SetFlags(current_page()->GetFlags(), Page::kCopyAllFlags); | 2097 page->SetFlags(current_page()->GetFlags(), |
| 2098 static_cast<uintptr_t>(Page::kCopyAllFlags)); |
2098 page->set_owner(this); | 2099 page->set_owner(this); |
2099 page->InsertAfter(anchor()); | 2100 page->InsertAfter(anchor()); |
2100 pages_used_++; | 2101 pages_used_++; |
2101 } | 2102 } |
2102 | 2103 |
2103 void SemiSpace::Swap(SemiSpace* from, SemiSpace* to) { | 2104 void SemiSpace::Swap(SemiSpace* from, SemiSpace* to) { |
2104 // We won't be swapping semispaces without data in them. | 2105 // We won't be swapping semispaces without data in them. |
2105 DCHECK_NE(from->anchor_.next_page(), &from->anchor_); | 2106 DCHECK_NE(from->anchor_.next_page(), &from->anchor_); |
2106 DCHECK_NE(to->anchor_.next_page(), &to->anchor_); | 2107 DCHECK_NE(to->anchor_.next_page(), &to->anchor_); |
2107 | 2108 |
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3281 object->ShortPrint(); | 3282 object->ShortPrint(); |
3282 PrintF("\n"); | 3283 PrintF("\n"); |
3283 } | 3284 } |
3284 printf(" --------------------------------------\n"); | 3285 printf(" --------------------------------------\n"); |
3285 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3286 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3286 } | 3287 } |
3287 | 3288 |
3288 #endif // DEBUG | 3289 #endif // DEBUG |
3289 } // namespace internal | 3290 } // namespace internal |
3290 } // namespace v8 | 3291 } // namespace v8 |
OLD | NEW |