| 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() { | 470 void IncrementalMarking::Start(int mark_compact_flags) { |
| 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); |
| 485 StartMarking(); | 486 StartMarking(); |
| 487 heap_->mark_compact_collector()->SetFlags(Heap::kNoGCFlags); |
| 486 } else { | 488 } else { |
| 487 if (FLAG_trace_incremental_marking) { | 489 if (FLAG_trace_incremental_marking) { |
| 488 PrintF("[IncrementalMarking] Start sweeping.\n"); | 490 PrintF("[IncrementalMarking] Start sweeping.\n"); |
| 489 } | 491 } |
| 490 state_ = SWEEPING; | 492 state_ = SWEEPING; |
| 491 } | 493 } |
| 492 | 494 |
| 493 heap_->new_space()->LowerInlineAllocationLimit(kAllocatedThreshold); | 495 heap_->new_space()->LowerInlineAllocationLimit(kAllocatedThreshold); |
| 494 } | 496 } |
| 495 | 497 |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 | 826 |
| 825 void IncrementalMarking::Epilogue() { | 827 void IncrementalMarking::Epilogue() { |
| 826 was_activated_ = false; | 828 was_activated_ = false; |
| 827 weak_closure_was_overapproximated_ = false; | 829 weak_closure_was_overapproximated_ = false; |
| 828 weak_closure_approximation_rounds_ = 0; | 830 weak_closure_approximation_rounds_ = 0; |
| 829 } | 831 } |
| 830 | 832 |
| 831 | 833 |
| 832 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { | 834 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { |
| 833 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) { | 835 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) { |
| 834 Start(); | 836 Start(Heap::kNoGCFlags); |
| 835 } else { | 837 } else { |
| 836 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); | 838 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); |
| 837 } | 839 } |
| 838 } | 840 } |
| 839 | 841 |
| 840 | 842 |
| 841 void IncrementalMarking::SpeedUp() { | 843 void IncrementalMarking::SpeedUp() { |
| 842 bool speed_up = false; | 844 bool speed_up = false; |
| 843 | 845 |
| 844 if ((steps_count_ % kMarkingSpeedAccellerationInterval) == 0) { | 846 if ((steps_count_ % kMarkingSpeedAccellerationInterval) == 0) { |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1030 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
| 1029 idle_marking_delay_counter_++; | 1031 idle_marking_delay_counter_++; |
| 1030 } | 1032 } |
| 1031 | 1033 |
| 1032 | 1034 |
| 1033 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1035 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
| 1034 idle_marking_delay_counter_ = 0; | 1036 idle_marking_delay_counter_ = 0; |
| 1035 } | 1037 } |
| 1036 } | 1038 } |
| 1037 } // namespace v8::internal | 1039 } // namespace v8::internal |
| OLD | NEW |