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/mark-compact.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 | « no previous file | src/heap/spaces.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/mark-compact.h" 5 #include "src/heap/mark-compact.h"
6 6
7 #include "src/base/atomicops.h" 7 #include "src/base/atomicops.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/base/sys-info.h" 9 #include "src/base/sys-info.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 intptr_t promoted_size_; 1794 intptr_t promoted_size_;
1795 intptr_t semispace_copied_size_; 1795 intptr_t semispace_copied_size_;
1796 HashMap* local_pretenuring_feedback_; 1796 HashMap* local_pretenuring_feedback_;
1797 }; 1797 };
1798 1798
1799 class MarkCompactCollector::EvacuateNewSpacePageVisitor final 1799 class MarkCompactCollector::EvacuateNewSpacePageVisitor final
1800 : public MarkCompactCollector::HeapObjectVisitor { 1800 : public MarkCompactCollector::HeapObjectVisitor {
1801 public: 1801 public:
1802 EvacuateNewSpacePageVisitor() : promoted_size_(0) {} 1802 EvacuateNewSpacePageVisitor() : promoted_size_(0) {}
1803 1803
1804 static void MoveToOldSpace(Page* page, PagedSpace* owner) { 1804 static void TryMoveToOldSpace(Page* page, PagedSpace* owner) {
1805 page->heap()->new_space()->ReplaceWithEmptyPage(page); 1805 if (page->heap()->new_space()->ReplaceWithEmptyPage(page)) {
1806 Page* new_page = Page::ConvertNewToOld(page, owner); 1806 Page* new_page = Page::ConvertNewToOld(page, owner);
1807 new_page->SetFlag(Page::PAGE_NEW_OLD_PROMOTION); 1807 new_page->SetFlag(Page::PAGE_NEW_OLD_PROMOTION);
1808 }
1808 } 1809 }
1809 1810
1810 inline bool Visit(HeapObject* object) { 1811 inline bool Visit(HeapObject* object) {
1811 if (V8_UNLIKELY(object->IsJSArrayBuffer())) { 1812 if (V8_UNLIKELY(object->IsJSArrayBuffer())) {
1812 object->GetHeap()->array_buffer_tracker()->Promote( 1813 object->GetHeap()->array_buffer_tracker()->Promote(
1813 JSArrayBuffer::cast(object)); 1814 JSArrayBuffer::cast(object));
1814 } 1815 }
1815 RecordMigratedSlotVisitor visitor; 1816 RecordMigratedSlotVisitor visitor;
1816 object->IterateBodyFast(&visitor); 1817 object->IterateBodyFast(&visitor);
1817 promoted_size_ += object->Size(); 1818 promoted_size_ += object->Size();
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after
3286 job.AddPage(page, &abandoned_pages); 3287 job.AddPage(page, &abandoned_pages);
3287 } 3288 }
3288 3289
3289 const Address age_mark = heap()->new_space()->age_mark(); 3290 const Address age_mark = heap()->new_space()->age_mark();
3290 for (Page* page : newspace_evacuation_candidates_) { 3291 for (Page* page : newspace_evacuation_candidates_) {
3291 live_bytes += page->LiveBytes(); 3292 live_bytes += page->LiveBytes();
3292 if (!page->NeverEvacuate() && 3293 if (!page->NeverEvacuate() &&
3293 (page->LiveBytes() > Evacuator::PageEvacuationThreshold()) && 3294 (page->LiveBytes() > Evacuator::PageEvacuationThreshold()) &&
3294 page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK) && 3295 page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK) &&
3295 !page->Contains(age_mark)) { 3296 !page->Contains(age_mark)) {
3296 EvacuateNewSpacePageVisitor::MoveToOldSpace(page, heap()->old_space()); 3297 EvacuateNewSpacePageVisitor::TryMoveToOldSpace(page, heap()->old_space());
3297 } 3298 }
3298 job.AddPage(page, &abandoned_pages); 3299 job.AddPage(page, &abandoned_pages);
3299 } 3300 }
3300 DCHECK_GE(job.NumberOfPages(), 1); 3301 DCHECK_GE(job.NumberOfPages(), 1);
3301 3302
3302 // Used for trace summary. 3303 // Used for trace summary.
3303 double compaction_speed = 0; 3304 double compaction_speed = 0;
3304 if (FLAG_trace_evacuation) { 3305 if (FLAG_trace_evacuation) {
3305 compaction_speed = heap()->tracer()->CompactionSpeedInBytesPerMillisecond(); 3306 compaction_speed = heap()->tracer()->CompactionSpeedInBytesPerMillisecond();
3306 } 3307 }
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
3946 MarkBit mark_bit = Marking::MarkBitFrom(host); 3947 MarkBit mark_bit = Marking::MarkBitFrom(host);
3947 if (Marking::IsBlack(mark_bit)) { 3948 if (Marking::IsBlack(mark_bit)) {
3948 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); 3949 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host);
3949 RecordRelocSlot(host, &rinfo, target); 3950 RecordRelocSlot(host, &rinfo, target);
3950 } 3951 }
3951 } 3952 }
3952 } 3953 }
3953 3954
3954 } // namespace internal 3955 } // namespace internal
3955 } // namespace v8 3956 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/heap/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698