| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 return IsSmi() || IsHeapNumber(); | 326 return IsSmi() || IsHeapNumber(); |
| 327 } | 327 } |
| 328 | 328 |
| 329 | 329 |
| 330 bool Object::IsByteArray() { | 330 bool Object::IsByteArray() { |
| 331 return Object::IsHeapObject() | 331 return Object::IsHeapObject() |
| 332 && HeapObject::cast(this)->map()->instance_type() == BYTE_ARRAY_TYPE; | 332 && HeapObject::cast(this)->map()->instance_type() == BYTE_ARRAY_TYPE; |
| 333 } | 333 } |
| 334 | 334 |
| 335 | 335 |
| 336 bool Object::IsFreeSpace() { |
| 337 return Object::IsHeapObject() |
| 338 && HeapObject::cast(this)->map()->instance_type() == FREE_SPACE_TYPE; |
| 339 } |
| 340 |
| 341 |
| 342 bool Object::IsFiller() { |
| 343 if (!Object::IsHeapObject()) return false; |
| 344 InstanceType instance_type = HeapObject::cast(this)->map()->instance_type(); |
| 345 return instance_type == FREE_SPACE_TYPE || instance_type == FILLER_TYPE; |
| 346 } |
| 347 |
| 348 |
| 336 bool Object::IsExternalPixelArray() { | 349 bool Object::IsExternalPixelArray() { |
| 337 return Object::IsHeapObject() && | 350 return Object::IsHeapObject() && |
| 338 HeapObject::cast(this)->map()->instance_type() == | 351 HeapObject::cast(this)->map()->instance_type() == |
| 339 EXTERNAL_PIXEL_ARRAY_TYPE; | 352 EXTERNAL_PIXEL_ARRAY_TYPE; |
| 340 } | 353 } |
| 341 | 354 |
| 342 | 355 |
| 343 bool Object::IsExternalArray() { | 356 bool Object::IsExternalArray() { |
| 344 if (!Object::IsHeapObject()) | 357 if (!Object::IsHeapObject()) |
| 345 return false; | 358 return false; |
| (...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1619 CAST_ACCESSOR(JSFunction) | 1632 CAST_ACCESSOR(JSFunction) |
| 1620 CAST_ACCESSOR(GlobalObject) | 1633 CAST_ACCESSOR(GlobalObject) |
| 1621 CAST_ACCESSOR(JSGlobalProxy) | 1634 CAST_ACCESSOR(JSGlobalProxy) |
| 1622 CAST_ACCESSOR(JSGlobalObject) | 1635 CAST_ACCESSOR(JSGlobalObject) |
| 1623 CAST_ACCESSOR(JSBuiltinsObject) | 1636 CAST_ACCESSOR(JSBuiltinsObject) |
| 1624 CAST_ACCESSOR(Code) | 1637 CAST_ACCESSOR(Code) |
| 1625 CAST_ACCESSOR(JSArray) | 1638 CAST_ACCESSOR(JSArray) |
| 1626 CAST_ACCESSOR(JSRegExp) | 1639 CAST_ACCESSOR(JSRegExp) |
| 1627 CAST_ACCESSOR(Proxy) | 1640 CAST_ACCESSOR(Proxy) |
| 1628 CAST_ACCESSOR(ByteArray) | 1641 CAST_ACCESSOR(ByteArray) |
| 1642 CAST_ACCESSOR(FreeSpace) |
| 1629 CAST_ACCESSOR(ExternalArray) | 1643 CAST_ACCESSOR(ExternalArray) |
| 1630 CAST_ACCESSOR(ExternalByteArray) | 1644 CAST_ACCESSOR(ExternalByteArray) |
| 1631 CAST_ACCESSOR(ExternalUnsignedByteArray) | 1645 CAST_ACCESSOR(ExternalUnsignedByteArray) |
| 1632 CAST_ACCESSOR(ExternalShortArray) | 1646 CAST_ACCESSOR(ExternalShortArray) |
| 1633 CAST_ACCESSOR(ExternalUnsignedShortArray) | 1647 CAST_ACCESSOR(ExternalUnsignedShortArray) |
| 1634 CAST_ACCESSOR(ExternalIntArray) | 1648 CAST_ACCESSOR(ExternalIntArray) |
| 1635 CAST_ACCESSOR(ExternalUnsignedIntArray) | 1649 CAST_ACCESSOR(ExternalUnsignedIntArray) |
| 1636 CAST_ACCESSOR(ExternalFloatArray) | 1650 CAST_ACCESSOR(ExternalFloatArray) |
| 1637 CAST_ACCESSOR(ExternalPixelArray) | 1651 CAST_ACCESSOR(ExternalPixelArray) |
| 1638 CAST_ACCESSOR(Struct) | 1652 CAST_ACCESSOR(Struct) |
| 1639 | 1653 |
| 1640 | 1654 |
| 1641 #define MAKE_STRUCT_CAST(NAME, Name, name) CAST_ACCESSOR(Name) | 1655 #define MAKE_STRUCT_CAST(NAME, Name, name) CAST_ACCESSOR(Name) |
| 1642 STRUCT_LIST(MAKE_STRUCT_CAST) | 1656 STRUCT_LIST(MAKE_STRUCT_CAST) |
| 1643 #undef MAKE_STRUCT_CAST | 1657 #undef MAKE_STRUCT_CAST |
| 1644 | 1658 |
| 1645 | 1659 |
| 1646 template <typename Shape, typename Key> | 1660 template <typename Shape, typename Key> |
| 1647 HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) { | 1661 HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) { |
| 1648 ASSERT(obj->IsHashTable()); | 1662 ASSERT(obj->IsHashTable()); |
| 1649 return reinterpret_cast<HashTable*>(obj); | 1663 return reinterpret_cast<HashTable*>(obj); |
| 1650 } | 1664 } |
| 1651 | 1665 |
| 1652 | 1666 |
| 1653 SMI_ACCESSORS(FixedArray, length, kLengthOffset) | 1667 SMI_ACCESSORS(FixedArray, length, kLengthOffset) |
| 1654 SMI_ACCESSORS(ByteArray, length, kLengthOffset) | 1668 SMI_ACCESSORS(ByteArray, length, kLengthOffset) |
| 1669 SMI_ACCESSORS(FreeSpace, size, kSizeOffset) |
| 1655 | 1670 |
| 1656 INT_ACCESSORS(ExternalArray, length, kLengthOffset) | 1671 INT_ACCESSORS(ExternalArray, length, kLengthOffset) |
| 1657 | 1672 |
| 1658 | 1673 |
| 1659 SMI_ACCESSORS(String, length, kLengthOffset) | 1674 SMI_ACCESSORS(String, length, kLengthOffset) |
| 1660 | 1675 |
| 1661 | 1676 |
| 1662 uint32_t String::hash_field() { | 1677 uint32_t String::hash_field() { |
| 1663 return READ_UINT32_FIELD(this, kHashFieldOffset); | 1678 return READ_UINT32_FIELD(this, kHashFieldOffset); |
| 1664 } | 1679 } |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2084 if (instance_type == FIXED_ARRAY_TYPE) { | 2099 if (instance_type == FIXED_ARRAY_TYPE) { |
| 2085 return FixedArray::BodyDescriptor::SizeOf(map, this); | 2100 return FixedArray::BodyDescriptor::SizeOf(map, this); |
| 2086 } | 2101 } |
| 2087 if (instance_type == ASCII_STRING_TYPE) { | 2102 if (instance_type == ASCII_STRING_TYPE) { |
| 2088 return SeqAsciiString::SizeFor( | 2103 return SeqAsciiString::SizeFor( |
| 2089 reinterpret_cast<SeqAsciiString*>(this)->length()); | 2104 reinterpret_cast<SeqAsciiString*>(this)->length()); |
| 2090 } | 2105 } |
| 2091 if (instance_type == BYTE_ARRAY_TYPE) { | 2106 if (instance_type == BYTE_ARRAY_TYPE) { |
| 2092 return reinterpret_cast<ByteArray*>(this)->ByteArraySize(); | 2107 return reinterpret_cast<ByteArray*>(this)->ByteArraySize(); |
| 2093 } | 2108 } |
| 2109 if (instance_type == FREE_SPACE_TYPE) { |
| 2110 return reinterpret_cast<FreeSpace*>(this)->size(); |
| 2111 } |
| 2094 if (instance_type == STRING_TYPE) { | 2112 if (instance_type == STRING_TYPE) { |
| 2095 return SeqTwoByteString::SizeFor( | 2113 return SeqTwoByteString::SizeFor( |
| 2096 reinterpret_cast<SeqTwoByteString*>(this)->length()); | 2114 reinterpret_cast<SeqTwoByteString*>(this)->length()); |
| 2097 } | 2115 } |
| 2098 ASSERT(instance_type == CODE_TYPE); | 2116 ASSERT(instance_type == CODE_TYPE); |
| 2099 return reinterpret_cast<Code*>(this)->CodeSize(); | 2117 return reinterpret_cast<Code*>(this)->CodeSize(); |
| 2100 } | 2118 } |
| 2101 | 2119 |
| 2102 | 2120 |
| 2103 void Map::set_instance_size(int value) { | 2121 void Map::set_instance_size(int value) { |
| (...skipping 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3803 #undef WRITE_INT_FIELD | 3821 #undef WRITE_INT_FIELD |
| 3804 #undef READ_SHORT_FIELD | 3822 #undef READ_SHORT_FIELD |
| 3805 #undef WRITE_SHORT_FIELD | 3823 #undef WRITE_SHORT_FIELD |
| 3806 #undef READ_BYTE_FIELD | 3824 #undef READ_BYTE_FIELD |
| 3807 #undef WRITE_BYTE_FIELD | 3825 #undef WRITE_BYTE_FIELD |
| 3808 | 3826 |
| 3809 | 3827 |
| 3810 } } // namespace v8::internal | 3828 } } // namespace v8::internal |
| 3811 | 3829 |
| 3812 #endif // V8_OBJECTS_INL_H_ | 3830 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |