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 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 Handle<Object> object, Handle<Name> key, Handle<Object> value, | 1124 Handle<Object> object, Handle<Name> key, Handle<Object> value, |
1125 StrictMode strict_mode, | 1125 StrictMode strict_mode, |
1126 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); | 1126 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); |
1127 | 1127 |
1128 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( | 1128 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( |
1129 LookupIterator* it, Handle<Object> value, StrictMode strict_mode, | 1129 LookupIterator* it, Handle<Object> value, StrictMode strict_mode, |
1130 StoreFromKeyed store_mode, | 1130 StoreFromKeyed store_mode, |
1131 StorePropertyMode data_store_mode = NORMAL_PROPERTY); | 1131 StorePropertyMode data_store_mode = NORMAL_PROPERTY); |
1132 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyProperty( | 1132 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyProperty( |
1133 LookupIterator* it, Handle<Object> value, StrictMode strict_mode); | 1133 LookupIterator* it, Handle<Object> value, StrictMode strict_mode); |
| 1134 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyElement( |
| 1135 Isolate* isolate, Handle<Object> receiver, uint32_t index, |
| 1136 Handle<Object> value, StrictMode strict_mode); |
1134 MUST_USE_RESULT static MaybeHandle<Object> SetDataProperty( | 1137 MUST_USE_RESULT static MaybeHandle<Object> SetDataProperty( |
1135 LookupIterator* it, Handle<Object> value); | 1138 LookupIterator* it, Handle<Object> value); |
1136 MUST_USE_RESULT static MaybeHandle<Object> AddDataProperty( | 1139 MUST_USE_RESULT static MaybeHandle<Object> AddDataProperty( |
1137 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, | 1140 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, |
1138 StrictMode strict_mode, StoreFromKeyed store_mode); | 1141 StrictMode strict_mode, StoreFromKeyed store_mode); |
1139 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( | 1142 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( |
1140 Handle<Object> object, | 1143 Handle<Object> object, |
1141 Handle<Name> key); | 1144 Handle<Name> key); |
1142 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( | 1145 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( |
1143 Isolate* isolate, | 1146 Isolate* isolate, |
(...skipping 25 matching lines...) Expand all Loading... |
1169 Isolate* isolate, | 1172 Isolate* isolate, |
1170 Handle<Object> object, | 1173 Handle<Object> object, |
1171 uint32_t index); | 1174 uint32_t index); |
1172 | 1175 |
1173 MUST_USE_RESULT static MaybeHandle<Object> GetElementWithReceiver( | 1176 MUST_USE_RESULT static MaybeHandle<Object> GetElementWithReceiver( |
1174 Isolate* isolate, | 1177 Isolate* isolate, |
1175 Handle<Object> object, | 1178 Handle<Object> object, |
1176 Handle<Object> receiver, | 1179 Handle<Object> receiver, |
1177 uint32_t index); | 1180 uint32_t index); |
1178 | 1181 |
| 1182 MUST_USE_RESULT static MaybeHandle<Object> SetElementWithReceiver( |
| 1183 Isolate* isolate, Handle<Object> object, Handle<Object> receiver, |
| 1184 uint32_t index, Handle<Object> value, StrictMode strict_mode); |
| 1185 |
1179 static inline Handle<Object> GetPrototypeSkipHiddenPrototypes( | 1186 static inline Handle<Object> GetPrototypeSkipHiddenPrototypes( |
1180 Isolate* isolate, Handle<Object> receiver); | 1187 Isolate* isolate, Handle<Object> receiver); |
1181 | 1188 |
1182 // Returns the permanent hash code associated with this object. May return | 1189 // Returns the permanent hash code associated with this object. May return |
1183 // undefined if not yet created. | 1190 // undefined if not yet created. |
1184 Object* GetHash(); | 1191 Object* GetHash(); |
1185 | 1192 |
1186 // Returns the permanent hash code associated with this object depending on | 1193 // Returns the permanent hash code associated with this object depending on |
1187 // the actual object type. May create and store a hash code if needed and none | 1194 // the actual object type. May create and store a hash code if needed and none |
1188 // exists. | 1195 // exists. |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1920 bool ShouldConvertToFastDoubleElements(bool* has_smi_only_elements); | 1927 bool ShouldConvertToFastDoubleElements(bool* has_smi_only_elements); |
1921 | 1928 |
1922 // Computes the new capacity when expanding the elements of a JSObject. | 1929 // Computes the new capacity when expanding the elements of a JSObject. |
1923 static int NewElementsCapacity(int old_capacity) { | 1930 static int NewElementsCapacity(int old_capacity) { |
1924 // (old_capacity + 50%) + 16 | 1931 // (old_capacity + 50%) + 16 |
1925 return old_capacity + (old_capacity >> 1) + 16; | 1932 return old_capacity + (old_capacity >> 1) + 16; |
1926 } | 1933 } |
1927 | 1934 |
1928 // These methods do not perform access checks! | 1935 // These methods do not perform access checks! |
1929 MUST_USE_RESULT static MaybeHandle<AccessorPair> GetOwnElementAccessorPair( | 1936 MUST_USE_RESULT static MaybeHandle<AccessorPair> GetOwnElementAccessorPair( |
1930 Handle<JSObject> object, | 1937 Handle<JSObject> object, uint32_t index); |
1931 uint32_t index); | |
1932 | 1938 |
1933 MUST_USE_RESULT static MaybeHandle<Object> SetFastElement( | 1939 MUST_USE_RESULT static MaybeHandle<Object> SetFastElement( |
1934 Handle<JSObject> object, | 1940 Handle<JSObject> object, |
1935 uint32_t index, | 1941 uint32_t index, |
1936 Handle<Object> value, | 1942 Handle<Object> value, |
1937 StrictMode strict_mode, | 1943 StrictMode strict_mode, |
1938 bool check_prototype); | 1944 bool check_prototype); |
1939 | 1945 |
1940 MUST_USE_RESULT static MaybeHandle<Object> SetOwnElement( | 1946 MUST_USE_RESULT static MaybeHandle<Object> SetOwnElement( |
1941 Handle<JSObject> object, | 1947 Handle<JSObject> object, |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2246 Handle<JSObject> object, | 2252 Handle<JSObject> object, |
2247 Handle<Object> receiver, | 2253 Handle<Object> receiver, |
2248 Handle<Object> structure, | 2254 Handle<Object> structure, |
2249 uint32_t index, | 2255 uint32_t index, |
2250 Handle<Object> holder); | 2256 Handle<Object> holder); |
2251 | 2257 |
2252 MUST_USE_RESULT static Maybe<PropertyAttributes> | 2258 MUST_USE_RESULT static Maybe<PropertyAttributes> |
2253 GetElementAttributeWithInterceptor(Handle<JSObject> object, | 2259 GetElementAttributeWithInterceptor(Handle<JSObject> object, |
2254 Handle<JSReceiver> receiver, | 2260 Handle<JSReceiver> receiver, |
2255 uint32_t index, bool continue_search); | 2261 uint32_t index, bool continue_search); |
| 2262 |
| 2263 // Queries indexed interceptor on an object for property attributes. |
| 2264 // |
| 2265 // We determine property attributes as follows: |
| 2266 // - if interceptor has a query callback, then the property attributes are |
| 2267 // the result of query callback for index. |
| 2268 // - otherwise if interceptor has a getter callback and it returns |
| 2269 // non-empty value on index, then the property attributes is NONE |
| 2270 // (property is present, and it is enumerable, configurable, writable) |
| 2271 // - otherwise there are no property attributes that can be inferred for |
| 2272 // interceptor, and this function returns ABSENT. |
| 2273 MUST_USE_RESULT static Maybe<PropertyAttributes> |
| 2274 GetElementAttributeFromInterceptor(Handle<JSObject> object, |
| 2275 Handle<Object> receiver, |
| 2276 uint32_t index); |
| 2277 |
2256 MUST_USE_RESULT static Maybe<PropertyAttributes> | 2278 MUST_USE_RESULT static Maybe<PropertyAttributes> |
2257 GetElementAttributeWithoutInterceptor(Handle<JSObject> object, | 2279 GetElementAttributeWithoutInterceptor(Handle<JSObject> object, |
2258 Handle<JSReceiver> receiver, | 2280 Handle<JSReceiver> receiver, |
2259 uint32_t index, | 2281 uint32_t index, |
2260 bool continue_search); | 2282 bool continue_search); |
2261 MUST_USE_RESULT static MaybeHandle<Object> SetElementWithCallback( | 2283 MUST_USE_RESULT static MaybeHandle<Object> SetElementWithCallback( |
2262 Handle<JSObject> object, | 2284 Handle<Object> object, Handle<Object> structure, uint32_t index, |
2263 Handle<Object> structure, | 2285 Handle<Object> value, Handle<JSObject> holder, StrictMode strict_mode); |
2264 uint32_t index, | |
2265 Handle<Object> value, | |
2266 Handle<JSObject> holder, | |
2267 StrictMode strict_mode); | |
2268 MUST_USE_RESULT static MaybeHandle<Object> SetElementWithInterceptor( | 2286 MUST_USE_RESULT static MaybeHandle<Object> SetElementWithInterceptor( |
2269 Handle<JSObject> object, | 2287 Handle<JSObject> object, |
2270 uint32_t index, | 2288 uint32_t index, |
2271 Handle<Object> value, | 2289 Handle<Object> value, |
2272 PropertyAttributes attributes, | 2290 PropertyAttributes attributes, |
2273 StrictMode strict_mode, | 2291 StrictMode strict_mode, |
2274 bool check_prototype, | 2292 bool check_prototype, |
2275 SetPropertyMode set_mode); | 2293 SetPropertyMode set_mode); |
2276 MUST_USE_RESULT static MaybeHandle<Object> SetElementWithoutInterceptor( | 2294 MUST_USE_RESULT static MaybeHandle<Object> SetElementWithoutInterceptor( |
2277 Handle<JSObject> object, | 2295 Handle<JSObject> object, |
(...skipping 8621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10899 } else { | 10917 } else { |
10900 value &= ~(1 << bit_position); | 10918 value &= ~(1 << bit_position); |
10901 } | 10919 } |
10902 return value; | 10920 return value; |
10903 } | 10921 } |
10904 }; | 10922 }; |
10905 | 10923 |
10906 } } // namespace v8::internal | 10924 } } // namespace v8::internal |
10907 | 10925 |
10908 #endif // V8_OBJECTS_H_ | 10926 #endif // V8_OBJECTS_H_ |
OLD | NEW |