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 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 static inline MaybeHandle<JSReceiver> ToObject(Isolate* isolate, | 1155 static inline MaybeHandle<JSReceiver> ToObject(Isolate* isolate, |
1156 Handle<Object> object); | 1156 Handle<Object> object); |
1157 static MaybeHandle<JSReceiver> ToObject(Isolate* isolate, | 1157 static MaybeHandle<JSReceiver> ToObject(Isolate* isolate, |
1158 Handle<Object> object, | 1158 Handle<Object> object, |
1159 Handle<Context> context); | 1159 Handle<Context> context); |
1160 | 1160 |
1161 // Converts this to a Smi if possible. | 1161 // Converts this to a Smi if possible. |
1162 MUST_USE_RESULT static inline MaybeHandle<Smi> ToSmi(Isolate* isolate, | 1162 MUST_USE_RESULT static inline MaybeHandle<Smi> ToSmi(Isolate* isolate, |
1163 Handle<Object> object); | 1163 Handle<Object> object); |
1164 | 1164 |
1165 MUST_USE_RESULT static MaybeHandle<Object> GetProperty( | 1165 MUST_USE_RESULT static MaybeHandle<Object> GetProperty(LookupIterator* it); |
1166 LookupIterator* it, LanguageMode language_mode = SLOPPY); | |
1167 | 1166 |
1168 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5. | 1167 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5. |
1169 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( | 1168 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( |
1170 Handle<Object> object, Handle<Name> name, Handle<Object> value, | 1169 Handle<Object> object, Handle<Name> name, Handle<Object> value, |
1171 LanguageMode language_mode, | 1170 LanguageMode language_mode, |
1172 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); | 1171 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); |
1173 | 1172 |
1174 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( | 1173 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( |
1175 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, | 1174 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, |
1176 StoreFromKeyed store_mode); | 1175 StoreFromKeyed store_mode); |
1177 | 1176 |
1178 MUST_USE_RESULT static MaybeHandle<Object> SetSuperProperty( | 1177 MUST_USE_RESULT static MaybeHandle<Object> SetSuperProperty( |
1179 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, | 1178 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, |
1180 StoreFromKeyed store_mode); | 1179 StoreFromKeyed store_mode); |
1181 | 1180 |
1182 MUST_USE_RESULT static MaybeHandle<Object> ReadAbsentProperty( | |
1183 LookupIterator* it, LanguageMode language_mode); | |
1184 MUST_USE_RESULT static MaybeHandle<Object> ReadAbsentProperty( | |
1185 Isolate* isolate, Handle<Object> receiver, Handle<Object> name, | |
1186 LanguageMode language_mode); | |
1187 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyProperty( | 1181 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyProperty( |
1188 LookupIterator* it, Handle<Object> value, LanguageMode language_mode); | 1182 LookupIterator* it, Handle<Object> value, LanguageMode language_mode); |
1189 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyProperty( | 1183 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyProperty( |
1190 Isolate* isolate, Handle<Object> receiver, Handle<Object> name, | 1184 Isolate* isolate, Handle<Object> reciever, Handle<Object> name, |
1191 Handle<Object> value, LanguageMode language_mode); | 1185 Handle<Object> value, LanguageMode language_mode); |
1192 MUST_USE_RESULT static MaybeHandle<Object> RedefineNonconfigurableProperty( | 1186 MUST_USE_RESULT static MaybeHandle<Object> RedefineNonconfigurableProperty( |
1193 Isolate* isolate, Handle<Object> name, Handle<Object> value, | 1187 Isolate* isolate, Handle<Object> name, Handle<Object> value, |
1194 LanguageMode language_mode); | 1188 LanguageMode language_mode); |
1195 MUST_USE_RESULT static MaybeHandle<Object> SetDataProperty( | 1189 MUST_USE_RESULT static MaybeHandle<Object> SetDataProperty( |
1196 LookupIterator* it, Handle<Object> value); | 1190 LookupIterator* it, Handle<Object> value); |
1197 MUST_USE_RESULT static MaybeHandle<Object> AddDataProperty( | 1191 MUST_USE_RESULT static MaybeHandle<Object> AddDataProperty( |
1198 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, | 1192 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, |
1199 LanguageMode language_mode, StoreFromKeyed store_mode); | 1193 LanguageMode language_mode, StoreFromKeyed store_mode); |
1200 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( | 1194 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( |
1201 Handle<Object> object, Handle<Name> name, | 1195 Handle<Object> object, Handle<Name> name); |
1202 LanguageMode language_mode = SLOPPY); | |
1203 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( | 1196 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( |
1204 Isolate* isolate, Handle<Object> object, const char* key, | 1197 Isolate* isolate, |
1205 LanguageMode language_mode = SLOPPY); | 1198 Handle<Object> object, |
| 1199 const char* key); |
1206 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( | 1200 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( |
1207 Handle<Object> object, Handle<Name> name, | 1201 Handle<Object> object, Handle<Name> name); |
1208 LanguageMode language_mode = SLOPPY); | |
1209 | 1202 |
1210 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithAccessor( | 1203 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithAccessor( |
1211 LookupIterator* it, LanguageMode language_mode); | 1204 LookupIterator* it); |
1212 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithAccessor( | 1205 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithAccessor( |
1213 LookupIterator* it, Handle<Object> value, LanguageMode language_mode); | 1206 LookupIterator* it, Handle<Object> value, LanguageMode language_mode); |
1214 | 1207 |
1215 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithDefinedGetter( | 1208 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithDefinedGetter( |
1216 Handle<Object> receiver, | 1209 Handle<Object> receiver, |
1217 Handle<JSReceiver> getter); | 1210 Handle<JSReceiver> getter); |
1218 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithDefinedSetter( | 1211 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithDefinedSetter( |
1219 Handle<Object> receiver, | 1212 Handle<Object> receiver, |
1220 Handle<JSReceiver> setter, | 1213 Handle<JSReceiver> setter, |
1221 Handle<Object> value); | 1214 Handle<Object> value); |
1222 | 1215 |
1223 MUST_USE_RESULT static inline MaybeHandle<Object> GetElement( | 1216 MUST_USE_RESULT static inline MaybeHandle<Object> GetElement( |
1224 Isolate* isolate, Handle<Object> object, uint32_t index, | 1217 Isolate* isolate, |
1225 LanguageMode language_mode = SLOPPY); | 1218 Handle<Object> object, |
| 1219 uint32_t index); |
1226 | 1220 |
1227 static inline Handle<Object> GetPrototypeSkipHiddenPrototypes( | 1221 static inline Handle<Object> GetPrototypeSkipHiddenPrototypes( |
1228 Isolate* isolate, Handle<Object> receiver); | 1222 Isolate* isolate, Handle<Object> receiver); |
1229 | 1223 |
1230 // Returns the permanent hash code associated with this object. May return | 1224 // Returns the permanent hash code associated with this object. May return |
1231 // undefined if not yet created. | 1225 // undefined if not yet created. |
1232 Object* GetHash(); | 1226 Object* GetHash(); |
1233 | 1227 |
1234 // Returns undefined for JSObjects, but returns the hash code for simple | 1228 // Returns undefined for JSObjects, but returns the hash code for simple |
1235 // objects. This avoids a double lookup in the cases where we know we will | 1229 // objects. This avoids a double lookup in the cases where we know we will |
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2331 friend class JSReceiver; | 2325 friend class JSReceiver; |
2332 friend class Object; | 2326 friend class Object; |
2333 | 2327 |
2334 static void MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map); | 2328 static void MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map); |
2335 static void MigrateFastToSlow(Handle<JSObject> object, | 2329 static void MigrateFastToSlow(Handle<JSObject> object, |
2336 Handle<Map> new_map, | 2330 Handle<Map> new_map, |
2337 int expected_additional_properties); | 2331 int expected_additional_properties); |
2338 | 2332 |
2339 // Used from Object::GetProperty(). | 2333 // Used from Object::GetProperty(). |
2340 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithFailedAccessCheck( | 2334 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithFailedAccessCheck( |
2341 LookupIterator* it, LanguageMode language_mode); | 2335 LookupIterator* it); |
2342 | 2336 |
2343 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithFailedAccessCheck( | 2337 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithFailedAccessCheck( |
2344 LookupIterator* it, Handle<Object> value); | 2338 LookupIterator* it, Handle<Object> value); |
2345 | 2339 |
2346 // Add a property to a slow-case object. | 2340 // Add a property to a slow-case object. |
2347 static void AddSlowProperty(Handle<JSObject> object, | 2341 static void AddSlowProperty(Handle<JSObject> object, |
2348 Handle<Name> name, | 2342 Handle<Name> name, |
2349 Handle<Object> value, | 2343 Handle<Object> value, |
2350 PropertyAttributes attributes); | 2344 PropertyAttributes attributes); |
2351 | 2345 |
(...skipping 8518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10870 } else { | 10864 } else { |
10871 value &= ~(1 << bit_position); | 10865 value &= ~(1 << bit_position); |
10872 } | 10866 } |
10873 return value; | 10867 return value; |
10874 } | 10868 } |
10875 }; | 10869 }; |
10876 | 10870 |
10877 } } // namespace v8::internal | 10871 } } // namespace v8::internal |
10878 | 10872 |
10879 #endif // V8_OBJECTS_H_ | 10873 #endif // V8_OBJECTS_H_ |
OLD | NEW |