Revision: 13058
Author:   [email protected]
Date:     Mon Nov 26 06:50:20 2012
Log: Remove eager sweeping for lazy swept spaces. Try to find in SlowAllocateRaw a bounded number of times a big enough memory slot.

BUG=v8:2194

Review URL: https://codereview.chromium.org/11420036
http://code.google.com/p/v8/source/detail?r=13058

Modified:
 /branches/bleeding_edge/src/mark-compact.cc
 /branches/bleeding_edge/src/spaces.cc

=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Thu Nov 15 09:57:40 2012
+++ /branches/bleeding_edge/src/mark-compact.cc Mon Nov 26 06:50:20 2012
@@ -3525,7 +3525,6 @@

   intptr_t freed_bytes = 0;
   int pages_swept = 0;
-  intptr_t newspace_size = space->heap()->new_space()->Size();
   bool lazy_sweeping_active = false;
   bool unused_page_present = false;

@@ -3588,15 +3587,8 @@
         }
         freed_bytes += SweepConservatively(space, p);
         pages_swept++;
-        if (freed_bytes > 2 * newspace_size) {
-          space->SetPagesToSweep(p->next_page());
-          lazy_sweeping_active = true;
-        } else {
-          if (FLAG_gc_verbose) {
-            PrintF("Only %" V8PRIdPTR " bytes freed.  Still sweeping.\n",
-                   freed_bytes);
-          }
-        }
+        space->SetPagesToSweep(p->next_page());
+        lazy_sweeping_active = true;
         break;
       }
       case PRECISE: {
=======================================
--- /branches/bleeding_edge/src/spaces.cc       Thu Nov 15 09:57:40 2012
+++ /branches/bleeding_edge/src/spaces.cc       Mon Nov 26 06:50:20 2012
@@ -2391,10 +2391,13 @@
 HeapObject* PagedSpace::SlowAllocateRaw(int size_in_bytes) {
   // Allocation in this space has failed.

- // If there are unswept pages advance lazy sweeper then sweep one page before
-  // allocating a new page.
-  if (first_unswept_page_->is_valid()) {
-    AdvanceSweeper(size_in_bytes);
+ // If there are unswept pages advance lazy sweeper a bounded number of times
+  // until we find a size_in_bytes contiguous piece of memory
+  const int kMaxSweepingTries = 5;
+  bool sweeping_complete = false;
+
+  for (int i = 0; i < kMaxSweepingTries && !sweeping_complete; i++) {
+    sweeping_complete = AdvanceSweeper(size_in_bytes);

     // Retry the free list allocation.
     HeapObject* object = free_list_.Allocate(size_in_bytes);

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to