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

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

Issue 7149016: Multi-page growing and shrinking new-space (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Address review comments Created 9 years, 6 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/incremental-marking.cc ('k') | src/mark-compact-inl.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 static void VerifyMarking(NewSpace* space) { 116 static void VerifyMarking(NewSpace* space) {
117 Address end = space->top(); 117 Address end = space->top();
118 NewSpacePageIterator it(space->bottom(), end); 118 NewSpacePageIterator it(space->bottom(), end);
119 // The bottom position is at the start of its page. Allows us to use 119 // The bottom position is at the start of its page. Allows us to use
120 // page->body() as start of range on all pages. 120 // page->body() as start of range on all pages.
121 ASSERT_EQ(space->bottom(), 121 ASSERT_EQ(space->bottom(),
122 NewSpacePage::FromAddress(space->bottom())->body()); 122 NewSpacePage::FromAddress(space->bottom())->body());
123 while (it.has_next()) { 123 while (it.has_next()) {
124 NewSpacePage* page = it.next(); 124 NewSpacePage* page = it.next();
125 Address limit = it.has_next() ? page->body_limit() : end; 125 Address limit = it.has_next() ? page->body_limit() : end;
126 ASSERT(limit == end || !page->Contains(end));
126 VerifyMarking(page->body(), limit); 127 VerifyMarking(page->body(), limit);
127 } 128 }
128 } 129 }
129 130
130 131
131 static void VerifyMarking(PagedSpace* space) { 132 static void VerifyMarking(PagedSpace* space) {
132 PageIterator it(space); 133 PageIterator it(space);
133 134
134 while (it.has_next()) { 135 while (it.has_next()) {
135 VerifyMarking(it.next()); 136 VerifyMarking(it.next());
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 #ifdef DEBUG 187 #ifdef DEBUG
187 static void VerifyMarkbitsAreClean(PagedSpace* space) { 188 static void VerifyMarkbitsAreClean(PagedSpace* space) {
188 PageIterator it(space); 189 PageIterator it(space);
189 190
190 while (it.has_next()) { 191 while (it.has_next()) {
191 Page* p = it.next(); 192 Page* p = it.next();
192 ASSERT(p->markbits()->IsClean()); 193 ASSERT(p->markbits()->IsClean());
193 } 194 }
194 } 195 }
195 196
197 static void VerifyMarkbitsAreClean(NewSpace* space) {
198 NewSpacePageIterator it(space->ToSpaceLow(), space->ToSpaceHigh());
199
200 while (it.has_next()) {
201 NewSpacePage* p = it.next();
202 ASSERT(p->markbits()->IsClean());
203 }
204 }
205
196 static void VerifyMarkbitsAreClean() { 206 static void VerifyMarkbitsAreClean() {
197 VerifyMarkbitsAreClean(HEAP->old_pointer_space()); 207 VerifyMarkbitsAreClean(HEAP->old_pointer_space());
198 VerifyMarkbitsAreClean(HEAP->old_data_space()); 208 VerifyMarkbitsAreClean(HEAP->old_data_space());
199 VerifyMarkbitsAreClean(HEAP->code_space()); 209 VerifyMarkbitsAreClean(HEAP->code_space());
200 VerifyMarkbitsAreClean(HEAP->cell_space()); 210 VerifyMarkbitsAreClean(HEAP->cell_space());
201 VerifyMarkbitsAreClean(HEAP->map_space()); 211 VerifyMarkbitsAreClean(HEAP->map_space());
202 ASSERT(HEAP->new_space()->ActivePage()->markbits()->IsClean()); 212 VerifyMarkbitsAreClean(HEAP->new_space());
203 } 213 }
204 #endif 214 #endif
205 215
206 216
207 static void ClearMarkbits(PagedSpace* space) { 217 static void ClearMarkbits(PagedSpace* space) {
208 PageIterator it(space); 218 PageIterator it(space);
209 219
210 while (it.has_next()) { 220 while (it.has_next()) {
211 Page* p = it.next(); 221 Page* p = it.next();
212 p->markbits()->Clear(); 222 p->markbits()->Clear();
213 } 223 }
214 } 224 }
215 225
216 226
227 static void ClearMarkbits(NewSpace* space) {
228 NewSpacePageIterator it(space->ToSpaceLow(), space->ToSpaceHigh());
229
230 while (it.has_next()) {
231 NewSpacePage* p = it.next();
232 p->markbits()->Clear();
233 }
234 }
235
236
217 static void ClearMarkbits() { 237 static void ClearMarkbits() {
218 // TODO(gc): Clean the mark bits while sweeping. 238 // TODO(gc): Clean the mark bits while sweeping.
219 ClearMarkbits(HEAP->code_space()); 239 Heap* heap = HEAP;
220 ClearMarkbits(HEAP->map_space()); 240 ClearMarkbits(heap->code_space());
221 ClearMarkbits(HEAP->old_pointer_space()); 241 ClearMarkbits(heap->map_space());
222 ClearMarkbits(HEAP->old_data_space()); 242 ClearMarkbits(heap->old_pointer_space());
223 ClearMarkbits(HEAP->cell_space()); 243 ClearMarkbits(heap->old_data_space());
224 HEAP->new_space()->ActivePage()->markbits()->Clear(); 244 ClearMarkbits(heap->cell_space());
245 ClearMarkbits(heap->new_space());
225 } 246 }
226 247
227 248
228 void Marking::TransferMark(Address old_start, Address new_start) { 249 void Marking::TransferMark(Address old_start, Address new_start) {
229 if (old_start == new_start) return; 250 if (old_start == new_start) return;
230 251
231 MarkBit new_mark_bit = MarkBitFrom(new_start); 252 MarkBit new_mark_bit = MarkBitFrom(new_start);
232 253
233 if (heap_->incremental_marking()->IsMarking()) { 254 if (heap_->incremental_marking()->IsMarking()) {
234 MarkBit old_mark_bit = MarkBitFrom(old_start); 255 MarkBit old_mark_bit = MarkBitFrom(old_start);
(...skipping 2562 matching lines...) Expand 10 before | Expand all | Expand 10 after
2797 } 2818 }
2798 2819
2799 2820
2800 void MarkCompactCollector::Initialize() { 2821 void MarkCompactCollector::Initialize() {
2801 StaticPointersToNewGenUpdatingVisitor::Initialize(); 2822 StaticPointersToNewGenUpdatingVisitor::Initialize();
2802 StaticMarkingVisitor::Initialize(); 2823 StaticMarkingVisitor::Initialize();
2803 } 2824 }
2804 2825
2805 2826
2806 } } // namespace v8::internal 2827 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/incremental-marking.cc ('k') | src/mark-compact-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698