| 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 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 Address HeapObject::address() { | 1466 Address HeapObject::address() { |
| 1467 return reinterpret_cast<Address>(this) - kHeapObjectTag; | 1467 return reinterpret_cast<Address>(this) - kHeapObjectTag; |
| 1468 } | 1468 } |
| 1469 | 1469 |
| 1470 | 1470 |
| 1471 int HeapObject::Size() { | 1471 int HeapObject::Size() { |
| 1472 return SizeFromMap(map()); | 1472 return SizeFromMap(map()); |
| 1473 } | 1473 } |
| 1474 | 1474 |
| 1475 | 1475 |
| 1476 bool HeapObject::MayContainNewSpacePointers() { | 1476 bool HeapObject::MayContainRawValues() { |
| 1477 InstanceType type = map()->instance_type(); | 1477 InstanceType type = map()->instance_type(); |
| 1478 if (type <= LAST_NAME_TYPE) { | 1478 if (type <= LAST_NAME_TYPE) { |
| 1479 if (type == SYMBOL_TYPE) { | 1479 if (type == SYMBOL_TYPE) { |
| 1480 return true; | 1480 return false; |
| 1481 } | 1481 } |
| 1482 DCHECK(type < FIRST_NONSTRING_TYPE); | 1482 DCHECK(type < FIRST_NONSTRING_TYPE); |
| 1483 // There are four string representations: sequential strings, external | 1483 // There are four string representations: sequential strings, external |
| 1484 // strings, cons strings, and sliced strings. | 1484 // strings, cons strings, and sliced strings. |
| 1485 // Only the latter two contain non-map-word pointers to heap objects. | 1485 // Only the former two contain raw values and no heap pointers (besides the |
| 1486 return ((type & kIsIndirectStringMask) == kIsIndirectStringTag); | 1486 // map-word). |
| 1487 return ((type & kIsIndirectStringMask) != kIsIndirectStringTag); |
| 1487 } | 1488 } |
| 1488 // The ConstantPoolArray contains heap pointers, but not new space pointers. | 1489 // The ConstantPoolArray contains heap pointers, but also raw values. |
| 1489 if (type == CONSTANT_POOL_ARRAY_TYPE) return false; | 1490 if (type == CONSTANT_POOL_ARRAY_TYPE) return true; |
| 1490 return (type > LAST_DATA_TYPE); | 1491 return (type <= LAST_DATA_TYPE); |
| 1491 } | 1492 } |
| 1492 | 1493 |
| 1493 | 1494 |
| 1494 void HeapObject::IteratePointers(ObjectVisitor* v, int start, int end) { | 1495 void HeapObject::IteratePointers(ObjectVisitor* v, int start, int end) { |
| 1495 v->VisitPointers(reinterpret_cast<Object**>(FIELD_ADDR(this, start)), | 1496 v->VisitPointers(reinterpret_cast<Object**>(FIELD_ADDR(this, start)), |
| 1496 reinterpret_cast<Object**>(FIELD_ADDR(this, end))); | 1497 reinterpret_cast<Object**>(FIELD_ADDR(this, end))); |
| 1497 } | 1498 } |
| 1498 | 1499 |
| 1499 | 1500 |
| 1500 void HeapObject::IteratePointer(ObjectVisitor* v, int offset) { | 1501 void HeapObject::IteratePointer(ObjectVisitor* v, int offset) { |
| (...skipping 5746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7247 #undef READ_SHORT_FIELD | 7248 #undef READ_SHORT_FIELD |
| 7248 #undef WRITE_SHORT_FIELD | 7249 #undef WRITE_SHORT_FIELD |
| 7249 #undef READ_BYTE_FIELD | 7250 #undef READ_BYTE_FIELD |
| 7250 #undef WRITE_BYTE_FIELD | 7251 #undef WRITE_BYTE_FIELD |
| 7251 #undef NOBARRIER_READ_BYTE_FIELD | 7252 #undef NOBARRIER_READ_BYTE_FIELD |
| 7252 #undef NOBARRIER_WRITE_BYTE_FIELD | 7253 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7253 | 7254 |
| 7254 } } // namespace v8::internal | 7255 } } // namespace v8::internal |
| 7255 | 7256 |
| 7256 #endif // V8_OBJECTS_INL_H_ | 7257 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |