| 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 ActivateIncrementalWriteBarrier(heap_->map_space()); | 393 ActivateIncrementalWriteBarrier(heap_->map_space()); |
| 394 ActivateIncrementalWriteBarrier(heap_->code_space()); | 394 ActivateIncrementalWriteBarrier(heap_->code_space()); |
| 395 ActivateIncrementalWriteBarrier(heap_->new_space()); | 395 ActivateIncrementalWriteBarrier(heap_->new_space()); |
| 396 | 396 |
| 397 for (LargePage* lop : *heap_->lo_space()) { | 397 for (LargePage* lop : *heap_->lo_space()) { |
| 398 SetOldSpacePageFlags(lop, true, is_compacting_); | 398 SetOldSpacePageFlags(lop, true, is_compacting_); |
| 399 } | 399 } |
| 400 } | 400 } |
| 401 | 401 |
| 402 | 402 |
| 403 bool IncrementalMarking::ShouldActivateEvenWithoutIdleNotification() { | |
| 404 #ifndef DEBUG | |
| 405 static const intptr_t kActivationThreshold = 8 * MB; | |
| 406 #else | |
| 407 // TODO(gc) consider setting this to some low level so that some | |
| 408 // debug tests run with incremental marking and some without. | |
| 409 static const intptr_t kActivationThreshold = 0; | |
| 410 #endif | |
| 411 // Don't switch on for very small heaps. | |
| 412 return CanBeActivated() && | |
| 413 heap_->PromotedSpaceSizeOfObjects() > kActivationThreshold && | |
| 414 heap_->HeapIsFullEnoughToStartIncrementalMarking( | |
| 415 heap_->old_generation_allocation_limit()); | |
| 416 } | |
| 417 | |
| 418 | |
| 419 bool IncrementalMarking::WasActivated() { return was_activated_; } | 403 bool IncrementalMarking::WasActivated() { return was_activated_; } |
| 420 | 404 |
| 421 | 405 |
| 422 bool IncrementalMarking::CanBeActivated() { | 406 bool IncrementalMarking::CanBeActivated() { |
| 423 // Only start incremental marking in a safe state: 1) when incremental | 407 // Only start incremental marking in a safe state: 1) when incremental |
| 424 // 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 |
| 425 // 3) when we are currently not serializing or deserializing the heap. | 409 // 3) when we are currently not serializing or deserializing the heap. |
| 426 return FLAG_incremental_marking && heap_->gc_state() == Heap::NOT_IN_GC && | 410 return FLAG_incremental_marking && heap_->gc_state() == Heap::NOT_IN_GC && |
| 427 heap_->deserialization_complete() && | 411 heap_->deserialization_complete() && |
| 428 !heap_->isolate()->serializer_enabled(); | 412 !heap_->isolate()->serializer_enabled(); |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1217 idle_marking_delay_counter_++; | 1201 idle_marking_delay_counter_++; |
| 1218 } | 1202 } |
| 1219 | 1203 |
| 1220 | 1204 |
| 1221 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1205 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
| 1222 idle_marking_delay_counter_ = 0; | 1206 idle_marking_delay_counter_ = 0; |
| 1223 } | 1207 } |
| 1224 | 1208 |
| 1225 } // namespace internal | 1209 } // namespace internal |
| 1226 } // namespace v8 | 1210 } // namespace v8 |
| OLD | NEW |