Fix lazy sweeping heuristics to prevent old-space expansion.
authormstarzinger@chromium.org <mstarzinger@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 22 Jun 2012 11:47:30 +0000 (11:47 +0000)
committermstarzinger@chromium.org <mstarzinger@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 22 Jun 2012 11:47:30 +0000 (11:47 +0000)
This is a temporary fix to prevent excessive expansion of old-space
caused by inaccuracies in lazy sweeper advancing. We actually don't
intend to sweep any pages eagerly, but that requires further changes
to lazy sweeping.

R=ulan@chromium.org,erik.corry@gmail.com
BUG=v8:2194

Review URL: https://chromiumcodereview.appspot.com/10640002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11904 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/mark-compact.cc

index 06cc19a..f26d9a5 100644 (file)
@@ -3823,12 +3823,6 @@ void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) {
   bool lazy_sweeping_active = false;
   bool unused_page_present = false;
 
-  intptr_t old_space_size = heap()->PromotedSpaceSizeOfObjects();
-  intptr_t space_left =
-      Min(heap()->OldGenLimit(old_space_size, Heap::kMinPromotionLimit),
-          heap()->OldGenLimit(old_space_size, Heap::kMinAllocationLimit)) -
-      old_space_size;
-
   while (it.has_next()) {
     Page* p = it.next();
 
@@ -3888,7 +3882,7 @@ void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) {
         }
         freed_bytes += SweepConservatively(space, p);
         pages_swept++;
-        if (space_left + freed_bytes > newspace_size) {
+        if (freed_bytes > 2 * newspace_size) {
           space->SetPagesToSweep(p->next_page());
           lazy_sweeping_active = true;
         } else {