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

Side by Side Diff: src/heap/mark-compact.cc

Issue 1929503002: Reland of "[heap] Uncommit pooled pages concurrently" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed pooling 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/heap.cc ('k') | 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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 839
840 DCHECK(!FLAG_never_compact || !FLAG_always_compact); 840 DCHECK(!FLAG_never_compact || !FLAG_always_compact);
841 841
842 if (sweeping_in_progress()) { 842 if (sweeping_in_progress()) {
843 // Instead of waiting we could also abort the sweeper threads here. 843 // Instead of waiting we could also abort the sweeper threads here.
844 EnsureSweepingCompleted(); 844 EnsureSweepingCompleted();
845 } 845 }
846 846
847 // If concurrent unmapping tasks are still running, we should wait for 847 // If concurrent unmapping tasks are still running, we should wait for
848 // them here. 848 // them here.
849 heap()->WaitUntilUnmappingOfFreeChunksCompleted(); 849 heap()->memory_allocator()->unmapper()->WaitUntilCompleted();
850 850
851 // Clear marking bits if incremental marking is aborted. 851 // Clear marking bits if incremental marking is aborted.
852 if (was_marked_incrementally_ && heap_->ShouldAbortIncrementalMarking()) { 852 if (was_marked_incrementally_ && heap_->ShouldAbortIncrementalMarking()) {
853 heap()->incremental_marking()->Stop(); 853 heap()->incremental_marking()->Stop();
854 ClearMarkbits(); 854 ClearMarkbits();
855 AbortWeakCollections(); 855 AbortWeakCollections();
856 AbortWeakCells(); 856 AbortWeakCells();
857 AbortTransitionArrays(); 857 AbortTransitionArrays();
858 AbortCompaction(); 858 AbortCompaction();
859 was_marked_incrementally_ = false; 859 was_marked_incrementally_ = false;
(...skipping 2672 matching lines...) Expand 10 before | Expand all | Expand 10 after
3532 EvacuateNewSpaceEpilogue(); 3532 EvacuateNewSpaceEpilogue();
3533 heap()->new_space()->set_age_mark(heap()->new_space()->top()); 3533 heap()->new_space()->set_age_mark(heap()->new_space()->top());
3534 } 3534 }
3535 3535
3536 UpdatePointersAfterEvacuation(); 3536 UpdatePointersAfterEvacuation();
3537 3537
3538 // Give pages that are queued to be freed back to the OS. Note that filtering 3538 // Give pages that are queued to be freed back to the OS. Note that filtering
3539 // slots only handles old space (for unboxed doubles), and thus map space can 3539 // slots only handles old space (for unboxed doubles), and thus map space can
3540 // still contain stale pointers. We only free the chunks after pointer updates 3540 // still contain stale pointers. We only free the chunks after pointer updates
3541 // to still have access to page headers. 3541 // to still have access to page headers.
3542 heap()->FreeQueuedChunks(); 3542 heap()->memory_allocator()->unmapper()->FreeQueuedChunks();
3543 3543
3544 { 3544 {
3545 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE_CLEAN_UP); 3545 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE_CLEAN_UP);
3546 3546
3547 for (Page* p : evacuation_candidates_) { 3547 for (Page* p : evacuation_candidates_) {
3548 // Important: skip list should be cleared only after roots were updated 3548 // Important: skip list should be cleared only after roots were updated
3549 // because root iteration traverses the stack and might have to find 3549 // because root iteration traverses the stack and might have to find
3550 // code objects from non-updated pc pointing into evacuation candidate. 3550 // code objects from non-updated pc pointing into evacuation candidate.
3551 SkipList* list = p->skip_list(); 3551 SkipList* list = p->skip_list();
3552 if (list != NULL) list->Clear(); 3552 if (list != NULL) list->Clear();
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
3720 void MarkCompactCollector::ReleaseEvacuationCandidates() { 3720 void MarkCompactCollector::ReleaseEvacuationCandidates() {
3721 for (Page* p : evacuation_candidates_) { 3721 for (Page* p : evacuation_candidates_) {
3722 if (!p->IsEvacuationCandidate()) continue; 3722 if (!p->IsEvacuationCandidate()) continue;
3723 PagedSpace* space = static_cast<PagedSpace*>(p->owner()); 3723 PagedSpace* space = static_cast<PagedSpace*>(p->owner());
3724 p->ResetLiveBytes(); 3724 p->ResetLiveBytes();
3725 CHECK(p->SweepingDone()); 3725 CHECK(p->SweepingDone());
3726 space->ReleasePage(p); 3726 space->ReleasePage(p);
3727 } 3727 }
3728 evacuation_candidates_.Rewind(0); 3728 evacuation_candidates_.Rewind(0);
3729 compacting_ = false; 3729 compacting_ = false;
3730 heap()->FreeQueuedChunks(); 3730 heap()->memory_allocator()->unmapper()->FreeQueuedChunks();
3731 } 3731 }
3732 3732
3733 int MarkCompactCollector::Sweeper::ParallelSweepSpace(AllocationSpace identity, 3733 int MarkCompactCollector::Sweeper::ParallelSweepSpace(AllocationSpace identity,
3734 int required_freed_bytes, 3734 int required_freed_bytes,
3735 int max_pages) { 3735 int max_pages) {
3736 int max_freed = 0; 3736 int max_freed = 0;
3737 int pages_freed = 0; 3737 int pages_freed = 0;
3738 Page* page = nullptr; 3738 Page* page = nullptr;
3739 while ((page = GetSweepingPageSafe(identity)) != nullptr) { 3739 while ((page = GetSweepingPageSafe(identity)) != nullptr) {
3740 int freed = ParallelSweepPage(page, heap_->paged_space(identity)); 3740 int freed = ParallelSweepPage(page, heap_->paged_space(identity));
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
3946 MarkBit mark_bit = Marking::MarkBitFrom(host); 3946 MarkBit mark_bit = Marking::MarkBitFrom(host);
3947 if (Marking::IsBlack(mark_bit)) { 3947 if (Marking::IsBlack(mark_bit)) {
3948 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); 3948 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host);
3949 RecordRelocSlot(host, &rinfo, target); 3949 RecordRelocSlot(host, &rinfo, target);
3950 } 3950 }
3951 } 3951 }
3952 } 3952 }
3953 3953
3954 } // namespace internal 3954 } // namespace internal
3955 } // namespace v8 3955 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698