Revision: 15085
Author:   [email protected]
Date:     Wed Jun 12 06:14:35 2013
Log:      Clean up StoreBuffer::EnsureSpace.

BUG=
[email protected]

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

Modified:
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/store-buffer.cc
 /branches/bleeding_edge/src/store-buffer.h

=======================================
--- /branches/bleeding_edge/src/heap.cc Wed Jun 12 02:31:39 2013
+++ /branches/bleeding_edge/src/heap.cc Wed Jun 12 06:14:35 2013
@@ -1212,7 +1212,7 @@
// Store Buffer overflowed while scanning promoted objects. These are not // in any particular page, though they are likely to be clustered by the
       // allocation routines.
-      store_buffer_->EnsureSpace(StoreBuffer::kStoreBufferSize);
+      store_buffer_->EnsureSpace(StoreBuffer::kStoreBufferSize / 2);
     } else {
// Store Buffer overflowed while scanning a particular old space page for
       // pointers to new space.
=======================================
--- /branches/bleeding_edge/src/store-buffer.cc Mon Jun 10 07:22:41 2013
+++ /branches/bleeding_edge/src/store-buffer.cc Wed Jun 12 06:14:35 2013
@@ -140,6 +140,11 @@
   }
   old_top_ = write;
 }
+
+
+bool StoreBuffer::SpaceAvailable(intptr_t space_needed) {
+  return old_limit_ - old_top_ >= space_needed;
+}


 void StoreBuffer::EnsureSpace(intptr_t space_needed) {
@@ -152,7 +157,7 @@
     old_limit_ += grow;
   }

-  if (old_limit_ - old_top_ >= space_needed) return;
+  if (SpaceAvailable(space_needed)) return;

   if (old_buffer_is_filtered_) return;
   ASSERT(may_move_store_buffer_entries_);
@@ -171,9 +176,7 @@
     Filter(MemoryChunk::SCAN_ON_SCAVENGE);
   }

- // If filtering out the entries from scan_on_scavenge pages got us down to
-  // less than half full, then we are satisfied with that.
-  if (old_limit_ - old_top_ > old_top_ - old_start_) return;
+  if (SpaceAvailable(space_needed)) return;

// Sample 1 entry in 97 and filter out the pages where we estimate that more
   // than 1 in 8 pointers are to new space.
@@ -192,7 +195,7 @@
     ExemptPopularPages(samples[i].prime_sample_step, samples[i].threshold);
// As a last resort we mark all pages as being exempt from the store buffer.
     ASSERT(i != (kSampleFinenesses - 1) || old_top_ == old_start_);
-    if (old_limit_ - old_top_ > old_top_ - old_start_) return;
+    if (SpaceAvailable(space_needed)) return;
   }
   UNREACHABLE();
 }
@@ -294,7 +297,7 @@
 void StoreBuffer::Clean() {
   ClearFilteringHashSets();
   Uniq();  // Also removes things that no longer point to new space.
-  CheckForFullBuffer();
+  EnsureSpace(kStoreBufferSize / 2);
 }


@@ -687,12 +690,6 @@
     ASSERT(old_top_ <= old_limit_);
   }
   heap_->isolate()->counters()->store_buffer_compactions()->Increment();
-  CheckForFullBuffer();
-}
-
-
-void StoreBuffer::CheckForFullBuffer() {
-  EnsureSpace(kStoreBufferSize * 2);
 }

 } }  // namespace v8::internal
=======================================
--- /branches/bleeding_edge/src/store-buffer.h  Wed Apr 24 04:20:16 2013
+++ /branches/bleeding_edge/src/store-buffer.h  Wed Jun 12 06:14:35 2013
@@ -160,7 +160,7 @@

   void ClearFilteringHashSets();

-  void CheckForFullBuffer();
+  bool SpaceAvailable(intptr_t space_needed);
   void Uniq();
   void ExemptPopularPages(int prime_sample_step, int threshold);

@@ -223,7 +223,6 @@
   ~StoreBufferRebuildScope() {
     store_buffer_->callback_ = stored_callback_;
     store_buffer_->store_buffer_rebuilding_enabled_ = stored_state_;
-    store_buffer_->CheckForFullBuffer();
   }

  private:

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to