Commit a5b923ec authored by hpayer@chromium.org's avatar hpayer@chromium.org

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

BUG=
R=rmcilroy@chromium.org

Review URL: https://codereview.chromium.org/413693002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22592 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 63fb5381
......@@ -1480,6 +1480,24 @@ int HeapObject::Size() {
}
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) {
v->VisitPointers(reinterpret_cast<Object**>(FIELD_ADDR(this, start)),
reinterpret_cast<Object**>(FIELD_ADDR(this, end)));
......
......@@ -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 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.
......
......@@ -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 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);
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment