OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1644 template <typename Shape, typename Key> | 1644 template <typename Shape, typename Key> |
1645 HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) { | 1645 HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) { |
1646 ASSERT(obj->IsHashTable()); | 1646 ASSERT(obj->IsHashTable()); |
1647 return reinterpret_cast<HashTable*>(obj); | 1647 return reinterpret_cast<HashTable*>(obj); |
1648 } | 1648 } |
1649 | 1649 |
1650 | 1650 |
1651 INT_ACCESSORS(Array, length, kLengthOffset) | 1651 INT_ACCESSORS(Array, length, kLengthOffset) |
1652 | 1652 |
1653 | 1653 |
1654 INT_ACCESSORS(String, length, kLengthOffset) | 1654 SMI_ACCESSORS(String, length, kLengthOffset) |
1655 | 1655 |
1656 | 1656 |
1657 uint32_t String::hash_field() { | 1657 uint32_t String::hash_field() { |
1658 return READ_UINT32_FIELD(this, kHashFieldOffset); | 1658 return READ_UINT32_FIELD(this, kHashFieldOffset); |
1659 } | 1659 } |
1660 | 1660 |
1661 | 1661 |
1662 void String::set_hash_field(uint32_t value) { | 1662 void String::set_hash_field(uint32_t value) { |
1663 WRITE_UINT32_FIELD(this, kHashFieldOffset, value); | 1663 WRITE_UINT32_FIELD(this, kHashFieldOffset, value); |
1664 } | 1664 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 } | 1766 } |
1767 | 1767 |
1768 | 1768 |
1769 void SeqTwoByteString::SeqTwoByteStringSet(int index, uint16_t value) { | 1769 void SeqTwoByteString::SeqTwoByteStringSet(int index, uint16_t value) { |
1770 ASSERT(index >= 0 && index < length()); | 1770 ASSERT(index >= 0 && index < length()); |
1771 WRITE_SHORT_FIELD(this, kHeaderSize + index * kShortSize, value); | 1771 WRITE_SHORT_FIELD(this, kHeaderSize + index * kShortSize, value); |
1772 } | 1772 } |
1773 | 1773 |
1774 | 1774 |
1775 int SeqTwoByteString::SeqTwoByteStringSize(InstanceType instance_type) { | 1775 int SeqTwoByteString::SeqTwoByteStringSize(InstanceType instance_type) { |
1776 uint32_t length = READ_INT_FIELD(this, kLengthOffset); | 1776 return SizeFor(length()); |
1777 return SizeFor(length); | |
1778 } | 1777 } |
1779 | 1778 |
1780 | 1779 |
1781 int SeqAsciiString::SeqAsciiStringSize(InstanceType instance_type) { | 1780 int SeqAsciiString::SeqAsciiStringSize(InstanceType instance_type) { |
1782 uint32_t length = READ_INT_FIELD(this, kLengthOffset); | 1781 return SizeFor(length()); |
1783 return SizeFor(length); | |
1784 } | 1782 } |
1785 | 1783 |
1786 | 1784 |
1787 String* ConsString::first() { | 1785 String* ConsString::first() { |
1788 return String::cast(READ_FIELD(this, kFirstOffset)); | 1786 return String::cast(READ_FIELD(this, kFirstOffset)); |
1789 } | 1787 } |
1790 | 1788 |
1791 | 1789 |
1792 Object* ConsString::unchecked_first() { | 1790 Object* ConsString::unchecked_first() { |
1793 return READ_FIELD(this, kFirstOffset); | 1791 return READ_FIELD(this, kFirstOffset); |
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3122 #undef WRITE_INT_FIELD | 3120 #undef WRITE_INT_FIELD |
3123 #undef READ_SHORT_FIELD | 3121 #undef READ_SHORT_FIELD |
3124 #undef WRITE_SHORT_FIELD | 3122 #undef WRITE_SHORT_FIELD |
3125 #undef READ_BYTE_FIELD | 3123 #undef READ_BYTE_FIELD |
3126 #undef WRITE_BYTE_FIELD | 3124 #undef WRITE_BYTE_FIELD |
3127 | 3125 |
3128 | 3126 |
3129 } } // namespace v8::internal | 3127 } } // namespace v8::internal |
3130 | 3128 |
3131 #endif // V8_OBJECTS_INL_H_ | 3129 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |