| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2032 // be added even though the receiver is non-extensible. | 2032 // be added even though the receiver is non-extensible. |
| 2033 enum ExtensibilityCheck { | 2033 enum ExtensibilityCheck { |
| 2034 PERFORM_EXTENSIBILITY_CHECK, | 2034 PERFORM_EXTENSIBILITY_CHECK, |
| 2035 OMIT_EXTENSIBILITY_CHECK | 2035 OMIT_EXTENSIBILITY_CHECK |
| 2036 }; | 2036 }; |
| 2037 | 2037 |
| 2038 // Casting. | 2038 // Casting. |
| 2039 static inline JSReceiver* cast(Object* obj); | 2039 static inline JSReceiver* cast(Object* obj); |
| 2040 | 2040 |
| 2041 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5. | 2041 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5. |
| 2042 static Handle<Object> SetProperty(Handle<JSReceiver> object, | 2042 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( |
| 2043 Handle<Name> key, | 2043 Handle<JSReceiver> object, |
| 2044 Handle<Object> value, | 2044 Handle<Name> key, |
| 2045 PropertyAttributes attributes, | 2045 Handle<Object> value, |
| 2046 StrictMode strict_mode, | 2046 PropertyAttributes attributes, |
| 2047 StoreFromKeyed store_mode = | 2047 StrictMode strict_mode, |
| 2048 MAY_BE_STORE_FROM_KEYED); | 2048 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); |
| 2049 static Handle<Object> SetElement(Handle<JSReceiver> object, | 2049 static Handle<Object> SetElement(Handle<JSReceiver> object, |
| 2050 uint32_t index, | 2050 uint32_t index, |
| 2051 Handle<Object> value, | 2051 Handle<Object> value, |
| 2052 PropertyAttributes attributes, | 2052 PropertyAttributes attributes, |
| 2053 StrictMode strict_mode); | 2053 StrictMode strict_mode); |
| 2054 | 2054 |
| 2055 // Implementation of [[HasProperty]], ECMA-262 5th edition, section 8.12.6. | 2055 // Implementation of [[HasProperty]], ECMA-262 5th edition, section 8.12.6. |
| 2056 static inline bool HasProperty(Handle<JSReceiver> object, Handle<Name> name); | 2056 static inline bool HasProperty(Handle<JSReceiver> object, Handle<Name> name); |
| 2057 static inline bool HasLocalProperty(Handle<JSReceiver>, Handle<Name> name); | 2057 static inline bool HasLocalProperty(Handle<JSReceiver>, Handle<Name> name); |
| 2058 static inline bool HasElement(Handle<JSReceiver> object, uint32_t index); | 2058 static inline bool HasElement(Handle<JSReceiver> object, uint32_t index); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2123 Handle<Object> value); | 2123 Handle<Object> value); |
| 2124 | 2124 |
| 2125 private: | 2125 private: |
| 2126 static PropertyAttributes GetPropertyAttributeForResult( | 2126 static PropertyAttributes GetPropertyAttributeForResult( |
| 2127 Handle<JSReceiver> object, | 2127 Handle<JSReceiver> object, |
| 2128 Handle<JSReceiver> receiver, | 2128 Handle<JSReceiver> receiver, |
| 2129 LookupResult* result, | 2129 LookupResult* result, |
| 2130 Handle<Name> name, | 2130 Handle<Name> name, |
| 2131 bool continue_search); | 2131 bool continue_search); |
| 2132 | 2132 |
| 2133 static Handle<Object> SetProperty(Handle<JSReceiver> receiver, | 2133 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( |
| 2134 LookupResult* result, | 2134 Handle<JSReceiver> receiver, |
| 2135 Handle<Name> key, | 2135 LookupResult* result, |
| 2136 Handle<Object> value, | 2136 Handle<Name> key, |
| 2137 PropertyAttributes attributes, | 2137 Handle<Object> value, |
| 2138 StrictMode strict_mode, | 2138 PropertyAttributes attributes, |
| 2139 StoreFromKeyed store_from_keyed); | 2139 StrictMode strict_mode, |
| 2140 StoreFromKeyed store_from_keyed); |
| 2140 | 2141 |
| 2141 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); | 2142 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); |
| 2142 }; | 2143 }; |
| 2143 | 2144 |
| 2144 // Forward declaration for JSObject::GetOrCreateHiddenPropertiesHashTable. | 2145 // Forward declaration for JSObject::GetOrCreateHiddenPropertiesHashTable. |
| 2145 class ObjectHashTable; | 2146 class ObjectHashTable; |
| 2146 | 2147 |
| 2147 // The JSObject describes real heap allocated JavaScript objects with | 2148 // The JSObject describes real heap allocated JavaScript objects with |
| 2148 // properties. | 2149 // properties. |
| 2149 // Note that the map of JSObject changes during execution to enable inline | 2150 // Note that the map of JSObject changes during execution to enable inline |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2245 // a dictionary, and it will stay a dictionary. | 2246 // a dictionary, and it will stay a dictionary. |
| 2246 static Handle<Object> PrepareSlowElementsForSort(Handle<JSObject> object, | 2247 static Handle<Object> PrepareSlowElementsForSort(Handle<JSObject> object, |
| 2247 uint32_t limit); | 2248 uint32_t limit); |
| 2248 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); | 2249 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); |
| 2249 | 2250 |
| 2250 static Handle<Object> GetPropertyWithCallback(Handle<JSObject> object, | 2251 static Handle<Object> GetPropertyWithCallback(Handle<JSObject> object, |
| 2251 Handle<Object> receiver, | 2252 Handle<Object> receiver, |
| 2252 Handle<Object> structure, | 2253 Handle<Object> structure, |
| 2253 Handle<Name> name); | 2254 Handle<Name> name); |
| 2254 | 2255 |
| 2255 static Handle<Object> SetPropertyWithCallback( | 2256 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithCallback( |
| 2256 Handle<JSObject> object, | 2257 Handle<JSObject> object, |
| 2257 Handle<Object> structure, | 2258 Handle<Object> structure, |
| 2258 Handle<Name> name, | 2259 Handle<Name> name, |
| 2259 Handle<Object> value, | 2260 Handle<Object> value, |
| 2260 Handle<JSObject> holder, | 2261 Handle<JSObject> holder, |
| 2261 StrictMode strict_mode); | 2262 StrictMode strict_mode); |
| 2262 | 2263 |
| 2263 static Handle<Object> SetPropertyWithInterceptor( | 2264 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithInterceptor( |
| 2264 Handle<JSObject> object, | 2265 Handle<JSObject> object, |
| 2265 Handle<Name> name, | 2266 Handle<Name> name, |
| 2266 Handle<Object> value, | 2267 Handle<Object> value, |
| 2267 PropertyAttributes attributes, | 2268 PropertyAttributes attributes, |
| 2268 StrictMode strict_mode); | 2269 StrictMode strict_mode); |
| 2269 | 2270 |
| 2270 static Handle<Object> SetPropertyForResult( | 2271 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyForResult( |
| 2271 Handle<JSObject> object, | 2272 Handle<JSObject> object, |
| 2272 LookupResult* result, | 2273 LookupResult* result, |
| 2273 Handle<Name> name, | 2274 Handle<Name> name, |
| 2274 Handle<Object> value, | 2275 Handle<Object> value, |
| 2275 PropertyAttributes attributes, | 2276 PropertyAttributes attributes, |
| 2276 StrictMode strict_mode, | 2277 StrictMode strict_mode, |
| 2277 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); | 2278 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); |
| 2278 | 2279 |
| 2279 static Handle<Object> SetLocalPropertyIgnoreAttributes( | 2280 MUST_USE_RESULT static MaybeHandle<Object> SetLocalPropertyIgnoreAttributes( |
| 2280 Handle<JSObject> object, | 2281 Handle<JSObject> object, |
| 2281 Handle<Name> key, | 2282 Handle<Name> key, |
| 2282 Handle<Object> value, | 2283 Handle<Object> value, |
| 2283 PropertyAttributes attributes, | 2284 PropertyAttributes attributes, |
| 2284 ValueType value_type = OPTIMAL_REPRESENTATION, | 2285 ValueType value_type = OPTIMAL_REPRESENTATION, |
| 2285 StoreMode mode = ALLOW_AS_CONSTANT, | 2286 StoreMode mode = ALLOW_AS_CONSTANT, |
| 2286 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK); | 2287 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK); |
| 2287 | 2288 |
| 2288 static inline Handle<String> ExpectedTransitionKey(Handle<Map> map); | 2289 static inline Handle<String> ExpectedTransitionKey(Handle<Map> map); |
| 2289 static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map); | 2290 static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map); |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2633 Object* pre_allocated_value, | 2634 Object* pre_allocated_value, |
| 2634 Object* filler_value); | 2635 Object* filler_value); |
| 2635 | 2636 |
| 2636 // Check whether this object references another object | 2637 // Check whether this object references another object |
| 2637 bool ReferencesObject(Object* obj); | 2638 bool ReferencesObject(Object* obj); |
| 2638 | 2639 |
| 2639 // Disalow further properties to be added to the object. | 2640 // Disalow further properties to be added to the object. |
| 2640 static Handle<Object> PreventExtensions(Handle<JSObject> object); | 2641 static Handle<Object> PreventExtensions(Handle<JSObject> object); |
| 2641 | 2642 |
| 2642 // ES5 Object.freeze | 2643 // ES5 Object.freeze |
| 2643 static MaybeHandle<Object> Freeze(Handle<JSObject> object); | 2644 MUST_USE_RESULT static MaybeHandle<Object> Freeze(Handle<JSObject> object); |
| 2644 | 2645 |
| 2645 // Called the first time an object is observed with ES7 Object.observe. | 2646 // Called the first time an object is observed with ES7 Object.observe. |
| 2646 static void SetObserved(Handle<JSObject> object); | 2647 static void SetObserved(Handle<JSObject> object); |
| 2647 | 2648 |
| 2648 // Copy object. | 2649 // Copy object. |
| 2649 enum DeepCopyHints { | 2650 enum DeepCopyHints { |
| 2650 kNoHints = 0, | 2651 kNoHints = 0, |
| 2651 kObjectIsShallowArray = 1 | 2652 kObjectIsShallowArray = 1 |
| 2652 }; | 2653 }; |
| 2653 | 2654 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2835 Handle<JSObject> object, | 2836 Handle<JSObject> object, |
| 2836 uint32_t index, | 2837 uint32_t index, |
| 2837 Handle<Object> value, | 2838 Handle<Object> value, |
| 2838 StrictMode strict_mode, | 2839 StrictMode strict_mode, |
| 2839 bool check_prototype = true); | 2840 bool check_prototype = true); |
| 2840 | 2841 |
| 2841 // Searches the prototype chain for property 'name'. If it is found and | 2842 // Searches the prototype chain for property 'name'. If it is found and |
| 2842 // has a setter, invoke it and set '*done' to true. If it is found and is | 2843 // has a setter, invoke it and set '*done' to true. If it is found and is |
| 2843 // read-only, reject and set '*done' to true. Otherwise, set '*done' to | 2844 // read-only, reject and set '*done' to true. Otherwise, set '*done' to |
| 2844 // false. Can throw and return an empty handle with '*done==true'. | 2845 // false. Can throw and return an empty handle with '*done==true'. |
| 2845 static Handle<Object> SetPropertyViaPrototypes( | 2846 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyViaPrototypes( |
| 2846 Handle<JSObject> object, | 2847 Handle<JSObject> object, |
| 2847 Handle<Name> name, | 2848 Handle<Name> name, |
| 2848 Handle<Object> value, | 2849 Handle<Object> value, |
| 2849 PropertyAttributes attributes, | 2850 PropertyAttributes attributes, |
| 2850 StrictMode strict_mode, | 2851 StrictMode strict_mode, |
| 2851 bool* done); | 2852 bool* done); |
| 2852 static Handle<Object> SetPropertyPostInterceptor( | 2853 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyPostInterceptor( |
| 2853 Handle<JSObject> object, | 2854 Handle<JSObject> object, |
| 2854 Handle<Name> name, | 2855 Handle<Name> name, |
| 2855 Handle<Object> value, | 2856 Handle<Object> value, |
| 2856 PropertyAttributes attributes, | 2857 PropertyAttributes attributes, |
| 2857 StrictMode strict_mode); | 2858 StrictMode strict_mode); |
| 2858 static Handle<Object> SetPropertyUsingTransition( | 2859 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyUsingTransition( |
| 2859 Handle<JSObject> object, | 2860 Handle<JSObject> object, |
| 2860 LookupResult* lookup, | 2861 LookupResult* lookup, |
| 2861 Handle<Name> name, | 2862 Handle<Name> name, |
| 2862 Handle<Object> value, | 2863 Handle<Object> value, |
| 2863 PropertyAttributes attributes); | 2864 PropertyAttributes attributes); |
| 2864 static Handle<Object> SetPropertyWithFailedAccessCheck( | 2865 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithFailedAccessCheck( |
| 2865 Handle<JSObject> object, | 2866 Handle<JSObject> object, |
| 2866 LookupResult* result, | 2867 LookupResult* result, |
| 2867 Handle<Name> name, | 2868 Handle<Name> name, |
| 2868 Handle<Object> value, | 2869 Handle<Object> value, |
| 2869 bool check_prototype, | 2870 bool check_prototype, |
| 2870 StrictMode strict_mode); | 2871 StrictMode strict_mode); |
| 2871 | 2872 |
| 2872 // Add a property to an object. | 2873 // Add a property to an object. |
| 2873 static Handle<Object> AddProperty( | 2874 MUST_USE_RESULT static MaybeHandle<Object> AddProperty( |
| 2874 Handle<JSObject> object, | 2875 Handle<JSObject> object, |
| 2875 Handle<Name> name, | 2876 Handle<Name> name, |
| 2876 Handle<Object> value, | 2877 Handle<Object> value, |
| 2877 PropertyAttributes attributes, | 2878 PropertyAttributes attributes, |
| 2878 StrictMode strict_mode, | 2879 StrictMode strict_mode, |
| 2879 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, | 2880 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, |
| 2880 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, | 2881 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, |
| 2881 ValueType value_type = OPTIMAL_REPRESENTATION, | 2882 ValueType value_type = OPTIMAL_REPRESENTATION, |
| 2882 StoreMode mode = ALLOW_AS_CONSTANT, | 2883 StoreMode mode = ALLOW_AS_CONSTANT, |
| 2883 TransitionFlag flag = INSERT_TRANSITION); | 2884 TransitionFlag flag = INSERT_TRANSITION); |
| (...skipping 7938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10822 } else { | 10823 } else { |
| 10823 value &= ~(1 << bit_position); | 10824 value &= ~(1 << bit_position); |
| 10824 } | 10825 } |
| 10825 return value; | 10826 return value; |
| 10826 } | 10827 } |
| 10827 }; | 10828 }; |
| 10828 | 10829 |
| 10829 } } // namespace v8::internal | 10830 } } // namespace v8::internal |
| 10830 | 10831 |
| 10831 #endif // V8_OBJECTS_H_ | 10832 #endif // V8_OBJECTS_H_ |
| OLD | NEW |