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 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1301 | 1301 |
1302 // Used for updating survived_since_last_expansion_ at function end. | 1302 // Used for updating survived_since_last_expansion_ at function end. |
1303 intptr_t survived_watermark = PromotedSpaceSizeOfObjects(); | 1303 intptr_t survived_watermark = PromotedSpaceSizeOfObjects(); |
1304 | 1304 |
1305 CheckNewSpaceExpansionCriteria(); | 1305 CheckNewSpaceExpansionCriteria(); |
1306 | 1306 |
1307 SelectScavengingVisitorsTable(); | 1307 SelectScavengingVisitorsTable(); |
1308 | 1308 |
1309 incremental_marking()->PrepareForScavenge(); | 1309 incremental_marking()->PrepareForScavenge(); |
1310 | 1310 |
1311 AdvanceSweepers(static_cast<int>(new_space_.Size())); | 1311 paged_space(OLD_DATA_SPACE)->EnsureSweeperProgress(new_space_.Size()); |
| 1312 paged_space(OLD_POINTER_SPACE)->EnsureSweeperProgress(new_space_.Size()); |
1312 | 1313 |
1313 // Flip the semispaces. After flipping, to space is empty, from space has | 1314 // Flip the semispaces. After flipping, to space is empty, from space has |
1314 // live objects. | 1315 // live objects. |
1315 new_space_.Flip(); | 1316 new_space_.Flip(); |
1316 new_space_.ResetAllocationInfo(); | 1317 new_space_.ResetAllocationInfo(); |
1317 | 1318 |
1318 // We need to sweep newly copied objects which can be either in the | 1319 // We need to sweep newly copied objects which can be either in the |
1319 // to space or promoted to the old generation. For to-space | 1320 // to space or promoted to the old generation. For to-space |
1320 // objects, we treat the bottom of the to space as a queue. Newly | 1321 // objects, we treat the bottom of the to space as a queue. Newly |
1321 // copied and unswept objects lie between a 'front' mark and the | 1322 // copied and unswept objects lie between a 'front' mark and the |
(...skipping 4091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5413 | 5414 |
5414 // By doing small chunks of GC work in each IdleNotification, | 5415 // By doing small chunks of GC work in each IdleNotification, |
5415 // perform a round of incremental GCs and after that wait until | 5416 // perform a round of incremental GCs and after that wait until |
5416 // the mutator creates enough garbage to justify a new round. | 5417 // the mutator creates enough garbage to justify a new round. |
5417 // An incremental GC progresses as follows: | 5418 // An incremental GC progresses as follows: |
5418 // 1. many incremental marking steps, | 5419 // 1. many incremental marking steps, |
5419 // 2. one old space mark-sweep-compact, | 5420 // 2. one old space mark-sweep-compact, |
5420 // 3. many lazy sweep steps. | 5421 // 3. many lazy sweep steps. |
5421 // Use mark-sweep-compact events to count incremental GCs in a round. | 5422 // Use mark-sweep-compact events to count incremental GCs in a round. |
5422 | 5423 |
5423 | |
5424 if (incremental_marking()->IsStopped()) { | 5424 if (incremental_marking()->IsStopped()) { |
5425 if (!IsSweepingComplete() && | 5425 if (!mark_compact_collector()->AreSweeperThreadsActivated() && |
| 5426 !IsSweepingComplete() && |
5426 !AdvanceSweepers(static_cast<int>(step_size))) { | 5427 !AdvanceSweepers(static_cast<int>(step_size))) { |
5427 return false; | 5428 return false; |
5428 } | 5429 } |
5429 } | 5430 } |
5430 | 5431 |
5431 if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) { | 5432 if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) { |
5432 if (EnoughGarbageSinceLastIdleRound()) { | 5433 if (EnoughGarbageSinceLastIdleRound()) { |
5433 StartIdleRound(); | 5434 StartIdleRound(); |
5434 } else { | 5435 } else { |
5435 return true; | 5436 return true; |
(...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7526 static_cast<int>(object_sizes_last_time_[index])); | 7527 static_cast<int>(object_sizes_last_time_[index])); |
7527 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7528 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7528 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7529 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7529 | 7530 |
7530 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7531 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7531 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7532 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7532 ClearObjectStats(); | 7533 ClearObjectStats(); |
7533 } | 7534 } |
7534 | 7535 |
7535 } } // namespace v8::internal | 7536 } } // namespace v8::internal |
OLD | NEW |