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

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

Issue 361983003: Wait for sweeper threads only if we have to. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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
« no previous file with comments | « src/mark-compact.h ('k') | src/spaces.h » ('j') | src/spaces.h » ('J')
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/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compilation-cache.h" 9 #include "src/compilation-cache.h"
10 #include "src/cpu-profiler.h" 10 #include "src/cpu-profiler.h"
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 space->AddToAccountingStats(freed_bytes); 640 space->AddToAccountingStats(freed_bytes);
641 space->DecrementUnsweptFreeBytes(freed_bytes); 641 space->DecrementUnsweptFreeBytes(freed_bytes);
642 } 642 }
643 643
644 644
645 bool MarkCompactCollector::AreSweeperThreadsActivated() { 645 bool MarkCompactCollector::AreSweeperThreadsActivated() {
646 return isolate()->sweeper_threads() != NULL || FLAG_job_based_sweeping; 646 return isolate()->sweeper_threads() != NULL || FLAG_job_based_sweeping;
647 } 647 }
648 648
649 649
650 bool MarkCompactCollector::IsConcurrentSweepingInProgress() { 650 bool MarkCompactCollector::IsConcurrentSweepingInProgress(PagedSpace* space) {
651 return sweeping_pending_; 651 return (space == NULL || space->was_swept_concurrently()) &&
652 sweeping_pending_;
652 } 653 }
653 654
654 655
655 void Marking::TransferMark(Address old_start, Address new_start) { 656 void Marking::TransferMark(Address old_start, Address new_start) {
656 // This is only used when resizing an object. 657 // This is only used when resizing an object.
657 ASSERT(MemoryChunk::FromAddress(old_start) == 658 ASSERT(MemoryChunk::FromAddress(old_start) ==
658 MemoryChunk::FromAddress(new_start)); 659 MemoryChunk::FromAddress(new_start));
659 660
660 if (!heap_->incremental_marking()->IsMarking()) return; 661 if (!heap_->incremental_marking()->IsMarking()) return;
661 662
(...skipping 3412 matching lines...) Expand 10 before | Expand all | Expand 10 after
4074 } 4075 }
4075 if (p == space->end_of_unswept_pages()) break; 4076 if (p == space->end_of_unswept_pages()) break;
4076 } 4077 }
4077 } 4078 }
4078 4079
4079 4080
4080 void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) { 4081 void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) {
4081 space->set_was_swept_conservatively(sweeper == CONSERVATIVE || 4082 space->set_was_swept_conservatively(sweeper == CONSERVATIVE ||
4082 sweeper == PARALLEL_CONSERVATIVE || 4083 sweeper == PARALLEL_CONSERVATIVE ||
4083 sweeper == CONCURRENT_CONSERVATIVE); 4084 sweeper == CONCURRENT_CONSERVATIVE);
4085 space->set_was_swept_concurrently(sweeper == CONCURRENT_CONSERVATIVE);
4084 space->ClearStats(); 4086 space->ClearStats();
4085 4087
4086 // We defensively initialize end_of_unswept_pages_ here with the first page 4088 // We defensively initialize end_of_unswept_pages_ here with the first page
4087 // of the pages list. 4089 // of the pages list.
4088 space->set_end_of_unswept_pages(space->FirstPage()); 4090 space->set_end_of_unswept_pages(space->FirstPage());
4089 4091
4090 PageIterator it(space); 4092 PageIterator it(space);
4091 4093
4092 int pages_swept = 0; 4094 int pages_swept = 0;
4093 bool unused_page_present = false; 4095 bool unused_page_present = false;
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
4489 while (buffer != NULL) { 4491 while (buffer != NULL) {
4490 SlotsBuffer* next_buffer = buffer->next(); 4492 SlotsBuffer* next_buffer = buffer->next();
4491 DeallocateBuffer(buffer); 4493 DeallocateBuffer(buffer);
4492 buffer = next_buffer; 4494 buffer = next_buffer;
4493 } 4495 }
4494 *buffer_address = NULL; 4496 *buffer_address = NULL;
4495 } 4497 }
4496 4498
4497 4499
4498 } } // namespace v8::internal 4500 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mark-compact.h ('k') | src/spaces.h » ('j') | src/spaces.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698