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 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1522 Address HeapObject::address() { | 1522 Address HeapObject::address() { |
1523 return reinterpret_cast<Address>(this) - kHeapObjectTag; | 1523 return reinterpret_cast<Address>(this) - kHeapObjectTag; |
1524 } | 1524 } |
1525 | 1525 |
1526 | 1526 |
1527 int HeapObject::Size() { | 1527 int HeapObject::Size() { |
1528 return SizeFromMap(map()); | 1528 return SizeFromMap(map()); |
1529 } | 1529 } |
1530 | 1530 |
1531 | 1531 |
1532 bool HeapObject::MayContainRawValues() { | 1532 HeapObjectContents HeapObject::ContentType() { |
1533 InstanceType type = map()->instance_type(); | 1533 InstanceType type = map()->instance_type(); |
1534 if (type <= LAST_NAME_TYPE) { | 1534 if (type <= LAST_NAME_TYPE) { |
1535 if (type == SYMBOL_TYPE) { | 1535 if (type == SYMBOL_TYPE) { |
1536 return false; | 1536 return HeapObjectContents::kTaggedValues; |
1537 } | 1537 } |
1538 DCHECK(type < FIRST_NONSTRING_TYPE); | 1538 DCHECK(type < FIRST_NONSTRING_TYPE); |
1539 // There are four string representations: sequential strings, external | 1539 // There are four string representations: sequential strings, external |
1540 // strings, cons strings, and sliced strings. | 1540 // strings, cons strings, and sliced strings. |
1541 // Only the former two contain raw values and no heap pointers (besides the | 1541 // Only the former two contain raw values and no heap pointers (besides the |
1542 // map-word). | 1542 // map-word). |
1543 return ((type & kIsIndirectStringMask) != kIsIndirectStringTag); | 1543 if (((type & kIsIndirectStringMask) != kIsIndirectStringTag)) |
| 1544 return HeapObjectContents::kRawValues; |
| 1545 else |
| 1546 return HeapObjectContents::kTaggedValues; |
| 1547 #if 0 |
| 1548 // TODO(jochen): Enable eventually. |
| 1549 } else if (type == JS_FUNCTION_TYPE) { |
| 1550 return HeapObjectContents::kMixedValues; |
| 1551 #endif |
| 1552 } else if (type <= LAST_DATA_TYPE) { |
| 1553 // TODO(jochen): Why do we claim that Code and Map contain only raw values? |
| 1554 return HeapObjectContents::kRawValues; |
| 1555 } else { |
| 1556 if (FLAG_unbox_double_fields) { |
| 1557 LayoutDescriptorHelper helper(map()); |
| 1558 if (!helper.all_fields_tagged()) return HeapObjectContents::kMixedValues; |
| 1559 } |
| 1560 return HeapObjectContents::kTaggedValues; |
1544 } | 1561 } |
1545 return (type <= LAST_DATA_TYPE); | |
1546 } | 1562 } |
1547 | 1563 |
1548 | 1564 |
1549 void HeapObject::IteratePointers(ObjectVisitor* v, int start, int end) { | 1565 void HeapObject::IteratePointers(ObjectVisitor* v, int start, int end) { |
1550 v->VisitPointers(reinterpret_cast<Object**>(FIELD_ADDR(this, start)), | 1566 v->VisitPointers(reinterpret_cast<Object**>(FIELD_ADDR(this, start)), |
1551 reinterpret_cast<Object**>(FIELD_ADDR(this, end))); | 1567 reinterpret_cast<Object**>(FIELD_ADDR(this, end))); |
1552 } | 1568 } |
1553 | 1569 |
1554 | 1570 |
1555 void HeapObject::IteratePointer(ObjectVisitor* v, int offset) { | 1571 void HeapObject::IteratePointer(ObjectVisitor* v, int offset) { |
(...skipping 5803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7359 #undef READ_SHORT_FIELD | 7375 #undef READ_SHORT_FIELD |
7360 #undef WRITE_SHORT_FIELD | 7376 #undef WRITE_SHORT_FIELD |
7361 #undef READ_BYTE_FIELD | 7377 #undef READ_BYTE_FIELD |
7362 #undef WRITE_BYTE_FIELD | 7378 #undef WRITE_BYTE_FIELD |
7363 #undef NOBARRIER_READ_BYTE_FIELD | 7379 #undef NOBARRIER_READ_BYTE_FIELD |
7364 #undef NOBARRIER_WRITE_BYTE_FIELD | 7380 #undef NOBARRIER_WRITE_BYTE_FIELD |
7365 | 7381 |
7366 } } // namespace v8::internal | 7382 } } // namespace v8::internal |
7367 | 7383 |
7368 #endif // V8_OBJECTS_INL_H_ | 7384 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |