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

Side by Side Diff: src/heap/incremental-marking.cc

Issue 1048013003: Reland "Allow compaction when incremental marking is on." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/incremental-marking.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 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/heap/incremental-marking.h" 7 #include "src/heap/incremental-marking.h"
8 8
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/compilation-cache.h" 10 #include "src/compilation-cache.h"
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 Object* e = stubs->ValueAt(i); 461 Object* e = stubs->ValueAt(i);
462 if (e->IsCode()) { 462 if (e->IsCode()) {
463 RecordWriteStub::Patch(Code::cast(e), mode); 463 RecordWriteStub::Patch(Code::cast(e), mode);
464 } 464 }
465 } 465 }
466 } 466 }
467 } 467 }
468 } 468 }
469 469
470 470
471 void IncrementalMarking::Start(CompactionFlag flag) { 471 void IncrementalMarking::Start() {
472 if (FLAG_trace_incremental_marking) { 472 if (FLAG_trace_incremental_marking) {
473 PrintF("[IncrementalMarking] Start\n"); 473 PrintF("[IncrementalMarking] Start\n");
474 } 474 }
475 DCHECK(FLAG_incremental_marking); 475 DCHECK(FLAG_incremental_marking);
476 DCHECK(FLAG_incremental_marking_steps); 476 DCHECK(FLAG_incremental_marking_steps);
477 DCHECK(state_ == STOPPED); 477 DCHECK(state_ == STOPPED);
478 DCHECK(heap_->gc_state() == Heap::NOT_IN_GC); 478 DCHECK(heap_->gc_state() == Heap::NOT_IN_GC);
479 DCHECK(!heap_->isolate()->serializer_enabled()); 479 DCHECK(!heap_->isolate()->serializer_enabled());
480 480
481 ResetStepCounters(); 481 ResetStepCounters();
482 482
483 was_activated_ = true; 483 was_activated_ = true;
484 484
485 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { 485 if (!heap_->mark_compact_collector()->sweeping_in_progress()) {
486 StartMarking(flag); 486 StartMarking();
487 } else { 487 } else {
488 if (FLAG_trace_incremental_marking) { 488 if (FLAG_trace_incremental_marking) {
489 PrintF("[IncrementalMarking] Start sweeping.\n"); 489 PrintF("[IncrementalMarking] Start sweeping.\n");
490 } 490 }
491 state_ = SWEEPING; 491 state_ = SWEEPING;
492 } 492 }
493 493
494 heap_->new_space()->LowerInlineAllocationLimit(kAllocatedThreshold); 494 heap_->new_space()->LowerInlineAllocationLimit(kAllocatedThreshold);
495 } 495 }
496 496
497 497
498 void IncrementalMarking::StartMarking(CompactionFlag flag) { 498 void IncrementalMarking::StartMarking() {
499 if (FLAG_trace_incremental_marking) { 499 if (FLAG_trace_incremental_marking) {
500 PrintF("[IncrementalMarking] Start marking\n"); 500 PrintF("[IncrementalMarking] Start marking\n");
501 } 501 }
502 502
503 is_compacting_ = !FLAG_never_compact && (flag == ALLOW_COMPACTION) && 503 is_compacting_ = !FLAG_never_compact &&
504 heap_->mark_compact_collector()->StartCompaction( 504 heap_->mark_compact_collector()->StartCompaction(
505 MarkCompactCollector::INCREMENTAL_COMPACTION); 505 MarkCompactCollector::INCREMENTAL_COMPACTION);
506 506
507 state_ = MARKING; 507 state_ = MARKING;
508 508
509 RecordWriteStub::Mode mode = is_compacting_ 509 RecordWriteStub::Mode mode = is_compacting_
510 ? RecordWriteStub::INCREMENTAL_COMPACTION 510 ? RecordWriteStub::INCREMENTAL_COMPACTION
511 : RecordWriteStub::INCREMENTAL; 511 : RecordWriteStub::INCREMENTAL;
512 512
513 PatchIncrementalMarkingRecordWriteStubs(heap_, mode); 513 PatchIncrementalMarkingRecordWriteStubs(heap_, mode);
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 827
828 void IncrementalMarking::Epilogue() { 828 void IncrementalMarking::Epilogue() {
829 was_activated_ = false; 829 was_activated_ = false;
830 weak_closure_was_overapproximated_ = false; 830 weak_closure_was_overapproximated_ = false;
831 weak_closure_approximation_rounds_ = 0; 831 weak_closure_approximation_rounds_ = 0;
832 } 832 }
833 833
834 834
835 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { 835 void IncrementalMarking::OldSpaceStep(intptr_t allocated) {
836 if (IsStopped() && ShouldActivate()) { 836 if (IsStopped() && ShouldActivate()) {
837 // TODO(hpayer): Let's play safe for now, but compaction should be 837 Start();
838 // in principle possible.
839 Start(PREVENT_COMPACTION);
840 } else { 838 } else {
841 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); 839 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD);
842 } 840 }
843 } 841 }
844 842
845 843
846 void IncrementalMarking::SpeedUp() { 844 void IncrementalMarking::SpeedUp() {
847 bool speed_up = false; 845 bool speed_up = false;
848 846
849 if ((steps_count_ % kMarkingSpeedAccellerationInterval) == 0) { 847 if ((steps_count_ % kMarkingSpeedAccellerationInterval) == 0) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 bytes_scanned_ += bytes_to_process; 956 bytes_scanned_ += bytes_to_process;
959 957
960 if (state_ == SWEEPING) { 958 if (state_ == SWEEPING) {
961 if (heap_->mark_compact_collector()->sweeping_in_progress() && 959 if (heap_->mark_compact_collector()->sweeping_in_progress() &&
962 (heap_->mark_compact_collector()->IsSweepingCompleted() || 960 (heap_->mark_compact_collector()->IsSweepingCompleted() ||
963 !heap_->concurrent_sweeping_enabled())) { 961 !heap_->concurrent_sweeping_enabled())) {
964 heap_->mark_compact_collector()->EnsureSweepingCompleted(); 962 heap_->mark_compact_collector()->EnsureSweepingCompleted();
965 } 963 }
966 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { 964 if (!heap_->mark_compact_collector()->sweeping_in_progress()) {
967 bytes_scanned_ = 0; 965 bytes_scanned_ = 0;
968 StartMarking(PREVENT_COMPACTION); 966 StartMarking();
969 } 967 }
970 } else if (state_ == MARKING) { 968 } else if (state_ == MARKING) {
971 bytes_processed = ProcessMarkingDeque(bytes_to_process); 969 bytes_processed = ProcessMarkingDeque(bytes_to_process);
972 if (heap_->mark_compact_collector()->marking_deque()->IsEmpty()) { 970 if (heap_->mark_compact_collector()->marking_deque()->IsEmpty()) {
973 if (completion == FORCE_COMPLETION || 971 if (completion == FORCE_COMPLETION ||
974 IsIdleMarkingDelayCounterLimitReached()) { 972 IsIdleMarkingDelayCounterLimitReached()) {
975 if (FLAG_overapproximate_weak_closure && 973 if (FLAG_overapproximate_weak_closure &&
976 !weak_closure_was_overapproximated_) { 974 !weak_closure_was_overapproximated_) {
977 OverApproximateWeakClosure(action); 975 OverApproximateWeakClosure(action);
978 } else { 976 } else {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { 1025 void IncrementalMarking::IncrementIdleMarkingDelayCounter() {
1028 idle_marking_delay_counter_++; 1026 idle_marking_delay_counter_++;
1029 } 1027 }
1030 1028
1031 1029
1032 void IncrementalMarking::ClearIdleMarkingDelayCounter() { 1030 void IncrementalMarking::ClearIdleMarkingDelayCounter() {
1033 idle_marking_delay_counter_ = 0; 1031 idle_marking_delay_counter_ = 0;
1034 } 1032 }
1035 } 1033 }
1036 } // namespace v8::internal 1034 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/incremental-marking.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698