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

Side by Side Diff: src/spaces.cc

Issue 398333002: Concurrent/parallel precise sweeping. (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/spaces.h ('k') | test/cctest/test-heap.cc » ('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 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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/base/platform/platform.h" 7 #include "src/base/platform/platform.h"
8 #include "src/full-codegen.h" 8 #include "src/full-codegen.h"
9 #include "src/macro-assembler.h" 9 #include "src/macro-assembler.h"
10 #include "src/mark-compact.h" 10 #include "src/mark-compact.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 size_func); 60 size_func);
61 ASSERT(page->WasSweptPrecisely()); 61 ASSERT(page->WasSweptPrecisely());
62 } 62 }
63 63
64 64
65 void HeapObjectIterator::Initialize(PagedSpace* space, 65 void HeapObjectIterator::Initialize(PagedSpace* space,
66 Address cur, Address end, 66 Address cur, Address end,
67 HeapObjectIterator::PageMode mode, 67 HeapObjectIterator::PageMode mode,
68 HeapObjectCallback size_f) { 68 HeapObjectCallback size_f) {
69 // Check that we actually can iterate this space. 69 // Check that we actually can iterate this space.
70 ASSERT(space->is_iterable()); 70 ASSERT(space->swept_precisely());
71 71
72 space_ = space; 72 space_ = space;
73 cur_addr_ = cur; 73 cur_addr_ = cur;
74 cur_end_ = end; 74 cur_end_ = end;
75 page_mode_ = mode; 75 page_mode_ = mode;
76 size_func_ = size_f; 76 size_func_ = size_f;
77 } 77 }
78 78
79 79
80 // We have hit the end of the page and should advance to the next block of 80 // We have hit the end of the page and should advance to the next block of
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 chunk->area_start_ = area_start; 472 chunk->area_start_ = area_start;
473 chunk->area_end_ = area_end; 473 chunk->area_end_ = area_end;
474 chunk->flags_ = 0; 474 chunk->flags_ = 0;
475 chunk->set_owner(owner); 475 chunk->set_owner(owner);
476 chunk->InitializeReservedMemory(); 476 chunk->InitializeReservedMemory();
477 chunk->slots_buffer_ = NULL; 477 chunk->slots_buffer_ = NULL;
478 chunk->skip_list_ = NULL; 478 chunk->skip_list_ = NULL;
479 chunk->write_barrier_counter_ = kWriteBarrierCounterGranularity; 479 chunk->write_barrier_counter_ = kWriteBarrierCounterGranularity;
480 chunk->progress_bar_ = 0; 480 chunk->progress_bar_ = 0;
481 chunk->high_water_mark_ = static_cast<int>(area_start - base); 481 chunk->high_water_mark_ = static_cast<int>(area_start - base);
482 chunk->set_parallel_sweeping(PARALLEL_SWEEPING_DONE); 482 chunk->set_parallel_sweeping(SWEEPING_DONE);
483 chunk->available_in_small_free_list_ = 0; 483 chunk->available_in_small_free_list_ = 0;
484 chunk->available_in_medium_free_list_ = 0; 484 chunk->available_in_medium_free_list_ = 0;
485 chunk->available_in_large_free_list_ = 0; 485 chunk->available_in_large_free_list_ = 0;
486 chunk->available_in_huge_free_list_ = 0; 486 chunk->available_in_huge_free_list_ = 0;
487 chunk->non_available_small_blocks_ = 0; 487 chunk->non_available_small_blocks_ = 0;
488 chunk->ResetLiveBytes(); 488 chunk->ResetLiveBytes();
489 Bitmap::Clear(chunk); 489 Bitmap::Clear(chunk);
490 chunk->initialize_scan_on_scavenge(false); 490 chunk->initialize_scan_on_scavenge(false);
491 chunk->SetFlag(WAS_SWEPT_PRECISELY); 491 chunk->SetFlag(WAS_SWEPT_PRECISELY);
492 492
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 928
929 // ----------------------------------------------------------------------------- 929 // -----------------------------------------------------------------------------
930 // PagedSpace implementation 930 // PagedSpace implementation
931 931
932 PagedSpace::PagedSpace(Heap* heap, 932 PagedSpace::PagedSpace(Heap* heap,
933 intptr_t max_capacity, 933 intptr_t max_capacity,
934 AllocationSpace id, 934 AllocationSpace id,
935 Executability executable) 935 Executability executable)
936 : Space(heap, id, executable), 936 : Space(heap, id, executable),
937 free_list_(this), 937 free_list_(this),
938 is_iterable_(true), 938 swept_precisely_(true),
939 unswept_free_bytes_(0), 939 unswept_free_bytes_(0),
940 end_of_unswept_pages_(NULL) { 940 end_of_unswept_pages_(NULL) {
941 if (id == CODE_SPACE) { 941 if (id == CODE_SPACE) {
942 area_size_ = heap->isolate()->memory_allocator()-> 942 area_size_ = heap->isolate()->memory_allocator()->
943 CodePageAreaSize(); 943 CodePageAreaSize();
944 } else { 944 } else {
945 area_size_ = Page::kPageSize - Page::kObjectStartOffset; 945 area_size_ = Page::kPageSize - Page::kObjectStartOffset;
946 } 946 }
947 max_capacity_ = (RoundDown(max_capacity, Page::kPageSize) / Page::kPageSize) 947 max_capacity_ = (RoundDown(max_capacity, Page::kPageSize) / Page::kPageSize)
948 * AreaSize(); 948 * AreaSize();
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 } 1150 }
1151 1151
1152 1152
1153 #ifdef DEBUG 1153 #ifdef DEBUG
1154 void PagedSpace::Print() { } 1154 void PagedSpace::Print() { }
1155 #endif 1155 #endif
1156 1156
1157 #ifdef VERIFY_HEAP 1157 #ifdef VERIFY_HEAP
1158 void PagedSpace::Verify(ObjectVisitor* visitor) { 1158 void PagedSpace::Verify(ObjectVisitor* visitor) {
1159 // We can only iterate over the pages if they were swept precisely. 1159 // We can only iterate over the pages if they were swept precisely.
1160 if (!is_iterable_) return; 1160 if (!swept_precisely_) return;
1161 1161
1162 bool allocation_pointer_found_in_space = 1162 bool allocation_pointer_found_in_space =
1163 (allocation_info_.top() == allocation_info_.limit()); 1163 (allocation_info_.top() == allocation_info_.limit());
1164 PageIterator page_iterator(this); 1164 PageIterator page_iterator(this);
1165 while (page_iterator.has_next()) { 1165 while (page_iterator.has_next()) {
1166 Page* page = page_iterator.next(); 1166 Page* page = page_iterator.next();
1167 CHECK(page->owner() == this); 1167 CHECK(page->owner() == this);
1168 if (page == Page::FromAllocationTop(allocation_info_.top())) { 1168 if (page == Page::FromAllocationTop(allocation_info_.top())) {
1169 allocation_pointer_found_in_space = true; 1169 allocation_pointer_found_in_space = true;
1170 } 1170 }
(...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after
2768 } 2768 }
2769 2769
2770 2770
2771 void PagedSpace::ReportStatistics() { 2771 void PagedSpace::ReportStatistics() {
2772 int pct = static_cast<int>(Available() * 100 / Capacity()); 2772 int pct = static_cast<int>(Available() * 100 / Capacity());
2773 PrintF(" capacity: %" V8_PTR_PREFIX "d" 2773 PrintF(" capacity: %" V8_PTR_PREFIX "d"
2774 ", waste: %" V8_PTR_PREFIX "d" 2774 ", waste: %" V8_PTR_PREFIX "d"
2775 ", available: %" V8_PTR_PREFIX "d, %%%d\n", 2775 ", available: %" V8_PTR_PREFIX "d, %%%d\n",
2776 Capacity(), Waste(), Available(), pct); 2776 Capacity(), Waste(), Available(), pct);
2777 2777
2778 if (!is_iterable_) return; 2778 if (!swept_precisely_) return;
2779 ClearHistograms(heap()->isolate()); 2779 ClearHistograms(heap()->isolate());
2780 HeapObjectIterator obj_it(this); 2780 HeapObjectIterator obj_it(this);
2781 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) 2781 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next())
2782 CollectHistogramInfo(obj); 2782 CollectHistogramInfo(obj);
2783 ReportHistogram(heap()->isolate(), true); 2783 ReportHistogram(heap()->isolate(), true);
2784 } 2784 }
2785 #endif 2785 #endif
2786 2786
2787 2787
2788 // ----------------------------------------------------------------------------- 2788 // -----------------------------------------------------------------------------
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
3150 object->ShortPrint(); 3150 object->ShortPrint();
3151 PrintF("\n"); 3151 PrintF("\n");
3152 } 3152 }
3153 printf(" --------------------------------------\n"); 3153 printf(" --------------------------------------\n");
3154 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3154 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3155 } 3155 }
3156 3156
3157 #endif // DEBUG 3157 #endif // DEBUG
3158 3158
3159 } } // namespace v8::internal 3159 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/spaces.h ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698