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 1924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1935 EnsureElementsMode mode); | 1935 EnsureElementsMode mode); |
1936 static void EnsureCanContainElements( | 1936 static void EnsureCanContainElements( |
1937 Handle<JSObject> object, | 1937 Handle<JSObject> object, |
1938 Arguments* arguments, | 1938 Arguments* arguments, |
1939 uint32_t first_arg, | 1939 uint32_t first_arg, |
1940 uint32_t arg_count, | 1940 uint32_t arg_count, |
1941 EnsureElementsMode mode); | 1941 EnsureElementsMode mode); |
1942 | 1942 |
1943 // Would we convert a fast elements array to dictionary mode given | 1943 // Would we convert a fast elements array to dictionary mode given |
1944 // an access at key? | 1944 // an access at key? |
1945 bool WouldConvertToSlowElements(Handle<Object> key); | 1945 bool WouldConvertToSlowElements(uint32_t index); |
| 1946 inline bool WouldConvertToSlowElements(Handle<Object> key); |
1946 // Do we want to keep the elements in fast case when increasing the | 1947 // Do we want to keep the elements in fast case when increasing the |
1947 // capacity? | 1948 // capacity? |
1948 bool ShouldConvertToSlowElements(int new_capacity); | 1949 bool ShouldConvertToSlowElements(int new_capacity); |
1949 // Returns true if the backing storage for the slow-case elements of | 1950 // Returns true if the backing storage for the slow-case elements of |
1950 // this object takes up nearly as much space as a fast-case backing | 1951 // this object takes up nearly as much space as a fast-case backing |
1951 // storage would. In that case the JSObject should have fast | 1952 // storage would. In that case the JSObject should have fast |
1952 // elements. | 1953 // elements. |
1953 bool ShouldConvertToFastElements(); | 1954 bool ShouldConvertToFastElements(); |
1954 // Returns true if the elements of JSObject contains only values that can be | 1955 // Returns true if the elements of JSObject contains only values that can be |
1955 // represented in a FixedDoubleArray and has at least one value that can only | 1956 // represented in a FixedDoubleArray and has at least one value that can only |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1989 MUST_USE_RESULT static MaybeHandle<Object> GetElementWithInterceptor( | 1990 MUST_USE_RESULT static MaybeHandle<Object> GetElementWithInterceptor( |
1990 Handle<JSObject> object, Handle<Object> receiver, uint32_t index, | 1991 Handle<JSObject> object, Handle<Object> receiver, uint32_t index, |
1991 bool check_prototype); | 1992 bool check_prototype); |
1992 | 1993 |
1993 enum SetFastElementsCapacitySmiMode { | 1994 enum SetFastElementsCapacitySmiMode { |
1994 kAllowSmiElements, | 1995 kAllowSmiElements, |
1995 kForceSmiElements, | 1996 kForceSmiElements, |
1996 kDontAllowSmiElements | 1997 kDontAllowSmiElements |
1997 }; | 1998 }; |
1998 | 1999 |
| 2000 static Handle<FixedArray> SetFastElementsCapacity( |
| 2001 Handle<JSObject> object, int capacity, |
| 2002 SetFastElementsCapacitySmiMode smi_mode); |
| 2003 static Handle<FixedArrayBase> SetFastDoubleElementsCapacity( |
| 2004 Handle<JSObject> object, int capacity); |
| 2005 |
1999 // Replace the elements' backing store with fast elements of the given | 2006 // Replace the elements' backing store with fast elements of the given |
2000 // capacity. Update the length for JSArrays. Returns the new backing | 2007 // capacity. Update the length for JSArrays. Returns the new backing |
2001 // store. | 2008 // store. |
2002 static Handle<FixedArray> SetFastElementsCapacityAndLength( | 2009 static Handle<FixedArray> SetFastElementsCapacityAndLength( |
2003 Handle<JSObject> object, | 2010 Handle<JSObject> object, |
2004 int capacity, | 2011 int capacity, |
2005 int length, | 2012 int length, |
2006 SetFastElementsCapacitySmiMode smi_mode); | 2013 SetFastElementsCapacitySmiMode smi_mode); |
2007 static void SetFastDoubleElementsCapacityAndLength( | 2014 static Handle<FixedArrayBase> SetFastDoubleElementsCapacityAndLength( |
2008 Handle<JSObject> object, | 2015 Handle<JSObject> object, int capacity, int length); |
2009 int capacity, | |
2010 int length); | |
2011 | 2016 |
2012 // Lookup interceptors are used for handling properties controlled by host | 2017 // Lookup interceptors are used for handling properties controlled by host |
2013 // objects. | 2018 // objects. |
2014 inline bool HasNamedInterceptor(); | 2019 inline bool HasNamedInterceptor(); |
2015 inline bool HasIndexedInterceptor(); | 2020 inline bool HasIndexedInterceptor(); |
2016 | 2021 |
2017 // Computes the enumerable keys from interceptors. Used for debug mirrors and | 2022 // Computes the enumerable keys from interceptors. Used for debug mirrors and |
2018 // by JSReceiver::GetKeys. | 2023 // by JSReceiver::GetKeys. |
2019 MUST_USE_RESULT static MaybeHandle<JSObject> GetKeysForNamedInterceptor( | 2024 MUST_USE_RESULT static MaybeHandle<JSObject> GetKeysForNamedInterceptor( |
2020 Handle<JSObject> object, | 2025 Handle<JSObject> object, |
(...skipping 9083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11104 } else { | 11109 } else { |
11105 value &= ~(1 << bit_position); | 11110 value &= ~(1 << bit_position); |
11106 } | 11111 } |
11107 return value; | 11112 return value; |
11108 } | 11113 } |
11109 }; | 11114 }; |
11110 | 11115 |
11111 } } // namespace v8::internal | 11116 } } // namespace v8::internal |
11112 | 11117 |
11113 #endif // V8_OBJECTS_H_ | 11118 #endif // V8_OBJECTS_H_ |
OLD | NEW |