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