Reviewers: jarin, rmcilroy,

Message:
Hi Ross, this should fix the constant pool issue.


Description:
Use heap iterator in store buffer when page was swept precisely.

BUG=

Please review this at https://codereview.chromium.org/413693002/

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

Affected files (+40, -2 lines):
  M src/objects.h
  M src/objects-inl.h
  M src/store-buffer.cc


Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 36e7eb1758769709f12c17d6abf609f422dd9359..d6e4f6c4a4b29ff5fde64a5be2761cf6507ea53d 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1480,6 +1480,23 @@ int HeapObject::Size() {
 }


+bool HeapObject::ContainsPointers() {
+  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);
+  }
+  if (type == CONSTANT_POOL_ARRAY_TYPE) return false;
+  return (type > LAST_DATA_TYPE);
+}
+
+
 void HeapObject::IteratePointers(ObjectVisitor* v, int start, int end) {
   v->VisitPointers(reinterpret_cast<Object**>(FIELD_ADDR(this, start)),
                    reinterpret_cast<Object**>(FIELD_ADDR(this, end)));
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index e32b51d2ff06cff2fb9a5fbb9f0704fdf094fb58..ce4aa24902343cda538fd4320027e6d0c60f799d 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -1747,6 +1747,10 @@ class HeapObject: public Object {
   // Returns the heap object's size in bytes
   inline int Size();

+  // Returns true if this heap object contains only references to other
+  // heap objects.
+  inline bool ContainsPointers();
+
   // 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.
Index: src/store-buffer.cc
diff --git a/src/store-buffer.cc b/src/store-buffer.cc
index d1a04d292fb2cb0f79282972caa0b26c8d3b8c2f..69de822e6e6b122d1b3892ec98043ad5000ed72f 100644
--- a/src/store-buffer.cc
+++ b/src/store-buffer.cc
@@ -515,8 +515,25 @@ void StoreBuffer::IteratePointersToNewSpace(ObjectSlotCallback slot_callback,
                 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 pointers only.
+                if (heap_object->ContainsPointers()) {
+                  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