Chromium Code Reviews| 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; |
|
rmcilroy
2014/07/23 11:04:53
The constant pool array does contain pointers (in
Hannes Payer (out of office)
2014/07/24 08:52:38
Makes sense. Done.
|
| + 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))); |