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