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

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

Issue 8234002: New flag --stress-compaction (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 2 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/v8.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 // 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 void MarkCompactCollector::CollectEvacuationCandidates(PagedSpace* space) { 426 void MarkCompactCollector::CollectEvacuationCandidates(PagedSpace* space) {
427 ASSERT(space->identity() == OLD_POINTER_SPACE || 427 ASSERT(space->identity() == OLD_POINTER_SPACE ||
428 space->identity() == OLD_DATA_SPACE || 428 space->identity() == OLD_DATA_SPACE ||
429 space->identity() == CODE_SPACE); 429 space->identity() == CODE_SPACE);
430 430
431 PageIterator it(space); 431 PageIterator it(space);
432 int count = 0; 432 int count = 0;
433 if (it.has_next()) it.next(); // Never compact the first page. 433 if (it.has_next()) it.next(); // Never compact the first page.
434 while (it.has_next()) { 434 while (it.has_next()) {
435 Page* p = it.next(); 435 Page* p = it.next();
436 if (space->IsFragmented(p)) { 436 bool evacuate = false;
437 if (FLAG_stress_compaction) {
438 int counter = space->heap()->ms_count();
439 uintptr_t page_number = reinterpret_cast<uintptr_t>(p) >> kPageSizeBits;
440 if ((counter & 1) == (page_number & 1)) evacuate = true;
441 } else {
442 if (space->IsFragmented(p)) evacuate = true;
443 }
444 if (evacuate) {
437 AddEvacuationCandidate(p); 445 AddEvacuationCandidate(p);
438 count++; 446 count++;
439 } else { 447 } else {
440 p->ClearEvacuationCandidate(); 448 p->ClearEvacuationCandidate();
441 } 449 }
442 } 450 }
443 451
444 if (count > 0 && FLAG_trace_fragmentation) { 452 if (count > 0 && FLAG_trace_fragmentation) {
445 PrintF("Collected %d evacuation candidates for space %s\n", 453 PrintF("Collected %d evacuation candidates for space %s\n",
446 count, 454 count,
(...skipping 3356 matching lines...) Expand 10 before | Expand all | Expand 10 after
3803 while (buffer != NULL) { 3811 while (buffer != NULL) {
3804 SlotsBuffer* next_buffer = buffer->next(); 3812 SlotsBuffer* next_buffer = buffer->next();
3805 DeallocateBuffer(buffer); 3813 DeallocateBuffer(buffer);
3806 buffer = next_buffer; 3814 buffer = next_buffer;
3807 } 3815 }
3808 *buffer_address = NULL; 3816 *buffer_address = NULL;
3809 } 3817 }
3810 3818
3811 3819
3812 } } // namespace v8::internal 3820 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/incremental-marking.cc ('k') | src/v8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698