Revision: 7290
Author:   [email protected]
Date:     Mon Mar 21 08:36:04 2011
Log:      Do not SortUniq store buffer before a regular iteration.

Iteration callback will rebuild store buffer effectively removing all duplicates.

Review URL: http://codereview.chromium.org/6713069
http://code.google.com/p/v8/source/detail?r=7290

Modified:
 /branches/experimental/gc/src/store-buffer.cc
 /branches/experimental/gc/src/store-buffer.h

=======================================
--- /branches/experimental/gc/src/store-buffer.cc       Thu Mar 17 10:41:44 2011
+++ /branches/experimental/gc/src/store-buffer.cc       Mon Mar 21 08:36:04 2011
@@ -94,7 +94,6 @@
   start_ = limit_ = NULL;
   Heap::public_set_store_buffer_top(start_);
 }
-


 #if V8_TARGET_ARCH_X64
@@ -159,6 +158,16 @@

   old_buffer_is_sorted_ = true;
 }
+
+
+void StoreBuffer::PrepareForIteration() {
+  Compact();
+  if (store_buffer_mode() == kStoreBufferDisabled) {
+    old_top_ = old_start_;
+    return;
+  }
+  ZapHashTables();
+}


 #ifdef DEBUG
@@ -256,7 +265,10 @@

 void StoreBuffer::IteratePointersToNewSpace(ObjectSlotCallback callback) {
   if (store_buffer_mode() == kStoreBufferFunctional) {
-    SortUniq();
+ // We do not sort or remove duplicated entries from the store buffer because
+    // we expect that callback will rebuild the store buffer thus removing
+    // all duplicates and pointers to old space.
+    PrepareForIteration();
   }
   if (store_buffer_mode() != kStoreBufferFunctional) {
     old_top_ = old_start_;
@@ -287,14 +299,10 @@
         Object* object = *cell;
         // May be invalid if object is not in new space.
         HeapObject* heap_object = reinterpret_cast<HeapObject*>(object);
-        if (Heap::InNewSpace(object)) {
+        if (Heap::InFromSpace(object)) {
           callback(reinterpret_cast<HeapObject**>(cell), heap_object);
         }
         ASSERT(old_top_ == saved_top + 1 || old_top_ == saved_top);
-        ASSERT((old_top_ == saved_top + 1) ==
-               (Heap::InNewSpace(*cell) &&
-                   !Heap::InNewSpace(reinterpret_cast<Address>(cell)) &&
-                   Memory::Address_at(heap_object->address()) != NULL));
       }
     }
   }
=======================================
--- /branches/experimental/gc/src/store-buffer.h        Thu Mar 17 10:41:44 2011
+++ /branches/experimental/gc/src/store-buffer.h        Mon Mar 21 08:36:04 2011
@@ -98,6 +98,8 @@
   static void SortUniq();
   static void Verify();

+  static void PrepareForIteration();
+
 #ifdef DEBUG
   static void Clean();
   // Slow, for asserts only.

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

Reply via email to