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

Don't record slots of objects that may contain raw values.

BUG=
R=mstarzinger@chromium.org, yangguo@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23791 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 72e27a3d
...@@ -2898,10 +2898,7 @@ void MarkCompactCollector::MigrateObject(HeapObject* dst, HeapObject* src, ...@@ -2898,10 +2898,7 @@ void MarkCompactCollector::MigrateObject(HeapObject* dst, HeapObject* src,
Memory::Object_at(dst_slot) = value; Memory::Object_at(dst_slot) = value;
// We special case ConstantPoolArrays below since they could contain if (!src->MayContainRawValues()) {
// integers value entries which look like tagged pointers.
// TODO(mstarzinger): restructure this code to avoid this special-casing.
if (!src->IsConstantPoolArray()) {
RecordMigratedSlot(value, dst_slot); RecordMigratedSlot(value, dst_slot);
} }
...@@ -2919,6 +2916,9 @@ void MarkCompactCollector::MigrateObject(HeapObject* dst, HeapObject* src, ...@@ -2919,6 +2916,9 @@ void MarkCompactCollector::MigrateObject(HeapObject* dst, HeapObject* src,
SlotsBuffer::IGNORE_OVERFLOW); SlotsBuffer::IGNORE_OVERFLOW);
} }
} else if (dst->IsConstantPoolArray()) { } else if (dst->IsConstantPoolArray()) {
// We special case ConstantPoolArrays since they could contain integers
// value entries which look like tagged pointers.
// TODO(mstarzinger): restructure this code to avoid this special-casing.
ConstantPoolArray* array = ConstantPoolArray::cast(dst); ConstantPoolArray* array = ConstantPoolArray::cast(dst);
ConstantPoolArray::Iterator code_iter(array, ConstantPoolArray::CODE_PTR); ConstantPoolArray::Iterator code_iter(array, ConstantPoolArray::CODE_PTR);
while (!code_iter.is_finished()) { while (!code_iter.is_finished()) {
......
...@@ -507,7 +507,7 @@ void StoreBuffer::IteratePointersToNewSpace(ObjectSlotCallback slot_callback, ...@@ -507,7 +507,7 @@ void StoreBuffer::IteratePointersToNewSpace(ObjectSlotCallback slot_callback,
for (HeapObject* heap_object = iterator.Next(); heap_object != NULL; for (HeapObject* heap_object = iterator.Next(); heap_object != NULL;
heap_object = iterator.Next()) { heap_object = iterator.Next()) {
// We iterate over objects that contain new space pointers only. // We iterate over objects that contain new space pointers only.
if (heap_object->MayContainNewSpacePointers()) { if (!heap_object->MayContainRawValues()) {
FindPointersToNewSpaceInRegion( FindPointersToNewSpaceInRegion(
heap_object->address() + HeapObject::kHeaderSize, heap_object->address() + HeapObject::kHeaderSize,
heap_object->address() + heap_object->Size(), slot_callback, heap_object->address() + heap_object->Size(), slot_callback,
......
...@@ -1473,21 +1473,22 @@ int HeapObject::Size() { ...@@ -1473,21 +1473,22 @@ int HeapObject::Size() {
} }
bool HeapObject::MayContainNewSpacePointers() { bool HeapObject::MayContainRawValues() {
InstanceType type = map()->instance_type(); InstanceType type = map()->instance_type();
if (type <= LAST_NAME_TYPE) { if (type <= LAST_NAME_TYPE) {
if (type == SYMBOL_TYPE) { if (type == SYMBOL_TYPE) {
return true; return false;
} }
DCHECK(type < FIRST_NONSTRING_TYPE); DCHECK(type < FIRST_NONSTRING_TYPE);
// There are four string representations: sequential strings, external // There are four string representations: sequential strings, external
// strings, cons strings, and sliced strings. // strings, cons strings, and sliced strings.
// Only the latter two contain non-map-word pointers to heap objects. // Only the former two contain raw values and no heap pointers (besides the
return ((type & kIsIndirectStringMask) == kIsIndirectStringTag); // map-word).
return ((type & kIsIndirectStringMask) != kIsIndirectStringTag);
} }
// The ConstantPoolArray contains heap pointers, but not new space pointers. // The ConstantPoolArray contains heap pointers, but also raw values.
if (type == CONSTANT_POOL_ARRAY_TYPE) return false; if (type == CONSTANT_POOL_ARRAY_TYPE) return true;
return (type > LAST_DATA_TYPE); return (type <= LAST_DATA_TYPE);
} }
......
...@@ -1740,9 +1740,9 @@ class HeapObject: public Object { ...@@ -1740,9 +1740,9 @@ class HeapObject: public Object {
// Returns the heap object's size in bytes // Returns the heap object's size in bytes
inline int Size(); inline int Size();
// Returns true if this heap object may contain pointers to objects in new // Returns true if this heap object may contain raw values, i.e., values that
// space. // look like pointers to heap objects.
inline bool MayContainNewSpacePointers(); inline bool MayContainRawValues();
// Given a heap object's map pointer, returns the heap size in bytes // Given a heap object's map pointer, returns the heap size in bytes
// Useful when the map pointer field is used for other purposes. // Useful when the map pointer field is used for other purposes.
......
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