| 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 |
| 477 // Only start incremental marking in a safe state: 1) when incremental | 484 // Only start incremental marking in a safe state: 1) when incremental |
| 478 // marking is turned on, 2) when we are currently not in a GC, and | 485 // marking is turned on, 2) when we are currently not in a GC, and |
| 479 // 3) when we are currently not serializing or deserializing the heap. | 486 // 3) when we are currently not serializing or deserializing the heap. |
| 480 // Don't switch on for very small heaps. | 487 // Don't switch on for very small heaps. |
| 481 return FLAG_incremental_marking && heap_->gc_state() == Heap::NOT_IN_GC && | 488 return FLAG_incremental_marking && heap_->gc_state() == Heap::NOT_IN_GC && |
| 482 heap_->deserialization_complete() && | 489 heap_->deserialization_complete() && |
| 483 !heap_->isolate()->serializer_enabled(); | 490 !heap_->isolate()->serializer_enabled() && |
| 491 heap_->PromotedSpaceSizeOfObjects() > kActivationThreshold; |
| 484 } | 492 } |
| 485 | 493 |
| 486 | 494 |
| 487 void IncrementalMarking::ActivateGeneratedStub(Code* stub) { | 495 void IncrementalMarking::ActivateGeneratedStub(Code* stub) { |
| 488 DCHECK(RecordWriteStub::GetMode(stub) == RecordWriteStub::STORE_BUFFER_ONLY); | 496 DCHECK(RecordWriteStub::GetMode(stub) == RecordWriteStub::STORE_BUFFER_ONLY); |
| 489 | 497 |
| 490 if (!IsMarking()) { | 498 if (!IsMarking()) { |
| 491 // Initially stub is generated in STORE_BUFFER_ONLY mode thus | 499 // Initially stub is generated in STORE_BUFFER_ONLY mode thus |
| 492 // we don't need to do anything if incremental marking is | 500 // we don't need to do anything if incremental marking is |
| 493 // not active. | 501 // not active. |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1154 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
| 1147 idle_marking_delay_counter_++; | 1155 idle_marking_delay_counter_++; |
| 1148 } | 1156 } |
| 1149 | 1157 |
| 1150 | 1158 |
| 1151 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1159 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
| 1152 idle_marking_delay_counter_ = 0; | 1160 idle_marking_delay_counter_ = 0; |
| 1153 } | 1161 } |
| 1154 } // namespace internal | 1162 } // namespace internal |
| 1155 } // namespace v8 | 1163 } // namespace v8 |
| OLD | NEW |