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 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1899 EnsureElementsMode mode); | 1899 EnsureElementsMode mode); |
1900 static void EnsureCanContainElements( | 1900 static void EnsureCanContainElements( |
1901 Handle<JSObject> object, | 1901 Handle<JSObject> object, |
1902 Arguments* arguments, | 1902 Arguments* arguments, |
1903 uint32_t first_arg, | 1903 uint32_t first_arg, |
1904 uint32_t arg_count, | 1904 uint32_t arg_count, |
1905 EnsureElementsMode mode); | 1905 EnsureElementsMode mode); |
1906 | 1906 |
1907 // Would we convert a fast elements array to dictionary mode given | 1907 // Would we convert a fast elements array to dictionary mode given |
1908 // an access at key? | 1908 // an access at key? |
1909 bool WouldConvertToSlowElements(uint32_t index); | 1909 bool WouldConvertToSlowElements(Handle<Object> key); |
1910 inline bool WouldConvertToSlowElements(Handle<Object> key); | |
1911 // Do we want to keep the elements in fast case when increasing the | 1910 // Do we want to keep the elements in fast case when increasing the |
1912 // capacity? | 1911 // capacity? |
1913 bool ShouldConvertToSlowElements(int new_capacity); | 1912 bool ShouldConvertToSlowElements(int new_capacity); |
1914 // Returns true if the backing storage for the slow-case elements of | 1913 // Returns true if the backing storage for the slow-case elements of |
1915 // this object takes up nearly as much space as a fast-case backing | 1914 // this object takes up nearly as much space as a fast-case backing |
1916 // storage would. In that case the JSObject should have fast | 1915 // storage would. In that case the JSObject should have fast |
1917 // elements. | 1916 // elements. |
1918 bool ShouldConvertToFastElements(); | 1917 bool ShouldConvertToFastElements(); |
1919 // Returns true if the elements of JSObject contains only values that can be | 1918 // Returns true if the elements of JSObject contains only values that can be |
1920 // represented in a FixedDoubleArray and has at least one value that can only | 1919 // represented in a FixedDoubleArray and has at least one value that can only |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1960 Handle<JSObject> object, | 1959 Handle<JSObject> object, |
1961 Handle<Object> receiver, | 1960 Handle<Object> receiver, |
1962 uint32_t index); | 1961 uint32_t index); |
1963 | 1962 |
1964 enum SetFastElementsCapacitySmiMode { | 1963 enum SetFastElementsCapacitySmiMode { |
1965 kAllowSmiElements, | 1964 kAllowSmiElements, |
1966 kForceSmiElements, | 1965 kForceSmiElements, |
1967 kDontAllowSmiElements | 1966 kDontAllowSmiElements |
1968 }; | 1967 }; |
1969 | 1968 |
1970 static Handle<FixedArray> SetFastElementsCapacity( | |
1971 Handle<JSObject> object, int capacity, | |
1972 SetFastElementsCapacitySmiMode smi_mode); | |
1973 static Handle<FixedArrayBase> SetFastDoubleElementsCapacity( | |
1974 Handle<JSObject> object, int capacity); | |
1975 | |
1976 // Replace the elements' backing store with fast elements of the given | 1969 // Replace the elements' backing store with fast elements of the given |
1977 // capacity. Update the length for JSArrays. Returns the new backing | 1970 // capacity. Update the length for JSArrays. Returns the new backing |
1978 // store. | 1971 // store. |
1979 static Handle<FixedArray> SetFastElementsCapacityAndLength( | 1972 static Handle<FixedArray> SetFastElementsCapacityAndLength( |
1980 Handle<JSObject> object, | 1973 Handle<JSObject> object, |
1981 int capacity, | 1974 int capacity, |
1982 int length, | 1975 int length, |
1983 SetFastElementsCapacitySmiMode smi_mode); | 1976 SetFastElementsCapacitySmiMode smi_mode); |
1984 static Handle<FixedArrayBase> SetFastDoubleElementsCapacityAndLength( | 1977 static void SetFastDoubleElementsCapacityAndLength( |
1985 Handle<JSObject> object, int capacity, int length); | 1978 Handle<JSObject> object, |
| 1979 int capacity, |
| 1980 int length); |
1986 | 1981 |
1987 // Lookup interceptors are used for handling properties controlled by host | 1982 // Lookup interceptors are used for handling properties controlled by host |
1988 // objects. | 1983 // objects. |
1989 inline bool HasNamedInterceptor(); | 1984 inline bool HasNamedInterceptor(); |
1990 inline bool HasIndexedInterceptor(); | 1985 inline bool HasIndexedInterceptor(); |
1991 | 1986 |
1992 // Computes the enumerable keys from interceptors. Used for debug mirrors and | 1987 // Computes the enumerable keys from interceptors. Used for debug mirrors and |
1993 // by JSReceiver::GetKeys. | 1988 // by JSReceiver::GetKeys. |
1994 MUST_USE_RESULT static MaybeHandle<JSObject> GetKeysForNamedInterceptor( | 1989 MUST_USE_RESULT static MaybeHandle<JSObject> GetKeysForNamedInterceptor( |
1995 Handle<JSObject> object, | 1990 Handle<JSObject> object, |
(...skipping 8978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10974 } else { | 10969 } else { |
10975 value &= ~(1 << bit_position); | 10970 value &= ~(1 << bit_position); |
10976 } | 10971 } |
10977 return value; | 10972 return value; |
10978 } | 10973 } |
10979 }; | 10974 }; |
10980 | 10975 |
10981 } } // namespace v8::internal | 10976 } } // namespace v8::internal |
10982 | 10977 |
10983 #endif // V8_OBJECTS_H_ | 10978 #endif // V8_OBJECTS_H_ |
OLD | NEW |