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

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

Issue 697423002: Fix predictable mode when job based sweeping is off. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | src/heap/spaces.cc » ('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/v8.h" 5 #include "src/v8.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/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/compilation-cache.h" 10 #include "src/compilation-cache.h"
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 Heap* heap_; 449 Heap* heap_;
450 PagedSpace* space_; 450 PagedSpace* space_;
451 451
452 DISALLOW_COPY_AND_ASSIGN(SweeperTask); 452 DISALLOW_COPY_AND_ASSIGN(SweeperTask);
453 }; 453 };
454 454
455 455
456 void MarkCompactCollector::StartSweeperThreads() { 456 void MarkCompactCollector::StartSweeperThreads() {
457 DCHECK(free_list_old_pointer_space_.get()->IsEmpty()); 457 DCHECK(free_list_old_pointer_space_.get()->IsEmpty());
458 DCHECK(free_list_old_data_space_.get()->IsEmpty()); 458 DCHECK(free_list_old_data_space_.get()->IsEmpty());
459 sweeping_in_progress_ = true;
460 V8::GetCurrentPlatform()->CallOnBackgroundThread( 459 V8::GetCurrentPlatform()->CallOnBackgroundThread(
461 new SweeperTask(heap(), heap()->old_data_space()), 460 new SweeperTask(heap(), heap()->old_data_space()),
462 v8::Platform::kShortRunningTask); 461 v8::Platform::kShortRunningTask);
463 V8::GetCurrentPlatform()->CallOnBackgroundThread( 462 V8::GetCurrentPlatform()->CallOnBackgroundThread(
464 new SweeperTask(heap(), heap()->old_pointer_space()), 463 new SweeperTask(heap(), heap()->old_pointer_space()),
465 v8::Platform::kShortRunningTask); 464 v8::Platform::kShortRunningTask);
466 } 465 }
467 466
468 467
469 void MarkCompactCollector::EnsureSweepingCompleted() { 468 void MarkCompactCollector::EnsureSweepingCompleted() {
470 DCHECK(sweeping_in_progress_ == true); 469 DCHECK(sweeping_in_progress_ == true);
471 470
472 // If sweeping is not completed or not running at all, we try to complete it 471 // If sweeping is not completed or not running at all, we try to complete it
473 // here. 472 // here.
474 if (!IsSweepingCompleted()) { 473 if (FLAG_predictable || !IsSweepingCompleted()) {
475 SweepInParallel(heap()->paged_space(OLD_DATA_SPACE), 0); 474 SweepInParallel(heap()->paged_space(OLD_DATA_SPACE), 0);
476 SweepInParallel(heap()->paged_space(OLD_POINTER_SPACE), 0); 475 SweepInParallel(heap()->paged_space(OLD_POINTER_SPACE), 0);
477 } 476 }
478 // Wait twice for both jobs. 477 // Wait twice for both jobs.
479 pending_sweeper_jobs_semaphore_.Wait(); 478 if (!FLAG_predictable) {
480 pending_sweeper_jobs_semaphore_.Wait(); 479 pending_sweeper_jobs_semaphore_.Wait();
480 pending_sweeper_jobs_semaphore_.Wait();
481 }
481 ParallelSweepSpacesComplete(); 482 ParallelSweepSpacesComplete();
482 sweeping_in_progress_ = false; 483 sweeping_in_progress_ = false;
483 RefillFreeList(heap()->paged_space(OLD_DATA_SPACE)); 484 RefillFreeList(heap()->paged_space(OLD_DATA_SPACE));
484 RefillFreeList(heap()->paged_space(OLD_POINTER_SPACE)); 485 RefillFreeList(heap()->paged_space(OLD_POINTER_SPACE));
485 heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes(); 486 heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes();
486 heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes(); 487 heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes();
487 488
488 #ifdef VERIFY_HEAP 489 #ifdef VERIFY_HEAP
489 if (FLAG_verify_heap) { 490 if (FLAG_verify_heap) {
490 VerifyEvacuation(heap_); 491 VerifyEvacuation(heap_);
(...skipping 3687 matching lines...) Expand 10 before | Expand all | Expand 10 after
4178 // the other spaces rely on possibly non-live maps to get the sizes for 4179 // the other spaces rely on possibly non-live maps to get the sizes for
4179 // non-live objects. 4180 // non-live objects.
4180 { 4181 {
4181 GCTracer::Scope sweep_scope(heap()->tracer(), 4182 GCTracer::Scope sweep_scope(heap()->tracer(),
4182 GCTracer::Scope::MC_SWEEP_OLDSPACE); 4183 GCTracer::Scope::MC_SWEEP_OLDSPACE);
4183 { 4184 {
4184 SequentialSweepingScope scope(this); 4185 SequentialSweepingScope scope(this);
4185 SweepSpace(heap()->old_pointer_space(), CONCURRENT_SWEEPING); 4186 SweepSpace(heap()->old_pointer_space(), CONCURRENT_SWEEPING);
4186 SweepSpace(heap()->old_data_space(), CONCURRENT_SWEEPING); 4187 SweepSpace(heap()->old_data_space(), CONCURRENT_SWEEPING);
4187 } 4188 }
4188 4189 sweeping_in_progress_ = true;
4189 if (!FLAG_predictable) { 4190 if (!FLAG_predictable) {
4190 StartSweeperThreads(); 4191 StartSweeperThreads();
4191 } 4192 }
4192 } 4193 }
4193 RemoveDeadInvalidatedCode(); 4194 RemoveDeadInvalidatedCode();
4194 4195
4195 { 4196 {
4196 GCTracer::Scope sweep_scope(heap()->tracer(), 4197 GCTracer::Scope sweep_scope(heap()->tracer(),
4197 GCTracer::Scope::MC_SWEEP_CODE); 4198 GCTracer::Scope::MC_SWEEP_CODE);
4198 SweepSpace(heap()->code_space(), SEQUENTIAL_SWEEPING); 4199 SweepSpace(heap()->code_space(), SEQUENTIAL_SWEEPING);
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
4448 SlotsBuffer* buffer = *buffer_address; 4449 SlotsBuffer* buffer = *buffer_address;
4449 while (buffer != NULL) { 4450 while (buffer != NULL) {
4450 SlotsBuffer* next_buffer = buffer->next(); 4451 SlotsBuffer* next_buffer = buffer->next();
4451 DeallocateBuffer(buffer); 4452 DeallocateBuffer(buffer);
4452 buffer = next_buffer; 4453 buffer = next_buffer;
4453 } 4454 }
4454 *buffer_address = NULL; 4455 *buffer_address = NULL;
4455 } 4456 }
4456 } 4457 }
4457 } // namespace v8::internal 4458 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/heap/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698