OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1569 // been modified since it was created. May give false positives. | 1569 // been modified since it was created. May give false positives. |
1570 bool IsDirty(); | 1570 bool IsDirty(); |
1571 | 1571 |
1572 // If the receiver is a JSGlobalProxy this method will return its prototype, | 1572 // If the receiver is a JSGlobalProxy this method will return its prototype, |
1573 // otherwise the result is the receiver itself. | 1573 // otherwise the result is the receiver itself. |
1574 inline Object* BypassGlobalProxy(); | 1574 inline Object* BypassGlobalProxy(); |
1575 | 1575 |
1576 // Accessors for hidden properties object. | 1576 // Accessors for hidden properties object. |
1577 // | 1577 // |
1578 // Hidden properties are not local properties of the object itself. | 1578 // Hidden properties are not local properties of the object itself. |
1579 // Instead they are stored on an auxiliary JSObject stored as a local | 1579 // Instead they are stored in an auxiliary structure kept as a local |
1580 // property with a special name Heap::hidden_symbol(). But if the | 1580 // property with a special name Heap::hidden_symbol(). But if the |
1581 // receiver is a JSGlobalProxy then the auxiliary object is a property | 1581 // receiver is a JSGlobalProxy then the auxiliary object is a property |
1582 // of its prototype. | 1582 // of its prototype, and if it's a detached proxy, then you can't have |
1583 // | 1583 // hidden properties. |
1584 // Has/Get/SetHiddenPropertiesObject methods don't allow the holder to be | |
1585 // a JSGlobalProxy. Use BypassGlobalProxy method above to get to the real | |
1586 // holder. | |
1587 // | |
1588 // These accessors do not touch interceptors or accessors. | |
1589 inline bool HasHiddenPropertiesObject(); | |
1590 inline Object* GetHiddenPropertiesObject(); | |
1591 MUST_USE_RESULT inline MaybeObject* SetHiddenPropertiesObject( | |
1592 Object* hidden_obj); | |
1593 | 1584 |
1594 // Retrieves the hidden properties object. | 1585 // Sets a hidden property on this object. Returns this object if successfull, |
Rico
2011/09/28 08:59:56
remove one l from successfull
| |
1595 // | 1586 // undefined if called on a detached proxy, and a failure if a GC |
1596 // The undefined value might be returned in case no hidden properties object | 1587 // is required |
1597 // is present and creation was omitted. | 1588 MaybeObject* SetHiddenProperty(String* key, Object* value); |
1598 inline bool HasHiddenProperties(); | 1589 // Gets the value of a hidden property with the given key. Returns undefined |
1599 MUST_USE_RESULT MaybeObject* GetHiddenProperties(CreationFlag flag); | 1590 // if the property doesn't exist (or if called on a detached proxy), |
1591 // otherwise returns the value set for the key. | |
1592 Object* GetHiddenProperty(String* key); | |
1593 // Deletes a hidden property. Deleting a non-existing property is | |
1594 // considered successful. | |
1595 void DeleteHiddenProperty(String* key); | |
1596 // Returns true if the object has a property with the hidden symbol as name. | |
1597 bool HasHiddenProperties(); | |
1600 | 1598 |
1601 MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); | 1599 MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); |
1602 MUST_USE_RESULT MaybeObject* SetIdentityHash(Object* hash, CreationFlag flag); | 1600 MUST_USE_RESULT MaybeObject* SetIdentityHash(Object* hash, CreationFlag flag); |
1603 | 1601 |
1604 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode); | 1602 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode); |
1605 MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode); | 1603 MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode); |
1606 | 1604 |
1607 // Tests for the fast common case for property enumeration. | 1605 // Tests for the fast common case for property enumeration. |
1608 bool IsSimpleEnum(); | 1606 bool IsSimpleEnum(); |
1609 | 1607 |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2030 MUST_USE_RESULT MaybeObject* SetPropertyCallback( | 2028 MUST_USE_RESULT MaybeObject* SetPropertyCallback( |
2031 String* name, | 2029 String* name, |
2032 Object* structure, | 2030 Object* structure, |
2033 PropertyAttributes attributes); | 2031 PropertyAttributes attributes); |
2034 MUST_USE_RESULT MaybeObject* DefineGetterSetter( | 2032 MUST_USE_RESULT MaybeObject* DefineGetterSetter( |
2035 String* name, | 2033 String* name, |
2036 PropertyAttributes attributes); | 2034 PropertyAttributes attributes); |
2037 | 2035 |
2038 void LookupInDescriptor(String* name, LookupResult* result); | 2036 void LookupInDescriptor(String* name, LookupResult* result); |
2039 | 2037 |
2038 // Returns the hidden properties backing store object, currently | |
2039 // a StringDictionary, stored on this object. | |
2040 // If no hidden properties object has been put on this object, | |
2041 // return undefined, unless create_if_absent is true, in which case | |
2042 // a new dictionary is created, added to this object, and returned. | |
2043 MaybeObject* GetHiddenPropertiesDictionary(bool create_if_absent); | |
2044 // Updates the existing hidden properties dictionary. | |
2045 MaybeObject* SetHiddenPropertiesDictionary(StringDictionary* dictionary); | |
2046 | |
2040 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); | 2047 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); |
2041 }; | 2048 }; |
2042 | 2049 |
2043 | 2050 |
2044 // Common superclass for FixedArrays that allow implementations to share | 2051 // Common superclass for FixedArrays that allow implementations to share |
2045 // common accessors and some code paths. | 2052 // common accessors and some code paths. |
2046 class FixedArrayBase: public HeapObject { | 2053 class FixedArrayBase: public HeapObject { |
2047 public: | 2054 public: |
2048 // [length]: length of the array. | 2055 // [length]: length of the array. |
2049 inline int length(); | 2056 inline int length(); |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2855 } | 2862 } |
2856 | 2863 |
2857 // Copies enumerable keys to preallocated fixed array. | 2864 // Copies enumerable keys to preallocated fixed array. |
2858 void CopyEnumKeysTo(FixedArray* storage, FixedArray* sort_array); | 2865 void CopyEnumKeysTo(FixedArray* storage, FixedArray* sort_array); |
2859 | 2866 |
2860 // For transforming properties of a JSObject. | 2867 // For transforming properties of a JSObject. |
2861 MUST_USE_RESULT MaybeObject* TransformPropertiesToFastFor( | 2868 MUST_USE_RESULT MaybeObject* TransformPropertiesToFastFor( |
2862 JSObject* obj, | 2869 JSObject* obj, |
2863 int unused_property_fields); | 2870 int unused_property_fields); |
2864 | 2871 |
2865 // Find entry for key otherwise return kNotFound. Optimzed version of | 2872 // Find entry for key, otherwise return kNotFound. Optimized version of |
2866 // HashTable::FindEntry. | 2873 // HashTable::FindEntry. |
2867 int FindEntry(String* key); | 2874 int FindEntry(String* key); |
2868 }; | 2875 }; |
2869 | 2876 |
2870 | 2877 |
2871 class NumberDictionaryShape { | 2878 class NumberDictionaryShape { |
2872 public: | 2879 public: |
2873 static inline bool IsMatch(uint32_t key, Object* other); | 2880 static inline bool IsMatch(uint32_t key, Object* other); |
2874 static inline uint32_t Hash(uint32_t key); | 2881 static inline uint32_t Hash(uint32_t key); |
2875 static inline uint32_t HashForObject(uint32_t key, Object* object); | 2882 static inline uint32_t HashForObject(uint32_t key, Object* object); |
(...skipping 4673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7549 } else { | 7556 } else { |
7550 value &= ~(1 << bit_position); | 7557 value &= ~(1 << bit_position); |
7551 } | 7558 } |
7552 return value; | 7559 return value; |
7553 } | 7560 } |
7554 }; | 7561 }; |
7555 | 7562 |
7556 } } // namespace v8::internal | 7563 } } // namespace v8::internal |
7557 | 7564 |
7558 #endif // V8_OBJECTS_H_ | 7565 #endif // V8_OBJECTS_H_ |
OLD | NEW |