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 // 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 4556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5721 // Minimal hint that allows to do full GC. | 5719 // Minimal hint that allows to do full GC. |
| 5722 const int kMinHintForFullGC = 100; | 5720 const int kMinHintForFullGC = 100; |
| 5723 intptr_t size_factor = Min(Max(hint, 20), kMaxHint) / 4; | 5721 intptr_t size_factor = Min(Max(hint, 20), kMaxHint) / 4; |
| 5724 // The size factor is in range [5..250]. The numbers here are chosen from | 5722 // The size factor is in range [5..250]. The numbers here are chosen from |
| 5725 // experiments. If you changes them, make sure to test with | 5723 // experiments. If you changes them, make sure to test with |
| 5726 // chrome/performance_ui_tests --gtest_filter="GeneralMixMemoryTest.* | 5724 // chrome/performance_ui_tests --gtest_filter="GeneralMixMemoryTest.* |
| 5727 intptr_t step_size = | 5725 intptr_t step_size = |
| 5728 size_factor * IncrementalMarking::kAllocatedThreshold; | 5726 size_factor * IncrementalMarking::kAllocatedThreshold; |
| 5729 | 5727 |
| 5730 if (contexts_disposed_ > 0) { | 5728 if (contexts_disposed_ > 0) { |
| 5729 contexts_disposed_ = 0; | |
|
danno
2013/11/06 08:15:53
DBC: Why is this change needed? It seems unrelated
| |
| 5731 if (hint >= kMaxHint) { | 5730 if (hint >= kMaxHint) { |
| 5732 // The embedder is requesting a lot of GC work after context disposal, | 5731 // The embedder is requesting a lot of GC work after context disposal, |
| 5733 // we age inline caches so that they don't keep objects from | 5732 // we age inline caches so that they don't keep objects from |
| 5734 // the old context alive. | 5733 // the old context alive. |
| 5735 AgeInlineCaches(); | 5734 AgeInlineCaches(); |
| 5736 } | 5735 } |
| 5737 int mark_sweep_time = Min(TimeMarkSweepWouldTakeInMs(), 1000); | 5736 int mark_sweep_time = Min(TimeMarkSweepWouldTakeInMs(), 1000); |
| 5738 if (hint >= mark_sweep_time && !FLAG_expose_gc && | 5737 if (hint >= mark_sweep_time && !FLAG_expose_gc && |
| 5739 incremental_marking()->IsStopped()) { | 5738 incremental_marking()->IsStopped()) { |
| 5740 HistogramTimerScope scope(isolate_->counters()->gc_context()); | 5739 HistogramTimerScope scope(isolate_->counters()->gc_context()); |
| 5741 CollectAllGarbage(kReduceMemoryFootprintMask, | 5740 CollectAllGarbage(kReduceMemoryFootprintMask, |
| 5742 "idle notification: contexts disposed"); | 5741 "idle notification: contexts disposed"); |
| 5743 } else { | 5742 } else { |
| 5744 AdvanceIdleIncrementalMarking(step_size); | 5743 AdvanceIdleIncrementalMarking(step_size); |
| 5745 contexts_disposed_ = 0; | |
| 5746 } | 5744 } |
| 5745 | |
| 5747 // After context disposal there is likely a lot of garbage remaining, reset | 5746 // After context disposal there is likely a lot of garbage remaining, reset |
| 5748 // the idle notification counters in order to trigger more incremental GCs | 5747 // the idle notification counters in order to trigger more incremental GCs |
| 5749 // on subsequent idle notifications. | 5748 // on subsequent idle notifications. |
| 5750 StartIdleRound(); | 5749 StartIdleRound(); |
| 5751 return false; | 5750 return false; |
| 5752 } | 5751 } |
| 5753 | 5752 |
| 5754 if (!FLAG_incremental_marking || FLAG_expose_gc || Serializer::enabled()) { | 5753 if (!FLAG_incremental_marking || FLAG_expose_gc || Serializer::enabled()) { |
| 5755 return IdleGlobalGC(); | 5754 return IdleGlobalGC(); |
| 5756 } | 5755 } |
| (...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7904 if (FLAG_concurrent_recompilation) { | 7903 if (FLAG_concurrent_recompilation) { |
| 7905 heap_->relocation_mutex_->Lock(); | 7904 heap_->relocation_mutex_->Lock(); |
| 7906 #ifdef DEBUG | 7905 #ifdef DEBUG |
| 7907 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 7906 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
| 7908 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 7907 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
| 7909 #endif // DEBUG | 7908 #endif // DEBUG |
| 7910 } | 7909 } |
| 7911 } | 7910 } |
| 7912 | 7911 |
| 7913 } } // namespace v8::internal | 7912 } } // namespace v8::internal |
| OLD | NEW |