Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: src/heap.cc

Issue 11782028: Parallel and concurrent sweeping. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 MarkCompactCollector* mark_compact = mark_compact_collector();
1277
1278 if (!mark_compact->AreSweeperThreadsActivated()) {
1279 AdvanceSweepers(static_cast<int>(new_space_.Size()));
1280 } else if (FLAG_concurrent_sweeping) {
1281 mark_compact->StealMemoryFromSweeperThreads(paged_space(OLD_DATA_SPACE));
1282 mark_compact->StealMemoryFromSweeperThreads(paged_space(OLD_POINTER_SPACE));
1283 }
Michael Starzinger 2013/01/28 16:30:18 What we actually wanna ensure here is that we made
Hannes Payer (out of office) 2013/01/30 10:11:27 Right, but this changes the current non-parallel n
1277 1284
1278 // Flip the semispaces. After flipping, to space is empty, from space has 1285 // Flip the semispaces. After flipping, to space is empty, from space has
1279 // live objects. 1286 // live objects.
1280 new_space_.Flip(); 1287 new_space_.Flip();
1281 new_space_.ResetAllocationInfo(); 1288 new_space_.ResetAllocationInfo();
1282 1289
1283 // We need to sweep newly copied objects which can be either in the 1290 // 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 1291 // 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 1292 // 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 1293 // copied and unswept objects lie between a 'front' mark and the
(...skipping 4078 matching lines...) Expand 10 before | Expand all | Expand 10 after
5365 5372
5366 // By doing small chunks of GC work in each IdleNotification, 5373 // By doing small chunks of GC work in each IdleNotification,
5367 // perform a round of incremental GCs and after that wait until 5374 // perform a round of incremental GCs and after that wait until
5368 // the mutator creates enough garbage to justify a new round. 5375 // the mutator creates enough garbage to justify a new round.
5369 // An incremental GC progresses as follows: 5376 // An incremental GC progresses as follows:
5370 // 1. many incremental marking steps, 5377 // 1. many incremental marking steps,
5371 // 2. one old space mark-sweep-compact, 5378 // 2. one old space mark-sweep-compact,
5372 // 3. many lazy sweep steps. 5379 // 3. many lazy sweep steps.
5373 // Use mark-sweep-compact events to count incremental GCs in a round. 5380 // Use mark-sweep-compact events to count incremental GCs in a round.
5374 5381
5375 5382
Michael Starzinger 2013/01/28 16:30:18 I know it's not your change, but drop one of the t
Hannes Payer (out of office) 2013/01/30 10:11:27 Done.
5376 if (incremental_marking()->IsStopped()) { 5383 if (incremental_marking()->IsStopped()) {
5377 if (!IsSweepingComplete() && 5384 if (!mark_compact_collector()->AreSweeperThreadsActivated() &&
5385 !IsSweepingComplete() &&
5378 !AdvanceSweepers(static_cast<int>(step_size))) { 5386 !AdvanceSweepers(static_cast<int>(step_size))) {
5379 return false; 5387 return false;
5380 } 5388 }
5381 } 5389 }
5382 5390
5383 if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) { 5391 if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) {
5384 if (EnoughGarbageSinceLastIdleRound()) { 5392 if (EnoughGarbageSinceLastIdleRound()) {
5385 StartIdleRound(); 5393 StartIdleRound();
5386 } else { 5394 } else {
5387 return true; 5395 return true;
(...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after
7356 static_cast<int>(object_sizes_last_time_[index])); 7364 static_cast<int>(object_sizes_last_time_[index]));
7357 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7365 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7358 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7366 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7359 7367
7360 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7368 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7361 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7369 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7362 ClearObjectStats(); 7370 ClearObjectStats();
7363 } 7371 }
7364 7372
7365 } } // namespace v8::internal 7373 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698