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/heap/incremental-marking.h" | 5 #include "src/heap/incremental-marking.h" |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/compilation-cache.h" | 8 #include "src/compilation-cache.h" |
9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/heap/gc-idle-time-handler.h" | 10 #include "src/heap/gc-idle-time-handler.h" |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 return CanBeActivated() && | 467 return CanBeActivated() && |
468 heap_->HeapIsFullEnoughToStartIncrementalMarking( | 468 heap_->HeapIsFullEnoughToStartIncrementalMarking( |
469 heap_->old_generation_allocation_limit()); | 469 heap_->old_generation_allocation_limit()); |
470 } | 470 } |
471 | 471 |
472 | 472 |
473 bool IncrementalMarking::WasActivated() { return was_activated_; } | 473 bool IncrementalMarking::WasActivated() { return was_activated_; } |
474 | 474 |
475 | 475 |
476 bool IncrementalMarking::CanBeActivated() { | 476 bool IncrementalMarking::CanBeActivated() { |
477 #ifndef DEBUG | |
478 static const intptr_t kActivationThreshold = 8 * MB; | |
479 #else | |
480 // TODO(gc) consider setting this to some low level so that some | |
481 // debug tests run with incremental marking and some without. | |
482 static const intptr_t kActivationThreshold = 0; | |
483 #endif | |
484 // Only start incremental marking in a safe state: 1) when incremental | 477 // Only start incremental marking in a safe state: 1) when incremental |
485 // marking is turned on, 2) when we are currently not in a GC, and | 478 // marking is turned on, 2) when we are currently not in a GC, and |
486 // 3) when we are currently not serializing or deserializing the heap. | 479 // 3) when we are currently not serializing or deserializing the heap. |
487 // Don't switch on for very small heaps. | 480 // Don't switch on for very small heaps. |
488 return FLAG_incremental_marking && heap_->gc_state() == Heap::NOT_IN_GC && | 481 return FLAG_incremental_marking && heap_->gc_state() == Heap::NOT_IN_GC && |
489 heap_->deserialization_complete() && | 482 heap_->deserialization_complete() && |
490 !heap_->isolate()->serializer_enabled() && | 483 !heap_->isolate()->serializer_enabled(); |
491 heap_->PromotedSpaceSizeOfObjects() > kActivationThreshold; | |
492 } | 484 } |
493 | 485 |
494 | 486 |
495 void IncrementalMarking::ActivateGeneratedStub(Code* stub) { | 487 void IncrementalMarking::ActivateGeneratedStub(Code* stub) { |
496 DCHECK(RecordWriteStub::GetMode(stub) == RecordWriteStub::STORE_BUFFER_ONLY); | 488 DCHECK(RecordWriteStub::GetMode(stub) == RecordWriteStub::STORE_BUFFER_ONLY); |
497 | 489 |
498 if (!IsMarking()) { | 490 if (!IsMarking()) { |
499 // Initially stub is generated in STORE_BUFFER_ONLY mode thus | 491 // Initially stub is generated in STORE_BUFFER_ONLY mode thus |
500 // we don't need to do anything if incremental marking is | 492 // we don't need to do anything if incremental marking is |
501 // not active. | 493 // not active. |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1146 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
1155 idle_marking_delay_counter_++; | 1147 idle_marking_delay_counter_++; |
1156 } | 1148 } |
1157 | 1149 |
1158 | 1150 |
1159 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1151 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1160 idle_marking_delay_counter_ = 0; | 1152 idle_marking_delay_counter_ = 0; |
1161 } | 1153 } |
1162 } // namespace internal | 1154 } // namespace internal |
1163 } // namespace v8 | 1155 } // namespace v8 |
OLD | NEW |