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/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 4390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4401 CollectAllGarbage(kReduceMemoryFootprintMask, message); | 4401 CollectAllGarbage(kReduceMemoryFootprintMask, message); |
4402 gc_idle_time_handler_.NotifyIdleMarkCompact(); | 4402 gc_idle_time_handler_.NotifyIdleMarkCompact(); |
4403 gc_count_at_last_idle_gc_ = gc_count_; | 4403 gc_count_at_last_idle_gc_ = gc_count_; |
4404 if (uncommit) { | 4404 if (uncommit) { |
4405 new_space_.Shrink(); | 4405 new_space_.Shrink(); |
4406 UncommitFromSpace(); | 4406 UncommitFromSpace(); |
4407 } | 4407 } |
4408 } | 4408 } |
4409 | 4409 |
4410 | 4410 |
4411 void Heap::TryFinalizeIdleIncrementalMarking( | 4411 bool Heap::TryFinalizeIdleIncrementalMarking( |
4412 double idle_time_in_ms, size_t size_of_objects, | 4412 double idle_time_in_ms, size_t size_of_objects, |
4413 size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { | 4413 size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { |
4414 if (incremental_marking()->IsComplete() || | 4414 if (incremental_marking()->IsComplete() || |
4415 (mark_compact_collector_.marking_deque()->IsEmpty() && | 4415 (mark_compact_collector_.marking_deque()->IsEmpty() && |
4416 gc_idle_time_handler_.ShouldDoFinalIncrementalMarkCompact( | 4416 gc_idle_time_handler_.ShouldDoFinalIncrementalMarkCompact( |
4417 static_cast<size_t>(idle_time_in_ms), size_of_objects, | 4417 static_cast<size_t>(idle_time_in_ms), size_of_objects, |
4418 final_incremental_mark_compact_speed_in_bytes_per_ms))) { | 4418 final_incremental_mark_compact_speed_in_bytes_per_ms))) { |
4419 CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental"); | 4419 CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental"); |
| 4420 return true; |
4420 } | 4421 } |
| 4422 return false; |
4421 } | 4423 } |
4422 | 4424 |
4423 | 4425 |
4424 bool Heap::WorthActivatingIncrementalMarking() { | 4426 bool Heap::WorthActivatingIncrementalMarking() { |
4425 return incremental_marking()->IsStopped() && | 4427 return incremental_marking()->IsStopped() && |
4426 incremental_marking()->WorthActivating() && NextGCIsLikelyToBeFull(); | 4428 incremental_marking()->WorthActivating() && NextGCIsLikelyToBeFull(); |
4427 } | 4429 } |
4428 | 4430 |
4429 | 4431 |
4430 static double MonotonicallyIncreasingTimeInMs() { | 4432 static double MonotonicallyIncreasingTimeInMs() { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4495 action.parameter, IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 4497 action.parameter, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
4496 IncrementalMarking::FORCE_MARKING, | 4498 IncrementalMarking::FORCE_MARKING, |
4497 IncrementalMarking::DO_NOT_FORCE_COMPLETION); | 4499 IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
4498 remaining_idle_time_in_ms = | 4500 remaining_idle_time_in_ms = |
4499 deadline_in_ms - MonotonicallyIncreasingTimeInMs(); | 4501 deadline_in_ms - MonotonicallyIncreasingTimeInMs(); |
4500 } while (remaining_idle_time_in_ms >= | 4502 } while (remaining_idle_time_in_ms >= |
4501 2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs && | 4503 2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs && |
4502 !incremental_marking()->IsComplete() && | 4504 !incremental_marking()->IsComplete() && |
4503 !mark_compact_collector_.marking_deque()->IsEmpty()); | 4505 !mark_compact_collector_.marking_deque()->IsEmpty()); |
4504 if (remaining_idle_time_in_ms > 0.0) { | 4506 if (remaining_idle_time_in_ms > 0.0) { |
4505 TryFinalizeIdleIncrementalMarking( | 4507 action.additional_work = TryFinalizeIdleIncrementalMarking( |
4506 remaining_idle_time_in_ms, heap_state.size_of_objects, | 4508 remaining_idle_time_in_ms, heap_state.size_of_objects, |
4507 heap_state.final_incremental_mark_compact_speed_in_bytes_per_ms); | 4509 heap_state.final_incremental_mark_compact_speed_in_bytes_per_ms); |
4508 } | 4510 } |
4509 break; | 4511 break; |
4510 } | 4512 } |
4511 case DO_FULL_GC: { | 4513 case DO_FULL_GC: { |
4512 if (contexts_disposed_) { | 4514 if (contexts_disposed_) { |
4513 HistogramTimerScope scope(isolate_->counters()->gc_context()); | 4515 HistogramTimerScope scope(isolate_->counters()->gc_context()); |
4514 CollectAllGarbage(kNoGCFlags, "idle notification: contexts disposed"); | 4516 CollectAllGarbage(kNoGCFlags, "idle notification: contexts disposed"); |
4515 gc_idle_time_handler_.NotifyIdleMarkCompact(); | 4517 gc_idle_time_handler_.NotifyIdleMarkCompact(); |
(...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6376 static_cast<int>(object_sizes_last_time_[index])); | 6378 static_cast<int>(object_sizes_last_time_[index])); |
6377 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6379 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6378 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6380 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6379 | 6381 |
6380 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6382 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6381 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6383 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6382 ClearObjectStats(); | 6384 ClearObjectStats(); |
6383 } | 6385 } |
6384 } | 6386 } |
6385 } // namespace v8::internal | 6387 } // namespace v8::internal |
OLD | NEW |