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

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

Issue 905773004: Mark pages created during bootstrapping as never-evacuate. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 | « src/heap/heap.cc ('k') | 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/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
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 if (p->NeverEvacuate()) return;
Hannes Payer (out of office) 2015/02/12 13:20:23 Dont' make the page an evacuation candidate. Pleas
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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 Candidate candidates[kMaxMaxEvacuationCandidates]; 712 Candidate candidates[kMaxMaxEvacuationCandidates];
712 713
713 max_evacuation_candidates = 714 max_evacuation_candidates =
714 Min(kMaxMaxEvacuationCandidates, max_evacuation_candidates); 715 Min(kMaxMaxEvacuationCandidates, max_evacuation_candidates);
715 716
716 int count = 0; 717 int count = 0;
717 int fragmentation = 0; 718 int fragmentation = 0;
718 Candidate* least = NULL; 719 Candidate* least = NULL;
719 720
720 PageIterator it(space); 721 PageIterator it(space);
721 if (it.has_next()) it.next(); // Never compact the first page.
722
723 while (it.has_next()) { 722 while (it.has_next()) {
724 Page* p = it.next(); 723 Page* p = it.next();
725 p->ClearEvacuationCandidate(); 724 p->ClearEvacuationCandidate();
726 725
Hannes Payer (out of office) 2015/02/12 13:20:23 If NeverEvacuate() is set, ignore the page.
727 if (FLAG_stress_compaction) { 726 if (FLAG_stress_compaction) {
728 unsigned int counter = space->heap()->ms_count(); 727 unsigned int counter = space->heap()->ms_count();
729 uintptr_t page_number = reinterpret_cast<uintptr_t>(p) >> kPageSizeBits; 728 uintptr_t page_number = reinterpret_cast<uintptr_t>(p) >> kPageSizeBits;
730 if ((counter & 1) == (page_number & 1)) fragmentation = 1; 729 if ((counter & 1) == (page_number & 1)) fragmentation = 1;
731 } else if (mode == REDUCE_MEMORY_FOOTPRINT) { 730 } else if (mode == REDUCE_MEMORY_FOOTPRINT) {
732 // Don't try to release too many pages. 731 // Don't try to release too many pages.
733 if (estimated_release >= over_reserved) { 732 if (estimated_release >= over_reserved) {
734 continue; 733 continue;
735 } 734 }
736 735
(...skipping 3685 matching lines...) Expand 10 before | Expand all | Expand 10 after
4422 SlotsBuffer* buffer = *buffer_address; 4421 SlotsBuffer* buffer = *buffer_address;
4423 while (buffer != NULL) { 4422 while (buffer != NULL) {
4424 SlotsBuffer* next_buffer = buffer->next(); 4423 SlotsBuffer* next_buffer = buffer->next();
4425 DeallocateBuffer(buffer); 4424 DeallocateBuffer(buffer);
4426 buffer = next_buffer; 4425 buffer = next_buffer;
4427 } 4426 }
4428 *buffer_address = NULL; 4427 *buffer_address = NULL;
4429 } 4428 }
4430 } 4429 }
4431 } // namespace v8::internal 4430 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698