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

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

Issue 1928883002: [heap] Bail out to regular evacuation if new->old fails to allocate a page (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comment Created 4 years, 7 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') | no next file » | 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 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after
1819 page->IsFlagSet(MemoryChunk::IN_FROM_SPACE)); 1819 page->IsFlagSet(MemoryChunk::IN_FROM_SPACE));
1820 } 1820 }
1821 } 1821 }
1822 1822
1823 1823
1824 void SemiSpace::Reset() { 1824 void SemiSpace::Reset() {
1825 DCHECK_NE(anchor_.next_page(), &anchor_); 1825 DCHECK_NE(anchor_.next_page(), &anchor_);
1826 current_page_ = anchor_.next_page(); 1826 current_page_ = anchor_.next_page();
1827 } 1827 }
1828 1828
1829 void SemiSpace::ReplaceWithEmptyPage(Page* old_page) { 1829 bool SemiSpace::ReplaceWithEmptyPage(Page* old_page) {
1830 // TODO(mlippautz): We do not have to get a new page here when the semispace
1831 // is uncommitted later on.
1830 Page* new_page = heap()->memory_allocator()->AllocatePage( 1832 Page* new_page = heap()->memory_allocator()->AllocatePage(
1831 Page::kAllocatableMemory, this, executable()); 1833 Page::kAllocatableMemory, this, executable());
1834 if (new_page == nullptr) return false;
1832 Bitmap::Clear(new_page); 1835 Bitmap::Clear(new_page);
1833 new_page->SetFlags(old_page->GetFlags(), Page::kCopyAllFlags); 1836 new_page->SetFlags(old_page->GetFlags(), Page::kCopyAllFlags);
1834 new_page->set_next_page(old_page->next_page()); 1837 new_page->set_next_page(old_page->next_page());
1835 new_page->set_prev_page(old_page->prev_page()); 1838 new_page->set_prev_page(old_page->prev_page());
1836 old_page->next_page()->set_prev_page(new_page); 1839 old_page->next_page()->set_prev_page(new_page);
1837 old_page->prev_page()->set_next_page(new_page); 1840 old_page->prev_page()->set_next_page(new_page);
1838 heap()->CreateFillerObjectAt(new_page->area_start(), new_page->area_size(), 1841 heap()->CreateFillerObjectAt(new_page->area_start(), new_page->area_size(),
1839 ClearRecordedSlots::kNo); 1842 ClearRecordedSlots::kNo);
1843 return true;
1840 } 1844 }
1841 1845
1842 void SemiSpace::Swap(SemiSpace* from, SemiSpace* to) { 1846 void SemiSpace::Swap(SemiSpace* from, SemiSpace* to) {
1843 // We won't be swapping semispaces without data in them. 1847 // We won't be swapping semispaces without data in them.
1844 DCHECK_NE(from->anchor_.next_page(), &from->anchor_); 1848 DCHECK_NE(from->anchor_.next_page(), &from->anchor_);
1845 DCHECK_NE(to->anchor_.next_page(), &to->anchor_); 1849 DCHECK_NE(to->anchor_.next_page(), &to->anchor_);
1846 1850
1847 intptr_t saved_to_space_flags = to->current_page()->GetFlags(); 1851 intptr_t saved_to_space_flags = to->current_page()->GetFlags();
1848 1852
1849 // We swap all properties but id_. 1853 // We swap all properties but id_.
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after
3148 object->ShortPrint(); 3152 object->ShortPrint();
3149 PrintF("\n"); 3153 PrintF("\n");
3150 } 3154 }
3151 printf(" --------------------------------------\n"); 3155 printf(" --------------------------------------\n");
3152 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3156 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3153 } 3157 }
3154 3158
3155 #endif // DEBUG 3159 #endif // DEBUG
3156 } // namespace internal 3160 } // namespace internal
3157 } // namespace v8 3161 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/spaces.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698