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