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

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

Issue 1522433002: [heap] Remove heap-local variable caching FLAG_concurrent_sweeping (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years 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/incremental-marking.cc ('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 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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 // We were not able to sweep that page, i.e., a concurrent 554 // We were not able to sweep that page, i.e., a concurrent
555 // sweeper thread currently owns this page. Wait for the sweeper 555 // sweeper thread currently owns this page. Wait for the sweeper
556 // thread to be done with this page. 556 // thread to be done with this page.
557 page->WaitUntilSweepingCompleted(); 557 page->WaitUntilSweepingCompleted();
558 } 558 }
559 } 559 }
560 } 560 }
561 561
562 562
563 void MarkCompactCollector::SweepAndRefill(CompactionSpace* space) { 563 void MarkCompactCollector::SweepAndRefill(CompactionSpace* space) {
564 if (heap()->concurrent_sweeping_enabled() && !IsSweepingCompleted()) { 564 if (FLAG_concurrent_sweeping && !IsSweepingCompleted()) {
565 SweepInParallel(heap()->paged_space(space->identity()), 0); 565 SweepInParallel(heap()->paged_space(space->identity()), 0);
566 space->RefillFreeList(); 566 space->RefillFreeList();
567 } 567 }
568 } 568 }
569 569
570 570
571 void MarkCompactCollector::EnsureSweepingCompleted() { 571 void MarkCompactCollector::EnsureSweepingCompleted() {
572 DCHECK(sweeping_in_progress_ == true); 572 DCHECK(sweeping_in_progress_ == true);
573 573
574 // If sweeping is not completed or not running at all, we try to complete it 574 // If sweeping is not completed or not running at all, we try to complete it
575 // here. 575 // here.
576 if (!heap()->concurrent_sweeping_enabled() || !IsSweepingCompleted()) { 576 if (!FLAG_concurrent_sweeping || !IsSweepingCompleted()) {
577 SweepInParallel(heap()->paged_space(OLD_SPACE), 0); 577 SweepInParallel(heap()->paged_space(OLD_SPACE), 0);
578 SweepInParallel(heap()->paged_space(CODE_SPACE), 0); 578 SweepInParallel(heap()->paged_space(CODE_SPACE), 0);
579 SweepInParallel(heap()->paged_space(MAP_SPACE), 0); 579 SweepInParallel(heap()->paged_space(MAP_SPACE), 0);
580 } 580 }
581 581
582 if (heap()->concurrent_sweeping_enabled()) { 582 if (FLAG_concurrent_sweeping) {
583 pending_sweeper_tasks_semaphore_.Wait(); 583 pending_sweeper_tasks_semaphore_.Wait();
584 pending_sweeper_tasks_semaphore_.Wait(); 584 pending_sweeper_tasks_semaphore_.Wait();
585 pending_sweeper_tasks_semaphore_.Wait(); 585 pending_sweeper_tasks_semaphore_.Wait();
586 } 586 }
587 587
588 ParallelSweepSpacesComplete(); 588 ParallelSweepSpacesComplete();
589 sweeping_in_progress_ = false; 589 sweeping_in_progress_ = false;
590 heap()->old_space()->RefillFreeList(); 590 heap()->old_space()->RefillFreeList();
591 heap()->code_space()->RefillFreeList(); 591 heap()->code_space()->RefillFreeList();
592 heap()->map_space()->RefillFreeList(); 592 heap()->map_space()->RefillFreeList();
(...skipping 3248 matching lines...) Expand 10 before | Expand all | Expand 10 after
3841 GCTracer::Scope sweep_scope(heap()->tracer(), 3841 GCTracer::Scope sweep_scope(heap()->tracer(),
3842 GCTracer::Scope::MC_SWEEP_CODE); 3842 GCTracer::Scope::MC_SWEEP_CODE);
3843 SweepSpace(heap()->code_space(), CONCURRENT_SWEEPING); 3843 SweepSpace(heap()->code_space(), CONCURRENT_SWEEPING);
3844 } 3844 }
3845 { 3845 {
3846 GCTracer::Scope sweep_scope(heap()->tracer(), 3846 GCTracer::Scope sweep_scope(heap()->tracer(),
3847 GCTracer::Scope::MC_SWEEP_MAP); 3847 GCTracer::Scope::MC_SWEEP_MAP);
3848 SweepSpace(heap()->map_space(), CONCURRENT_SWEEPING); 3848 SweepSpace(heap()->map_space(), CONCURRENT_SWEEPING);
3849 } 3849 }
3850 sweeping_in_progress_ = true; 3850 sweeping_in_progress_ = true;
3851 if (heap()->concurrent_sweeping_enabled()) { 3851 if (FLAG_concurrent_sweeping) {
3852 StartSweeperThreads(); 3852 StartSweeperThreads();
3853 } 3853 }
3854 } 3854 }
3855 3855
3856 // Deallocate unmarked large objects. 3856 // Deallocate unmarked large objects.
3857 heap_->lo_space()->FreeUnmarkedObjects(); 3857 heap_->lo_space()->FreeUnmarkedObjects();
3858 3858
3859 // Give pages that are queued to be freed back to the OS. Invalid store 3859 // Give pages that are queued to be freed back to the OS. Invalid store
3860 // buffer entries are already filter out. We can just release the memory. 3860 // buffer entries are already filter out. We can just release the memory.
3861 heap()->FreeQueuedChunks(); 3861 heap()->FreeQueuedChunks();
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
3974 MarkBit mark_bit = Marking::MarkBitFrom(host); 3974 MarkBit mark_bit = Marking::MarkBitFrom(host);
3975 if (Marking::IsBlack(mark_bit)) { 3975 if (Marking::IsBlack(mark_bit)) {
3976 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); 3976 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host);
3977 RecordRelocSlot(&rinfo, target); 3977 RecordRelocSlot(&rinfo, target);
3978 } 3978 }
3979 } 3979 }
3980 } 3980 }
3981 3981
3982 } // namespace internal 3982 } // namespace internal
3983 } // namespace v8 3983 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/incremental-marking.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698