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 if (type == CONSTANT_POOL_ARRAY_TYPE) return false; | |
rmcilroy
2014/07/24 10:24:48
nit - add a comment here that the ConstantPoolArra
Hannes Payer (out of office)
2014/07/24 10:40:08
Done.
| |
1496 return (type > LAST_DATA_TYPE); | |
1497 } | |
1498 | |
1499 | |
1483 void HeapObject::IteratePointers(ObjectVisitor* v, int start, int end) { | 1500 void HeapObject::IteratePointers(ObjectVisitor* v, int start, int end) { |
1484 v->VisitPointers(reinterpret_cast<Object**>(FIELD_ADDR(this, start)), | 1501 v->VisitPointers(reinterpret_cast<Object**>(FIELD_ADDR(this, start)), |
1485 reinterpret_cast<Object**>(FIELD_ADDR(this, end))); | 1502 reinterpret_cast<Object**>(FIELD_ADDR(this, end))); |
1486 } | 1503 } |
1487 | 1504 |
1488 | 1505 |
1489 void HeapObject::IteratePointer(ObjectVisitor* v, int offset) { | 1506 void HeapObject::IteratePointer(ObjectVisitor* v, int offset) { |
1490 v->VisitPointer(reinterpret_cast<Object**>(FIELD_ADDR(this, offset))); | 1507 v->VisitPointer(reinterpret_cast<Object**>(FIELD_ADDR(this, offset))); |
1491 } | 1508 } |
1492 | 1509 |
(...skipping 5703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7196 #undef READ_SHORT_FIELD | 7213 #undef READ_SHORT_FIELD |
7197 #undef WRITE_SHORT_FIELD | 7214 #undef WRITE_SHORT_FIELD |
7198 #undef READ_BYTE_FIELD | 7215 #undef READ_BYTE_FIELD |
7199 #undef WRITE_BYTE_FIELD | 7216 #undef WRITE_BYTE_FIELD |
7200 #undef NOBARRIER_READ_BYTE_FIELD | 7217 #undef NOBARRIER_READ_BYTE_FIELD |
7201 #undef NOBARRIER_WRITE_BYTE_FIELD | 7218 #undef NOBARRIER_WRITE_BYTE_FIELD |
7202 | 7219 |
7203 } } // namespace v8::internal | 7220 } } // namespace v8::internal |
7204 | 7221 |
7205 #endif // V8_OBJECTS_INL_H_ | 7222 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |