| 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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 MarkCompactPrologue(); | 1143 MarkCompactPrologue(); |
| 1144 | 1144 |
| 1145 mark_compact_collector_.CollectGarbage(); | 1145 mark_compact_collector_.CollectGarbage(); |
| 1146 | 1146 |
| 1147 LOG(isolate_, ResourceEvent("markcompact", "end")); | 1147 LOG(isolate_, ResourceEvent("markcompact", "end")); |
| 1148 | 1148 |
| 1149 gc_state_ = NOT_IN_GC; | 1149 gc_state_ = NOT_IN_GC; |
| 1150 | 1150 |
| 1151 isolate_->counters()->objs_since_last_full()->Set(0); | 1151 isolate_->counters()->objs_since_last_full()->Set(0); |
| 1152 | 1152 |
| 1153 contexts_disposed_ = 0; | |
| 1154 | |
| 1155 flush_monomorphic_ics_ = false; | 1153 flush_monomorphic_ics_ = false; |
| 1156 } | 1154 } |
| 1157 | 1155 |
| 1158 | 1156 |
| 1159 void Heap::MarkCompactPrologue() { | 1157 void Heap::MarkCompactPrologue() { |
| 1160 // At any old GC clear the keyed lookup cache to enable collection of unused | 1158 // At any old GC clear the keyed lookup cache to enable collection of unused |
| 1161 // maps. | 1159 // maps. |
| 1162 isolate_->keyed_lookup_cache()->Clear(); | 1160 isolate_->keyed_lookup_cache()->Clear(); |
| 1163 isolate_->context_slot_cache()->Clear(); | 1161 isolate_->context_slot_cache()->Clear(); |
| 1164 isolate_->descriptor_lookup_cache()->Clear(); | 1162 isolate_->descriptor_lookup_cache()->Clear(); |
| (...skipping 4589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5754 // Minimal hint that allows to do full GC. | 5752 // Minimal hint that allows to do full GC. |
| 5755 const int kMinHintForFullGC = 100; | 5753 const int kMinHintForFullGC = 100; |
| 5756 intptr_t size_factor = Min(Max(hint, 20), kMaxHint) / 4; | 5754 intptr_t size_factor = Min(Max(hint, 20), kMaxHint) / 4; |
| 5757 // The size factor is in range [5..250]. The numbers here are chosen from | 5755 // The size factor is in range [5..250]. The numbers here are chosen from |
| 5758 // experiments. If you changes them, make sure to test with | 5756 // experiments. If you changes them, make sure to test with |
| 5759 // chrome/performance_ui_tests --gtest_filter="GeneralMixMemoryTest.* | 5757 // chrome/performance_ui_tests --gtest_filter="GeneralMixMemoryTest.* |
| 5760 intptr_t step_size = | 5758 intptr_t step_size = |
| 5761 size_factor * IncrementalMarking::kAllocatedThreshold; | 5759 size_factor * IncrementalMarking::kAllocatedThreshold; |
| 5762 | 5760 |
| 5763 if (contexts_disposed_ > 0) { | 5761 if (contexts_disposed_ > 0) { |
| 5762 contexts_disposed_ = 0; |
| 5764 if (hint >= kMaxHint) { | 5763 if (hint >= kMaxHint) { |
| 5765 // The embedder is requesting a lot of GC work after context disposal, | 5764 // The embedder is requesting a lot of GC work after context disposal, |
| 5766 // we age inline caches so that they don't keep objects from | 5765 // we age inline caches so that they don't keep objects from |
| 5767 // the old context alive. | 5766 // the old context alive. |
| 5768 AgeInlineCaches(); | 5767 AgeInlineCaches(); |
| 5769 } | 5768 } |
| 5770 int mark_sweep_time = Min(TimeMarkSweepWouldTakeInMs(), 1000); | 5769 int mark_sweep_time = Min(TimeMarkSweepWouldTakeInMs(), 1000); |
| 5771 if (hint >= mark_sweep_time && !FLAG_expose_gc && | 5770 if (hint >= mark_sweep_time && !FLAG_expose_gc && |
| 5772 incremental_marking()->IsStopped()) { | 5771 incremental_marking()->IsStopped()) { |
| 5773 HistogramTimerScope scope(isolate_->counters()->gc_context()); | 5772 HistogramTimerScope scope(isolate_->counters()->gc_context()); |
| 5774 CollectAllGarbage(kReduceMemoryFootprintMask, | 5773 CollectAllGarbage(kReduceMemoryFootprintMask, |
| 5775 "idle notification: contexts disposed"); | 5774 "idle notification: contexts disposed"); |
| 5776 } else { | 5775 } else { |
| 5777 AdvanceIdleIncrementalMarking(step_size); | 5776 AdvanceIdleIncrementalMarking(step_size); |
| 5778 contexts_disposed_ = 0; | |
| 5779 } | 5777 } |
| 5778 |
| 5780 // After context disposal there is likely a lot of garbage remaining, reset | 5779 // After context disposal there is likely a lot of garbage remaining, reset |
| 5781 // the idle notification counters in order to trigger more incremental GCs | 5780 // the idle notification counters in order to trigger more incremental GCs |
| 5782 // on subsequent idle notifications. | 5781 // on subsequent idle notifications. |
| 5783 StartIdleRound(); | 5782 StartIdleRound(); |
| 5784 return false; | 5783 return false; |
| 5785 } | 5784 } |
| 5786 | 5785 |
| 5787 if (!FLAG_incremental_marking || FLAG_expose_gc || Serializer::enabled()) { | 5786 if (!FLAG_incremental_marking || FLAG_expose_gc || Serializer::enabled()) { |
| 5788 return IdleGlobalGC(); | 5787 return IdleGlobalGC(); |
| 5789 } | 5788 } |
| (...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7937 if (FLAG_concurrent_recompilation) { | 7936 if (FLAG_concurrent_recompilation) { |
| 7938 heap_->relocation_mutex_->Lock(); | 7937 heap_->relocation_mutex_->Lock(); |
| 7939 #ifdef DEBUG | 7938 #ifdef DEBUG |
| 7940 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 7939 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
| 7941 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 7940 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
| 7942 #endif // DEBUG | 7941 #endif // DEBUG |
| 7943 } | 7942 } |
| 7944 } | 7943 } |
| 7945 | 7944 |
| 7946 } } // namespace v8::internal | 7945 } } // namespace v8::internal |
| OLD | NEW |