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 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL) | 1010 HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL) |
1011 #undef IS_TYPE_FUNCTION_DECL | 1011 #undef IS_TYPE_FUNCTION_DECL |
1012 | 1012 |
1013 // A non-keyed store is of the form a.x = foo or a["x"] = foo whereas | 1013 // A non-keyed store is of the form a.x = foo or a["x"] = foo whereas |
1014 // a keyed store is of the form a[expression] = foo. | 1014 // a keyed store is of the form a[expression] = foo. |
1015 enum StoreFromKeyed { | 1015 enum StoreFromKeyed { |
1016 MAY_BE_STORE_FROM_KEYED, | 1016 MAY_BE_STORE_FROM_KEYED, |
1017 CERTAINLY_NOT_STORE_FROM_KEYED | 1017 CERTAINLY_NOT_STORE_FROM_KEYED |
1018 }; | 1018 }; |
1019 | 1019 |
1020 enum StorePropertyMode { NORMAL_PROPERTY, SUPER_PROPERTY }; | |
1021 | |
1022 INLINE(bool IsFixedArrayBase() const); | 1020 INLINE(bool IsFixedArrayBase() const); |
1023 INLINE(bool IsExternal() const); | 1021 INLINE(bool IsExternal() const); |
1024 INLINE(bool IsAccessorInfo() const); | 1022 INLINE(bool IsAccessorInfo() const); |
1025 | 1023 |
1026 INLINE(bool IsStruct() const); | 1024 INLINE(bool IsStruct() const); |
1027 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) \ | 1025 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) \ |
1028 INLINE(bool Is##Name() const); | 1026 INLINE(bool Is##Name() const); |
1029 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) | 1027 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) |
1030 #undef DECLARE_STRUCT_PREDICATE | 1028 #undef DECLARE_STRUCT_PREDICATE |
1031 | 1029 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 MUST_USE_RESULT static MaybeHandle<Object> GetProperty(LookupIterator* it); | 1119 MUST_USE_RESULT static MaybeHandle<Object> GetProperty(LookupIterator* it); |
1122 | 1120 |
1123 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5. | 1121 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5. |
1124 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( | 1122 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( |
1125 Handle<Object> object, Handle<Name> key, Handle<Object> value, | 1123 Handle<Object> object, Handle<Name> key, Handle<Object> value, |
1126 LanguageMode language_mode, | 1124 LanguageMode language_mode, |
1127 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); | 1125 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); |
1128 | 1126 |
1129 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( | 1127 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( |
1130 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, | 1128 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, |
1131 StoreFromKeyed store_mode, | 1129 StoreFromKeyed store_mode); |
1132 StorePropertyMode data_store_mode = NORMAL_PROPERTY); | 1130 |
| 1131 MUST_USE_RESULT static MaybeHandle<Object> SetSuperProperty( |
| 1132 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, |
| 1133 StoreFromKeyed store_mode); |
| 1134 |
1133 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyProperty( | 1135 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyProperty( |
1134 LookupIterator* it, Handle<Object> value, LanguageMode language_mode); | 1136 LookupIterator* it, Handle<Object> value, LanguageMode language_mode); |
| 1137 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyProperty( |
| 1138 Isolate* isolate, Handle<Object> reciever, Handle<Object> name, |
| 1139 Handle<Object> value, LanguageMode language_mode); |
1135 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyElement( | 1140 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyElement( |
1136 Isolate* isolate, Handle<Object> receiver, uint32_t index, | 1141 Isolate* isolate, Handle<Object> receiver, uint32_t index, |
1137 Handle<Object> value, LanguageMode language_mode); | 1142 Handle<Object> value, LanguageMode language_mode); |
| 1143 MUST_USE_RESULT static MaybeHandle<Object> RedefineNonconfigurableProperty( |
| 1144 Isolate* isolate, Handle<Object> name, Handle<Object> value, |
| 1145 LanguageMode language_mode); |
1138 MUST_USE_RESULT static MaybeHandle<Object> SetDataProperty( | 1146 MUST_USE_RESULT static MaybeHandle<Object> SetDataProperty( |
1139 LookupIterator* it, Handle<Object> value); | 1147 LookupIterator* it, Handle<Object> value); |
1140 MUST_USE_RESULT static MaybeHandle<Object> AddDataProperty( | 1148 MUST_USE_RESULT static MaybeHandle<Object> AddDataProperty( |
1141 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, | 1149 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, |
1142 LanguageMode language_mode, StoreFromKeyed store_mode); | 1150 LanguageMode language_mode, StoreFromKeyed store_mode); |
1143 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( | 1151 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( |
1144 Handle<Object> object, | 1152 Handle<Object> object, |
1145 Handle<Name> key); | 1153 Handle<Name> key); |
1146 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( | 1154 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( |
1147 Isolate* isolate, | 1155 Isolate* isolate, |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 void Print(std::ostream& os) { ShortPrint(os); } // NOLINT | 1255 void Print(std::ostream& os) { ShortPrint(os); } // NOLINT |
1248 #endif | 1256 #endif |
1249 | 1257 |
1250 private: | 1258 private: |
1251 friend class LookupIterator; | 1259 friend class LookupIterator; |
1252 friend class PrototypeIterator; | 1260 friend class PrototypeIterator; |
1253 | 1261 |
1254 // Return the map of the root of object's prototype chain. | 1262 // Return the map of the root of object's prototype chain. |
1255 Map* GetRootMap(Isolate* isolate); | 1263 Map* GetRootMap(Isolate* isolate); |
1256 | 1264 |
| 1265 // Helper for SetProperty and SetSuperProperty. |
| 1266 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyInternal( |
| 1267 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, |
| 1268 StoreFromKeyed store_mode, bool* found); |
| 1269 |
1257 DISALLOW_IMPLICIT_CONSTRUCTORS(Object); | 1270 DISALLOW_IMPLICIT_CONSTRUCTORS(Object); |
1258 }; | 1271 }; |
1259 | 1272 |
1260 | 1273 |
1261 struct Brief { | 1274 struct Brief { |
1262 explicit Brief(const Object* const v) : value(v) {} | 1275 explicit Brief(const Object* const v) : value(v) {} |
1263 const Object* value; | 1276 const Object* value; |
1264 }; | 1277 }; |
1265 | 1278 |
1266 | 1279 |
(...skipping 9711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10978 } else { | 10991 } else { |
10979 value &= ~(1 << bit_position); | 10992 value &= ~(1 << bit_position); |
10980 } | 10993 } |
10981 return value; | 10994 return value; |
10982 } | 10995 } |
10983 }; | 10996 }; |
10984 | 10997 |
10985 } } // namespace v8::internal | 10998 } } // namespace v8::internal |
10986 | 10999 |
10987 #endif // V8_OBJECTS_H_ | 11000 #endif // V8_OBJECTS_H_ |
OLD | NEW |