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 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1819 inline bool HasFixedArrayElements(); | 1819 inline bool HasFixedArrayElements(); |
1820 inline bool HasFixedInt8Elements(); | 1820 inline bool HasFixedInt8Elements(); |
1821 inline bool HasFixedUint8Elements(); | 1821 inline bool HasFixedUint8Elements(); |
1822 inline bool HasFixedInt16Elements(); | 1822 inline bool HasFixedInt16Elements(); |
1823 inline bool HasFixedUint16Elements(); | 1823 inline bool HasFixedUint16Elements(); |
1824 inline bool HasFixedInt32Elements(); | 1824 inline bool HasFixedInt32Elements(); |
1825 inline bool HasFixedUint32Elements(); | 1825 inline bool HasFixedUint32Elements(); |
1826 inline bool HasFixedFloat32Elements(); | 1826 inline bool HasFixedFloat32Elements(); |
1827 inline bool HasFixedFloat64Elements(); | 1827 inline bool HasFixedFloat64Elements(); |
1828 | 1828 |
1829 bool HasFastArgumentsElements(); | 1829 inline bool HasFastArgumentsElements(); |
1830 bool HasDictionaryArgumentsElements(); | 1830 inline bool HasSlowArgumentsElements(); |
1831 inline SeededNumberDictionary* element_dictionary(); // Gets slow elements. | 1831 inline SeededNumberDictionary* element_dictionary(); // Gets slow elements. |
1832 | 1832 |
1833 // Requires: HasFastElements(). | 1833 // Requires: HasFastElements(). |
1834 static Handle<FixedArray> EnsureWritableFastElements( | 1834 static Handle<FixedArray> EnsureWritableFastElements( |
1835 Handle<JSObject> object); | 1835 Handle<JSObject> object); |
1836 | 1836 |
1837 // Collects elements starting at index 0. | 1837 // Collects elements starting at index 0. |
1838 // Undefined values are placed after non-undefined values. | 1838 // Undefined values are placed after non-undefined values. |
1839 // Returns the number of non-undefined values. | 1839 // Returns the number of non-undefined values. |
1840 static Handle<Object> PrepareElementsForSort(Handle<JSObject> object, | 1840 static Handle<Object> PrepareElementsForSort(Handle<JSObject> object, |
(...skipping 3854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5695 | 5695 |
5696 inline bool has_fast_double_elements() { | 5696 inline bool has_fast_double_elements() { |
5697 return IsFastDoubleElementsKind(elements_kind()); | 5697 return IsFastDoubleElementsKind(elements_kind()); |
5698 } | 5698 } |
5699 | 5699 |
5700 inline bool has_fast_elements() { | 5700 inline bool has_fast_elements() { |
5701 return IsFastElementsKind(elements_kind()); | 5701 return IsFastElementsKind(elements_kind()); |
5702 } | 5702 } |
5703 | 5703 |
5704 inline bool has_sloppy_arguments_elements() { | 5704 inline bool has_sloppy_arguments_elements() { |
5705 return elements_kind() == SLOPPY_ARGUMENTS_ELEMENTS; | 5705 return IsSloppyArgumentsElements(elements_kind()); |
5706 } | 5706 } |
5707 | 5707 |
5708 inline bool has_external_array_elements() { | 5708 inline bool has_external_array_elements() { |
5709 return IsExternalArrayElementsKind(elements_kind()); | 5709 return IsExternalArrayElementsKind(elements_kind()); |
5710 } | 5710 } |
5711 | 5711 |
5712 inline bool has_fixed_typed_array_elements() { | 5712 inline bool has_fixed_typed_array_elements() { |
5713 return IsFixedTypedArrayElementsKind(elements_kind()); | 5713 return IsFixedTypedArrayElementsKind(elements_kind()); |
5714 } | 5714 } |
5715 | 5715 |
5716 inline bool has_dictionary_elements() { | 5716 inline bool has_dictionary_elements() { |
5717 return IsDictionaryElementsKind(elements_kind()); | 5717 return IsDictionaryElementsKind(elements_kind()); |
5718 } | 5718 } |
5719 | 5719 |
5720 inline bool has_slow_elements_kind() { | |
5721 return elements_kind() == DICTIONARY_ELEMENTS | |
5722 || elements_kind() == SLOPPY_ARGUMENTS_ELEMENTS; | |
5723 } | |
5724 | |
5725 static bool IsValidElementsTransition(ElementsKind from_kind, | 5720 static bool IsValidElementsTransition(ElementsKind from_kind, |
5726 ElementsKind to_kind); | 5721 ElementsKind to_kind); |
5727 | 5722 |
5728 // Returns true if the current map doesn't have DICTIONARY_ELEMENTS but if a | 5723 // Returns true if the current map doesn't have DICTIONARY_ELEMENTS but if a |
5729 // map with DICTIONARY_ELEMENTS was found in the prototype chain. | 5724 // map with DICTIONARY_ELEMENTS was found in the prototype chain. |
5730 bool DictionaryElementsInPrototypeChainOnly(); | 5725 bool DictionaryElementsInPrototypeChainOnly(); |
5731 | 5726 |
5732 inline Map* ElementsTransitionMap(); | 5727 inline Map* ElementsTransitionMap(); |
5733 | 5728 |
5734 inline FixedArrayBase* GetInitialElements(); | 5729 inline FixedArrayBase* GetInitialElements(); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6039 | 6034 |
6040 // Returns the map that this map transitions to if its elements_kind | 6035 // Returns the map that this map transitions to if its elements_kind |
6041 // is changed to |elements_kind|, or NULL if no such map is cached yet. | 6036 // is changed to |elements_kind|, or NULL if no such map is cached yet. |
6042 // |safe_to_add_transitions| is set to false if adding transitions is not | 6037 // |safe_to_add_transitions| is set to false if adding transitions is not |
6043 // allowed. | 6038 // allowed. |
6044 Map* LookupElementsTransitionMap(ElementsKind elements_kind); | 6039 Map* LookupElementsTransitionMap(ElementsKind elements_kind); |
6045 | 6040 |
6046 // Returns the transitioned map for this map with the most generic | 6041 // Returns the transitioned map for this map with the most generic |
6047 // elements_kind that's found in |candidates|, or null handle if no match is | 6042 // elements_kind that's found in |candidates|, or null handle if no match is |
6048 // found at all. | 6043 // found at all. |
6049 Handle<Map> FindTransitionedMap(MapHandleList* candidates); | 6044 static Handle<Map> FindTransitionedMap(Handle<Map> map, |
| 6045 MapHandleList* candidates); |
6050 | 6046 |
6051 bool CanTransition() { | 6047 bool CanTransition() { |
6052 // Only JSObject and subtypes have map transitions and back pointers. | 6048 // Only JSObject and subtypes have map transitions and back pointers. |
6053 STATIC_ASSERT(LAST_TYPE == LAST_JS_OBJECT_TYPE); | 6049 STATIC_ASSERT(LAST_TYPE == LAST_JS_OBJECT_TYPE); |
6054 return instance_type() >= FIRST_JS_OBJECT_TYPE; | 6050 return instance_type() >= FIRST_JS_OBJECT_TYPE; |
6055 } | 6051 } |
6056 | 6052 |
6057 bool IsJSObjectMap() { | 6053 bool IsJSObjectMap() { |
6058 return instance_type() >= FIRST_JS_OBJECT_TYPE; | 6054 return instance_type() >= FIRST_JS_OBJECT_TYPE; |
6059 } | 6055 } |
(...skipping 4757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10817 } else { | 10813 } else { |
10818 value &= ~(1 << bit_position); | 10814 value &= ~(1 << bit_position); |
10819 } | 10815 } |
10820 return value; | 10816 return value; |
10821 } | 10817 } |
10822 }; | 10818 }; |
10823 | 10819 |
10824 } } // namespace v8::internal | 10820 } } // namespace v8::internal |
10825 | 10821 |
10826 #endif // V8_OBJECTS_H_ | 10822 #endif // V8_OBJECTS_H_ |
OLD | NEW |