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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 ActivateIncrementalWriteBarrier(heap_->new_space()); | 379 ActivateIncrementalWriteBarrier(heap_->new_space()); |
380 | 380 |
381 LargePage* lop = heap_->lo_space()->first_page(); | 381 LargePage* lop = heap_->lo_space()->first_page(); |
382 while (lop->is_valid()) { | 382 while (lop->is_valid()) { |
383 SetOldSpacePageFlags(lop, true, is_compacting_); | 383 SetOldSpacePageFlags(lop, true, is_compacting_); |
384 lop = lop->next_page(); | 384 lop = lop->next_page(); |
385 } | 385 } |
386 } | 386 } |
387 | 387 |
388 | 388 |
389 bool IncrementalMarking::ShouldActivate() { | 389 bool IncrementalMarking::ShouldActivateEvenWithoutIdleNotification() { |
390 return WorthActivating() && | 390 return CanBeActivated() && |
391 heap_->NextGCIsLikelyToBeFull( | 391 heap_->HeapIsFullEnoughToStartIncrementalMarking( |
392 heap_->old_generation_allocation_limit()); | 392 heap_->old_generation_allocation_limit()); |
393 } | 393 } |
394 | 394 |
395 | 395 |
396 bool IncrementalMarking::WasActivated() { return was_activated_; } | 396 bool IncrementalMarking::WasActivated() { return was_activated_; } |
397 | 397 |
398 | 398 |
399 bool IncrementalMarking::WorthActivating() { | 399 bool IncrementalMarking::CanBeActivated() { |
400 #ifndef DEBUG | 400 #ifndef DEBUG |
401 static const intptr_t kActivationThreshold = 8 * MB; | 401 static const intptr_t kActivationThreshold = 8 * MB; |
402 #else | 402 #else |
403 // TODO(gc) consider setting this to some low level so that some | 403 // TODO(gc) consider setting this to some low level so that some |
404 // debug tests run with incremental marking and some without. | 404 // debug tests run with incremental marking and some without. |
405 static const intptr_t kActivationThreshold = 0; | 405 static const intptr_t kActivationThreshold = 0; |
406 #endif | 406 #endif |
407 // Only start incremental marking in a safe state: 1) when incremental | 407 // Only start incremental marking in a safe state: 1) when incremental |
408 // marking is turned on, 2) when we are currently not in a GC, and | 408 // marking is turned on, 2) when we are currently not in a GC, and |
409 // 3) when we are currently not serializing or deserializing the heap. | 409 // 3) when we are currently not serializing or deserializing the heap. |
| 410 // Don't switch on for very small heaps. |
410 return FLAG_incremental_marking && FLAG_incremental_marking_steps && | 411 return FLAG_incremental_marking && FLAG_incremental_marking_steps && |
411 heap_->gc_state() == Heap::NOT_IN_GC && | 412 heap_->gc_state() == Heap::NOT_IN_GC && |
412 heap_->deserialization_complete() && | 413 heap_->deserialization_complete() && |
413 !heap_->isolate()->serializer_enabled() && | 414 !heap_->isolate()->serializer_enabled() && |
414 heap_->PromotedSpaceSizeOfObjects() > kActivationThreshold; | 415 heap_->PromotedSpaceSizeOfObjects() > kActivationThreshold; |
415 } | 416 } |
416 | 417 |
417 | 418 |
418 void IncrementalMarking::ActivateGeneratedStub(Code* stub) { | 419 void IncrementalMarking::ActivateGeneratedStub(Code* stub) { |
419 DCHECK(RecordWriteStub::GetMode(stub) == RecordWriteStub::STORE_BUFFER_ONLY); | 420 DCHECK(RecordWriteStub::GetMode(stub) == RecordWriteStub::STORE_BUFFER_ONLY); |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 | 808 |
808 | 809 |
809 void IncrementalMarking::Epilogue() { | 810 void IncrementalMarking::Epilogue() { |
810 was_activated_ = false; | 811 was_activated_ = false; |
811 weak_closure_was_overapproximated_ = false; | 812 weak_closure_was_overapproximated_ = false; |
812 weak_closure_approximation_rounds_ = 0; | 813 weak_closure_approximation_rounds_ = 0; |
813 } | 814 } |
814 | 815 |
815 | 816 |
816 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { | 817 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { |
817 if (IsStopped() && ShouldActivate()) { | 818 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) { |
818 Start(); | 819 Start(); |
819 } else { | 820 } else { |
820 Step(allocated * kOldSpaceAllocationMarkingFactor, GC_VIA_STACK_GUARD); | 821 Step(allocated * kOldSpaceAllocationMarkingFactor, GC_VIA_STACK_GUARD); |
821 } | 822 } |
822 } | 823 } |
823 | 824 |
824 | 825 |
825 void IncrementalMarking::SpeedUp() { | 826 void IncrementalMarking::SpeedUp() { |
826 bool speed_up = false; | 827 bool speed_up = false; |
827 | 828 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1006 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
1006 idle_marking_delay_counter_++; | 1007 idle_marking_delay_counter_++; |
1007 } | 1008 } |
1008 | 1009 |
1009 | 1010 |
1010 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1011 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1011 idle_marking_delay_counter_ = 0; | 1012 idle_marking_delay_counter_ = 0; |
1012 } | 1013 } |
1013 } | 1014 } |
1014 } // namespace v8::internal | 1015 } // namespace v8::internal |
OLD | NEW |