| 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 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1803 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array()); | 1803 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array()); |
| 1804 } | 1804 } |
| 1805 | 1805 |
| 1806 | 1806 |
| 1807 void JSObject::initialize_elements() { | 1807 void JSObject::initialize_elements() { |
| 1808 FixedArrayBase* elements = map()->GetInitialElements(); | 1808 FixedArrayBase* elements = map()->GetInitialElements(); |
| 1809 WRITE_FIELD(this, kElementsOffset, elements); | 1809 WRITE_FIELD(this, kElementsOffset, elements); |
| 1810 } | 1810 } |
| 1811 | 1811 |
| 1812 | 1812 |
| 1813 Handle<String> JSObject::ExpectedTransitionKey(Handle<Map> map) { | 1813 Handle<String> Map::ExpectedTransitionKey(Handle<Map> map) { |
| 1814 DisallowHeapAllocation no_gc; | 1814 DisallowHeapAllocation no_gc; |
| 1815 if (!map->HasTransitionArray()) return Handle<String>::null(); | 1815 if (!map->HasTransitionArray()) return Handle<String>::null(); |
| 1816 TransitionArray* transitions = map->transitions(); | 1816 TransitionArray* transitions = map->transitions(); |
| 1817 if (!transitions->IsSimpleTransition()) return Handle<String>::null(); | 1817 if (!transitions->IsSimpleTransition()) return Handle<String>::null(); |
| 1818 int transition = TransitionArray::kSimpleTransitionIndex; | 1818 int transition = TransitionArray::kSimpleTransitionIndex; |
| 1819 PropertyDetails details = transitions->GetTargetDetails(transition); | 1819 PropertyDetails details = transitions->GetTargetDetails(transition); |
| 1820 Name* name = transitions->GetKey(transition); | 1820 Name* name = transitions->GetKey(transition); |
| 1821 if (details.type() != FIELD) return Handle<String>::null(); | 1821 if (details.type() != FIELD) return Handle<String>::null(); |
| 1822 if (details.attributes() != NONE) return Handle<String>::null(); | 1822 if (details.attributes() != NONE) return Handle<String>::null(); |
| 1823 if (!name->IsString()) return Handle<String>::null(); | 1823 if (!name->IsString()) return Handle<String>::null(); |
| 1824 return Handle<String>(String::cast(name)); | 1824 return Handle<String>(String::cast(name)); |
| 1825 } | 1825 } |
| 1826 | 1826 |
| 1827 | 1827 |
| 1828 Handle<Map> JSObject::ExpectedTransitionTarget(Handle<Map> map) { | 1828 Handle<Map> Map::ExpectedTransitionTarget(Handle<Map> map) { |
| 1829 ASSERT(!ExpectedTransitionKey(map).is_null()); | 1829 ASSERT(!ExpectedTransitionKey(map).is_null()); |
| 1830 return Handle<Map>(map->transitions()->GetTarget( | 1830 return Handle<Map>(map->transitions()->GetTarget( |
| 1831 TransitionArray::kSimpleTransitionIndex)); | 1831 TransitionArray::kSimpleTransitionIndex)); |
| 1832 } | 1832 } |
| 1833 | 1833 |
| 1834 | 1834 |
| 1835 Handle<Map> JSObject::FindTransitionToField(Handle<Map> map, Handle<Name> key) { | 1835 Handle<Map> Map::FindTransitionToField(Handle<Map> map, Handle<Name> key) { |
| 1836 DisallowHeapAllocation no_allocation; | 1836 DisallowHeapAllocation no_allocation; |
| 1837 if (!map->HasTransitionArray()) return Handle<Map>::null(); | 1837 if (!map->HasTransitionArray()) return Handle<Map>::null(); |
| 1838 TransitionArray* transitions = map->transitions(); | 1838 TransitionArray* transitions = map->transitions(); |
| 1839 int transition = transitions->Search(*key); | 1839 int transition = transitions->Search(*key); |
| 1840 if (transition == TransitionArray::kNotFound) return Handle<Map>::null(); | 1840 if (transition == TransitionArray::kNotFound) return Handle<Map>::null(); |
| 1841 PropertyDetails target_details = transitions->GetTargetDetails(transition); | 1841 PropertyDetails target_details = transitions->GetTargetDetails(transition); |
| 1842 if (target_details.type() != FIELD) return Handle<Map>::null(); | 1842 if (target_details.type() != FIELD) return Handle<Map>::null(); |
| 1843 if (target_details.attributes() != NONE) return Handle<Map>::null(); | 1843 if (target_details.attributes() != NONE) return Handle<Map>::null(); |
| 1844 return Handle<Map>(transitions->GetTarget(transition)); | 1844 return Handle<Map>(transitions->GetTarget(transition)); |
| 1845 } | 1845 } |
| (...skipping 5178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7024 #undef READ_SHORT_FIELD | 7024 #undef READ_SHORT_FIELD |
| 7025 #undef WRITE_SHORT_FIELD | 7025 #undef WRITE_SHORT_FIELD |
| 7026 #undef READ_BYTE_FIELD | 7026 #undef READ_BYTE_FIELD |
| 7027 #undef WRITE_BYTE_FIELD | 7027 #undef WRITE_BYTE_FIELD |
| 7028 #undef NOBARRIER_READ_BYTE_FIELD | 7028 #undef NOBARRIER_READ_BYTE_FIELD |
| 7029 #undef NOBARRIER_WRITE_BYTE_FIELD | 7029 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7030 | 7030 |
| 7031 } } // namespace v8::internal | 7031 } } // namespace v8::internal |
| 7032 | 7032 |
| 7033 #endif // V8_OBJECTS_INL_H_ | 7033 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |