| 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 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1582 enum AccessorComponent { | 1582 enum AccessorComponent { |
| 1583 ACCESSOR_GETTER, | 1583 ACCESSOR_GETTER, |
| 1584 ACCESSOR_SETTER | 1584 ACCESSOR_SETTER |
| 1585 }; | 1585 }; |
| 1586 | 1586 |
| 1587 | 1587 |
| 1588 // JSReceiver includes types on which properties can be defined, i.e., | 1588 // JSReceiver includes types on which properties can be defined, i.e., |
| 1589 // JSObject and JSProxy. | 1589 // JSObject and JSProxy. |
| 1590 class JSReceiver: public HeapObject { | 1590 class JSReceiver: public HeapObject { |
| 1591 public: | 1591 public: |
| 1592 enum DeleteMode { | |
| 1593 NORMAL_DELETION, | |
| 1594 STRICT_DELETION, | |
| 1595 FORCE_DELETION | |
| 1596 }; | |
| 1597 | |
| 1598 DECLARE_CAST(JSReceiver) | 1592 DECLARE_CAST(JSReceiver) |
| 1599 | 1593 |
| 1600 MUST_USE_RESULT static MaybeHandle<Object> SetElement( | 1594 MUST_USE_RESULT static MaybeHandle<Object> SetElement( |
| 1601 Handle<JSReceiver> object, | 1595 Handle<JSReceiver> object, |
| 1602 uint32_t index, | 1596 uint32_t index, |
| 1603 Handle<Object> value, | 1597 Handle<Object> value, |
| 1604 PropertyAttributes attributes, | 1598 PropertyAttributes attributes, |
| 1605 StrictMode strict_mode); | 1599 StrictMode strict_mode); |
| 1606 | 1600 |
| 1607 // Implementation of [[HasProperty]], ECMA-262 5th edition, section 8.12.6. | 1601 // Implementation of [[HasProperty]], ECMA-262 5th edition, section 8.12.6. |
| 1608 MUST_USE_RESULT static inline Maybe<bool> HasProperty( | 1602 MUST_USE_RESULT static inline Maybe<bool> HasProperty( |
| 1609 Handle<JSReceiver> object, Handle<Name> name); | 1603 Handle<JSReceiver> object, Handle<Name> name); |
| 1610 MUST_USE_RESULT static inline Maybe<bool> HasOwnProperty(Handle<JSReceiver>, | 1604 MUST_USE_RESULT static inline Maybe<bool> HasOwnProperty(Handle<JSReceiver>, |
| 1611 Handle<Name> name); | 1605 Handle<Name> name); |
| 1612 MUST_USE_RESULT static inline Maybe<bool> HasElement( | 1606 MUST_USE_RESULT static inline Maybe<bool> HasElement( |
| 1613 Handle<JSReceiver> object, uint32_t index); | 1607 Handle<JSReceiver> object, uint32_t index); |
| 1614 MUST_USE_RESULT static inline Maybe<bool> HasOwnElement( | 1608 MUST_USE_RESULT static inline Maybe<bool> HasOwnElement( |
| 1615 Handle<JSReceiver> object, uint32_t index); | 1609 Handle<JSReceiver> object, uint32_t index); |
| 1616 | 1610 |
| 1617 // Implementation of [[Delete]], ECMA-262 5th edition, section 8.12.7. | 1611 // Implementation of [[Delete]], ECMA-262 5th edition, section 8.12.7. |
| 1618 MUST_USE_RESULT static MaybeHandle<Object> DeleteProperty( | 1612 MUST_USE_RESULT static MaybeHandle<Object> DeleteProperty( |
| 1619 Handle<JSReceiver> object, | 1613 Handle<JSReceiver> object, Handle<Name> name, |
| 1620 Handle<Name> name, | 1614 StrictMode strict_mode = SLOPPY); |
| 1621 DeleteMode mode = NORMAL_DELETION); | |
| 1622 MUST_USE_RESULT static MaybeHandle<Object> DeleteElement( | 1615 MUST_USE_RESULT static MaybeHandle<Object> DeleteElement( |
| 1623 Handle<JSReceiver> object, | 1616 Handle<JSReceiver> object, uint32_t index, |
| 1624 uint32_t index, | 1617 StrictMode strict_mode = SLOPPY); |
| 1625 DeleteMode mode = NORMAL_DELETION); | |
| 1626 | 1618 |
| 1627 // Tests for the fast common case for property enumeration. | 1619 // Tests for the fast common case for property enumeration. |
| 1628 bool IsSimpleEnum(); | 1620 bool IsSimpleEnum(); |
| 1629 | 1621 |
| 1630 // Returns the class name ([[Class]] property in the specification). | 1622 // Returns the class name ([[Class]] property in the specification). |
| 1631 String* class_name(); | 1623 String* class_name(); |
| 1632 | 1624 |
| 1633 // Returns the constructor name (the name (possibly, inferred name) of the | 1625 // Returns the constructor name (the name (possibly, inferred name) of the |
| 1634 // function that was used to instantiate the object). | 1626 // function that was used to instantiate the object). |
| 1635 String* constructor_name(); | 1627 String* constructor_name(); |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2334 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithFailedAccessCheck( | 2326 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithFailedAccessCheck( |
| 2335 LookupIterator* it, Handle<Object> value, StrictMode strict_mode); | 2327 LookupIterator* it, Handle<Object> value, StrictMode strict_mode); |
| 2336 | 2328 |
| 2337 // Add a property to a slow-case object. | 2329 // Add a property to a slow-case object. |
| 2338 static void AddSlowProperty(Handle<JSObject> object, | 2330 static void AddSlowProperty(Handle<JSObject> object, |
| 2339 Handle<Name> name, | 2331 Handle<Name> name, |
| 2340 Handle<Object> value, | 2332 Handle<Object> value, |
| 2341 PropertyAttributes attributes); | 2333 PropertyAttributes attributes); |
| 2342 | 2334 |
| 2343 MUST_USE_RESULT static MaybeHandle<Object> DeleteProperty( | 2335 MUST_USE_RESULT static MaybeHandle<Object> DeleteProperty( |
| 2344 Handle<JSObject> object, | 2336 Handle<JSObject> object, Handle<Name> name, StrictMode strict_mode); |
| 2345 Handle<Name> name, | |
| 2346 DeleteMode mode); | |
| 2347 MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithInterceptor( | 2337 MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithInterceptor( |
| 2348 Handle<JSObject> holder, Handle<JSObject> receiver, Handle<Name> name); | 2338 Handle<JSObject> holder, Handle<JSObject> receiver, Handle<Name> name); |
| 2349 | 2339 |
| 2350 // Deletes the named property in a normalized object. | 2340 // Deletes an existing named property in a normalized object. |
| 2351 static Handle<Object> DeleteNormalizedProperty(Handle<JSObject> object, | 2341 static void DeleteNormalizedProperty(Handle<JSObject> object, |
| 2352 Handle<Name> name, | 2342 Handle<Name> name); |
| 2353 DeleteMode mode); | |
| 2354 | 2343 |
| 2355 MUST_USE_RESULT static MaybeHandle<Object> DeleteElement( | 2344 MUST_USE_RESULT static MaybeHandle<Object> DeleteElement( |
| 2356 Handle<JSObject> object, | 2345 Handle<JSObject> object, uint32_t index, StrictMode strict_mode); |
| 2357 uint32_t index, | |
| 2358 DeleteMode mode); | |
| 2359 MUST_USE_RESULT static MaybeHandle<Object> DeleteElementWithInterceptor( | 2346 MUST_USE_RESULT static MaybeHandle<Object> DeleteElementWithInterceptor( |
| 2360 Handle<JSObject> object, | 2347 Handle<JSObject> object, |
| 2361 uint32_t index); | 2348 uint32_t index); |
| 2362 | 2349 |
| 2363 bool ReferencesObjectFromElements(FixedArray* elements, | 2350 bool ReferencesObjectFromElements(FixedArray* elements, |
| 2364 ElementsKind kind, | 2351 ElementsKind kind, |
| 2365 Object* object); | 2352 Object* object); |
| 2366 | 2353 |
| 2367 // Returns true if most of the elements backing storage is used. | 2354 // Returns true if most of the elements backing storage is used. |
| 2368 bool HasDenseElements(); | 2355 bool HasDenseElements(); |
| (...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3549 | 3536 |
| 3550 // Set the details for entry. | 3537 // Set the details for entry. |
| 3551 void DetailsAtPut(int entry, PropertyDetails value) { | 3538 void DetailsAtPut(int entry, PropertyDetails value) { |
| 3552 this->set(DerivedHashTable::EntryToIndex(entry) + 2, value.AsSmi()); | 3539 this->set(DerivedHashTable::EntryToIndex(entry) + 2, value.AsSmi()); |
| 3553 } | 3540 } |
| 3554 | 3541 |
| 3555 // Sorting support | 3542 // Sorting support |
| 3556 void CopyValuesTo(FixedArray* elements); | 3543 void CopyValuesTo(FixedArray* elements); |
| 3557 | 3544 |
| 3558 // Delete a property from the dictionary. | 3545 // Delete a property from the dictionary. |
| 3559 static Handle<Object> DeleteProperty( | 3546 static Handle<Object> DeleteProperty(Handle<Derived> dictionary, int entry); |
| 3560 Handle<Derived> dictionary, | |
| 3561 int entry, | |
| 3562 JSObject::DeleteMode mode); | |
| 3563 | 3547 |
| 3564 // Attempt to shrink the dictionary after deletion of key. | 3548 // Attempt to shrink the dictionary after deletion of key. |
| 3565 MUST_USE_RESULT static inline Handle<Derived> Shrink( | 3549 MUST_USE_RESULT static inline Handle<Derived> Shrink( |
| 3566 Handle<Derived> dictionary, | 3550 Handle<Derived> dictionary, |
| 3567 Key key) { | 3551 Key key) { |
| 3568 return DerivedHashTable::Shrink(dictionary, key); | 3552 return DerivedHashTable::Shrink(dictionary, key); |
| 3569 } | 3553 } |
| 3570 | 3554 |
| 3571 // Returns the number of elements in the dictionary filtering out properties | 3555 // Returns the number of elements in the dictionary filtering out properties |
| 3572 // with the specified attributes. | 3556 // with the specified attributes. |
| (...skipping 6263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9836 uint32_t index, | 9820 uint32_t index, |
| 9837 Handle<Object> value, | 9821 Handle<Object> value, |
| 9838 StrictMode strict_mode); | 9822 StrictMode strict_mode); |
| 9839 | 9823 |
| 9840 MUST_USE_RESULT static Maybe<bool> HasPropertyWithHandler( | 9824 MUST_USE_RESULT static Maybe<bool> HasPropertyWithHandler( |
| 9841 Handle<JSProxy> proxy, Handle<Name> name); | 9825 Handle<JSProxy> proxy, Handle<Name> name); |
| 9842 MUST_USE_RESULT static inline Maybe<bool> HasElementWithHandler( | 9826 MUST_USE_RESULT static inline Maybe<bool> HasElementWithHandler( |
| 9843 Handle<JSProxy> proxy, uint32_t index); | 9827 Handle<JSProxy> proxy, uint32_t index); |
| 9844 | 9828 |
| 9845 MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithHandler( | 9829 MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithHandler( |
| 9846 Handle<JSProxy> proxy, | 9830 Handle<JSProxy> proxy, Handle<Name> name, StrictMode strict_mode); |
| 9847 Handle<Name> name, | |
| 9848 DeleteMode mode); | |
| 9849 MUST_USE_RESULT static MaybeHandle<Object> DeleteElementWithHandler( | 9831 MUST_USE_RESULT static MaybeHandle<Object> DeleteElementWithHandler( |
| 9850 Handle<JSProxy> proxy, | 9832 Handle<JSProxy> proxy, uint32_t index, StrictMode strict_mode); |
| 9851 uint32_t index, | |
| 9852 DeleteMode mode); | |
| 9853 | 9833 |
| 9854 MUST_USE_RESULT Object* GetIdentityHash(); | 9834 MUST_USE_RESULT Object* GetIdentityHash(); |
| 9855 | 9835 |
| 9856 static Handle<Smi> GetOrCreateIdentityHash(Handle<JSProxy> proxy); | 9836 static Handle<Smi> GetOrCreateIdentityHash(Handle<JSProxy> proxy); |
| 9857 | 9837 |
| 9858 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); | 9838 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); |
| 9859 }; | 9839 }; |
| 9860 | 9840 |
| 9861 | 9841 |
| 9862 class JSFunctionProxy: public JSProxy { | 9842 class JSFunctionProxy: public JSProxy { |
| (...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10954 } else { | 10934 } else { |
| 10955 value &= ~(1 << bit_position); | 10935 value &= ~(1 << bit_position); |
| 10956 } | 10936 } |
| 10957 return value; | 10937 return value; |
| 10958 } | 10938 } |
| 10959 }; | 10939 }; |
| 10960 | 10940 |
| 10961 } } // namespace v8::internal | 10941 } } // namespace v8::internal |
| 10962 | 10942 |
| 10963 #endif // V8_OBJECTS_H_ | 10943 #endif // V8_OBJECTS_H_ |
| OLD | NEW |