Revision: 22592
Author:   [email protected]
Date:     Thu Jul 24 10:45:37 2014 UTC
Log:      Use heap iterator in store buffer when page was swept precisely.

BUG=
[email protected]

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

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

=======================================
--- /branches/bleeding_edge/src/objects-inl.h   Wed Jul 23 07:16:32 2014 UTC
+++ /branches/bleeding_edge/src/objects-inl.h   Thu Jul 24 10:45:37 2014 UTC
@@ -1478,6 +1478,24 @@
 int HeapObject::Size() {
   return SizeFromMap(map());
 }
+
+
+bool HeapObject::MayContainNewSpacePointers() {
+  InstanceType type = map()->instance_type();
+  if (type <= LAST_NAME_TYPE) {
+    if (type == SYMBOL_TYPE) {
+      return true;
+    }
+    ASSERT(type < FIRST_NONSTRING_TYPE);
+    // There are four string representations: sequential strings, external
+    // strings, cons strings, and sliced strings.
+    // Only the latter two contain non-map-word pointers to heap objects.
+    return ((type & kIsIndirectStringMask) == kIsIndirectStringTag);
+  }
+ // The ConstantPoolArray contains heap pointers, but not new space pointers.
+  if (type == CONSTANT_POOL_ARRAY_TYPE) return false;
+  return (type > LAST_DATA_TYPE);
+}


 void HeapObject::IteratePointers(ObjectVisitor* v, int start, int end) {
=======================================
--- /branches/bleeding_edge/src/objects.h       Wed Jul 23 08:27:04 2014 UTC
+++ /branches/bleeding_edge/src/objects.h       Thu Jul 24 10:45:37 2014 UTC
@@ -1747,6 +1747,10 @@
   // Returns the heap object's size in bytes
   inline int Size();

+ // Returns true if this heap object may contain pointers to objects in new
+  // space.
+  inline bool MayContainNewSpacePointers();
+
   // Given a heap object's map pointer, returns the heap size in bytes
   // Useful when the map pointer field is used for other purposes.
   // GC internal.
=======================================
--- /branches/bleeding_edge/src/store-buffer.cc Wed Jul 23 09:17:21 2014 UTC
+++ /branches/bleeding_edge/src/store-buffer.cc Thu Jul 24 10:45:37 2014 UTC
@@ -515,8 +515,25 @@
                 heap_->mark_compact_collector()->EnsureSweepingCompleted();
               }
             }
-            FindPointersToNewSpaceInRegion(
-                start, end, slot_callback, clear_maps);
+ // TODO(hpayer): remove the special casing and merge map and pointer
+            // space handling as soon as we removed conservative sweeping.
+            CHECK(page->owner() == heap_->old_pointer_space());
+            if (heap_->old_pointer_space()->swept_precisely()) {
+              HeapObjectIterator iterator(page, NULL);
+              for (HeapObject* heap_object = iterator.Next();
+                   heap_object != NULL; heap_object = iterator.Next()) {
+ // We iterate over objects that contain new space pointers only.
+                if (heap_object->MayContainNewSpacePointers()) {
+                  FindPointersToNewSpaceInRegion(
+                      heap_object->address() + HeapObject::kHeaderSize,
+                      heap_object->address() + heap_object->Size(),
+                      slot_callback, clear_maps);
+                }
+              }
+            } else {
+              FindPointersToNewSpaceInRegion(start, end, slot_callback,
+                                             clear_maps);
+            }
           }
         }
       }

--
--
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/d/optout.

Reply via email to