OLD | NEW |
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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 } | 235 } |
236 | 236 |
237 | 237 |
238 void MarkCompactCollector::TearDown() { | 238 void MarkCompactCollector::TearDown() { |
239 AbortCompaction(); | 239 AbortCompaction(); |
240 delete marking_deque_memory_; | 240 delete marking_deque_memory_; |
241 } | 241 } |
242 | 242 |
243 | 243 |
244 void MarkCompactCollector::AddEvacuationCandidate(Page* p) { | 244 void MarkCompactCollector::AddEvacuationCandidate(Page* p) { |
| 245 DCHECK(!p->NeverEvacuate()); |
245 p->MarkEvacuationCandidate(); | 246 p->MarkEvacuationCandidate(); |
246 evacuation_candidates_.Add(p); | 247 evacuation_candidates_.Add(p); |
247 } | 248 } |
248 | 249 |
249 | 250 |
250 static void TraceFragmentation(PagedSpace* space) { | 251 static void TraceFragmentation(PagedSpace* space) { |
251 int number_of_pages = space->CountTotalPages(); | 252 int number_of_pages = space->CountTotalPages(); |
252 intptr_t reserved = (number_of_pages * space->AreaSize()); | 253 intptr_t reserved = (number_of_pages * space->AreaSize()); |
253 intptr_t free = reserved - space->SizeOfObjects(); | 254 intptr_t free = reserved - space->SizeOfObjects(); |
254 PrintF("[%s]: %d pages, %d (%.1f%%) free\n", | 255 PrintF("[%s]: %d pages, %d (%.1f%%) free\n", |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 Candidate candidates[kMaxMaxEvacuationCandidates]; | 713 Candidate candidates[kMaxMaxEvacuationCandidates]; |
713 | 714 |
714 max_evacuation_candidates = | 715 max_evacuation_candidates = |
715 Min(kMaxMaxEvacuationCandidates, max_evacuation_candidates); | 716 Min(kMaxMaxEvacuationCandidates, max_evacuation_candidates); |
716 | 717 |
717 int count = 0; | 718 int count = 0; |
718 int fragmentation = 0; | 719 int fragmentation = 0; |
719 Candidate* least = NULL; | 720 Candidate* least = NULL; |
720 | 721 |
721 PageIterator it(space); | 722 PageIterator it(space); |
722 if (it.has_next()) it.next(); // Never compact the first page. | |
723 | |
724 while (it.has_next()) { | 723 while (it.has_next()) { |
725 Page* p = it.next(); | 724 Page* p = it.next(); |
| 725 if (p->NeverEvacuate()) continue; |
726 p->ClearEvacuationCandidate(); | 726 p->ClearEvacuationCandidate(); |
727 | 727 |
728 if (FLAG_stress_compaction) { | 728 if (FLAG_stress_compaction) { |
729 unsigned int counter = space->heap()->ms_count(); | 729 unsigned int counter = space->heap()->ms_count(); |
730 uintptr_t page_number = reinterpret_cast<uintptr_t>(p) >> kPageSizeBits; | 730 uintptr_t page_number = reinterpret_cast<uintptr_t>(p) >> kPageSizeBits; |
731 if ((counter & 1) == (page_number & 1)) fragmentation = 1; | 731 if ((counter & 1) == (page_number & 1)) fragmentation = 1; |
732 } else if (mode == REDUCE_MEMORY_FOOTPRINT) { | 732 } else if (mode == REDUCE_MEMORY_FOOTPRINT) { |
733 // Don't try to release too many pages. | 733 // Don't try to release too many pages. |
734 if (estimated_release >= over_reserved) { | 734 if (estimated_release >= over_reserved) { |
735 continue; | 735 continue; |
(...skipping 3592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4328 SlotsBuffer* buffer = *buffer_address; | 4328 SlotsBuffer* buffer = *buffer_address; |
4329 while (buffer != NULL) { | 4329 while (buffer != NULL) { |
4330 SlotsBuffer* next_buffer = buffer->next(); | 4330 SlotsBuffer* next_buffer = buffer->next(); |
4331 DeallocateBuffer(buffer); | 4331 DeallocateBuffer(buffer); |
4332 buffer = next_buffer; | 4332 buffer = next_buffer; |
4333 } | 4333 } |
4334 *buffer_address = NULL; | 4334 *buffer_address = NULL; |
4335 } | 4335 } |
4336 } | 4336 } |
4337 } // namespace v8::internal | 4337 } // namespace v8::internal |
OLD | NEW |