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 5305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5316 size_factor * IncrementalMarking::kAllocatedThreshold; | 5316 size_factor * IncrementalMarking::kAllocatedThreshold; |
5317 | 5317 |
5318 if (contexts_disposed_ > 0) { | 5318 if (contexts_disposed_ > 0) { |
5319 if (hint >= kMaxHint) { | 5319 if (hint >= kMaxHint) { |
5320 // The embedder is requesting a lot of GC work after context disposal, | 5320 // The embedder is requesting a lot of GC work after context disposal, |
5321 // we age inline caches so that they don't keep objects from | 5321 // we age inline caches so that they don't keep objects from |
5322 // the old context alive. | 5322 // the old context alive. |
5323 AgeInlineCaches(); | 5323 AgeInlineCaches(); |
5324 } | 5324 } |
5325 int mark_sweep_time = Min(TimeMarkSweepWouldTakeInMs(), 1000); | 5325 int mark_sweep_time = Min(TimeMarkSweepWouldTakeInMs(), 1000); |
5326 if (hint >= mark_sweep_time && incremental_marking()->IsStopped()) { | 5326 if (hint >= mark_sweep_time && !FLAG_expose_gc && |
| 5327 incremental_marking()->IsStopped()) { |
5327 HistogramTimerScope scope(isolate_->counters()->gc_context()); | 5328 HistogramTimerScope scope(isolate_->counters()->gc_context()); |
5328 CollectAllGarbage(kReduceMemoryFootprintMask, | 5329 CollectAllGarbage(kReduceMemoryFootprintMask, |
5329 "idle notification: contexts disposed"); | 5330 "idle notification: contexts disposed"); |
5330 } else { | 5331 } else { |
5331 AdvanceIdleIncrementalMarking(step_size); | 5332 AdvanceIdleIncrementalMarking(step_size); |
5332 contexts_disposed_ = 0; | 5333 contexts_disposed_ = 0; |
5333 } | 5334 } |
5334 // After context disposal there is likely a lot of garbage remaining, reset | 5335 // After context disposal there is likely a lot of garbage remaining, reset |
5335 // the idle notification counters in order to trigger more incremental GCs | 5336 // the idle notification counters in order to trigger more incremental GCs |
5336 // on subsequent idle notifications. | 5337 // on subsequent idle notifications. |
5337 StartIdleRound(); | 5338 StartIdleRound(); |
5338 return false; | 5339 return false; |
5339 } | 5340 } |
5340 | 5341 |
5341 if (!FLAG_incremental_marking || Serializer::enabled()) { | 5342 if (!FLAG_incremental_marking || FLAG_expose_gc || Serializer::enabled()) { |
5342 return IdleGlobalGC(); | 5343 return IdleGlobalGC(); |
5343 } | 5344 } |
5344 | 5345 |
5345 // By doing small chunks of GC work in each IdleNotification, | 5346 // By doing small chunks of GC work in each IdleNotification, |
5346 // perform a round of incremental GCs and after that wait until | 5347 // perform a round of incremental GCs and after that wait until |
5347 // the mutator creates enough garbage to justify a new round. | 5348 // the mutator creates enough garbage to justify a new round. |
5348 // An incremental GC progresses as follows: | 5349 // An incremental GC progresses as follows: |
5349 // 1. many incremental marking steps, | 5350 // 1. many incremental marking steps, |
5350 // 2. one old space mark-sweep-compact, | 5351 // 2. one old space mark-sweep-compact, |
5351 // 3. many lazy sweep steps. | 5352 // 3. many lazy sweep steps. |
(...skipping 1977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7329 static_cast<int>(object_sizes_last_time_[index])); | 7330 static_cast<int>(object_sizes_last_time_[index])); |
7330 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7331 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7331 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7332 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7332 | 7333 |
7333 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7334 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7334 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7335 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7335 ClearObjectStats(); | 7336 ClearObjectStats(); |
7336 } | 7337 } |
7337 | 7338 |
7338 } } // namespace v8::internal | 7339 } } // namespace v8::internal |
OLD | NEW |