Reviewers: Michael Starzinger,

Description:
Remove eager sweeping for lazy swept spaces. Try to find in SlowAllocateRaw a
bounded number of times a big enough memory slot.


BUG=


Please review this at https://chromiumcodereview.appspot.com/11420036/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/mark-compact.cc
  M src/spaces.cc


Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 30abe6d54ca22cbe76b37f55d06ce8691daa0fbf..aa1900b322029e65a486418d8984a25f9bb0c8d1 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -3525,7 +3525,6 @@ void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) {

   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 @@ void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) {
         }
         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: {
Index: src/spaces.cc
diff --git a/src/spaces.cc b/src/spaces.cc
index 0ac23d279db6d5c13e3d9b0b67206cdd7f983ce0..ee117888088caf0a5e45121383062c750e86ee1e 100644
--- a/src/spaces.cc
+++ b/src/spaces.cc
@@ -2391,9 +2391,12 @@ void PagedSpace::EvictEvacuationCandidatesFromFreeLists() {
 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()) {
+ // 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;
+  int i = 0;
+
+ for (i = 0; i < kMaxSweepingTries && first_unswept_page_->is_valid(); i++) {
     AdvanceSweeper(size_in_bytes);

     // Retry the free list allocation.


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

Reply via email to