Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: src/heap/spaces.cc

Issue 1863983002: 🏄 [heap] Add page evacuation mode for new->old (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Disable optimize_for_size for the feature test as we require >1 page new space Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/spaces.h ('k') | src/heap/spaces-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/platform/platform.h" 8 #include "src/base/platform/platform.h"
9 #include "src/full-codegen/full-codegen.h" 9 #include "src/full-codegen/full-codegen.h"
10 #include "src/heap/slot-set.h" 10 #include "src/heap/slot-set.h"
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 bool PagedSpace::Expand() { 1154 bool PagedSpace::Expand() {
1155 int size = AreaSize(); 1155 int size = AreaSize();
1156 if (snapshotable() && !HasPages()) { 1156 if (snapshotable() && !HasPages()) {
1157 size = Snapshot::SizeOfFirstPage(heap()->isolate(), identity()); 1157 size = Snapshot::SizeOfFirstPage(heap()->isolate(), identity());
1158 } 1158 }
1159 1159
1160 if (!heap()->CanExpandOldGeneration(size)) return false; 1160 if (!heap()->CanExpandOldGeneration(size)) return false;
1161 1161
1162 Page* p = 1162 Page* p =
1163 heap()->memory_allocator()->AllocatePage<Page>(size, this, executable()); 1163 heap()->memory_allocator()->AllocatePage<Page>(size, this, executable());
1164 if (p == NULL) return false; 1164 if (p == nullptr) return false;
1165 1165
1166 AccountCommitted(static_cast<intptr_t>(p->size())); 1166 AccountCommitted(static_cast<intptr_t>(p->size()));
1167 1167
1168 // Pages created during bootstrapping may contain immortal immovable objects. 1168 // Pages created during bootstrapping may contain immortal immovable objects.
1169 if (!heap()->deserialization_complete()) p->MarkNeverEvacuate(); 1169 if (!heap()->deserialization_complete()) p->MarkNeverEvacuate();
1170 1170
1171 // When incremental marking was activated, old space pages are allocated 1171 // When incremental marking was activated, old space pages are allocated
1172 // black. 1172 // black.
1173 if (heap()->incremental_marking()->black_allocation() && 1173 if (heap()->incremental_marking()->black_allocation() &&
1174 identity() == OLD_SPACE) { 1174 identity() == OLD_SPACE) {
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 page->IsFlagSet(MemoryChunk::IN_FROM_SPACE)); 1810 page->IsFlagSet(MemoryChunk::IN_FROM_SPACE));
1811 } 1811 }
1812 } 1812 }
1813 1813
1814 1814
1815 void SemiSpace::Reset() { 1815 void SemiSpace::Reset() {
1816 DCHECK_NE(anchor_.next_page(), &anchor_); 1816 DCHECK_NE(anchor_.next_page(), &anchor_);
1817 current_page_ = anchor_.next_page(); 1817 current_page_ = anchor_.next_page();
1818 } 1818 }
1819 1819
1820 void SemiSpace::ReplaceWithEmptyPage(NewSpacePage* old_page) {
1821 NewSpacePage* new_page =
1822 heap()->memory_allocator()->AllocatePage<NewSpacePage>(
1823 NewSpacePage::kAllocatableMemory, this, executable());
1824 Bitmap::Clear(new_page);
1825 new_page->SetFlags(old_page->GetFlags(), NewSpacePage::kCopyAllFlags);
1826 new_page->set_next_page(old_page->next_page());
1827 new_page->set_prev_page(old_page->prev_page());
1828 old_page->next_page()->set_prev_page(new_page);
1829 old_page->prev_page()->set_next_page(new_page);
1830 heap()->CreateFillerObjectAt(new_page->area_start(), new_page->area_size(),
1831 ClearRecordedSlots::kNo);
1832 }
1820 1833
1821 void SemiSpace::Swap(SemiSpace* from, SemiSpace* to) { 1834 void SemiSpace::Swap(SemiSpace* from, SemiSpace* to) {
1822 // We won't be swapping semispaces without data in them. 1835 // We won't be swapping semispaces without data in them.
1823 DCHECK_NE(from->anchor_.next_page(), &from->anchor_); 1836 DCHECK_NE(from->anchor_.next_page(), &from->anchor_);
1824 DCHECK_NE(to->anchor_.next_page(), &to->anchor_); 1837 DCHECK_NE(to->anchor_.next_page(), &to->anchor_);
1825 1838
1826 intptr_t saved_to_space_flags = to->current_page()->GetFlags(); 1839 intptr_t saved_to_space_flags = to->current_page()->GetFlags();
1827 1840
1828 // We swap all properties but id_. 1841 // We swap all properties but id_.
1829 std::swap(from->current_capacity_, to->current_capacity_); 1842 std::swap(from->current_capacity_, to->current_capacity_);
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after
3127 object->ShortPrint(); 3140 object->ShortPrint();
3128 PrintF("\n"); 3141 PrintF("\n");
3129 } 3142 }
3130 printf(" --------------------------------------\n"); 3143 printf(" --------------------------------------\n");
3131 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3144 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3132 } 3145 }
3133 3146
3134 #endif // DEBUG 3147 #endif // DEBUG
3135 } // namespace internal 3148 } // namespace internal
3136 } // namespace v8 3149 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/spaces.h ('k') | src/heap/spaces-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698