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 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 | 1266 |
1267 // Used for updating survived_since_last_expansion_ at function end. | 1267 // Used for updating survived_since_last_expansion_ at function end. |
1268 intptr_t survived_watermark = PromotedSpaceSizeOfObjects(); | 1268 intptr_t survived_watermark = PromotedSpaceSizeOfObjects(); |
1269 | 1269 |
1270 CheckNewSpaceExpansionCriteria(); | 1270 CheckNewSpaceExpansionCriteria(); |
1271 | 1271 |
1272 SelectScavengingVisitorsTable(); | 1272 SelectScavengingVisitorsTable(); |
1273 | 1273 |
1274 incremental_marking()->PrepareForScavenge(); | 1274 incremental_marking()->PrepareForScavenge(); |
1275 | 1275 |
1276 AdvanceSweepers(static_cast<int>(new_space_.Size())); | 1276 paged_space(OLD_DATA_SPACE)->EnsureSweeperProgress(new_space_.Size()); |
| 1277 paged_space(OLD_POINTER_SPACE)->EnsureSweeperProgress(new_space_.Size()); |
1277 | 1278 |
1278 // Flip the semispaces. After flipping, to space is empty, from space has | 1279 // Flip the semispaces. After flipping, to space is empty, from space has |
1279 // live objects. | 1280 // live objects. |
1280 new_space_.Flip(); | 1281 new_space_.Flip(); |
1281 new_space_.ResetAllocationInfo(); | 1282 new_space_.ResetAllocationInfo(); |
1282 | 1283 |
1283 // We need to sweep newly copied objects which can be either in the | 1284 // We need to sweep newly copied objects which can be either in the |
1284 // to space or promoted to the old generation. For to-space | 1285 // to space or promoted to the old generation. For to-space |
1285 // objects, we treat the bottom of the to space as a queue. Newly | 1286 // objects, we treat the bottom of the to space as a queue. Newly |
1286 // copied and unswept objects lie between a 'front' mark and the | 1287 // copied and unswept objects lie between a 'front' mark and the |
(...skipping 4078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5365 | 5366 |
5366 // By doing small chunks of GC work in each IdleNotification, | 5367 // By doing small chunks of GC work in each IdleNotification, |
5367 // perform a round of incremental GCs and after that wait until | 5368 // perform a round of incremental GCs and after that wait until |
5368 // the mutator creates enough garbage to justify a new round. | 5369 // the mutator creates enough garbage to justify a new round. |
5369 // An incremental GC progresses as follows: | 5370 // An incremental GC progresses as follows: |
5370 // 1. many incremental marking steps, | 5371 // 1. many incremental marking steps, |
5371 // 2. one old space mark-sweep-compact, | 5372 // 2. one old space mark-sweep-compact, |
5372 // 3. many lazy sweep steps. | 5373 // 3. many lazy sweep steps. |
5373 // Use mark-sweep-compact events to count incremental GCs in a round. | 5374 // Use mark-sweep-compact events to count incremental GCs in a round. |
5374 | 5375 |
5375 | |
5376 if (incremental_marking()->IsStopped()) { | 5376 if (incremental_marking()->IsStopped()) { |
5377 if (!IsSweepingComplete() && | 5377 if (!mark_compact_collector()->AreSweeperThreadsActivated() && |
| 5378 !IsSweepingComplete() && |
5378 !AdvanceSweepers(static_cast<int>(step_size))) { | 5379 !AdvanceSweepers(static_cast<int>(step_size))) { |
5379 return false; | 5380 return false; |
5380 } | 5381 } |
5381 } | 5382 } |
5382 | 5383 |
5383 if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) { | 5384 if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) { |
5384 if (EnoughGarbageSinceLastIdleRound()) { | 5385 if (EnoughGarbageSinceLastIdleRound()) { |
5385 StartIdleRound(); | 5386 StartIdleRound(); |
5386 } else { | 5387 } else { |
5387 return true; | 5388 return true; |
(...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7356 static_cast<int>(object_sizes_last_time_[index])); | 7357 static_cast<int>(object_sizes_last_time_[index])); |
7357 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7358 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7358 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7359 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7359 | 7360 |
7360 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7361 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7361 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7362 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7362 ClearObjectStats(); | 7363 ClearObjectStats(); |
7363 } | 7364 } |
7364 | 7365 |
7365 } } // namespace v8::internal | 7366 } } // namespace v8::internal |
OLD | NEW |