Chromium Code Reviews| 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 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 900 (collector == SCAVENGER) ? isolate_->counters()->gc_scavenger() | 900 (collector == SCAVENGER) ? isolate_->counters()->gc_scavenger() |
| 901 : isolate_->counters()->gc_compactor()); | 901 : isolate_->counters()->gc_compactor()); |
| 902 next_gc_likely_to_collect_more = | 902 next_gc_likely_to_collect_more = |
| 903 PerformGarbageCollection(collector, gc_callback_flags); | 903 PerformGarbageCollection(collector, gc_callback_flags); |
| 904 } | 904 } |
| 905 | 905 |
| 906 GarbageCollectionEpilogue(); | 906 GarbageCollectionEpilogue(); |
| 907 if (collector == MARK_COMPACTOR && FLAG_track_detached_contexts) { | 907 if (collector == MARK_COMPACTOR && FLAG_track_detached_contexts) { |
| 908 isolate()->CheckDetachedContextsAfterGC(); | 908 isolate()->CheckDetachedContextsAfterGC(); |
| 909 } | 909 } |
| 910 | |
| 911 if (collector == MARK_COMPACTOR) { | |
| 912 gc_idle_time_handler_.NotifyMarkCompact(); | |
| 913 } else { | |
| 914 gc_idle_time_handler_.NotifyScavenge(); | |
| 915 } | |
| 916 | |
| 910 tracer()->Stop(collector); | 917 tracer()->Stop(collector); |
| 911 } | 918 } |
| 912 | 919 |
| 913 // Start incremental marking for the next cycle. The heap snapshot | 920 // Start incremental marking for the next cycle. The heap snapshot |
| 914 // generator needs incremental marking to stay off after it aborted. | 921 // generator needs incremental marking to stay off after it aborted. |
| 915 if (!mark_compact_collector()->abort_incremental_marking() && | 922 if (!mark_compact_collector()->abort_incremental_marking() && |
| 916 incremental_marking()->IsStopped() && | 923 incremental_marking()->IsStopped() && |
| 917 incremental_marking()->ShouldActivateEvenWithoutIdleNotification()) { | 924 incremental_marking()->ShouldActivateEvenWithoutIdleNotification()) { |
| 918 incremental_marking()->Start(); | 925 incremental_marking()->Start(); |
| 919 } | 926 } |
| (...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1627 new_space_.LowerInlineAllocationLimit( | 1634 new_space_.LowerInlineAllocationLimit( |
| 1628 new_space_.inline_allocation_limit_step()); | 1635 new_space_.inline_allocation_limit_step()); |
| 1629 | 1636 |
| 1630 // Update how much has survived scavenge. | 1637 // Update how much has survived scavenge. |
| 1631 IncrementYoungSurvivorsCounter(static_cast<int>( | 1638 IncrementYoungSurvivorsCounter(static_cast<int>( |
| 1632 (PromotedSpaceSizeOfObjects() - survived_watermark) + new_space_.Size())); | 1639 (PromotedSpaceSizeOfObjects() - survived_watermark) + new_space_.Size())); |
| 1633 | 1640 |
| 1634 LOG(isolate_, ResourceEvent("scavenge", "end")); | 1641 LOG(isolate_, ResourceEvent("scavenge", "end")); |
| 1635 | 1642 |
| 1636 gc_state_ = NOT_IN_GC; | 1643 gc_state_ = NOT_IN_GC; |
| 1637 | |
| 1638 gc_idle_time_handler_.NotifyScavenge(); | |
| 1639 } | 1644 } |
| 1640 | 1645 |
| 1641 | 1646 |
| 1642 String* Heap::UpdateNewSpaceReferenceInExternalStringTableEntry(Heap* heap, | 1647 String* Heap::UpdateNewSpaceReferenceInExternalStringTableEntry(Heap* heap, |
| 1643 Object** p) { | 1648 Object** p) { |
| 1644 MapWord first_word = HeapObject::cast(*p)->map_word(); | 1649 MapWord first_word = HeapObject::cast(*p)->map_word(); |
| 1645 | 1650 |
| 1646 if (!first_word.IsForwardingAddress()) { | 1651 if (!first_word.IsForwardingAddress()) { |
| 1647 // Unreachable external string can be finalized. | 1652 // Unreachable external string can be finalized. |
| 1648 heap->FinalizeExternalString(String::cast(*p)); | 1653 heap->FinalizeExternalString(String::cast(*p)); |
| (...skipping 2906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4555 static_cast<size_t>(idle_time_in_ms))))) { | 4560 static_cast<size_t>(idle_time_in_ms))))) { |
| 4556 OverApproximateWeakClosure( | 4561 OverApproximateWeakClosure( |
| 4557 "Idle notification: overapproximate weak closure"); | 4562 "Idle notification: overapproximate weak closure"); |
| 4558 return true; | 4563 return true; |
| 4559 } else if (incremental_marking()->IsComplete() || | 4564 } else if (incremental_marking()->IsComplete() || |
| 4560 (mark_compact_collector_.marking_deque()->IsEmpty() && | 4565 (mark_compact_collector_.marking_deque()->IsEmpty() && |
| 4561 gc_idle_time_handler_.ShouldDoFinalIncrementalMarkCompact( | 4566 gc_idle_time_handler_.ShouldDoFinalIncrementalMarkCompact( |
| 4562 static_cast<size_t>(idle_time_in_ms), size_of_objects, | 4567 static_cast<size_t>(idle_time_in_ms), size_of_objects, |
| 4563 final_incremental_mark_compact_speed_in_bytes_per_ms))) { | 4568 final_incremental_mark_compact_speed_in_bytes_per_ms))) { |
| 4564 CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental"); | 4569 CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental"); |
| 4570 gc_idle_time_handler_.NotifyIdleMarkCompact(); | |
| 4565 ReduceNewSpaceSize(is_long_idle_notification); | 4571 ReduceNewSpaceSize(is_long_idle_notification); |
| 4566 return true; | 4572 return true; |
| 4567 } | 4573 } |
| 4568 return false; | 4574 return false; |
| 4569 } | 4575 } |
| 4570 | 4576 |
| 4571 | 4577 |
| 4572 static double MonotonicallyIncreasingTimeInMs() { | 4578 static double MonotonicallyIncreasingTimeInMs() { |
| 4573 return V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() * | 4579 return V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() * |
| 4574 static_cast<double>(base::Time::kMillisecondsPerSecond); | 4580 static_cast<double>(base::Time::kMillisecondsPerSecond); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4634 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state); | 4640 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state); |
| 4635 isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample( | 4641 isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample( |
| 4636 static_cast<int>(idle_time_in_ms)); | 4642 static_cast<int>(idle_time_in_ms)); |
| 4637 | 4643 |
| 4638 bool result = false; | 4644 bool result = false; |
| 4639 switch (action.type) { | 4645 switch (action.type) { |
| 4640 case DONE: | 4646 case DONE: |
| 4641 result = true; | 4647 result = true; |
| 4642 break; | 4648 break; |
| 4643 case DO_INCREMENTAL_MARKING: { | 4649 case DO_INCREMENTAL_MARKING: { |
| 4644 if (incremental_marking()->IsStopped()) { | 4650 if (incremental_marking()->IsStopped()) { |
|
Hannes Payer (out of office)
2015/05/04 11:20:37
please add a TODO that start should take reduce_me
ulan
2015/05/05 12:10:13
Done.
| |
| 4645 incremental_marking()->Start(); | 4651 incremental_marking()->Start(); |
| 4646 } | 4652 } |
| 4647 double remaining_idle_time_in_ms = 0.0; | 4653 double remaining_idle_time_in_ms = 0.0; |
| 4648 do { | 4654 do { |
| 4649 incremental_marking()->Step( | 4655 incremental_marking()->Step( |
| 4650 action.parameter, IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 4656 action.parameter, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 4651 IncrementalMarking::FORCE_MARKING, | 4657 IncrementalMarking::FORCE_MARKING, |
| 4652 IncrementalMarking::DO_NOT_FORCE_COMPLETION); | 4658 IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
| 4653 remaining_idle_time_in_ms = | 4659 remaining_idle_time_in_ms = |
| 4654 deadline_in_ms - MonotonicallyIncreasingTimeInMs(); | 4660 deadline_in_ms - MonotonicallyIncreasingTimeInMs(); |
| (...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6414 static_cast<int>(object_sizes_last_time_[index])); | 6420 static_cast<int>(object_sizes_last_time_[index])); |
| 6415 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6421 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 6416 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6422 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 6417 | 6423 |
| 6418 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6424 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 6419 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6425 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 6420 ClearObjectStats(); | 6426 ClearObjectStats(); |
| 6421 } | 6427 } |
| 6422 } | 6428 } |
| 6423 } // namespace v8::internal | 6429 } // namespace v8::internal |
| OLD | NEW |