| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 last_gc_end_timestamp_(0.0), | 145 last_gc_end_timestamp_(0.0), |
| 146 marking_time_(0.0), | 146 marking_time_(0.0), |
| 147 sweeping_time_(0.0), | 147 sweeping_time_(0.0), |
| 148 store_buffer_(this), | 148 store_buffer_(this), |
| 149 marking_(this), | 149 marking_(this), |
| 150 incremental_marking_(this), | 150 incremental_marking_(this), |
| 151 number_idle_notifications_(0), | 151 number_idle_notifications_(0), |
| 152 last_idle_notification_gc_count_(0), | 152 last_idle_notification_gc_count_(0), |
| 153 last_idle_notification_gc_count_init_(false), | 153 last_idle_notification_gc_count_init_(false), |
| 154 mark_sweeps_since_idle_round_started_(0), | 154 mark_sweeps_since_idle_round_started_(0), |
| 155 ms_count_at_last_idle_notification_(0), | |
| 156 gc_count_at_last_idle_gc_(0), | 155 gc_count_at_last_idle_gc_(0), |
| 157 scavenges_since_last_idle_round_(kIdleScavengeThreshold), | 156 scavenges_since_last_idle_round_(kIdleScavengeThreshold), |
| 158 gcs_since_last_deopt_(0), | 157 gcs_since_last_deopt_(0), |
| 159 #ifdef VERIFY_HEAP | 158 #ifdef VERIFY_HEAP |
| 160 no_weak_embedded_maps_verification_scope_depth_(0), | 159 no_weak_embedded_maps_verification_scope_depth_(0), |
| 161 #endif | 160 #endif |
| 162 promotion_queue_(this), | 161 promotion_queue_(this), |
| 163 configured_(false), | 162 configured_(false), |
| 164 chunks_queued_for_free_(NULL), | 163 chunks_queued_for_free_(NULL), |
| 165 relocation_mutex_(NULL) { | 164 relocation_mutex_(NULL) { |
| (...skipping 5597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5763 IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 5762 IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
| 5764 | 5763 |
| 5765 if (incremental_marking()->IsComplete()) { | 5764 if (incremental_marking()->IsComplete()) { |
| 5766 bool uncommit = false; | 5765 bool uncommit = false; |
| 5767 if (gc_count_at_last_idle_gc_ == gc_count_) { | 5766 if (gc_count_at_last_idle_gc_ == gc_count_) { |
| 5768 // No GC since the last full GC, the mutator is probably not active. | 5767 // No GC since the last full GC, the mutator is probably not active. |
| 5769 isolate_->compilation_cache()->Clear(); | 5768 isolate_->compilation_cache()->Clear(); |
| 5770 uncommit = true; | 5769 uncommit = true; |
| 5771 } | 5770 } |
| 5772 CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental"); | 5771 CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental"); |
| 5772 mark_sweeps_since_idle_round_started_++; |
| 5773 gc_count_at_last_idle_gc_ = gc_count_; | 5773 gc_count_at_last_idle_gc_ = gc_count_; |
| 5774 if (uncommit) { | 5774 if (uncommit) { |
| 5775 new_space_.Shrink(); | 5775 new_space_.Shrink(); |
| 5776 UncommitFromSpace(); | 5776 UncommitFromSpace(); |
| 5777 } | 5777 } |
| 5778 } | 5778 } |
| 5779 } | 5779 } |
| 5780 | 5780 |
| 5781 | 5781 |
| 5782 bool Heap::IdleNotification(int hint) { | 5782 bool Heap::IdleNotification(int hint) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5838 } | 5838 } |
| 5839 | 5839 |
| 5840 if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) { | 5840 if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) { |
| 5841 if (EnoughGarbageSinceLastIdleRound()) { | 5841 if (EnoughGarbageSinceLastIdleRound()) { |
| 5842 StartIdleRound(); | 5842 StartIdleRound(); |
| 5843 } else { | 5843 } else { |
| 5844 return true; | 5844 return true; |
| 5845 } | 5845 } |
| 5846 } | 5846 } |
| 5847 | 5847 |
| 5848 int new_mark_sweeps = ms_count_ - ms_count_at_last_idle_notification_; | |
| 5849 mark_sweeps_since_idle_round_started_ += new_mark_sweeps; | |
| 5850 ms_count_at_last_idle_notification_ = ms_count_; | |
| 5851 | |
| 5852 int remaining_mark_sweeps = kMaxMarkSweepsInIdleRound - | 5848 int remaining_mark_sweeps = kMaxMarkSweepsInIdleRound - |
| 5853 mark_sweeps_since_idle_round_started_; | 5849 mark_sweeps_since_idle_round_started_; |
| 5854 | 5850 |
| 5855 if (remaining_mark_sweeps <= 0) { | |
| 5856 FinishIdleRound(); | |
| 5857 return true; | |
| 5858 } | |
| 5859 | |
| 5860 if (incremental_marking()->IsStopped()) { | 5851 if (incremental_marking()->IsStopped()) { |
| 5861 // If there are no more than two GCs left in this idle round and we are | 5852 // If there are no more than two GCs left in this idle round and we are |
| 5862 // allowed to do a full GC, then make those GCs full in order to compact | 5853 // allowed to do a full GC, then make those GCs full in order to compact |
| 5863 // the code space. | 5854 // the code space. |
| 5864 // TODO(ulan): Once we enable code compaction for incremental marking, | 5855 // TODO(ulan): Once we enable code compaction for incremental marking, |
| 5865 // we can get rid of this special case and always start incremental marking. | 5856 // we can get rid of this special case and always start incremental marking. |
| 5866 if (remaining_mark_sweeps <= 2 && hint >= kMinHintForFullGC) { | 5857 if (remaining_mark_sweeps <= 2 && hint >= kMinHintForFullGC) { |
| 5867 CollectAllGarbage(kReduceMemoryFootprintMask, | 5858 CollectAllGarbage(kReduceMemoryFootprintMask, |
| 5868 "idle notification: finalize idle round"); | 5859 "idle notification: finalize idle round"); |
| 5860 mark_sweeps_since_idle_round_started_++; |
| 5869 } else { | 5861 } else { |
| 5870 incremental_marking()->Start(); | 5862 incremental_marking()->Start(); |
| 5871 } | 5863 } |
| 5872 } | 5864 } |
| 5873 if (!incremental_marking()->IsStopped()) { | 5865 if (!incremental_marking()->IsStopped()) { |
| 5874 AdvanceIdleIncrementalMarking(step_size); | 5866 AdvanceIdleIncrementalMarking(step_size); |
| 5875 } | 5867 } |
| 5868 |
| 5869 if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) { |
| 5870 FinishIdleRound(); |
| 5871 return true; |
| 5872 } |
| 5873 |
| 5876 return false; | 5874 return false; |
| 5877 } | 5875 } |
| 5878 | 5876 |
| 5879 | 5877 |
| 5880 bool Heap::IdleGlobalGC() { | 5878 bool Heap::IdleGlobalGC() { |
| 5881 static const int kIdlesBeforeScavenge = 4; | 5879 static const int kIdlesBeforeScavenge = 4; |
| 5882 static const int kIdlesBeforeMarkSweep = 7; | 5880 static const int kIdlesBeforeMarkSweep = 7; |
| 5883 static const int kIdlesBeforeMarkCompact = 8; | 5881 static const int kIdlesBeforeMarkCompact = 8; |
| 5884 static const int kMaxIdleCount = kIdlesBeforeMarkCompact + 1; | 5882 static const int kMaxIdleCount = kIdlesBeforeMarkCompact + 1; |
| 5885 static const unsigned int kGCsBetweenCleanup = 4; | 5883 static const unsigned int kGCsBetweenCleanup = 4; |
| (...skipping 2063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7949 if (FLAG_parallel_recompilation) { | 7947 if (FLAG_parallel_recompilation) { |
| 7950 heap_->relocation_mutex_->Lock(); | 7948 heap_->relocation_mutex_->Lock(); |
| 7951 #ifdef DEBUG | 7949 #ifdef DEBUG |
| 7952 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 7950 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
| 7953 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 7951 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
| 7954 #endif // DEBUG | 7952 #endif // DEBUG |
| 7955 } | 7953 } |
| 7956 } | 7954 } |
| 7957 | 7955 |
| 7958 } } // namespace v8::internal | 7956 } } // namespace v8::internal |
| OLD | NEW |