OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/assert-scope.h" | 10 #include "src/assert-scope.h" |
(...skipping 2189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2200 MUST_USE_RESULT static MaybeHandle<Object> SetAccessor( | 2200 MUST_USE_RESULT static MaybeHandle<Object> SetAccessor( |
2201 Handle<JSObject> object, | 2201 Handle<JSObject> object, |
2202 Handle<AccessorInfo> info); | 2202 Handle<AccessorInfo> info); |
2203 | 2203 |
2204 // The result must be checked first for exceptions. If there's no exception, | 2204 // The result must be checked first for exceptions. If there's no exception, |
2205 // the output parameter |done| indicates whether the interceptor has a result | 2205 // the output parameter |done| indicates whether the interceptor has a result |
2206 // or not. | 2206 // or not. |
2207 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithInterceptor( | 2207 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithInterceptor( |
2208 LookupIterator* it, bool* done); | 2208 LookupIterator* it, bool* done); |
2209 | 2209 |
2210 // Accessors for hidden properties object. | |
2211 // | |
2212 // Hidden properties are not own properties of the object itself. Instead | |
2213 // they are stored in an auxiliary structure kept as an own property with a | |
2214 // special name Heap::hidden_properties_symbol(). But if the receiver is a | |
2215 // JSGlobalProxy then the auxiliary object is a property of its prototype, and | |
2216 // if it's a detached proxy, then you can't have hidden properties. | |
2217 | |
2218 // Sets a hidden property on this object. Returns this object if successful, | |
2219 // undefined if called on a detached proxy. | |
2220 static Handle<Object> SetHiddenProperty(Handle<JSObject> object, | |
2221 Handle<Name> key, | |
2222 Handle<Object> value); | |
2223 // Gets the value of a hidden property with the given key. Returns the hole | |
2224 // if the property doesn't exist (or if called on a detached proxy), | |
2225 // otherwise returns the value set for the key. | |
2226 Object* GetHiddenProperty(Handle<Name> key); | |
2227 // Deletes a hidden property. Deleting a non-existing property is | |
2228 // considered successful. | |
2229 static void DeleteHiddenProperty(Handle<JSObject> object, | |
2230 Handle<Name> key); | |
2231 // Returns true if the object has a property with the hidden string as name. | |
2232 static bool HasHiddenProperties(Handle<JSObject> object); | |
2233 | |
2234 static void ValidateElements(Handle<JSObject> object); | 2210 static void ValidateElements(Handle<JSObject> object); |
2235 | 2211 |
2236 // Makes sure that this object can contain HeapObject as elements. | 2212 // Makes sure that this object can contain HeapObject as elements. |
2237 static inline void EnsureCanContainHeapObjectElements(Handle<JSObject> obj); | 2213 static inline void EnsureCanContainHeapObjectElements(Handle<JSObject> obj); |
2238 | 2214 |
2239 // Makes sure that this object can contain the specified elements. | 2215 // Makes sure that this object can contain the specified elements. |
2240 static inline void EnsureCanContainElements( | 2216 static inline void EnsureCanContainElements( |
2241 Handle<JSObject> object, | 2217 Handle<JSObject> object, |
2242 Object** elements, | 2218 Object** elements, |
2243 uint32_t count, | 2219 uint32_t count, |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2508 Handle<Object> value, | 2484 Handle<Object> value, |
2509 PropertyAttributes attributes); | 2485 PropertyAttributes attributes); |
2510 | 2486 |
2511 MUST_USE_RESULT static Maybe<bool> DeletePropertyWithInterceptor( | 2487 MUST_USE_RESULT static Maybe<bool> DeletePropertyWithInterceptor( |
2512 LookupIterator* it, ShouldThrow should_throw); | 2488 LookupIterator* it, ShouldThrow should_throw); |
2513 | 2489 |
2514 bool ReferencesObjectFromElements(FixedArray* elements, | 2490 bool ReferencesObjectFromElements(FixedArray* elements, |
2515 ElementsKind kind, | 2491 ElementsKind kind, |
2516 Object* object); | 2492 Object* object); |
2517 | 2493 |
2518 // Return the hash table backing store or the inline stored identity hash, | |
2519 // whatever is found. | |
2520 MUST_USE_RESULT Object* GetHiddenPropertiesHashTable(); | |
2521 | |
2522 // Return the hash table backing store for hidden properties. If there is no | |
2523 // backing store, allocate one. | |
2524 static Handle<ObjectHashTable> GetOrCreateHiddenPropertiesHashtable( | |
2525 Handle<JSObject> object); | |
2526 | |
2527 // Set the hidden property backing store to either a hash table or | |
2528 // the inline-stored identity hash. | |
2529 static Handle<Object> SetHiddenPropertiesHashTable( | |
2530 Handle<JSObject> object, | |
2531 Handle<Object> value); | |
2532 | |
2533 static Handle<Object> GetIdentityHash(Isolate* isolate, | 2494 static Handle<Object> GetIdentityHash(Isolate* isolate, |
2534 Handle<JSObject> object); | 2495 Handle<JSObject> object); |
2535 | 2496 |
2536 static Handle<Smi> GetOrCreateIdentityHash(Handle<JSObject> object); | 2497 static Handle<Smi> GetOrCreateIdentityHash(Handle<JSObject> object); |
2537 | 2498 |
2538 // Helper for fast versions of preventExtensions, seal, and freeze. | 2499 // Helper for fast versions of preventExtensions, seal, and freeze. |
2539 // attrs is one of NONE, SEALED, or FROZEN (depending on the operation). | 2500 // attrs is one of NONE, SEALED, or FROZEN (depending on the operation). |
2540 template <PropertyAttributes attrs> | 2501 template <PropertyAttributes attrs> |
2541 MUST_USE_RESULT static Maybe<bool> PreventExtensionsWithTransition( | 2502 MUST_USE_RESULT static Maybe<bool> PreventExtensionsWithTransition( |
2542 Handle<JSObject> object, ShouldThrow should_throw); | 2503 Handle<JSObject> object, ShouldThrow should_throw); |
(...skipping 8226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10769 } | 10730 } |
10770 return value; | 10731 return value; |
10771 } | 10732 } |
10772 }; | 10733 }; |
10773 | 10734 |
10774 | 10735 |
10775 } // NOLINT, false-positive due to second-order macros. | 10736 } // NOLINT, false-positive due to second-order macros. |
10776 } // NOLINT, false-positive due to second-order macros. | 10737 } // NOLINT, false-positive due to second-order macros. |
10777 | 10738 |
10778 #endif // V8_OBJECTS_H_ | 10739 #endif // V8_OBJECTS_H_ |
OLD | NEW |