OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 2027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2038 inline bool HasFixedUint16Elements(); | 2038 inline bool HasFixedUint16Elements(); |
2039 inline bool HasFixedInt32Elements(); | 2039 inline bool HasFixedInt32Elements(); |
2040 inline bool HasFixedUint32Elements(); | 2040 inline bool HasFixedUint32Elements(); |
2041 inline bool HasFixedFloat32Elements(); | 2041 inline bool HasFixedFloat32Elements(); |
2042 inline bool HasFixedFloat64Elements(); | 2042 inline bool HasFixedFloat64Elements(); |
2043 | 2043 |
2044 inline bool HasFastArgumentsElements(); | 2044 inline bool HasFastArgumentsElements(); |
2045 inline bool HasSlowArgumentsElements(); | 2045 inline bool HasSlowArgumentsElements(); |
2046 inline bool HasFastStringWrapperElements(); | 2046 inline bool HasFastStringWrapperElements(); |
2047 inline bool HasSlowStringWrapperElements(); | 2047 inline bool HasSlowStringWrapperElements(); |
| 2048 bool HasEnumerableElements(); |
| 2049 |
2048 inline SeededNumberDictionary* element_dictionary(); // Gets slow elements. | 2050 inline SeededNumberDictionary* element_dictionary(); // Gets slow elements. |
2049 | 2051 |
2050 // Requires: HasFastElements(). | 2052 // Requires: HasFastElements(). |
2051 static Handle<FixedArray> EnsureWritableFastElements( | 2053 static Handle<FixedArray> EnsureWritableFastElements( |
2052 Handle<JSObject> object); | 2054 Handle<JSObject> object); |
2053 | 2055 |
2054 // Collects elements starting at index 0. | 2056 // Collects elements starting at index 0. |
2055 // Undefined values are placed after non-undefined values. | 2057 // Undefined values are placed after non-undefined values. |
2056 // Returns the number of non-undefined values. | 2058 // Returns the number of non-undefined values. |
2057 static Handle<Object> PrepareElementsForSort(Handle<JSObject> object, | 2059 static Handle<Object> PrepareElementsForSort(Handle<JSObject> object, |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2291 // with the specified attributes (ignoring interceptors). | 2293 // with the specified attributes (ignoring interceptors). |
2292 // TODO(jkummerow): Deprecated, only used by Object.observe. | 2294 // TODO(jkummerow): Deprecated, only used by Object.observe. |
2293 int GetOwnElementKeys(FixedArray* storage, PropertyFilter filter); | 2295 int GetOwnElementKeys(FixedArray* storage, PropertyFilter filter); |
2294 | 2296 |
2295 static void CollectOwnElementKeys(Handle<JSObject> object, | 2297 static void CollectOwnElementKeys(Handle<JSObject> object, |
2296 KeyAccumulator* keys, | 2298 KeyAccumulator* keys, |
2297 PropertyFilter filter); | 2299 PropertyFilter filter); |
2298 | 2300 |
2299 static Handle<FixedArray> GetEnumPropertyKeys(Handle<JSObject> object); | 2301 static Handle<FixedArray> GetEnumPropertyKeys(Handle<JSObject> object); |
2300 | 2302 |
| 2303 static Handle<FixedArray> GetFastEnumPropertyKeys(Isolate* isolate, |
| 2304 Handle<JSObject> object); |
| 2305 |
2301 // Returns a new map with all transitions dropped from the object's current | 2306 // Returns a new map with all transitions dropped from the object's current |
2302 // map and the ElementsKind set. | 2307 // map and the ElementsKind set. |
2303 static Handle<Map> GetElementsTransitionMap(Handle<JSObject> object, | 2308 static Handle<Map> GetElementsTransitionMap(Handle<JSObject> object, |
2304 ElementsKind to_kind); | 2309 ElementsKind to_kind); |
2305 static void TransitionElementsKind(Handle<JSObject> object, | 2310 static void TransitionElementsKind(Handle<JSObject> object, |
2306 ElementsKind to_kind); | 2311 ElementsKind to_kind); |
2307 | 2312 |
2308 // Always use this to migrate an object to a new map. | 2313 // Always use this to migrate an object to a new map. |
2309 // |expected_additional_properties| is only used for fast-to-slow transitions | 2314 // |expected_additional_properties| is only used for fast-to-slow transitions |
2310 // and ignored otherwise. | 2315 // and ignored otherwise. |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2887 // Generic array grows dynamically with O(1) amortized insertion. | 2892 // Generic array grows dynamically with O(1) amortized insertion. |
2888 class ArrayList : public FixedArray { | 2893 class ArrayList : public FixedArray { |
2889 public: | 2894 public: |
2890 enum AddMode { | 2895 enum AddMode { |
2891 kNone, | 2896 kNone, |
2892 // Use this if GC can delete elements from the array. | 2897 // Use this if GC can delete elements from the array. |
2893 kReloadLengthAfterAllocation, | 2898 kReloadLengthAfterAllocation, |
2894 }; | 2899 }; |
2895 static Handle<ArrayList> Add(Handle<ArrayList> array, Handle<Object> obj, | 2900 static Handle<ArrayList> Add(Handle<ArrayList> array, Handle<Object> obj, |
2896 AddMode mode = kNone); | 2901 AddMode mode = kNone); |
| 2902 static Handle<ArrayList> Add(Handle<ArrayList> array, Smi* smi, |
| 2903 AddMode mode = kNone); |
2897 static Handle<ArrayList> Add(Handle<ArrayList> array, Handle<Object> obj1, | 2904 static Handle<ArrayList> Add(Handle<ArrayList> array, Handle<Object> obj1, |
2898 Handle<Object> obj2, AddMode = kNone); | 2905 Handle<Object> obj2, AddMode = kNone); |
2899 inline int Length(); | 2906 inline int Length(); |
2900 inline void SetLength(int length); | 2907 inline void SetLength(int length); |
2901 inline Object* Get(int index); | 2908 inline Object* Get(int index); |
2902 inline Object** Slot(int index); | 2909 inline Object** Slot(int index); |
2903 inline void Set(int index, Object* obj); | 2910 inline void Set(int index, Object* obj); |
2904 inline void Clear(int index, Object* undefined); | 2911 inline void Clear(int index, Object* undefined); |
2905 bool IsFull(); | 2912 bool IsFull(); |
2906 DECLARE_CAST(ArrayList) | 2913 DECLARE_CAST(ArrayList) |
(...skipping 7941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10848 } | 10855 } |
10849 return value; | 10856 return value; |
10850 } | 10857 } |
10851 }; | 10858 }; |
10852 | 10859 |
10853 | 10860 |
10854 } // NOLINT, false-positive due to second-order macros. | 10861 } // NOLINT, false-positive due to second-order macros. |
10855 } // NOLINT, false-positive due to second-order macros. | 10862 } // NOLINT, false-positive due to second-order macros. |
10856 | 10863 |
10857 #endif // V8_OBJECTS_H_ | 10864 #endif // V8_OBJECTS_H_ |
OLD | NEW |