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::MayContainNewSpacePointers() { |
| 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 // The ConstantPoolArray contains heap pointers, but not new space pointers. |
| 1496 if (type == CONSTANT_POOL_ARRAY_TYPE) return false; |
| 1497 return (type > LAST_DATA_TYPE); |
| 1498 } |
| 1499 |
| 1500 |
1483 void HeapObject::IteratePointers(ObjectVisitor* v, int start, int end) { | 1501 void HeapObject::IteratePointers(ObjectVisitor* v, int start, int end) { |
1484 v->VisitPointers(reinterpret_cast<Object**>(FIELD_ADDR(this, start)), | 1502 v->VisitPointers(reinterpret_cast<Object**>(FIELD_ADDR(this, start)), |
1485 reinterpret_cast<Object**>(FIELD_ADDR(this, end))); | 1503 reinterpret_cast<Object**>(FIELD_ADDR(this, end))); |
1486 } | 1504 } |
1487 | 1505 |
1488 | 1506 |
1489 void HeapObject::IteratePointer(ObjectVisitor* v, int offset) { | 1507 void HeapObject::IteratePointer(ObjectVisitor* v, int offset) { |
1490 v->VisitPointer(reinterpret_cast<Object**>(FIELD_ADDR(this, offset))); | 1508 v->VisitPointer(reinterpret_cast<Object**>(FIELD_ADDR(this, offset))); |
1491 } | 1509 } |
1492 | 1510 |
(...skipping 5703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7196 #undef READ_SHORT_FIELD | 7214 #undef READ_SHORT_FIELD |
7197 #undef WRITE_SHORT_FIELD | 7215 #undef WRITE_SHORT_FIELD |
7198 #undef READ_BYTE_FIELD | 7216 #undef READ_BYTE_FIELD |
7199 #undef WRITE_BYTE_FIELD | 7217 #undef WRITE_BYTE_FIELD |
7200 #undef NOBARRIER_READ_BYTE_FIELD | 7218 #undef NOBARRIER_READ_BYTE_FIELD |
7201 #undef NOBARRIER_WRITE_BYTE_FIELD | 7219 #undef NOBARRIER_WRITE_BYTE_FIELD |
7202 | 7220 |
7203 } } // namespace v8::internal | 7221 } } // namespace v8::internal |
7204 | 7222 |
7205 #endif // V8_OBJECTS_INL_H_ | 7223 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |