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

Side by Side Diff: src/spaces.cc

Issue 256743004: Don't unlink evacuation candidates before sweeping, move them to the end of their list of pages. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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/spaces.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 "v8.h" 5 #include "v8.h"
6 6
7 #include "full-codegen.h" 7 #include "full-codegen.h"
8 #include "macro-assembler.h" 8 #include "macro-assembler.h"
9 #include "mark-compact.h" 9 #include "mark-compact.h"
10 #include "msan.h" 10 #include "msan.h"
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 MemoryChunk* other_next = other->next_chunk(); 552 MemoryChunk* other_next = other->next_chunk();
553 553
554 set_next_chunk(other_next); 554 set_next_chunk(other_next);
555 set_prev_chunk(other); 555 set_prev_chunk(other);
556 other_next->set_prev_chunk(this); 556 other_next->set_prev_chunk(this);
557 other->set_next_chunk(this); 557 other->set_next_chunk(this);
558 } 558 }
559 559
560 560
561 void MemoryChunk::Unlink() { 561 void MemoryChunk::Unlink() {
562 if (!InNewSpace() && IsFlagSet(SCAN_ON_SCAVENGE)) {
563 heap_->decrement_scan_on_scavenge_pages();
564 ClearFlag(SCAN_ON_SCAVENGE);
565 }
566 MemoryChunk* next_element = next_chunk(); 562 MemoryChunk* next_element = next_chunk();
567 MemoryChunk* prev_element = prev_chunk(); 563 MemoryChunk* prev_element = prev_chunk();
568 next_element->set_prev_chunk(prev_element); 564 next_element->set_prev_chunk(prev_element);
569 prev_element->set_next_chunk(next_element); 565 prev_element->set_next_chunk(next_element);
570 set_prev_chunk(NULL); 566 set_prev_chunk(NULL);
571 set_next_chunk(NULL); 567 set_next_chunk(NULL);
572 } 568 }
573 569
574 570
575 MemoryChunk* MemoryAllocator::AllocateChunk(intptr_t reserve_area_size, 571 MemoryChunk* MemoryAllocator::AllocateChunk(intptr_t reserve_area_size,
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 // ----------------------------------------------------------------------------- 919 // -----------------------------------------------------------------------------
924 // PagedSpace implementation 920 // PagedSpace implementation
925 921
926 PagedSpace::PagedSpace(Heap* heap, 922 PagedSpace::PagedSpace(Heap* heap,
927 intptr_t max_capacity, 923 intptr_t max_capacity,
928 AllocationSpace id, 924 AllocationSpace id,
929 Executability executable) 925 Executability executable)
930 : Space(heap, id, executable), 926 : Space(heap, id, executable),
931 free_list_(this), 927 free_list_(this),
932 was_swept_conservatively_(false), 928 was_swept_conservatively_(false),
933 unswept_free_bytes_(0) { 929 unswept_free_bytes_(0),
930 end_of_unswept_pages_(NULL) {
934 if (id == CODE_SPACE) { 931 if (id == CODE_SPACE) {
935 area_size_ = heap->isolate()->memory_allocator()-> 932 area_size_ = heap->isolate()->memory_allocator()->
936 CodePageAreaSize(); 933 CodePageAreaSize();
937 } else { 934 } else {
938 area_size_ = Page::kPageSize - Page::kObjectStartOffset; 935 area_size_ = Page::kPageSize - Page::kObjectStartOffset;
939 } 936 }
940 max_capacity_ = (RoundDown(max_capacity, Page::kPageSize) / Page::kPageSize) 937 max_capacity_ = (RoundDown(max_capacity, Page::kPageSize) / Page::kPageSize)
941 * AreaSize(); 938 * AreaSize();
942 accounting_stats_.Clear(); 939 accounting_stats_.Clear();
943 940
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 page->ResetFreeListStatistics(); 1093 page->ResetFreeListStatistics();
1097 } 1094 }
1098 } 1095 }
1099 1096
1100 1097
1101 void PagedSpace::IncreaseCapacity(int size) { 1098 void PagedSpace::IncreaseCapacity(int size) {
1102 accounting_stats_.ExpandSpace(size); 1099 accounting_stats_.ExpandSpace(size);
1103 } 1100 }
1104 1101
1105 1102
1106 void PagedSpace::ReleasePage(Page* page, bool unlink) { 1103 void PagedSpace::ReleasePage(Page* page) {
1107 ASSERT(page->LiveBytes() == 0); 1104 ASSERT(page->LiveBytes() == 0);
1108 ASSERT(AreaSize() == page->area_size()); 1105 ASSERT(AreaSize() == page->area_size());
1109 1106
1110 if (page->WasSwept()) { 1107 if (page->WasSwept()) {
1111 intptr_t size = free_list_.EvictFreeListItems(page); 1108 intptr_t size = free_list_.EvictFreeListItems(page);
1112 accounting_stats_.AllocateBytes(size); 1109 accounting_stats_.AllocateBytes(size);
1113 ASSERT_EQ(AreaSize(), static_cast<int>(size)); 1110 ASSERT_EQ(AreaSize(), static_cast<int>(size));
1114 } else { 1111 } else {
1115 DecreaseUnsweptFreeBytes(page); 1112 DecreaseUnsweptFreeBytes(page);
1116 } 1113 }
1117 1114
1115 if (page->IsFlagSet(MemoryChunk::SCAN_ON_SCAVENGE)) {
1116 heap()->decrement_scan_on_scavenge_pages();
1117 page->ClearFlag(MemoryChunk::SCAN_ON_SCAVENGE);
1118 }
1119
1118 ASSERT(!free_list_.ContainsPageFreeListItems(page)); 1120 ASSERT(!free_list_.ContainsPageFreeListItems(page));
1119 1121
1120 if (Page::FromAllocationTop(allocation_info_.top()) == page) { 1122 if (Page::FromAllocationTop(allocation_info_.top()) == page) {
1121 allocation_info_.set_top(NULL); 1123 allocation_info_.set_top(NULL);
1122 allocation_info_.set_limit(NULL); 1124 allocation_info_.set_limit(NULL);
1123 } 1125 }
1124 1126
1125 if (unlink) { 1127 page->Unlink();
1126 page->Unlink();
1127 }
1128 if (page->IsFlagSet(MemoryChunk::CONTAINS_ONLY_DATA)) { 1128 if (page->IsFlagSet(MemoryChunk::CONTAINS_ONLY_DATA)) {
1129 heap()->isolate()->memory_allocator()->Free(page); 1129 heap()->isolate()->memory_allocator()->Free(page);
1130 } else { 1130 } else {
1131 heap()->QueueMemoryChunkForFree(page); 1131 heap()->QueueMemoryChunkForFree(page);
1132 } 1132 }
1133 1133
1134 ASSERT(Capacity() > 0); 1134 ASSERT(Capacity() > 0);
1135 accounting_stats_.ShrinkSpace(AreaSize()); 1135 accounting_stats_.ShrinkSpace(AreaSize());
1136 } 1136 }
1137 1137
(...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after
3109 object->ShortPrint(); 3109 object->ShortPrint();
3110 PrintF("\n"); 3110 PrintF("\n");
3111 } 3111 }
3112 printf(" --------------------------------------\n"); 3112 printf(" --------------------------------------\n");
3113 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3113 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3114 } 3114 }
3115 3115
3116 #endif // DEBUG 3116 #endif // DEBUG
3117 3117
3118 } } // namespace v8::internal 3118 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/spaces.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698