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

Side by Side Diff: src/heap/mark-compact.cc

Issue 1653973003: [heap] Simplify distribution of remaining memory during sweeping & compaction (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove tests for dead code Created 4 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
« no previous file with comments | « no previous file | src/heap/spaces.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/heap/mark-compact.h" 5 #include "src/heap/mark-compact.h"
6 6
7 #include "src/base/atomicops.h" 7 #include "src/base/atomicops.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/base/sys-info.h" 9 #include "src/base/sys-info.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 3263 matching lines...) Expand 10 before | Expand all | Expand 10 after
3274 // Used for trace summary. 3274 // Used for trace summary.
3275 intptr_t compaction_speed = 0; 3275 intptr_t compaction_speed = 0;
3276 if (FLAG_trace_fragmentation) { 3276 if (FLAG_trace_fragmentation) {
3277 compaction_speed = heap()->tracer()->CompactionSpeedInBytesPerMillisecond(); 3277 compaction_speed = heap()->tracer()->CompactionSpeedInBytesPerMillisecond();
3278 } 3278 }
3279 3279
3280 const int num_tasks = NumberOfParallelCompactionTasks(num_pages, live_bytes); 3280 const int num_tasks = NumberOfParallelCompactionTasks(num_pages, live_bytes);
3281 3281
3282 // Set up compaction spaces. 3282 // Set up compaction spaces.
3283 Evacuator** evacuators = new Evacuator*[num_tasks]; 3283 Evacuator** evacuators = new Evacuator*[num_tasks];
3284 CompactionSpaceCollection** compaction_spaces_for_tasks =
3285 new CompactionSpaceCollection*[num_tasks];
3286 for (int i = 0; i < num_tasks; i++) { 3284 for (int i = 0; i < num_tasks; i++) {
3287 evacuators[i] = new Evacuator(this, evacuation_candidates_, 3285 evacuators[i] = new Evacuator(this, evacuation_candidates_,
3288 newspace_evacuation_candidates_); 3286 newspace_evacuation_candidates_);
3289 compaction_spaces_for_tasks[i] = evacuators[i]->compaction_spaces();
3290 } 3287 }
3291 heap()->old_space()->DivideUponCompactionSpaces(compaction_spaces_for_tasks,
3292 num_tasks);
3293 heap()->code_space()->DivideUponCompactionSpaces(compaction_spaces_for_tasks,
3294 num_tasks);
3295 delete[] compaction_spaces_for_tasks;
3296 3288
3297 // Kick off parallel tasks. 3289 // Kick off parallel tasks.
3298 StartParallelCompaction(evacuators, num_tasks); 3290 StartParallelCompaction(evacuators, num_tasks);
3299 // Wait for unfinished and not-yet-started tasks. 3291 // Wait for unfinished and not-yet-started tasks.
3300 WaitUntilCompactionCompleted(&evacuators[1], num_tasks - 1); 3292 WaitUntilCompactionCompleted(&evacuators[1], num_tasks - 1);
3301 3293
3302 // Finalize local evacuators by merging back all locally cached data. 3294 // Finalize local evacuators by merging back all locally cached data.
3303 for (int i = 0; i < num_tasks; i++) { 3295 for (int i = 0; i < num_tasks; i++) {
3304 evacuators[i]->Finalize(); 3296 evacuators[i]->Finalize();
3305 delete evacuators[i]; 3297 delete evacuators[i];
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
4063 MarkBit mark_bit = Marking::MarkBitFrom(host); 4055 MarkBit mark_bit = Marking::MarkBitFrom(host);
4064 if (Marking::IsBlack(mark_bit)) { 4056 if (Marking::IsBlack(mark_bit)) {
4065 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); 4057 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host);
4066 RecordRelocSlot(&rinfo, target); 4058 RecordRelocSlot(&rinfo, target);
4067 } 4059 }
4068 } 4060 }
4069 } 4061 }
4070 4062
4071 } // namespace internal 4063 } // namespace internal
4072 } // namespace v8 4064 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/heap/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698