OLD | NEW |
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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 Object* e = stubs->ValueAt(i); | 460 Object* e = stubs->ValueAt(i); |
461 if (e->IsCode()) { | 461 if (e->IsCode()) { |
462 RecordWriteStub::Patch(Code::cast(e), mode); | 462 RecordWriteStub::Patch(Code::cast(e), mode); |
463 } | 463 } |
464 } | 464 } |
465 } | 465 } |
466 } | 466 } |
467 } | 467 } |
468 | 468 |
469 | 469 |
470 void IncrementalMarking::Start(int mark_compact_flags) { | 470 void IncrementalMarking::Start() { |
471 if (FLAG_trace_incremental_marking) { | 471 if (FLAG_trace_incremental_marking) { |
472 PrintF("[IncrementalMarking] Start\n"); | 472 PrintF("[IncrementalMarking] Start\n"); |
473 } | 473 } |
474 DCHECK(FLAG_incremental_marking); | 474 DCHECK(FLAG_incremental_marking); |
475 DCHECK(FLAG_incremental_marking_steps); | 475 DCHECK(FLAG_incremental_marking_steps); |
476 DCHECK(state_ == STOPPED); | 476 DCHECK(state_ == STOPPED); |
477 DCHECK(heap_->gc_state() == Heap::NOT_IN_GC); | 477 DCHECK(heap_->gc_state() == Heap::NOT_IN_GC); |
478 DCHECK(!heap_->isolate()->serializer_enabled()); | 478 DCHECK(!heap_->isolate()->serializer_enabled()); |
479 | 479 |
480 ResetStepCounters(); | 480 ResetStepCounters(); |
481 | 481 |
482 was_activated_ = true; | 482 was_activated_ = true; |
483 | 483 |
484 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { | 484 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { |
485 heap_->mark_compact_collector()->SetFlags(mark_compact_flags); | |
486 StartMarking(); | 485 StartMarking(); |
487 heap_->mark_compact_collector()->SetFlags(Heap::kNoGCFlags); | |
488 } else { | 486 } else { |
489 if (FLAG_trace_incremental_marking) { | 487 if (FLAG_trace_incremental_marking) { |
490 PrintF("[IncrementalMarking] Start sweeping.\n"); | 488 PrintF("[IncrementalMarking] Start sweeping.\n"); |
491 } | 489 } |
492 state_ = SWEEPING; | 490 state_ = SWEEPING; |
493 } | 491 } |
494 | 492 |
495 heap_->new_space()->LowerInlineAllocationLimit(kAllocatedThreshold); | 493 heap_->new_space()->LowerInlineAllocationLimit(kAllocatedThreshold); |
496 } | 494 } |
497 | 495 |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 | 824 |
827 void IncrementalMarking::Epilogue() { | 825 void IncrementalMarking::Epilogue() { |
828 was_activated_ = false; | 826 was_activated_ = false; |
829 weak_closure_was_overapproximated_ = false; | 827 weak_closure_was_overapproximated_ = false; |
830 weak_closure_approximation_rounds_ = 0; | 828 weak_closure_approximation_rounds_ = 0; |
831 } | 829 } |
832 | 830 |
833 | 831 |
834 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { | 832 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { |
835 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) { | 833 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) { |
836 Start(Heap::kNoGCFlags); | 834 Start(); |
837 } else { | 835 } else { |
838 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); | 836 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); |
839 } | 837 } |
840 } | 838 } |
841 | 839 |
842 | 840 |
843 void IncrementalMarking::SpeedUp() { | 841 void IncrementalMarking::SpeedUp() { |
844 bool speed_up = false; | 842 bool speed_up = false; |
845 | 843 |
846 if ((steps_count_ % kMarkingSpeedAccellerationInterval) == 0) { | 844 if ((steps_count_ % kMarkingSpeedAccellerationInterval) == 0) { |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1028 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
1031 idle_marking_delay_counter_++; | 1029 idle_marking_delay_counter_++; |
1032 } | 1030 } |
1033 | 1031 |
1034 | 1032 |
1035 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1033 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1036 idle_marking_delay_counter_ = 0; | 1034 idle_marking_delay_counter_ = 0; |
1037 } | 1035 } |
1038 } | 1036 } |
1039 } // namespace v8::internal | 1037 } // namespace v8::internal |
OLD | NEW |