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 SMI_ACCESSORS(String, length, kLengthOffset) | 1654 INT_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 return SizeFor(length()); | 1776 uint32_t length = READ_INT_FIELD(this, kLengthOffset); |
| 1777 return SizeFor(length); |
1777 } | 1778 } |
1778 | 1779 |
1779 | 1780 |
1780 int SeqAsciiString::SeqAsciiStringSize(InstanceType instance_type) { | 1781 int SeqAsciiString::SeqAsciiStringSize(InstanceType instance_type) { |
1781 return SizeFor(length()); | 1782 uint32_t length = READ_INT_FIELD(this, kLengthOffset); |
| 1783 return SizeFor(length); |
1782 } | 1784 } |
1783 | 1785 |
1784 | 1786 |
1785 String* ConsString::first() { | 1787 String* ConsString::first() { |
1786 return String::cast(READ_FIELD(this, kFirstOffset)); | 1788 return String::cast(READ_FIELD(this, kFirstOffset)); |
1787 } | 1789 } |
1788 | 1790 |
1789 | 1791 |
1790 Object* ConsString::unchecked_first() { | 1792 Object* ConsString::unchecked_first() { |
1791 return READ_FIELD(this, kFirstOffset); | 1793 return READ_FIELD(this, kFirstOffset); |
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3102 #undef WRITE_INT_FIELD | 3104 #undef WRITE_INT_FIELD |
3103 #undef READ_SHORT_FIELD | 3105 #undef READ_SHORT_FIELD |
3104 #undef WRITE_SHORT_FIELD | 3106 #undef WRITE_SHORT_FIELD |
3105 #undef READ_BYTE_FIELD | 3107 #undef READ_BYTE_FIELD |
3106 #undef WRITE_BYTE_FIELD | 3108 #undef WRITE_BYTE_FIELD |
3107 | 3109 |
3108 | 3110 |
3109 } } // namespace v8::internal | 3111 } } // namespace v8::internal |
3110 | 3112 |
3111 #endif // V8_OBJECTS_INL_H_ | 3113 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |