OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Review notes: | 5 // Review notes: |
6 // | 6 // |
7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
10 // | 10 // |
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1473 Address HeapObject::address() { | 1473 Address HeapObject::address() { |
1474 return reinterpret_cast<Address>(this) - kHeapObjectTag; | 1474 return reinterpret_cast<Address>(this) - kHeapObjectTag; |
1475 } | 1475 } |
1476 | 1476 |
1477 | 1477 |
1478 int HeapObject::Size() { | 1478 int HeapObject::Size() { |
1479 return SizeFromMap(map()); | 1479 return SizeFromMap(map()); |
1480 } | 1480 } |
1481 | 1481 |
1482 | 1482 |
| 1483 bool HeapObject::ContainsPointers() { |
| 1484 InstanceType type = map()->instance_type(); |
| 1485 if (type <= LAST_NAME_TYPE) { |
| 1486 if (type == SYMBOL_TYPE) { |
| 1487 return true; |
| 1488 } |
| 1489 ASSERT(type < FIRST_NONSTRING_TYPE); |
| 1490 // There are four string representations: sequential strings, external |
| 1491 // strings, cons strings, and sliced strings. |
| 1492 // Only the latter two contain non-map-word pointers to heap objects. |
| 1493 return ((type & kIsIndirectStringMask) == kIsIndirectStringTag); |
| 1494 } |
| 1495 return (type > LAST_DATA_TYPE); |
| 1496 } |
| 1497 |
| 1498 |
1483 void HeapObject::IteratePointers(ObjectVisitor* v, int start, int end) { | 1499 void HeapObject::IteratePointers(ObjectVisitor* v, int start, int end) { |
1484 v->VisitPointers(reinterpret_cast<Object**>(FIELD_ADDR(this, start)), | 1500 v->VisitPointers(reinterpret_cast<Object**>(FIELD_ADDR(this, start)), |
1485 reinterpret_cast<Object**>(FIELD_ADDR(this, end))); | 1501 reinterpret_cast<Object**>(FIELD_ADDR(this, end))); |
1486 } | 1502 } |
1487 | 1503 |
1488 | 1504 |
1489 void HeapObject::IteratePointer(ObjectVisitor* v, int offset) { | 1505 void HeapObject::IteratePointer(ObjectVisitor* v, int offset) { |
1490 v->VisitPointer(reinterpret_cast<Object**>(FIELD_ADDR(this, offset))); | 1506 v->VisitPointer(reinterpret_cast<Object**>(FIELD_ADDR(this, offset))); |
1491 } | 1507 } |
1492 | 1508 |
(...skipping 5632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7125 #undef READ_SHORT_FIELD | 7141 #undef READ_SHORT_FIELD |
7126 #undef WRITE_SHORT_FIELD | 7142 #undef WRITE_SHORT_FIELD |
7127 #undef READ_BYTE_FIELD | 7143 #undef READ_BYTE_FIELD |
7128 #undef WRITE_BYTE_FIELD | 7144 #undef WRITE_BYTE_FIELD |
7129 #undef NOBARRIER_READ_BYTE_FIELD | 7145 #undef NOBARRIER_READ_BYTE_FIELD |
7130 #undef NOBARRIER_WRITE_BYTE_FIELD | 7146 #undef NOBARRIER_WRITE_BYTE_FIELD |
7131 | 7147 |
7132 } } // namespace v8::internal | 7148 } } // namespace v8::internal |
7133 | 7149 |
7134 #endif // V8_OBJECTS_INL_H_ | 7150 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |