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 2107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2118 // Returns the number of non-undefined values. | 2118 // Returns the number of non-undefined values. |
2119 MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit); | 2119 MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit); |
2120 // As PrepareElementsForSort, but only on objects where elements is | 2120 // As PrepareElementsForSort, but only on objects where elements is |
2121 // a dictionary, and it will stay a dictionary. | 2121 // a dictionary, and it will stay a dictionary. |
2122 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); | 2122 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); |
2123 | 2123 |
2124 MUST_USE_RESULT MaybeObject* GetPropertyWithCallback(Object* receiver, | 2124 MUST_USE_RESULT MaybeObject* GetPropertyWithCallback(Object* receiver, |
2125 Object* structure, | 2125 Object* structure, |
2126 Name* name); | 2126 Name* name); |
2127 | 2127 |
2128 MUST_USE_RESULT MaybeObject* SetPropertyWithFailedAccessCheck( | 2128 static Handle<Object> SetPropertyWithCallback( |
2129 LookupResult* result, | 2129 Handle<JSObject> object, |
2130 Name* name, | 2130 Handle<Object> structure, |
2131 Object* value, | 2131 Handle<Name> name, |
2132 bool check_prototype, | 2132 Handle<Object> value, |
| 2133 Handle<JSObject> holder, |
2133 StrictModeFlag strict_mode); | 2134 StrictModeFlag strict_mode); |
2134 MUST_USE_RESULT MaybeObject* SetPropertyWithCallback( | 2135 |
2135 Object* structure, | |
2136 Name* name, | |
2137 Object* value, | |
2138 JSObject* holder, | |
2139 StrictModeFlag strict_mode); | |
2140 static Handle<Object> SetPropertyWithInterceptor( | 2136 static Handle<Object> SetPropertyWithInterceptor( |
2141 Handle<JSObject> object, | 2137 Handle<JSObject> object, |
2142 Handle<Name> name, | 2138 Handle<Name> name, |
2143 Handle<Object> value, | 2139 Handle<Object> value, |
2144 PropertyAttributes attributes, | 2140 PropertyAttributes attributes, |
2145 StrictModeFlag strict_mode); | 2141 StrictModeFlag strict_mode); |
2146 | 2142 |
2147 static Handle<Object> SetPropertyForResult( | 2143 static Handle<Object> SetPropertyForResult( |
2148 Handle<JSObject> object, | 2144 Handle<JSObject> object, |
2149 LookupResult* result, | 2145 LookupResult* result, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2188 Object* value, | 2184 Object* value, |
2189 PropertyAttributes attributes, | 2185 PropertyAttributes attributes, |
2190 ValueType value_type = OPTIMAL_REPRESENTATION, | 2186 ValueType value_type = OPTIMAL_REPRESENTATION, |
2191 StoreMode mode = ALLOW_AS_CONSTANT, | 2187 StoreMode mode = ALLOW_AS_CONSTANT, |
2192 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK); | 2188 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK); |
2193 | 2189 |
2194 // Retrieve a value in a normalized object given a lookup result. | 2190 // Retrieve a value in a normalized object given a lookup result. |
2195 // Handles the special representation of JS global objects. | 2191 // Handles the special representation of JS global objects. |
2196 Object* GetNormalizedProperty(LookupResult* result); | 2192 Object* GetNormalizedProperty(LookupResult* result); |
2197 | 2193 |
2198 // Sets the property value in a normalized object given (key, value). | |
2199 // Handles the special representation of JS global objects. | |
2200 static Handle<Object> SetNormalizedProperty(Handle<JSObject> object, | |
2201 LookupResult* result, | |
2202 Handle<Object> value); | |
2203 | |
2204 // Sets the property value in a normalized object given a lookup result. | 2194 // Sets the property value in a normalized object given a lookup result. |
2205 // Handles the special representation of JS global objects. | 2195 // Handles the special representation of JS global objects. |
2206 MUST_USE_RESULT MaybeObject* SetNormalizedProperty(LookupResult* result, | 2196 static void SetNormalizedProperty(Handle<JSObject> object, |
2207 Object* value); | 2197 LookupResult* result, |
| 2198 Handle<Object> value); |
2208 | 2199 |
2209 // Sets the property value in a normalized object given (key, value, details). | 2200 // Sets the property value in a normalized object given (key, value, details). |
2210 // Handles the special representation of JS global objects. | 2201 // Handles the special representation of JS global objects. |
2211 static Handle<Object> SetNormalizedProperty(Handle<JSObject> object, | 2202 static void SetNormalizedProperty(Handle<JSObject> object, |
2212 Handle<Name> key, | 2203 Handle<Name> key, |
2213 Handle<Object> value, | 2204 Handle<Object> value, |
2214 PropertyDetails details); | 2205 PropertyDetails details); |
2215 | |
2216 MUST_USE_RESULT MaybeObject* SetNormalizedProperty(Name* name, | |
2217 Object* value, | |
2218 PropertyDetails details); | |
2219 | 2206 |
2220 static void OptimizeAsPrototype(Handle<JSObject> object); | 2207 static void OptimizeAsPrototype(Handle<JSObject> object); |
2221 | 2208 |
2222 // Retrieve interceptors. | 2209 // Retrieve interceptors. |
2223 InterceptorInfo* GetNamedInterceptor(); | 2210 InterceptorInfo* GetNamedInterceptor(); |
2224 InterceptorInfo* GetIndexedInterceptor(); | 2211 InterceptorInfo* GetIndexedInterceptor(); |
2225 | 2212 |
2226 // Used from JSReceiver. | 2213 // Used from JSReceiver. |
2227 PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver, | 2214 PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver, |
2228 Name* name, | 2215 Name* name, |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2435 inline int GetInternalFieldCount(); | 2422 inline int GetInternalFieldCount(); |
2436 inline int GetInternalFieldOffset(int index); | 2423 inline int GetInternalFieldOffset(int index); |
2437 inline Object* GetInternalField(int index); | 2424 inline Object* GetInternalField(int index); |
2438 inline void SetInternalField(int index, Object* value); | 2425 inline void SetInternalField(int index, Object* value); |
2439 inline void SetInternalField(int index, Smi* value); | 2426 inline void SetInternalField(int index, Smi* value); |
2440 | 2427 |
2441 // The following lookup functions skip interceptors. | 2428 // The following lookup functions skip interceptors. |
2442 void LocalLookupRealNamedProperty(Name* name, LookupResult* result); | 2429 void LocalLookupRealNamedProperty(Name* name, LookupResult* result); |
2443 void LookupRealNamedProperty(Name* name, LookupResult* result); | 2430 void LookupRealNamedProperty(Name* name, LookupResult* result); |
2444 void LookupRealNamedPropertyInPrototypes(Name* name, LookupResult* result); | 2431 void LookupRealNamedPropertyInPrototypes(Name* name, LookupResult* result); |
2445 MUST_USE_RESULT MaybeObject* SetElementWithCallbackSetterInPrototypes( | |
2446 uint32_t index, Object* value, bool* found, StrictModeFlag strict_mode); | |
2447 void LookupCallbackProperty(Name* name, LookupResult* result); | 2432 void LookupCallbackProperty(Name* name, LookupResult* result); |
2448 | 2433 |
2449 // Returns the number of properties on this object filtering out properties | 2434 // Returns the number of properties on this object filtering out properties |
2450 // with the specified attributes (ignoring interceptors). | 2435 // with the specified attributes (ignoring interceptors). |
2451 int NumberOfLocalProperties(PropertyAttributes filter = NONE); | 2436 int NumberOfLocalProperties(PropertyAttributes filter = NONE); |
2452 // Fill in details for properties into storage starting at the specified | 2437 // Fill in details for properties into storage starting at the specified |
2453 // index. | 2438 // index. |
2454 void GetLocalPropertyNames( | 2439 void GetLocalPropertyNames( |
2455 FixedArray* storage, int index, PropertyAttributes filter = NONE); | 2440 FixedArray* storage, int index, PropertyAttributes filter = NONE); |
2456 | 2441 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2675 uint32_t index, | 2660 uint32_t index, |
2676 Object* holder); | 2661 Object* holder); |
2677 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor( | 2662 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor( |
2678 JSReceiver* receiver, | 2663 JSReceiver* receiver, |
2679 uint32_t index, | 2664 uint32_t index, |
2680 bool continue_search); | 2665 bool continue_search); |
2681 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithoutInterceptor( | 2666 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithoutInterceptor( |
2682 JSReceiver* receiver, | 2667 JSReceiver* receiver, |
2683 uint32_t index, | 2668 uint32_t index, |
2684 bool continue_search); | 2669 bool continue_search); |
2685 MUST_USE_RESULT MaybeObject* SetElementWithCallback( | 2670 static Handle<Object> SetElementWithCallback( |
2686 Object* structure, | 2671 Handle<JSObject> object, |
| 2672 Handle<Object> structure, |
2687 uint32_t index, | 2673 uint32_t index, |
2688 Object* value, | 2674 Handle<Object> value, |
2689 JSObject* holder, | 2675 Handle<JSObject> holder, |
2690 StrictModeFlag strict_mode); | 2676 StrictModeFlag strict_mode); |
2691 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor( | 2677 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor( |
2692 uint32_t index, | 2678 uint32_t index, |
2693 Object* value, | 2679 Object* value, |
2694 PropertyAttributes attributes, | 2680 PropertyAttributes attributes, |
2695 StrictModeFlag strict_mode, | 2681 StrictModeFlag strict_mode, |
2696 bool check_prototype, | 2682 bool check_prototype, |
2697 SetPropertyMode set_mode); | 2683 SetPropertyMode set_mode); |
2698 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor( | 2684 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor( |
2699 uint32_t index, | 2685 uint32_t index, |
2700 Object* value, | 2686 Object* value, |
2701 PropertyAttributes attributes, | 2687 PropertyAttributes attributes, |
2702 StrictModeFlag strict_mode, | 2688 StrictModeFlag strict_mode, |
2703 bool check_prototype, | 2689 bool check_prototype, |
2704 SetPropertyMode set_mode); | 2690 SetPropertyMode set_mode); |
| 2691 MUST_USE_RESULT MaybeObject* SetElementWithCallbackSetterInPrototypes( |
| 2692 uint32_t index, |
| 2693 Object* value, |
| 2694 bool* found, |
| 2695 StrictModeFlag strict_mode); |
2705 | 2696 |
2706 // Searches the prototype chain for property 'name'. If it is found and | 2697 // Searches the prototype chain for property 'name'. If it is found and |
2707 // has a setter, invoke it and set '*done' to true. If it is found and is | 2698 // has a setter, invoke it and set '*done' to true. If it is found and is |
2708 // read-only, reject and set '*done' to true. Otherwise, set '*done' to | 2699 // read-only, reject and set '*done' to true. Otherwise, set '*done' to |
2709 // false. Can throw and return an empty handle with '*done==true'. | 2700 // false. Can throw and return an empty handle with '*done==true'. |
2710 static Handle<Object> SetPropertyViaPrototypes( | 2701 static Handle<Object> SetPropertyViaPrototypes( |
2711 Handle<JSObject> object, | 2702 Handle<JSObject> object, |
2712 Handle<Name> name, | 2703 Handle<Name> name, |
2713 Handle<Object> value, | 2704 Handle<Object> value, |
2714 PropertyAttributes attributes, | 2705 PropertyAttributes attributes, |
2715 StrictModeFlag strict_mode, | 2706 StrictModeFlag strict_mode, |
2716 bool* done); | 2707 bool* done); |
2717 static Handle<Object> SetPropertyPostInterceptor( | 2708 static Handle<Object> SetPropertyPostInterceptor( |
2718 Handle<JSObject> object, | 2709 Handle<JSObject> object, |
2719 Handle<Name> name, | 2710 Handle<Name> name, |
2720 Handle<Object> value, | 2711 Handle<Object> value, |
2721 PropertyAttributes attributes, | 2712 PropertyAttributes attributes, |
2722 StrictModeFlag strict_mode); | 2713 StrictModeFlag strict_mode); |
2723 static Handle<Object> SetPropertyUsingTransition( | 2714 static Handle<Object> SetPropertyUsingTransition( |
2724 Handle<JSObject> object, | 2715 Handle<JSObject> object, |
2725 LookupResult* lookup, | 2716 LookupResult* lookup, |
2726 Handle<Name> name, | 2717 Handle<Name> name, |
2727 Handle<Object> value, | 2718 Handle<Object> value, |
2728 PropertyAttributes attributes); | 2719 PropertyAttributes attributes); |
| 2720 static Handle<Object> SetPropertyWithFailedAccessCheck( |
| 2721 Handle<JSObject> object, |
| 2722 LookupResult* result, |
| 2723 Handle<Name> name, |
| 2724 Handle<Object> value, |
| 2725 bool check_prototype, |
| 2726 StrictModeFlag strict_mode); |
2729 | 2727 |
2730 // Add a property to an object. | 2728 // Add a property to an object. |
2731 static Handle<Object> AddProperty( | 2729 static Handle<Object> AddProperty( |
2732 Handle<JSObject> object, | 2730 Handle<JSObject> object, |
2733 Handle<Name> name, | 2731 Handle<Name> name, |
2734 Handle<Object> value, | 2732 Handle<Object> value, |
2735 PropertyAttributes attributes, | 2733 PropertyAttributes attributes, |
2736 StrictModeFlag strict_mode, | 2734 StrictModeFlag strict_mode, |
2737 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, | 2735 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, |
2738 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, | 2736 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, |
(...skipping 6342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9081 Object* receiver, | 9079 Object* receiver, |
9082 Name* name); | 9080 Name* name); |
9083 MUST_USE_RESULT MaybeObject* GetElementWithHandler( | 9081 MUST_USE_RESULT MaybeObject* GetElementWithHandler( |
9084 Object* receiver, | 9082 Object* receiver, |
9085 uint32_t index); | 9083 uint32_t index); |
9086 | 9084 |
9087 // If the handler defines an accessor property with a setter, invoke it. | 9085 // If the handler defines an accessor property with a setter, invoke it. |
9088 // If it defines an accessor property without a setter, or a data property | 9086 // If it defines an accessor property without a setter, or a data property |
9089 // that is read-only, throw. In all these cases set '*done' to true, | 9087 // that is read-only, throw. In all these cases set '*done' to true, |
9090 // otherwise set it to false. | 9088 // otherwise set it to false. |
9091 MUST_USE_RESULT MaybeObject* SetPropertyViaPrototypesWithHandler( | 9089 static Handle<Object> SetPropertyViaPrototypesWithHandler( |
9092 JSReceiver* receiver, | 9090 Handle<JSProxy> proxy, |
9093 Name* name, | 9091 Handle<JSReceiver> receiver, |
9094 Object* value, | 9092 Handle<Name> name, |
| 9093 Handle<Object> value, |
9095 PropertyAttributes attributes, | 9094 PropertyAttributes attributes, |
9096 StrictModeFlag strict_mode, | 9095 StrictModeFlag strict_mode, |
9097 bool* done); | 9096 bool* done); |
9098 | 9097 |
9099 MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler( | 9098 MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler( |
9100 JSReceiver* receiver, | 9099 JSReceiver* receiver, |
9101 Name* name); | 9100 Name* name); |
9102 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithHandler( | 9101 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithHandler( |
9103 JSReceiver* receiver, | 9102 JSReceiver* receiver, |
9104 uint32_t index); | 9103 uint32_t index); |
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10249 } else { | 10248 } else { |
10250 value &= ~(1 << bit_position); | 10249 value &= ~(1 << bit_position); |
10251 } | 10250 } |
10252 return value; | 10251 return value; |
10253 } | 10252 } |
10254 }; | 10253 }; |
10255 | 10254 |
10256 } } // namespace v8::internal | 10255 } } // namespace v8::internal |
10257 | 10256 |
10258 #endif // V8_OBJECTS_H_ | 10257 #endif // V8_OBJECTS_H_ |
OLD | NEW |