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

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

Issue 10640002: Fix lazy sweeping heuristics to prevent old-space expansion. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 | « no previous file | 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3794 matching lines...) Expand 10 before | Expand all | Expand 10 after
3805 space->ClearStats(); 3805 space->ClearStats();
3806 3806
3807 PageIterator it(space); 3807 PageIterator it(space);
3808 3808
3809 intptr_t freed_bytes = 0; 3809 intptr_t freed_bytes = 0;
3810 int pages_swept = 0; 3810 int pages_swept = 0;
3811 intptr_t newspace_size = space->heap()->new_space()->Size(); 3811 intptr_t newspace_size = space->heap()->new_space()->Size();
3812 bool lazy_sweeping_active = false; 3812 bool lazy_sweeping_active = false;
3813 bool unused_page_present = false; 3813 bool unused_page_present = false;
3814 3814
3815 intptr_t old_space_size = heap()->PromotedSpaceSizeOfObjects();
3816 intptr_t space_left =
3817 Min(heap()->OldGenLimit(old_space_size, Heap::kMinPromotionLimit),
3818 heap()->OldGenLimit(old_space_size, Heap::kMinAllocationLimit)) -
3819 old_space_size;
3820
3821 while (it.has_next()) { 3815 while (it.has_next()) {
3822 Page* p = it.next(); 3816 Page* p = it.next();
3823 3817
3824 // Clear sweeping flags indicating that marking bits are still intact. 3818 // Clear sweeping flags indicating that marking bits are still intact.
3825 p->ClearSweptPrecisely(); 3819 p->ClearSweptPrecisely();
3826 p->ClearSweptConservatively(); 3820 p->ClearSweptConservatively();
3827 3821
3828 if (p->IsEvacuationCandidate()) { 3822 if (p->IsEvacuationCandidate()) {
3829 ASSERT(evacuation_candidates_.length() > 0); 3823 ASSERT(evacuation_candidates_.length() > 0);
3830 continue; 3824 continue;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3870 pages_swept++; 3864 pages_swept++;
3871 break; 3865 break;
3872 } 3866 }
3873 case LAZY_CONSERVATIVE: { 3867 case LAZY_CONSERVATIVE: {
3874 if (FLAG_gc_verbose) { 3868 if (FLAG_gc_verbose) {
3875 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively as needed.\n", 3869 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively as needed.\n",
3876 reinterpret_cast<intptr_t>(p)); 3870 reinterpret_cast<intptr_t>(p));
3877 } 3871 }
3878 freed_bytes += SweepConservatively(space, p); 3872 freed_bytes += SweepConservatively(space, p);
3879 pages_swept++; 3873 pages_swept++;
3880 if (space_left + freed_bytes > newspace_size) { 3874 if (freed_bytes > 2 * newspace_size) {
3881 space->SetPagesToSweep(p->next_page()); 3875 space->SetPagesToSweep(p->next_page());
3882 lazy_sweeping_active = true; 3876 lazy_sweeping_active = true;
3883 } else { 3877 } else {
3884 if (FLAG_gc_verbose) { 3878 if (FLAG_gc_verbose) {
3885 PrintF("Only %" V8PRIdPTR " bytes freed. Still sweeping.\n", 3879 PrintF("Only %" V8PRIdPTR " bytes freed. Still sweeping.\n",
3886 freed_bytes); 3880 freed_bytes);
3887 } 3881 }
3888 } 3882 }
3889 break; 3883 break;
3890 } 3884 }
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
4119 while (buffer != NULL) { 4113 while (buffer != NULL) {
4120 SlotsBuffer* next_buffer = buffer->next(); 4114 SlotsBuffer* next_buffer = buffer->next();
4121 DeallocateBuffer(buffer); 4115 DeallocateBuffer(buffer);
4122 buffer = next_buffer; 4116 buffer = next_buffer;
4123 } 4117 }
4124 *buffer_address = NULL; 4118 *buffer_address = NULL;
4125 } 4119 }
4126 4120
4127 4121
4128 } } // namespace v8::internal 4122 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698