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

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') | 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/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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 current += object->Size(); 201 current += object->Size();
202 } 202 }
203 } 203 }
204 } 204 }
205 205
206 206
207 static void VerifyEvacuation(PagedSpace* space) { 207 static void VerifyEvacuation(PagedSpace* space) {
208 // TODO(hpayer): Bring back VerifyEvacuation for parallel-concurrently 208 // TODO(hpayer): Bring back VerifyEvacuation for parallel-concurrently
209 // swept pages. 209 // swept pages.
210 if ((FLAG_concurrent_sweeping || FLAG_parallel_sweeping) && 210 if ((FLAG_concurrent_sweeping || FLAG_parallel_sweeping) &&
211 space->was_swept_conservatively()) return; 211 !space->is_iterable()) return;
212 PageIterator it(space); 212 PageIterator it(space);
213 213
214 while (it.has_next()) { 214 while (it.has_next()) {
215 Page* p = it.next(); 215 Page* p = it.next();
216 if (p->IsEvacuationCandidate()) continue; 216 if (p->IsEvacuationCandidate()) continue;
217 VerifyEvacuation(p->area_start(), p->area_end()); 217 VerifyEvacuation(p->area_start(), p->area_end());
218 } 218 }
219 } 219 }
220 220
221 221
(...skipping 418 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->is_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 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after
2037 } 2038 }
2038 *cells = 0; 2039 *cells = 0;
2039 } 2040 }
2040 return survivors_size; 2041 return survivors_size;
2041 } 2042 }
2042 2043
2043 2044
2044 static void DiscoverGreyObjectsInSpace(Heap* heap, 2045 static void DiscoverGreyObjectsInSpace(Heap* heap,
2045 MarkingDeque* marking_deque, 2046 MarkingDeque* marking_deque,
2046 PagedSpace* space) { 2047 PagedSpace* space) {
2047 if (!space->was_swept_conservatively()) { 2048 if (space->is_iterable()) {
2048 HeapObjectIterator it(space); 2049 HeapObjectIterator it(space);
2049 DiscoverGreyObjectsWithIterator(heap, marking_deque, &it); 2050 DiscoverGreyObjectsWithIterator(heap, marking_deque, &it);
2050 } else { 2051 } else {
2051 PageIterator it(space); 2052 PageIterator it(space);
2052 while (it.has_next()) { 2053 while (it.has_next()) {
2053 Page* p = it.next(); 2054 Page* p = it.next();
2054 DiscoverGreyObjectsOnPage(marking_deque, p); 2055 DiscoverGreyObjectsOnPage(marking_deque, p);
2055 if (marking_deque->IsFull()) return; 2056 if (marking_deque->IsFull()) return;
2056 } 2057 }
2057 } 2058 }
(...skipping 2013 matching lines...) Expand 10 before | Expand all | Expand 10 after
4071 SweepConservatively<SWEEP_IN_PARALLEL>(space, &private_free_list, p); 4072 SweepConservatively<SWEEP_IN_PARALLEL>(space, &private_free_list, p);
4072 free_list->Concatenate(&private_free_list); 4073 free_list->Concatenate(&private_free_list);
4073 p->set_parallel_sweeping(MemoryChunk::PARALLEL_SWEEPING_FINALIZE); 4074 p->set_parallel_sweeping(MemoryChunk::PARALLEL_SWEEPING_FINALIZE);
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_is_iterable(sweeper == PRECISE);
4082 sweeper == PARALLEL_CONSERVATIVE || 4083 space->set_is_swept_concurrently(sweeper == CONCURRENT_CONSERVATIVE);
4083 sweeper == CONCURRENT_CONSERVATIVE);
4084 space->ClearStats(); 4084 space->ClearStats();
4085 4085
4086 // We defensively initialize end_of_unswept_pages_ here with the first page 4086 // We defensively initialize end_of_unswept_pages_ here with the first page
4087 // of the pages list. 4087 // of the pages list.
4088 space->set_end_of_unswept_pages(space->FirstPage()); 4088 space->set_end_of_unswept_pages(space->FirstPage());
4089 4089
4090 PageIterator it(space); 4090 PageIterator it(space);
4091 4091
4092 int pages_swept = 0; 4092 int pages_swept = 0;
4093 bool unused_page_present = false; 4093 bool unused_page_present = false;
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
4489 while (buffer != NULL) { 4489 while (buffer != NULL) {
4490 SlotsBuffer* next_buffer = buffer->next(); 4490 SlotsBuffer* next_buffer = buffer->next();
4491 DeallocateBuffer(buffer); 4491 DeallocateBuffer(buffer);
4492 buffer = next_buffer; 4492 buffer = next_buffer;
4493 } 4493 }
4494 *buffer_address = NULL; 4494 *buffer_address = NULL;
4495 } 4495 }
4496 4496
4497 4497
4498 } } // namespace v8::internal 4498 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mark-compact.h ('k') | src/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698