Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: src/objects.h

Issue 1431443003: Refactor Object::SetSuperProperty and others. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Revert unintended change to test262 status file. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ic/ic.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 // ES6 [[Set]] (when passed DONT_THROW) 1241 // ES6 [[Set]] (when passed DONT_THROW)
1242 // Invariants for this and related functions (unless stated otherwise): 1242 // Invariants for this and related functions (unless stated otherwise):
1243 // 1) When the result is Nothing, an exception is pending. 1243 // 1) When the result is Nothing, an exception is pending.
1244 // 2) When passed THROW_ON_ERROR, the result is never Just(false). 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 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 1246 // argument. These cases are either in accordance with the spec or not
1247 // covered by it (eg., concerning API callbacks). 1247 // covered by it (eg., concerning API callbacks).
1248 MUST_USE_RESULT static Maybe<bool> SetProperty(LookupIterator* it, 1248 MUST_USE_RESULT static Maybe<bool> SetProperty(LookupIterator* it,
1249 Handle<Object> value, 1249 Handle<Object> value,
1250 LanguageMode language_mode, 1250 LanguageMode language_mode,
1251 ShouldThrow should_throw,
1252 StoreFromKeyed store_mode); 1251 StoreFromKeyed store_mode);
1253 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( 1252 MUST_USE_RESULT static MaybeHandle<Object> SetProperty(
1254 Handle<Object> object, Handle<Name> name, Handle<Object> value, 1253 Handle<Object> object, Handle<Name> name, Handle<Object> value,
1255 LanguageMode language_mode, 1254 LanguageMode language_mode,
1256 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); 1255 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED);
1257 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( 1256
1257 MUST_USE_RESULT static Maybe<bool> SetSuperProperty(
1258 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, 1258 LookupIterator* it, Handle<Object> value, LanguageMode language_mode,
1259 StoreFromKeyed store_mode); 1259 StoreFromKeyed store_mode);
1260 1260
1261 MUST_USE_RESULT static MaybeHandle<Object> SetSuperProperty(
1262 LookupIterator* it, Handle<Object> value, LanguageMode language_mode,
1263 StoreFromKeyed store_mode);
1264
1265 MUST_USE_RESULT static MaybeHandle<Object> ReadAbsentProperty( 1261 MUST_USE_RESULT static MaybeHandle<Object> ReadAbsentProperty(
1266 LookupIterator* it, LanguageMode language_mode); 1262 LookupIterator* it, LanguageMode language_mode);
1267 MUST_USE_RESULT static MaybeHandle<Object> ReadAbsentProperty( 1263 MUST_USE_RESULT static MaybeHandle<Object> ReadAbsentProperty(
1268 Isolate* isolate, Handle<Object> receiver, Handle<Object> name, 1264 Isolate* isolate, Handle<Object> receiver, Handle<Object> name,
1269 LanguageMode language_mode); 1265 LanguageMode language_mode);
1270 MUST_USE_RESULT static Maybe<bool> CannotCreateProperty( 1266 MUST_USE_RESULT static Maybe<bool> CannotCreateProperty(
1271 Isolate* isolate, Handle<Object> receiver, Handle<Object> name, 1267 Isolate* isolate, Handle<Object> receiver, Handle<Object> name,
1272 Handle<Object> value, LanguageMode language_mode, 1268 Handle<Object> value, ShouldThrow should_throw);
1273 ShouldThrow should_throw);
1274 MUST_USE_RESULT static Maybe<bool> WriteToReadOnlyProperty( 1269 MUST_USE_RESULT static Maybe<bool> WriteToReadOnlyProperty(
1275 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, 1270 LookupIterator* it, Handle<Object> value, ShouldThrow should_throw);
1276 ShouldThrow should_throw);
1277 MUST_USE_RESULT static Maybe<bool> WriteToReadOnlyProperty( 1271 MUST_USE_RESULT static Maybe<bool> WriteToReadOnlyProperty(
1278 Isolate* isolate, Handle<Object> receiver, Handle<Object> name, 1272 Isolate* isolate, Handle<Object> receiver, Handle<Object> name,
1279 Handle<Object> value, LanguageMode language_mode, 1273 Handle<Object> value, ShouldThrow should_throw);
1274 MUST_USE_RESULT static Maybe<bool> RedefineNonconfigurableProperty(
1275 Isolate* isolate, Handle<Object> name, Handle<Object> value,
1280 ShouldThrow should_throw); 1276 ShouldThrow should_throw);
1281 MUST_USE_RESULT static MaybeHandle<Object> RedefineNonconfigurableProperty(
1282 Isolate* isolate, Handle<Object> name, Handle<Object> value,
1283 LanguageMode language_mode);
1284 MUST_USE_RESULT static Maybe<bool> SetDataProperty(LookupIterator* it, 1277 MUST_USE_RESULT static Maybe<bool> SetDataProperty(LookupIterator* it,
1285 Handle<Object> value, 1278 Handle<Object> value,
1286 ShouldThrow should_throw); 1279 ShouldThrow should_throw);
1287 MUST_USE_RESULT static MaybeHandle<Object> AddDataProperty(
1288 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes,
1289 LanguageMode language_mode, StoreFromKeyed store_mode);
1290 MUST_USE_RESULT static Maybe<bool> AddDataProperty( 1280 MUST_USE_RESULT static Maybe<bool> AddDataProperty(
1291 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, 1281 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes,
1292 LanguageMode language_mode, ShouldThrow should_throw, 1282 ShouldThrow should_throw, StoreFromKeyed store_mode);
1293 StoreFromKeyed store_mode);
1294 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( 1283 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement(
1295 Handle<Object> object, Handle<Name> name, 1284 Handle<Object> object, Handle<Name> name,
1296 LanguageMode language_mode = SLOPPY); 1285 LanguageMode language_mode = SLOPPY);
1297 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( 1286 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement(
1298 Handle<JSReceiver> holder, Handle<Name> name, Handle<Object> receiver, 1287 Handle<JSReceiver> holder, Handle<Name> name, Handle<Object> receiver,
1299 LanguageMode language_mode = SLOPPY); 1288 LanguageMode language_mode = SLOPPY);
1300 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( 1289 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty(
1301 Isolate* isolate, Handle<Object> object, const char* key, 1290 Isolate* isolate, Handle<Object> object, const char* key,
1302 LanguageMode language_mode = SLOPPY); 1291 LanguageMode language_mode = SLOPPY);
1303 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( 1292 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty(
1304 Handle<Object> object, Handle<Name> name, 1293 Handle<Object> object, Handle<Name> name,
1305 LanguageMode language_mode = SLOPPY); 1294 LanguageMode language_mode = SLOPPY);
1306 1295
1307 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithAccessor( 1296 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithAccessor(
1308 LookupIterator* it, LanguageMode language_mode); 1297 LookupIterator* it, LanguageMode language_mode);
1309 MUST_USE_RESULT static Maybe<bool> SetPropertyWithAccessor( 1298 MUST_USE_RESULT static Maybe<bool> SetPropertyWithAccessor(
1310 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, 1299 LookupIterator* it, Handle<Object> value, ShouldThrow should_throw);
1311 ShouldThrow should_throw);
1312 1300
1313 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithDefinedGetter( 1301 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithDefinedGetter(
1314 Handle<Object> receiver, 1302 Handle<Object> receiver,
1315 Handle<JSReceiver> getter); 1303 Handle<JSReceiver> getter);
1316 MUST_USE_RESULT static Maybe<bool> SetPropertyWithDefinedSetter( 1304 MUST_USE_RESULT static Maybe<bool> SetPropertyWithDefinedSetter(
1317 Handle<Object> receiver, Handle<JSReceiver> setter, Handle<Object> value, 1305 Handle<Object> receiver, Handle<JSReceiver> setter, Handle<Object> value,
1318 ShouldThrow should_throw); 1306 ShouldThrow should_throw);
1319 1307
1320 MUST_USE_RESULT static inline MaybeHandle<Object> GetElement( 1308 MUST_USE_RESULT static inline MaybeHandle<Object> GetElement(
1321 Isolate* isolate, Handle<Object> object, uint32_t index, 1309 Isolate* isolate, Handle<Object> object, uint32_t index,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 friend class LookupIterator; 1393 friend class LookupIterator;
1406 friend class PrototypeIterator; 1394 friend class PrototypeIterator;
1407 1395
1408 // Return the map of the root of object's prototype chain. 1396 // Return the map of the root of object's prototype chain.
1409 Map* GetRootMap(Isolate* isolate); 1397 Map* GetRootMap(Isolate* isolate);
1410 1398
1411 // Helper for SetProperty and SetSuperProperty. 1399 // Helper for SetProperty and SetSuperProperty.
1412 // Return value is only meaningful if [found] is set to true on return. 1400 // Return value is only meaningful if [found] is set to true on return.
1413 MUST_USE_RESULT static Maybe<bool> SetPropertyInternal( 1401 MUST_USE_RESULT static Maybe<bool> SetPropertyInternal(
1414 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, 1402 LookupIterator* it, Handle<Object> value, LanguageMode language_mode,
1415 ShouldThrow should_throw, StoreFromKeyed store_mode, bool* found); 1403 StoreFromKeyed store_mode, bool* found);
1416 1404
1417 DISALLOW_IMPLICIT_CONSTRUCTORS(Object); 1405 DISALLOW_IMPLICIT_CONSTRUCTORS(Object);
1418 }; 1406 };
1419 1407
1420 1408
1421 // In objects.h to be usable without objects-inl.h inclusion. 1409 // In objects.h to be usable without objects-inl.h inclusion.
1422 bool Object::IsSmi() const { return HAS_SMI_TAG(this); } 1410 bool Object::IsSmi() const { return HAS_SMI_TAG(this); }
1423 bool Object::IsHeapObject() const { return Internals::HasHeapObjectTag(this); } 1411 bool Object::IsHeapObject() const { return Internals::HasHeapObjectTag(this); }
1424 1412
1425 1413
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
2058 LookupIterator* it, Handle<Object> value); 2046 LookupIterator* it, Handle<Object> value);
2059 2047
2060 // SetLocalPropertyIgnoreAttributes converts callbacks to fields. We need to 2048 // SetLocalPropertyIgnoreAttributes converts callbacks to fields. We need to
2061 // grant an exemption to ExecutableAccessor callbacks in some cases. 2049 // grant an exemption to ExecutableAccessor callbacks in some cases.
2062 enum ExecutableAccessorInfoHandling { DEFAULT_HANDLING, DONT_FORCE_FIELD }; 2050 enum ExecutableAccessorInfoHandling { DEFAULT_HANDLING, DONT_FORCE_FIELD };
2063 2051
2064 MUST_USE_RESULT static MaybeHandle<Object> DefineOwnPropertyIgnoreAttributes( 2052 MUST_USE_RESULT static MaybeHandle<Object> DefineOwnPropertyIgnoreAttributes(
2065 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, 2053 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes,
2066 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING); 2054 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING);
2067 2055
2056 MUST_USE_RESULT static Maybe<bool> DefineOwnPropertyIgnoreAttributes(
2057 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes,
2058 ShouldThrow should_throw,
2059 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING);
2060
2068 MUST_USE_RESULT static MaybeHandle<Object> SetOwnPropertyIgnoreAttributes( 2061 MUST_USE_RESULT static MaybeHandle<Object> SetOwnPropertyIgnoreAttributes(
2069 Handle<JSObject> object, Handle<Name> name, Handle<Object> value, 2062 Handle<JSObject> object, Handle<Name> name, Handle<Object> value,
2070 PropertyAttributes attributes, 2063 PropertyAttributes attributes,
2071 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING); 2064 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING);
2072 2065
2073 MUST_USE_RESULT static MaybeHandle<Object> SetOwnElementIgnoreAttributes( 2066 MUST_USE_RESULT static MaybeHandle<Object> SetOwnElementIgnoreAttributes(
2074 Handle<JSObject> object, uint32_t index, Handle<Object> value, 2067 Handle<JSObject> object, uint32_t index, Handle<Object> value,
2075 PropertyAttributes attributes, 2068 PropertyAttributes attributes,
2076 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING); 2069 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING);
2077 2070
(...skipping 7484 matching lines...) Expand 10 before | Expand all | Expand 10 after
9562 Handle<Name> name); 9555 Handle<Name> name);
9563 9556
9564 // If the handler defines an accessor property with a setter, invoke it. 9557 // If the handler defines an accessor property with a setter, invoke it.
9565 // If it defines an accessor property without a setter, or a data property 9558 // If it defines an accessor property without a setter, or a data property
9566 // that is read-only, fail. In all these cases set '*done' to true. 9559 // that is read-only, fail. In all these cases set '*done' to true.
9567 // Otherwise set it to false, in which case the return value is not 9560 // Otherwise set it to false, in which case the return value is not
9568 // meaningful. 9561 // meaningful.
9569 MUST_USE_RESULT 9562 MUST_USE_RESULT
9570 static Maybe<bool> SetPropertyViaPrototypesWithHandler( 9563 static Maybe<bool> SetPropertyViaPrototypesWithHandler(
9571 Handle<JSProxy> proxy, Handle<Object> receiver, Handle<Name> name, 9564 Handle<JSProxy> proxy, Handle<Object> receiver, Handle<Name> name,
9572 Handle<Object> value, LanguageMode language_mode, 9565 Handle<Object> value, ShouldThrow should_throw, bool* done);
9573 ShouldThrow should_throw, bool* done);
9574 9566
9575 MUST_USE_RESULT static Maybe<PropertyAttributes> 9567 MUST_USE_RESULT static Maybe<PropertyAttributes>
9576 GetPropertyAttributesWithHandler(Handle<JSProxy> proxy, 9568 GetPropertyAttributesWithHandler(Handle<JSProxy> proxy,
9577 Handle<Object> receiver, 9569 Handle<Object> receiver,
9578 Handle<Name> name); 9570 Handle<Name> name);
9579 MUST_USE_RESULT static Maybe<bool> SetPropertyWithHandler( 9571 MUST_USE_RESULT static Maybe<bool> SetPropertyWithHandler(
9580 Handle<JSProxy> proxy, Handle<Object> receiver, Handle<Name> name, 9572 Handle<JSProxy> proxy, Handle<Object> receiver, Handle<Name> name,
9581 Handle<Object> value, LanguageMode language_mode, 9573 Handle<Object> value, ShouldThrow should_throw);
9582 ShouldThrow should_throw);
9583 9574
9584 // Turn the proxy into an (empty) JSObject. 9575 // Turn the proxy into an (empty) JSObject.
9585 static void Fix(Handle<JSProxy> proxy); 9576 static void Fix(Handle<JSProxy> proxy);
9586 9577
9587 // Initializes the body after the handler slot. 9578 // Initializes the body after the handler slot.
9588 inline void InitializeBody(int object_size, Object* value); 9579 inline void InitializeBody(int object_size, Object* value);
9589 9580
9590 // Invoke a trap by name. If the trap does not exist on this's handler, 9581 // Invoke a trap by name. If the trap does not exist on this's handler,
9591 // but derived_trap is non-NULL, invoke that instead. May cause GC. 9582 // but derived_trap is non-NULL, invoke that instead. May cause GC.
9592 MUST_USE_RESULT static MaybeHandle<Object> CallTrap( 9583 MUST_USE_RESULT static MaybeHandle<Object> CallTrap(
(...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after
10838 // (elements + properties) in the current level. 10829 // (elements + properties) in the current level.
10839 int levelLength_ = 0; 10830 int levelLength_ = 0;
10840 10831
10841 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); 10832 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator);
10842 }; 10833 };
10843 10834
10844 } // NOLINT, false-positive due to second-order macros. 10835 } // NOLINT, false-positive due to second-order macros.
10845 } // NOLINT, false-positive due to second-order macros. 10836 } // NOLINT, false-positive due to second-order macros.
10846 10837
10847 #endif // V8_OBJECTS_H_ 10838 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/ic/ic.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698