| 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 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL) | 1026 HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL) |
| 1027 #undef IS_TYPE_FUNCTION_DECL | 1027 #undef IS_TYPE_FUNCTION_DECL |
| 1028 | 1028 |
| 1029 // A non-keyed store is of the form a.x = foo or a["x"] = foo whereas | 1029 // A non-keyed store is of the form a.x = foo or a["x"] = foo whereas |
| 1030 // a keyed store is of the form a[expression] = foo. | 1030 // a keyed store is of the form a[expression] = foo. |
| 1031 enum StoreFromKeyed { | 1031 enum StoreFromKeyed { |
| 1032 MAY_BE_STORE_FROM_KEYED, | 1032 MAY_BE_STORE_FROM_KEYED, |
| 1033 CERTAINLY_NOT_STORE_FROM_KEYED | 1033 CERTAINLY_NOT_STORE_FROM_KEYED |
| 1034 }; | 1034 }; |
| 1035 | 1035 |
| 1036 enum ShouldThrow { THROW_ON_ERROR, DONT_THROW }; |
| 1037 |
| 1038 #define RETURN_FAILURE(isolate, should_throw, call) \ |
| 1039 do { \ |
| 1040 if ((should_throw) == DONT_THROW) { \ |
| 1041 return Just(false); \ |
| 1042 } else { \ |
| 1043 isolate->Throw(*isolate->factory()->call); \ |
| 1044 return Nothing<bool>(); \ |
| 1045 } \ |
| 1046 } while (false) |
| 1047 |
| 1048 #define MAYBE_RETURN(call, value) \ |
| 1049 do { \ |
| 1050 if ((call).IsNothing()) return value; \ |
| 1051 } while (false) |
| 1052 |
| 1053 #define MAYBE_RETURN_NULL(call) MAYBE_RETURN(call, MaybeHandle<Object>()) |
| 1054 |
| 1036 INLINE(bool IsFixedArrayBase() const); | 1055 INLINE(bool IsFixedArrayBase() const); |
| 1037 INLINE(bool IsExternal() const); | 1056 INLINE(bool IsExternal() const); |
| 1038 INLINE(bool IsAccessorInfo() const); | 1057 INLINE(bool IsAccessorInfo() const); |
| 1039 | 1058 |
| 1040 INLINE(bool IsStruct() const); | 1059 INLINE(bool IsStruct() const); |
| 1041 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) \ | 1060 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) \ |
| 1042 INLINE(bool Is##Name() const); | 1061 INLINE(bool Is##Name() const); |
| 1043 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) | 1062 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) |
| 1044 #undef DECLARE_STRUCT_PREDICATE | 1063 #undef DECLARE_STRUCT_PREDICATE |
| 1045 | 1064 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 MUST_USE_RESULT static MaybeHandle<Object> BitwiseOr( | 1231 MUST_USE_RESULT static MaybeHandle<Object> BitwiseOr( |
| 1213 Isolate* isolate, Handle<Object> lhs, Handle<Object> rhs, | 1232 Isolate* isolate, Handle<Object> lhs, Handle<Object> rhs, |
| 1214 Strength strength = Strength::WEAK); | 1233 Strength strength = Strength::WEAK); |
| 1215 MUST_USE_RESULT static MaybeHandle<Object> BitwiseXor( | 1234 MUST_USE_RESULT static MaybeHandle<Object> BitwiseXor( |
| 1216 Isolate* isolate, Handle<Object> lhs, Handle<Object> rhs, | 1235 Isolate* isolate, Handle<Object> lhs, Handle<Object> rhs, |
| 1217 Strength strength = Strength::WEAK); | 1236 Strength strength = Strength::WEAK); |
| 1218 | 1237 |
| 1219 MUST_USE_RESULT static MaybeHandle<Object> GetProperty( | 1238 MUST_USE_RESULT static MaybeHandle<Object> GetProperty( |
| 1220 LookupIterator* it, LanguageMode language_mode = SLOPPY); | 1239 LookupIterator* it, LanguageMode language_mode = SLOPPY); |
| 1221 | 1240 |
| 1222 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5. | 1241 // ES6 [[Set]] (when passed DONT_THROW) |
| 1242 // Invariants for this and related functions (unless stated otherwise): |
| 1243 // 1) When the result is Nothing, an exception is pending. |
| 1244 // 2) When passed THROW_ON_ERROR, the result is never Just(false). |
| 1245 // In some cases, an exception is thrown regardless of the ShouldThrow |
| 1246 // argument. These cases are either in accordance with the spec or not |
| 1247 // covered by it (eg., concerning API callbacks). |
| 1248 MUST_USE_RESULT static Maybe<bool> SetProperty(LookupIterator* it, |
| 1249 Handle<Object> value, |
| 1250 LanguageMode language_mode, |
| 1251 ShouldThrow should_throw, |
| 1252 StoreFromKeyed store_mode); |
| 1223 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( | 1253 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( |
| 1224 Handle<Object> object, Handle<Name> name, Handle<Object> value, | 1254 Handle<Object> object, Handle<Name> name, Handle<Object> value, |
| 1225 LanguageMode language_mode, | 1255 LanguageMode language_mode, |
| 1226 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); | 1256 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); |
| 1227 | |
| 1228 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( | 1257 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( |
| 1229 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, | 1258 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, |
| 1230 StoreFromKeyed store_mode); | 1259 StoreFromKeyed store_mode); |
| 1231 | 1260 |
| 1232 MUST_USE_RESULT static MaybeHandle<Object> SetSuperProperty( | 1261 MUST_USE_RESULT static MaybeHandle<Object> SetSuperProperty( |
| 1233 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, | 1262 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, |
| 1234 StoreFromKeyed store_mode); | 1263 StoreFromKeyed store_mode); |
| 1235 | 1264 |
| 1236 MUST_USE_RESULT static MaybeHandle<Object> ReadAbsentProperty( | 1265 MUST_USE_RESULT static MaybeHandle<Object> ReadAbsentProperty( |
| 1237 LookupIterator* it, LanguageMode language_mode); | 1266 LookupIterator* it, LanguageMode language_mode); |
| 1238 MUST_USE_RESULT static MaybeHandle<Object> ReadAbsentProperty( | 1267 MUST_USE_RESULT static MaybeHandle<Object> ReadAbsentProperty( |
| 1239 Isolate* isolate, Handle<Object> receiver, Handle<Object> name, | 1268 Isolate* isolate, Handle<Object> receiver, Handle<Object> name, |
| 1240 LanguageMode language_mode); | 1269 LanguageMode language_mode); |
| 1241 MUST_USE_RESULT static MaybeHandle<Object> CannotCreateProperty( | 1270 MUST_USE_RESULT static Maybe<bool> CannotCreateProperty( |
| 1242 LookupIterator* it, Handle<Object> value, LanguageMode language_mode); | |
| 1243 MUST_USE_RESULT static MaybeHandle<Object> CannotCreateProperty( | |
| 1244 Isolate* isolate, Handle<Object> receiver, Handle<Object> name, | 1271 Isolate* isolate, Handle<Object> receiver, Handle<Object> name, |
| 1245 Handle<Object> value, LanguageMode language_mode); | 1272 Handle<Object> value, LanguageMode language_mode, |
| 1246 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyProperty( | 1273 ShouldThrow should_throw); |
| 1247 LookupIterator* it, Handle<Object> value, LanguageMode language_mode); | 1274 MUST_USE_RESULT static Maybe<bool> WriteToReadOnlyProperty( |
| 1248 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyProperty( | 1275 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, |
| 1276 ShouldThrow should_throw); |
| 1277 MUST_USE_RESULT static Maybe<bool> WriteToReadOnlyProperty( |
| 1249 Isolate* isolate, Handle<Object> receiver, Handle<Object> name, | 1278 Isolate* isolate, Handle<Object> receiver, Handle<Object> name, |
| 1250 Handle<Object> value, LanguageMode language_mode); | 1279 Handle<Object> value, LanguageMode language_mode, |
| 1280 ShouldThrow should_throw); |
| 1251 MUST_USE_RESULT static MaybeHandle<Object> RedefineNonconfigurableProperty( | 1281 MUST_USE_RESULT static MaybeHandle<Object> RedefineNonconfigurableProperty( |
| 1252 Isolate* isolate, Handle<Object> name, Handle<Object> value, | 1282 Isolate* isolate, Handle<Object> name, Handle<Object> value, |
| 1253 LanguageMode language_mode); | 1283 LanguageMode language_mode); |
| 1254 MUST_USE_RESULT static MaybeHandle<Object> SetDataProperty( | 1284 MUST_USE_RESULT static Maybe<bool> SetDataProperty(LookupIterator* it, |
| 1255 LookupIterator* it, Handle<Object> value); | 1285 Handle<Object> value, |
| 1286 ShouldThrow should_throw); |
| 1256 MUST_USE_RESULT static MaybeHandle<Object> AddDataProperty( | 1287 MUST_USE_RESULT static MaybeHandle<Object> AddDataProperty( |
| 1257 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, | 1288 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, |
| 1258 LanguageMode language_mode, StoreFromKeyed store_mode); | 1289 LanguageMode language_mode, StoreFromKeyed store_mode); |
| 1290 MUST_USE_RESULT static Maybe<bool> AddDataProperty( |
| 1291 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, |
| 1292 LanguageMode language_mode, ShouldThrow should_throw, |
| 1293 StoreFromKeyed store_mode); |
| 1259 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( | 1294 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( |
| 1260 Handle<Object> object, Handle<Name> name, | 1295 Handle<Object> object, Handle<Name> name, |
| 1261 LanguageMode language_mode = SLOPPY); | 1296 LanguageMode language_mode = SLOPPY); |
| 1262 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( | 1297 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( |
| 1263 Handle<JSReceiver> holder, Handle<Name> name, Handle<Object> receiver, | 1298 Handle<JSReceiver> holder, Handle<Name> name, Handle<Object> receiver, |
| 1264 LanguageMode language_mode = SLOPPY); | 1299 LanguageMode language_mode = SLOPPY); |
| 1265 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( | 1300 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( |
| 1266 Isolate* isolate, Handle<Object> object, const char* key, | 1301 Isolate* isolate, Handle<Object> object, const char* key, |
| 1267 LanguageMode language_mode = SLOPPY); | 1302 LanguageMode language_mode = SLOPPY); |
| 1268 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( | 1303 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( |
| 1269 Handle<Object> object, Handle<Name> name, | 1304 Handle<Object> object, Handle<Name> name, |
| 1270 LanguageMode language_mode = SLOPPY); | 1305 LanguageMode language_mode = SLOPPY); |
| 1271 | 1306 |
| 1272 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithAccessor( | 1307 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithAccessor( |
| 1273 LookupIterator* it, LanguageMode language_mode); | 1308 LookupIterator* it, LanguageMode language_mode); |
| 1274 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithAccessor( | 1309 MUST_USE_RESULT static Maybe<bool> SetPropertyWithAccessor( |
| 1275 LookupIterator* it, Handle<Object> value, LanguageMode language_mode); | 1310 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, |
| 1311 ShouldThrow should_throw); |
| 1276 | 1312 |
| 1277 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithDefinedGetter( | 1313 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithDefinedGetter( |
| 1278 Handle<Object> receiver, | 1314 Handle<Object> receiver, |
| 1279 Handle<JSReceiver> getter); | 1315 Handle<JSReceiver> getter); |
| 1280 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithDefinedSetter( | 1316 MUST_USE_RESULT static Maybe<bool> SetPropertyWithDefinedSetter( |
| 1281 Handle<Object> receiver, | 1317 Handle<Object> receiver, Handle<JSReceiver> setter, Handle<Object> value, |
| 1282 Handle<JSReceiver> setter, | 1318 ShouldThrow should_throw); |
| 1283 Handle<Object> value); | |
| 1284 | 1319 |
| 1285 MUST_USE_RESULT static inline MaybeHandle<Object> GetElement( | 1320 MUST_USE_RESULT static inline MaybeHandle<Object> GetElement( |
| 1286 Isolate* isolate, Handle<Object> object, uint32_t index, | 1321 Isolate* isolate, Handle<Object> object, uint32_t index, |
| 1287 LanguageMode language_mode = SLOPPY); | 1322 LanguageMode language_mode = SLOPPY); |
| 1288 | 1323 |
| 1289 MUST_USE_RESULT static inline MaybeHandle<Object> SetElement( | 1324 MUST_USE_RESULT static inline MaybeHandle<Object> SetElement( |
| 1290 Isolate* isolate, Handle<Object> object, uint32_t index, | 1325 Isolate* isolate, Handle<Object> object, uint32_t index, |
| 1291 Handle<Object> value, LanguageMode language_mode); | 1326 Handle<Object> value, LanguageMode language_mode); |
| 1292 | 1327 |
| 1293 // Get the first non-hidden prototype. | 1328 // Get the first non-hidden prototype. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1367 #endif | 1402 #endif |
| 1368 | 1403 |
| 1369 private: | 1404 private: |
| 1370 friend class LookupIterator; | 1405 friend class LookupIterator; |
| 1371 friend class PrototypeIterator; | 1406 friend class PrototypeIterator; |
| 1372 | 1407 |
| 1373 // Return the map of the root of object's prototype chain. | 1408 // Return the map of the root of object's prototype chain. |
| 1374 Map* GetRootMap(Isolate* isolate); | 1409 Map* GetRootMap(Isolate* isolate); |
| 1375 | 1410 |
| 1376 // Helper for SetProperty and SetSuperProperty. | 1411 // Helper for SetProperty and SetSuperProperty. |
| 1377 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyInternal( | 1412 // Return value is only meaningful if [found] is set to true on return. |
| 1413 MUST_USE_RESULT static Maybe<bool> SetPropertyInternal( |
| 1378 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, | 1414 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, |
| 1379 StoreFromKeyed store_mode, bool* found); | 1415 ShouldThrow should_throw, StoreFromKeyed store_mode, bool* found); |
| 1380 | 1416 |
| 1381 DISALLOW_IMPLICIT_CONSTRUCTORS(Object); | 1417 DISALLOW_IMPLICIT_CONSTRUCTORS(Object); |
| 1382 }; | 1418 }; |
| 1383 | 1419 |
| 1384 | 1420 |
| 1385 // In objects.h to be usable without objects-inl.h inclusion. | 1421 // In objects.h to be usable without objects-inl.h inclusion. |
| 1386 bool Object::IsSmi() const { return HAS_SMI_TAG(this); } | 1422 bool Object::IsSmi() const { return HAS_SMI_TAG(this); } |
| 1387 bool Object::IsHeapObject() const { return Internals::HasHeapObjectTag(this); } | 1423 bool Object::IsHeapObject() const { return Internals::HasHeapObjectTag(this); } |
| 1388 | 1424 |
| 1389 | 1425 |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1791 ACCESSOR_SETTER | 1827 ACCESSOR_SETTER |
| 1792 }; | 1828 }; |
| 1793 | 1829 |
| 1794 | 1830 |
| 1795 enum KeyFilter { SKIP_SYMBOLS, INCLUDE_SYMBOLS }; | 1831 enum KeyFilter { SKIP_SYMBOLS, INCLUDE_SYMBOLS }; |
| 1796 | 1832 |
| 1797 | 1833 |
| 1798 enum GetKeysConversion { KEEP_NUMBERS, CONVERT_TO_STRING }; | 1834 enum GetKeysConversion { KEEP_NUMBERS, CONVERT_TO_STRING }; |
| 1799 | 1835 |
| 1800 | 1836 |
| 1801 enum ShouldThrow { THROW_ON_ERROR, DONT_THROW }; | |
| 1802 | |
| 1803 | |
| 1804 #define RETURN_FAILURE(isolate, should_throw, call) \ | |
| 1805 do { \ | |
| 1806 if ((should_throw) == DONT_THROW) { \ | |
| 1807 return Just(false); \ | |
| 1808 } else { \ | |
| 1809 isolate->Throw(*isolate->factory()->call); \ | |
| 1810 return Nothing<bool>(); \ | |
| 1811 } \ | |
| 1812 } while (false) | |
| 1813 | |
| 1814 | |
| 1815 #define MAYBE_RETURN(call, value) \ | |
| 1816 do { \ | |
| 1817 if ((call).IsNothing()) return value; \ | |
| 1818 } while (false) | |
| 1819 | |
| 1820 #define MAYBE_RETURN_NULL(call) MAYBE_RETURN(call, MaybeHandle<Object>()) | |
| 1821 | |
| 1822 | |
| 1823 // JSReceiver includes types on which properties can be defined, i.e., | 1837 // JSReceiver includes types on which properties can be defined, i.e., |
| 1824 // JSObject and JSProxy. | 1838 // JSObject and JSProxy. |
| 1825 class JSReceiver: public HeapObject { | 1839 class JSReceiver: public HeapObject { |
| 1826 public: | 1840 public: |
| 1827 DECLARE_CAST(JSReceiver) | 1841 DECLARE_CAST(JSReceiver) |
| 1828 | 1842 |
| 1829 // ES6 section 7.1.1 ToPrimitive | 1843 // ES6 section 7.1.1 ToPrimitive |
| 1830 MUST_USE_RESULT static MaybeHandle<Object> ToPrimitive( | 1844 MUST_USE_RESULT static MaybeHandle<Object> ToPrimitive( |
| 1831 Handle<JSReceiver> receiver, | 1845 Handle<JSReceiver> receiver, |
| 1832 ToPrimitiveHint hint = ToPrimitiveHint::kDefault); | 1846 ToPrimitiveHint hint = ToPrimitiveHint::kDefault); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2033 // Undefined values are placed after non-undefined values. | 2047 // Undefined values are placed after non-undefined values. |
| 2034 // Returns the number of non-undefined values. | 2048 // Returns the number of non-undefined values. |
| 2035 static Handle<Object> PrepareElementsForSort(Handle<JSObject> object, | 2049 static Handle<Object> PrepareElementsForSort(Handle<JSObject> object, |
| 2036 uint32_t limit); | 2050 uint32_t limit); |
| 2037 // As PrepareElementsForSort, but only on objects where elements is | 2051 // As PrepareElementsForSort, but only on objects where elements is |
| 2038 // a dictionary, and it will stay a dictionary. Collates undefined and | 2052 // a dictionary, and it will stay a dictionary. Collates undefined and |
| 2039 // unexisting elements below limit from position zero of the elements. | 2053 // unexisting elements below limit from position zero of the elements. |
| 2040 static Handle<Object> PrepareSlowElementsForSort(Handle<JSObject> object, | 2054 static Handle<Object> PrepareSlowElementsForSort(Handle<JSObject> object, |
| 2041 uint32_t limit); | 2055 uint32_t limit); |
| 2042 | 2056 |
| 2043 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithInterceptor( | 2057 MUST_USE_RESULT static Maybe<bool> SetPropertyWithInterceptor( |
| 2044 LookupIterator* it, Handle<Object> value); | 2058 LookupIterator* it, Handle<Object> value); |
| 2045 | 2059 |
| 2046 // SetLocalPropertyIgnoreAttributes converts callbacks to fields. We need to | 2060 // SetLocalPropertyIgnoreAttributes converts callbacks to fields. We need to |
| 2047 // grant an exemption to ExecutableAccessor callbacks in some cases. | 2061 // grant an exemption to ExecutableAccessor callbacks in some cases. |
| 2048 enum ExecutableAccessorInfoHandling { DEFAULT_HANDLING, DONT_FORCE_FIELD }; | 2062 enum ExecutableAccessorInfoHandling { DEFAULT_HANDLING, DONT_FORCE_FIELD }; |
| 2049 | 2063 |
| 2050 MUST_USE_RESULT static MaybeHandle<Object> DefineOwnPropertyIgnoreAttributes( | 2064 MUST_USE_RESULT static MaybeHandle<Object> DefineOwnPropertyIgnoreAttributes( |
| 2051 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, | 2065 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, |
| 2052 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING); | 2066 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING); |
| 2053 | 2067 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2070 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING); | 2084 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING); |
| 2071 | 2085 |
| 2072 // Adds or reconfigures a property to attributes NONE. It will fail when it | 2086 // Adds or reconfigures a property to attributes NONE. It will fail when it |
| 2073 // cannot. | 2087 // cannot. |
| 2074 MUST_USE_RESULT static Maybe<bool> CreateDataProperty(LookupIterator* it, | 2088 MUST_USE_RESULT static Maybe<bool> CreateDataProperty(LookupIterator* it, |
| 2075 Handle<Object> value); | 2089 Handle<Object> value); |
| 2076 | 2090 |
| 2077 static void AddProperty(Handle<JSObject> object, Handle<Name> name, | 2091 static void AddProperty(Handle<JSObject> object, Handle<Name> name, |
| 2078 Handle<Object> value, PropertyAttributes attributes); | 2092 Handle<Object> value, PropertyAttributes attributes); |
| 2079 | 2093 |
| 2094 MUST_USE_RESULT static Maybe<bool> AddDataElement( |
| 2095 Handle<JSObject> receiver, uint32_t index, Handle<Object> value, |
| 2096 PropertyAttributes attributes, ShouldThrow should_throw); |
| 2080 MUST_USE_RESULT static MaybeHandle<Object> AddDataElement( | 2097 MUST_USE_RESULT static MaybeHandle<Object> AddDataElement( |
| 2081 Handle<JSObject> receiver, uint32_t index, Handle<Object> value, | 2098 Handle<JSObject> receiver, uint32_t index, Handle<Object> value, |
| 2082 PropertyAttributes attributes); | 2099 PropertyAttributes attributes); |
| 2083 | 2100 |
| 2084 // Extend the receiver with a single fast property appeared first in the | 2101 // Extend the receiver with a single fast property appeared first in the |
| 2085 // passed map. This also extends the property backing store if necessary. | 2102 // passed map. This also extends the property backing store if necessary. |
| 2086 static void AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map); | 2103 static void AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map); |
| 2087 | 2104 |
| 2088 // Migrates the given object to a map whose field representations are the | 2105 // Migrates the given object to a map whose field representations are the |
| 2089 // lowest upper bound of all known representations for that field. | 2106 // lowest upper bound of all known representations for that field. |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2498 | 2515 |
| 2499 static void MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map); | 2516 static void MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map); |
| 2500 static void MigrateFastToSlow(Handle<JSObject> object, | 2517 static void MigrateFastToSlow(Handle<JSObject> object, |
| 2501 Handle<Map> new_map, | 2518 Handle<Map> new_map, |
| 2502 int expected_additional_properties); | 2519 int expected_additional_properties); |
| 2503 | 2520 |
| 2504 // Used from Object::GetProperty(). | 2521 // Used from Object::GetProperty(). |
| 2505 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithFailedAccessCheck( | 2522 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithFailedAccessCheck( |
| 2506 LookupIterator* it); | 2523 LookupIterator* it); |
| 2507 | 2524 |
| 2508 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithFailedAccessCheck( | 2525 MUST_USE_RESULT static Maybe<bool> SetPropertyWithFailedAccessCheck( |
| 2509 LookupIterator* it, Handle<Object> value); | 2526 LookupIterator* it, Handle<Object> value, ShouldThrow should_throw); |
| 2510 | 2527 |
| 2511 // Add a property to a slow-case object. | 2528 // Add a property to a slow-case object. |
| 2512 static void AddSlowProperty(Handle<JSObject> object, | 2529 static void AddSlowProperty(Handle<JSObject> object, |
| 2513 Handle<Name> name, | 2530 Handle<Name> name, |
| 2514 Handle<Object> value, | 2531 Handle<Object> value, |
| 2515 PropertyAttributes attributes); | 2532 PropertyAttributes attributes); |
| 2516 | 2533 |
| 2517 MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithInterceptor( | 2534 MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithInterceptor( |
| 2518 LookupIterator* it); | 2535 LookupIterator* it); |
| 2519 | 2536 |
| (...skipping 7019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9539 | 9556 |
| 9540 DECLARE_CAST(JSProxy) | 9557 DECLARE_CAST(JSProxy) |
| 9541 | 9558 |
| 9542 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithHandler( | 9559 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithHandler( |
| 9543 Handle<JSProxy> proxy, | 9560 Handle<JSProxy> proxy, |
| 9544 Handle<Object> receiver, | 9561 Handle<Object> receiver, |
| 9545 Handle<Name> name); | 9562 Handle<Name> name); |
| 9546 | 9563 |
| 9547 // If the handler defines an accessor property with a setter, invoke it. | 9564 // If the handler defines an accessor property with a setter, invoke it. |
| 9548 // If it defines an accessor property without a setter, or a data property | 9565 // If it defines an accessor property without a setter, or a data property |
| 9549 // that is read-only, throw. In all these cases set '*done' to true, | 9566 // that is read-only, fail. In all these cases set '*done' to true. |
| 9550 // otherwise set it to false. | 9567 // Otherwise set it to false, in which case the return value is not |
| 9568 // meaningful. |
| 9551 MUST_USE_RESULT | 9569 MUST_USE_RESULT |
| 9552 static MaybeHandle<Object> SetPropertyViaPrototypesWithHandler( | 9570 static Maybe<bool> SetPropertyViaPrototypesWithHandler( |
| 9553 Handle<JSProxy> proxy, Handle<Object> receiver, Handle<Name> name, | 9571 Handle<JSProxy> proxy, Handle<Object> receiver, Handle<Name> name, |
| 9554 Handle<Object> value, LanguageMode language_mode, bool* done); | 9572 Handle<Object> value, LanguageMode language_mode, |
| 9573 ShouldThrow should_throw, bool* done); |
| 9555 | 9574 |
| 9556 MUST_USE_RESULT static Maybe<PropertyAttributes> | 9575 MUST_USE_RESULT static Maybe<PropertyAttributes> |
| 9557 GetPropertyAttributesWithHandler(Handle<JSProxy> proxy, | 9576 GetPropertyAttributesWithHandler(Handle<JSProxy> proxy, |
| 9558 Handle<Object> receiver, | 9577 Handle<Object> receiver, |
| 9559 Handle<Name> name); | 9578 Handle<Name> name); |
| 9560 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithHandler( | 9579 MUST_USE_RESULT static Maybe<bool> SetPropertyWithHandler( |
| 9561 Handle<JSProxy> proxy, Handle<Object> receiver, Handle<Name> name, | 9580 Handle<JSProxy> proxy, Handle<Object> receiver, Handle<Name> name, |
| 9562 Handle<Object> value, LanguageMode language_mode); | 9581 Handle<Object> value, LanguageMode language_mode, |
| 9582 ShouldThrow should_throw); |
| 9563 | 9583 |
| 9564 // Turn the proxy into an (empty) JSObject. | 9584 // Turn the proxy into an (empty) JSObject. |
| 9565 static void Fix(Handle<JSProxy> proxy); | 9585 static void Fix(Handle<JSProxy> proxy); |
| 9566 | 9586 |
| 9567 // Initializes the body after the handler slot. | 9587 // Initializes the body after the handler slot. |
| 9568 inline void InitializeBody(int object_size, Object* value); | 9588 inline void InitializeBody(int object_size, Object* value); |
| 9569 | 9589 |
| 9570 // Invoke a trap by name. If the trap does not exist on this's handler, | 9590 // Invoke a trap by name. If the trap does not exist on this's handler, |
| 9571 // but derived_trap is non-NULL, invoke that instead. May cause GC. | 9591 // but derived_trap is non-NULL, invoke that instead. May cause GC. |
| 9572 MUST_USE_RESULT static MaybeHandle<Object> CallTrap( | 9592 MUST_USE_RESULT static MaybeHandle<Object> CallTrap( |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10086 public: | 10106 public: |
| 10087 // [length]: The length property. | 10107 // [length]: The length property. |
| 10088 DECL_ACCESSORS(length, Object) | 10108 DECL_ACCESSORS(length, Object) |
| 10089 | 10109 |
| 10090 // Overload the length setter to skip write barrier when the length | 10110 // Overload the length setter to skip write barrier when the length |
| 10091 // is set to a smi. This matches the set function on FixedArray. | 10111 // is set to a smi. This matches the set function on FixedArray. |
| 10092 inline void set_length(Smi* length); | 10112 inline void set_length(Smi* length); |
| 10093 | 10113 |
| 10094 static bool HasReadOnlyLength(Handle<JSArray> array); | 10114 static bool HasReadOnlyLength(Handle<JSArray> array); |
| 10095 static bool WouldChangeReadOnlyLength(Handle<JSArray> array, uint32_t index); | 10115 static bool WouldChangeReadOnlyLength(Handle<JSArray> array, uint32_t index); |
| 10096 static MaybeHandle<Object> ReadOnlyLengthError(Handle<JSArray> array); | |
| 10097 | 10116 |
| 10098 // Initialize the array with the given capacity. The function may | 10117 // Initialize the array with the given capacity. The function may |
| 10099 // fail due to out-of-memory situations, but only if the requested | 10118 // fail due to out-of-memory situations, but only if the requested |
| 10100 // capacity is non-zero. | 10119 // capacity is non-zero. |
| 10101 static void Initialize(Handle<JSArray> array, int capacity, int length = 0); | 10120 static void Initialize(Handle<JSArray> array, int capacity, int length = 0); |
| 10102 | 10121 |
| 10103 // If the JSArray has fast elements, and new_length would result in | 10122 // If the JSArray has fast elements, and new_length would result in |
| 10104 // normalization, returns true. | 10123 // normalization, returns true. |
| 10105 bool SetLengthWouldNormalize(uint32_t new_length); | 10124 bool SetLengthWouldNormalize(uint32_t new_length); |
| 10106 static inline bool SetLengthWouldNormalize(Heap* heap, uint32_t new_length); | 10125 static inline bool SetLengthWouldNormalize(Heap* heap, uint32_t new_length); |
| (...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10815 // (elements + properties) in the current level. | 10834 // (elements + properties) in the current level. |
| 10816 int levelLength_; | 10835 int levelLength_; |
| 10817 | 10836 |
| 10818 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); | 10837 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); |
| 10819 }; | 10838 }; |
| 10820 | 10839 |
| 10821 } // NOLINT, false-positive due to second-order macros. | 10840 } // NOLINT, false-positive due to second-order macros. |
| 10822 } // NOLINT, false-positive due to second-order macros. | 10841 } // NOLINT, false-positive due to second-order macros. |
| 10823 | 10842 |
| 10824 #endif // V8_OBJECTS_H_ | 10843 #endif // V8_OBJECTS_H_ |
| OLD | NEW |