| 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 2025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 static Handle<Object> SetProperty(Handle<JSReceiver> object, |
| 2043 Handle<Name> key, | 2043 Handle<Name> key, |
| 2044 Handle<Object> value, | 2044 Handle<Object> value, |
| 2045 PropertyAttributes attributes, | 2045 PropertyAttributes attributes, |
| 2046 StrictModeFlag strict_mode, | 2046 StrictMode strict_mode, |
| 2047 StoreFromKeyed store_mode = | 2047 StoreFromKeyed store_mode = |
| 2048 MAY_BE_STORE_FROM_KEYED); | 2048 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 StrictModeFlag 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); |
| 2059 static inline bool HasLocalElement(Handle<JSReceiver> object, uint32_t index); | 2059 static inline bool HasLocalElement(Handle<JSReceiver> object, uint32_t index); |
| 2060 | 2060 |
| 2061 // Implementation of [[Delete]], ECMA-262 5th edition, section 8.12.7. | 2061 // Implementation of [[Delete]], ECMA-262 5th edition, section 8.12.7. |
| 2062 static Handle<Object> DeleteProperty(Handle<JSReceiver> object, | 2062 static Handle<Object> DeleteProperty(Handle<JSReceiver> object, |
| 2063 Handle<Name> name, | 2063 Handle<Name> name, |
| 2064 DeleteMode mode = NORMAL_DELETION); | 2064 DeleteMode mode = NORMAL_DELETION); |
| 2065 static Handle<Object> DeleteElement(Handle<JSReceiver> object, | 2065 static Handle<Object> DeleteElement(Handle<JSReceiver> object, |
| 2066 uint32_t index, | 2066 uint32_t index, |
| 2067 DeleteMode mode = NORMAL_DELETION); | 2067 DeleteMode mode = NORMAL_DELETION); |
| 2068 | 2068 |
| 2069 // Tests for the fast common case for property enumeration. | 2069 // Tests for the fast common case for property enumeration. |
| 2070 bool IsSimpleEnum(); | 2070 bool IsSimpleEnum(); |
| 2071 | 2071 |
| 2072 // Returns the class name ([[Class]] property in the specification). | 2072 // Returns the class name ([[Class]] property in the specification). |
| 2073 String* class_name(); | 2073 String* class_name(); |
| 2074 | 2074 |
| 2075 // Returns the constructor name (the name (possibly, inferred name) of the | 2075 // Returns the constructor name (the name (possibly, inferred name) of the |
| 2076 // function that was used to instantiate the object). | 2076 // function that was used to instantiate the object). |
| 2077 String* constructor_name(); | 2077 String* constructor_name(); |
| 2078 | 2078 |
| 2079 inline PropertyAttributes GetPropertyAttribute(Name* name); | 2079 static inline PropertyAttributes GetPropertyAttribute( |
| 2080 PropertyAttributes GetPropertyAttributeWithReceiver(JSReceiver* receiver, | 2080 Handle<JSReceiver> object, |
| 2081 Name* name); | 2081 Handle<Name> name); |
| 2082 PropertyAttributes GetLocalPropertyAttribute(Name* name); | 2082 static PropertyAttributes GetPropertyAttributeWithReceiver( |
| 2083 Handle<JSReceiver> object, |
| 2084 Handle<JSReceiver> receiver, |
| 2085 Handle<Name> name); |
| 2086 static PropertyAttributes GetLocalPropertyAttribute( |
| 2087 Handle<JSReceiver> object, |
| 2088 Handle<Name> name); |
| 2083 | 2089 |
| 2084 inline PropertyAttributes GetElementAttribute(uint32_t index); | 2090 static inline PropertyAttributes GetElementAttribute( |
| 2085 inline PropertyAttributes GetLocalElementAttribute(uint32_t index); | 2091 Handle<JSReceiver> object, |
| 2092 uint32_t index); |
| 2093 static inline PropertyAttributes GetLocalElementAttribute( |
| 2094 Handle<JSReceiver> object, |
| 2095 uint32_t index); |
| 2086 | 2096 |
| 2087 // Return the object's prototype (might be Heap::null_value()). | 2097 // Return the object's prototype (might be Heap::null_value()). |
| 2088 inline Object* GetPrototype(); | 2098 inline Object* GetPrototype(); |
| 2089 | 2099 |
| 2090 // Return the constructor function (may be Heap::null_value()). | 2100 // Return the constructor function (may be Heap::null_value()). |
| 2091 inline Object* GetConstructor(); | 2101 inline Object* GetConstructor(); |
| 2092 | 2102 |
| 2093 // Retrieves a permanent object identity hash code. The undefined value might | 2103 // Retrieves a permanent object identity hash code. The undefined value might |
| 2094 // be returned in case no hash was created yet. | 2104 // be returned in case no hash was created yet. |
| 2095 inline Object* GetIdentityHash(); | 2105 inline Object* GetIdentityHash(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2106 void Lookup(Name* name, LookupResult* result); | 2116 void Lookup(Name* name, LookupResult* result); |
| 2107 | 2117 |
| 2108 protected: | 2118 protected: |
| 2109 Smi* GenerateIdentityHash(); | 2119 Smi* GenerateIdentityHash(); |
| 2110 | 2120 |
| 2111 static Handle<Object> SetPropertyWithDefinedSetter(Handle<JSReceiver> object, | 2121 static Handle<Object> SetPropertyWithDefinedSetter(Handle<JSReceiver> object, |
| 2112 Handle<JSReceiver> setter, | 2122 Handle<JSReceiver> setter, |
| 2113 Handle<Object> value); | 2123 Handle<Object> value); |
| 2114 | 2124 |
| 2115 private: | 2125 private: |
| 2116 PropertyAttributes GetPropertyAttributeForResult(JSReceiver* receiver, | 2126 static PropertyAttributes GetPropertyAttributeForResult( |
| 2117 LookupResult* result, | 2127 Handle<JSReceiver> object, |
| 2118 Name* name, | 2128 Handle<JSReceiver> receiver, |
| 2119 bool continue_search); | 2129 LookupResult* result, |
| 2130 Handle<Name> name, |
| 2131 bool continue_search); |
| 2120 | 2132 |
| 2121 static Handle<Object> SetProperty(Handle<JSReceiver> receiver, | 2133 static Handle<Object> SetProperty(Handle<JSReceiver> receiver, |
| 2122 LookupResult* result, | 2134 LookupResult* result, |
| 2123 Handle<Name> key, | 2135 Handle<Name> key, |
| 2124 Handle<Object> value, | 2136 Handle<Object> value, |
| 2125 PropertyAttributes attributes, | 2137 PropertyAttributes attributes, |
| 2126 StrictModeFlag strict_mode, | 2138 StrictMode strict_mode, |
| 2127 StoreFromKeyed store_from_keyed); | 2139 StoreFromKeyed store_from_keyed); |
| 2128 | 2140 |
| 2129 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); | 2141 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); |
| 2130 }; | 2142 }; |
| 2131 | 2143 |
| 2132 // Forward declaration for JSObject::GetOrCreateHiddenPropertiesHashTable. | 2144 // Forward declaration for JSObject::GetOrCreateHiddenPropertiesHashTable. |
| 2133 class ObjectHashTable; | 2145 class ObjectHashTable; |
| 2134 | 2146 |
| 2135 // The JSObject describes real heap allocated JavaScript objects with | 2147 // The JSObject describes real heap allocated JavaScript objects with |
| 2136 // properties. | 2148 // properties. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2148 | 2160 |
| 2149 // [elements]: The elements (properties with names that are integers). | 2161 // [elements]: The elements (properties with names that are integers). |
| 2150 // | 2162 // |
| 2151 // Elements can be in two general modes: fast and slow. Each mode | 2163 // Elements can be in two general modes: fast and slow. Each mode |
| 2152 // corrensponds to a set of object representations of elements that | 2164 // corrensponds to a set of object representations of elements that |
| 2153 // have something in common. | 2165 // have something in common. |
| 2154 // | 2166 // |
| 2155 // In the fast mode elements is a FixedArray and so each element can | 2167 // In the fast mode elements is a FixedArray and so each element can |
| 2156 // be quickly accessed. This fact is used in the generated code. The | 2168 // be quickly accessed. This fact is used in the generated code. The |
| 2157 // elements array can have one of three maps in this mode: | 2169 // elements array can have one of three maps in this mode: |
| 2158 // fixed_array_map, non_strict_arguments_elements_map or | 2170 // fixed_array_map, sloppy_arguments_elements_map or |
| 2159 // fixed_cow_array_map (for copy-on-write arrays). In the latter case | 2171 // fixed_cow_array_map (for copy-on-write arrays). In the latter case |
| 2160 // the elements array may be shared by a few objects and so before | 2172 // the elements array may be shared by a few objects and so before |
| 2161 // writing to any element the array must be copied. Use | 2173 // writing to any element the array must be copied. Use |
| 2162 // EnsureWritableFastElements in this case. | 2174 // EnsureWritableFastElements in this case. |
| 2163 // | 2175 // |
| 2164 // In the slow mode the elements is either a NumberDictionary, an | 2176 // In the slow mode the elements is either a NumberDictionary, an |
| 2165 // ExternalArray, or a FixedArray parameter map for a (non-strict) | 2177 // ExternalArray, or a FixedArray parameter map for a (sloppy) |
| 2166 // arguments object. | 2178 // arguments object. |
| 2167 DECL_ACCESSORS(elements, FixedArrayBase) | 2179 DECL_ACCESSORS(elements, FixedArrayBase) |
| 2168 inline void initialize_elements(); | 2180 inline void initialize_elements(); |
| 2169 MUST_USE_RESULT inline MaybeObject* ResetElements(); | 2181 MUST_USE_RESULT inline MaybeObject* ResetElements(); |
| 2170 inline ElementsKind GetElementsKind(); | 2182 inline ElementsKind GetElementsKind(); |
| 2171 inline ElementsAccessor* GetElementsAccessor(); | 2183 inline ElementsAccessor* GetElementsAccessor(); |
| 2172 // Returns true if an object has elements of FAST_SMI_ELEMENTS ElementsKind. | 2184 // Returns true if an object has elements of FAST_SMI_ELEMENTS ElementsKind. |
| 2173 inline bool HasFastSmiElements(); | 2185 inline bool HasFastSmiElements(); |
| 2174 // Returns true if an object has elements of FAST_ELEMENTS ElementsKind. | 2186 // Returns true if an object has elements of FAST_ELEMENTS ElementsKind. |
| 2175 inline bool HasFastObjectElements(); | 2187 inline bool HasFastObjectElements(); |
| 2176 // Returns true if an object has elements of FAST_ELEMENTS or | 2188 // Returns true if an object has elements of FAST_ELEMENTS or |
| 2177 // FAST_SMI_ONLY_ELEMENTS. | 2189 // FAST_SMI_ONLY_ELEMENTS. |
| 2178 inline bool HasFastSmiOrObjectElements(); | 2190 inline bool HasFastSmiOrObjectElements(); |
| 2179 // Returns true if an object has any of the fast elements kinds. | 2191 // Returns true if an object has any of the fast elements kinds. |
| 2180 inline bool HasFastElements(); | 2192 inline bool HasFastElements(); |
| 2181 // Returns true if an object has elements of FAST_DOUBLE_ELEMENTS | 2193 // Returns true if an object has elements of FAST_DOUBLE_ELEMENTS |
| 2182 // ElementsKind. | 2194 // ElementsKind. |
| 2183 inline bool HasFastDoubleElements(); | 2195 inline bool HasFastDoubleElements(); |
| 2184 // Returns true if an object has elements of FAST_HOLEY_*_ELEMENTS | 2196 // Returns true if an object has elements of FAST_HOLEY_*_ELEMENTS |
| 2185 // ElementsKind. | 2197 // ElementsKind. |
| 2186 inline bool HasFastHoleyElements(); | 2198 inline bool HasFastHoleyElements(); |
| 2187 inline bool HasNonStrictArgumentsElements(); | 2199 inline bool HasSloppyArgumentsElements(); |
| 2188 inline bool HasDictionaryElements(); | 2200 inline bool HasDictionaryElements(); |
| 2189 | 2201 |
| 2190 inline bool HasExternalUint8ClampedElements(); | 2202 inline bool HasExternalUint8ClampedElements(); |
| 2191 inline bool HasExternalArrayElements(); | 2203 inline bool HasExternalArrayElements(); |
| 2192 inline bool HasExternalInt8Elements(); | 2204 inline bool HasExternalInt8Elements(); |
| 2193 inline bool HasExternalUint8Elements(); | 2205 inline bool HasExternalUint8Elements(); |
| 2194 inline bool HasExternalInt16Elements(); | 2206 inline bool HasExternalInt16Elements(); |
| 2195 inline bool HasExternalUint16Elements(); | 2207 inline bool HasExternalUint16Elements(); |
| 2196 inline bool HasExternalInt32Elements(); | 2208 inline bool HasExternalInt32Elements(); |
| 2197 inline bool HasExternalUint32Elements(); | 2209 inline bool HasExternalUint32Elements(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2229 Handle<Object> receiver, | 2241 Handle<Object> receiver, |
| 2230 Handle<Object> structure, | 2242 Handle<Object> structure, |
| 2231 Handle<Name> name); | 2243 Handle<Name> name); |
| 2232 | 2244 |
| 2233 static Handle<Object> SetPropertyWithCallback( | 2245 static Handle<Object> SetPropertyWithCallback( |
| 2234 Handle<JSObject> object, | 2246 Handle<JSObject> object, |
| 2235 Handle<Object> structure, | 2247 Handle<Object> structure, |
| 2236 Handle<Name> name, | 2248 Handle<Name> name, |
| 2237 Handle<Object> value, | 2249 Handle<Object> value, |
| 2238 Handle<JSObject> holder, | 2250 Handle<JSObject> holder, |
| 2239 StrictModeFlag strict_mode); | 2251 StrictMode strict_mode); |
| 2240 | 2252 |
| 2241 static Handle<Object> SetPropertyWithInterceptor( | 2253 static Handle<Object> SetPropertyWithInterceptor( |
| 2242 Handle<JSObject> object, | 2254 Handle<JSObject> object, |
| 2243 Handle<Name> name, | 2255 Handle<Name> name, |
| 2244 Handle<Object> value, | 2256 Handle<Object> value, |
| 2245 PropertyAttributes attributes, | 2257 PropertyAttributes attributes, |
| 2246 StrictModeFlag strict_mode); | 2258 StrictMode strict_mode); |
| 2247 | 2259 |
| 2248 static Handle<Object> SetPropertyForResult( | 2260 static Handle<Object> SetPropertyForResult( |
| 2249 Handle<JSObject> object, | 2261 Handle<JSObject> object, |
| 2250 LookupResult* result, | 2262 LookupResult* result, |
| 2251 Handle<Name> name, | 2263 Handle<Name> name, |
| 2252 Handle<Object> value, | 2264 Handle<Object> value, |
| 2253 PropertyAttributes attributes, | 2265 PropertyAttributes attributes, |
| 2254 StrictModeFlag strict_mode, | 2266 StrictMode strict_mode, |
| 2255 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); | 2267 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); |
| 2256 | 2268 |
| 2257 static Handle<Object> SetLocalPropertyIgnoreAttributes( | 2269 static Handle<Object> SetLocalPropertyIgnoreAttributes( |
| 2258 Handle<JSObject> object, | 2270 Handle<JSObject> object, |
| 2259 Handle<Name> key, | 2271 Handle<Name> key, |
| 2260 Handle<Object> value, | 2272 Handle<Object> value, |
| 2261 PropertyAttributes attributes, | 2273 PropertyAttributes attributes, |
| 2262 ValueType value_type = OPTIMAL_REPRESENTATION, | 2274 ValueType value_type = OPTIMAL_REPRESENTATION, |
| 2263 StoreMode mode = ALLOW_AS_CONSTANT, | 2275 StoreMode mode = ALLOW_AS_CONSTANT, |
| 2264 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK); | 2276 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2300 Handle<Object> value, | 2312 Handle<Object> value, |
| 2301 PropertyDetails details); | 2313 PropertyDetails details); |
| 2302 | 2314 |
| 2303 static void OptimizeAsPrototype(Handle<JSObject> object); | 2315 static void OptimizeAsPrototype(Handle<JSObject> object); |
| 2304 | 2316 |
| 2305 // Retrieve interceptors. | 2317 // Retrieve interceptors. |
| 2306 InterceptorInfo* GetNamedInterceptor(); | 2318 InterceptorInfo* GetNamedInterceptor(); |
| 2307 InterceptorInfo* GetIndexedInterceptor(); | 2319 InterceptorInfo* GetIndexedInterceptor(); |
| 2308 | 2320 |
| 2309 // Used from JSReceiver. | 2321 // Used from JSReceiver. |
| 2310 PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver, | 2322 static PropertyAttributes GetPropertyAttributePostInterceptor( |
| 2311 Name* name, | 2323 Handle<JSObject> object, |
| 2312 bool continue_search); | 2324 Handle<JSObject> receiver, |
| 2313 PropertyAttributes GetPropertyAttributeWithInterceptor(JSObject* receiver, | 2325 Handle<Name> name, |
| 2314 Name* name, | 2326 bool continue_search); |
| 2315 bool continue_search); | 2327 static PropertyAttributes GetPropertyAttributeWithInterceptor( |
| 2316 PropertyAttributes GetPropertyAttributeWithFailedAccessCheck( | 2328 Handle<JSObject> object, |
| 2317 Object* receiver, | 2329 Handle<JSObject> receiver, |
| 2330 Handle<Name> name, |
| 2331 bool continue_search); |
| 2332 static PropertyAttributes GetPropertyAttributeWithFailedAccessCheck( |
| 2333 Handle<JSObject> object, |
| 2318 LookupResult* result, | 2334 LookupResult* result, |
| 2319 Name* name, | 2335 Handle<Name> name, |
| 2320 bool continue_search); | 2336 bool continue_search); |
| 2321 PropertyAttributes GetElementAttributeWithReceiver(JSReceiver* receiver, | 2337 static PropertyAttributes GetElementAttributeWithReceiver( |
| 2322 uint32_t index, | 2338 Handle<JSObject> object, |
| 2323 bool continue_search); | 2339 Handle<JSReceiver> receiver, |
| 2340 uint32_t index, |
| 2341 bool continue_search); |
| 2324 | 2342 |
| 2325 // Retrieves an AccessorPair property from the given object. Might return | 2343 // Retrieves an AccessorPair property from the given object. Might return |
| 2326 // undefined if the property doesn't exist or is of a different kind. | 2344 // undefined if the property doesn't exist or is of a different kind. |
| 2327 static Handle<Object> GetAccessor(Handle<JSObject> object, | 2345 static Handle<Object> GetAccessor(Handle<JSObject> object, |
| 2328 Handle<Name> name, | 2346 Handle<Name> name, |
| 2329 AccessorComponent component); | 2347 AccessorComponent component); |
| 2330 | 2348 |
| 2331 // Defines an AccessorPair property on the given object. | 2349 // Defines an AccessorPair property on the given object. |
| 2332 // TODO(mstarzinger): Rename to SetAccessor() and return empty handle on | 2350 // TODO(mstarzinger): Rename to SetAccessor() and return empty handle on |
| 2333 // exception instead of letting callers check for scheduled exception. | 2351 // exception instead of letting callers check for scheduled exception. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2354 PropertyAttributes* attributes); | 2372 PropertyAttributes* attributes); |
| 2355 MUST_USE_RESULT MaybeObject* GetLocalPropertyPostInterceptor( | 2373 MUST_USE_RESULT MaybeObject* GetLocalPropertyPostInterceptor( |
| 2356 Object* receiver, | 2374 Object* receiver, |
| 2357 Name* name, | 2375 Name* name, |
| 2358 PropertyAttributes* attributes); | 2376 PropertyAttributes* attributes); |
| 2359 | 2377 |
| 2360 // Returns true if this is an instance of an api function and has | 2378 // Returns true if this is an instance of an api function and has |
| 2361 // been modified since it was created. May give false positives. | 2379 // been modified since it was created. May give false positives. |
| 2362 bool IsDirty(); | 2380 bool IsDirty(); |
| 2363 | 2381 |
| 2364 // If the receiver is a JSGlobalProxy this method will return its prototype, | |
| 2365 // otherwise the result is the receiver itself. | |
| 2366 inline Object* BypassGlobalProxy(); | |
| 2367 | |
| 2368 // Accessors for hidden properties object. | 2382 // Accessors for hidden properties object. |
| 2369 // | 2383 // |
| 2370 // Hidden properties are not local properties of the object itself. | 2384 // Hidden properties are not local properties of the object itself. |
| 2371 // Instead they are stored in an auxiliary structure kept as a local | 2385 // Instead they are stored in an auxiliary structure kept as a local |
| 2372 // property with a special name Heap::hidden_string(). But if the | 2386 // property with a special name Heap::hidden_string(). But if the |
| 2373 // receiver is a JSGlobalProxy then the auxiliary object is a property | 2387 // receiver is a JSGlobalProxy then the auxiliary object is a property |
| 2374 // of its prototype, and if it's a detached proxy, then you can't have | 2388 // of its prototype, and if it's a detached proxy, then you can't have |
| 2375 // hidden properties. | 2389 // hidden properties. |
| 2376 | 2390 |
| 2377 // Sets a hidden property on this object. Returns this object if successful, | 2391 // Sets a hidden property on this object. Returns this object if successful, |
| 2378 // undefined if called on a detached proxy. | 2392 // undefined if called on a detached proxy. |
| 2379 static Handle<Object> SetHiddenProperty(Handle<JSObject> object, | 2393 static Handle<Object> SetHiddenProperty(Handle<JSObject> object, |
| 2380 Handle<Name> key, | 2394 Handle<Name> key, |
| 2381 Handle<Object> value); | 2395 Handle<Object> value); |
| 2382 // Gets the value of a hidden property with the given key. Returns the hole | 2396 // Gets the value of a hidden property with the given key. Returns the hole |
| 2383 // if the property doesn't exist (or if called on a detached proxy), | 2397 // if the property doesn't exist (or if called on a detached proxy), |
| 2384 // otherwise returns the value set for the key. | 2398 // otherwise returns the value set for the key. |
| 2385 Object* GetHiddenProperty(Name* key); | 2399 Object* GetHiddenProperty(Name* key); |
| 2386 // Deletes a hidden property. Deleting a non-existing property is | 2400 // Deletes a hidden property. Deleting a non-existing property is |
| 2387 // considered successful. | 2401 // considered successful. |
| 2388 static void DeleteHiddenProperty(Handle<JSObject> object, | 2402 static void DeleteHiddenProperty(Handle<JSObject> object, |
| 2389 Handle<Name> key); | 2403 Handle<Name> key); |
| 2390 // Returns true if the object has a property with the hidden string as name. | 2404 // Returns true if the object has a property with the hidden string as name. |
| 2391 bool HasHiddenProperties(); | 2405 static bool HasHiddenProperties(Handle<JSObject> object); |
| 2392 | 2406 |
| 2393 static void SetIdentityHash(Handle<JSObject> object, Handle<Smi> hash); | 2407 static void SetIdentityHash(Handle<JSObject> object, Handle<Smi> hash); |
| 2394 | 2408 |
| 2395 inline void ValidateElements(); | 2409 inline void ValidateElements(); |
| 2396 | 2410 |
| 2397 // Makes sure that this object can contain HeapObject as elements. | 2411 // Makes sure that this object can contain HeapObject as elements. |
| 2398 static inline void EnsureCanContainHeapObjectElements(Handle<JSObject> obj); | 2412 static inline void EnsureCanContainHeapObjectElements(Handle<JSObject> obj); |
| 2399 | 2413 |
| 2400 // Makes sure that this object can contain the specified elements. | 2414 // Makes sure that this object can contain the specified elements. |
| 2401 MUST_USE_RESULT inline MaybeObject* EnsureCanContainElements( | 2415 MUST_USE_RESULT inline MaybeObject* EnsureCanContainElements( |
| 2402 Object** elements, | 2416 Object** elements, |
| 2403 uint32_t count, | 2417 uint32_t count, |
| 2404 EnsureElementsMode mode); | 2418 EnsureElementsMode mode); |
| 2405 MUST_USE_RESULT inline MaybeObject* EnsureCanContainElements( | 2419 MUST_USE_RESULT inline MaybeObject* EnsureCanContainElements( |
| 2406 FixedArrayBase* elements, | 2420 FixedArrayBase* elements, |
| 2407 uint32_t length, | 2421 uint32_t length, |
| 2408 EnsureElementsMode mode); | 2422 EnsureElementsMode mode); |
| 2409 MUST_USE_RESULT MaybeObject* EnsureCanContainElements( | 2423 MUST_USE_RESULT MaybeObject* EnsureCanContainElements( |
| 2410 Arguments* arguments, | 2424 Arguments* arguments, |
| 2411 uint32_t first_arg, | 2425 uint32_t first_arg, |
| 2412 uint32_t arg_count, | 2426 uint32_t arg_count, |
| 2413 EnsureElementsMode mode); | 2427 EnsureElementsMode mode); |
| 2414 | 2428 |
| 2429 // Would we convert a fast elements array to dictionary mode given |
| 2430 // an access at key? |
| 2431 bool WouldConvertToSlowElements(Handle<Object> key); |
| 2415 // Do we want to keep the elements in fast case when increasing the | 2432 // Do we want to keep the elements in fast case when increasing the |
| 2416 // capacity? | 2433 // capacity? |
| 2417 bool ShouldConvertToSlowElements(int new_capacity); | 2434 bool ShouldConvertToSlowElements(int new_capacity); |
| 2418 // Returns true if the backing storage for the slow-case elements of | 2435 // Returns true if the backing storage for the slow-case elements of |
| 2419 // this object takes up nearly as much space as a fast-case backing | 2436 // this object takes up nearly as much space as a fast-case backing |
| 2420 // storage would. In that case the JSObject should have fast | 2437 // storage would. In that case the JSObject should have fast |
| 2421 // elements. | 2438 // elements. |
| 2422 bool ShouldConvertToFastElements(); | 2439 bool ShouldConvertToFastElements(); |
| 2423 // Returns true if the elements of JSObject contains only values that can be | 2440 // Returns true if the elements of JSObject contains only values that can be |
| 2424 // represented in a FixedDoubleArray and has at least one value that can only | 2441 // represented in a FixedDoubleArray and has at least one value that can only |
| 2425 // be represented as a double and not a Smi. | 2442 // be represented as a double and not a Smi. |
| 2426 bool ShouldConvertToFastDoubleElements(bool* has_smi_only_elements); | 2443 bool ShouldConvertToFastDoubleElements(bool* has_smi_only_elements); |
| 2427 | 2444 |
| 2428 // Computes the new capacity when expanding the elements of a JSObject. | 2445 // Computes the new capacity when expanding the elements of a JSObject. |
| 2429 static int NewElementsCapacity(int old_capacity) { | 2446 static int NewElementsCapacity(int old_capacity) { |
| 2430 // (old_capacity + 50%) + 16 | 2447 // (old_capacity + 50%) + 16 |
| 2431 return old_capacity + (old_capacity >> 1) + 16; | 2448 return old_capacity + (old_capacity >> 1) + 16; |
| 2432 } | 2449 } |
| 2433 | 2450 |
| 2434 // These methods do not perform access checks! | 2451 // These methods do not perform access checks! |
| 2435 AccessorPair* GetLocalPropertyAccessorPair(Name* name); | 2452 AccessorPair* GetLocalPropertyAccessorPair(Name* name); |
| 2436 AccessorPair* GetLocalElementAccessorPair(uint32_t index); | 2453 AccessorPair* GetLocalElementAccessorPair(uint32_t index); |
| 2437 | 2454 |
| 2438 static Handle<Object> SetFastElement(Handle<JSObject> object, uint32_t index, | 2455 static Handle<Object> SetFastElement(Handle<JSObject> object, uint32_t index, |
| 2439 Handle<Object> value, | 2456 Handle<Object> value, |
| 2440 StrictModeFlag strict_mode, | 2457 StrictMode strict_mode, |
| 2441 bool check_prototype); | 2458 bool check_prototype); |
| 2442 | 2459 |
| 2443 static Handle<Object> SetOwnElement(Handle<JSObject> object, | 2460 static Handle<Object> SetOwnElement(Handle<JSObject> object, |
| 2444 uint32_t index, | 2461 uint32_t index, |
| 2445 Handle<Object> value, | 2462 Handle<Object> value, |
| 2446 StrictModeFlag strict_mode); | 2463 StrictMode strict_mode); |
| 2447 | 2464 |
| 2448 // Empty handle is returned if the element cannot be set to the given value. | 2465 // Empty handle is returned if the element cannot be set to the given value. |
| 2449 static Handle<Object> SetElement( | 2466 static Handle<Object> SetElement( |
| 2450 Handle<JSObject> object, | 2467 Handle<JSObject> object, |
| 2451 uint32_t index, | 2468 uint32_t index, |
| 2452 Handle<Object> value, | 2469 Handle<Object> value, |
| 2453 PropertyAttributes attributes, | 2470 PropertyAttributes attributes, |
| 2454 StrictModeFlag strict_mode, | 2471 StrictMode strict_mode, |
| 2455 bool check_prototype = true, | 2472 bool check_prototype = true, |
| 2456 SetPropertyMode set_mode = SET_PROPERTY); | 2473 SetPropertyMode set_mode = SET_PROPERTY); |
| 2457 | 2474 |
| 2458 // Returns the index'th element. | 2475 // Returns the index'th element. |
| 2459 // The undefined object if index is out of bounds. | 2476 // The undefined object if index is out of bounds. |
| 2460 MUST_USE_RESULT MaybeObject* GetElementWithInterceptor(Object* receiver, | 2477 MUST_USE_RESULT MaybeObject* GetElementWithInterceptor(Object* receiver, |
| 2461 uint32_t index); | 2478 uint32_t index); |
| 2462 | 2479 |
| 2463 enum SetFastElementsCapacitySmiMode { | 2480 enum SetFastElementsCapacitySmiMode { |
| 2464 kAllowSmiElements, | 2481 kAllowSmiElements, |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2751 Handle<JSObject> object, | 2768 Handle<JSObject> object, |
| 2752 Handle<Object> receiver, | 2769 Handle<Object> receiver, |
| 2753 LookupResult* result, | 2770 LookupResult* result, |
| 2754 Handle<Name> name, | 2771 Handle<Name> name, |
| 2755 PropertyAttributes* attributes); | 2772 PropertyAttributes* attributes); |
| 2756 | 2773 |
| 2757 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, | 2774 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, |
| 2758 Object* structure, | 2775 Object* structure, |
| 2759 uint32_t index, | 2776 uint32_t index, |
| 2760 Object* holder); | 2777 Object* holder); |
| 2761 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor( | 2778 static PropertyAttributes GetElementAttributeWithInterceptor( |
| 2762 JSReceiver* receiver, | 2779 Handle<JSObject> object, |
| 2780 Handle<JSReceiver> receiver, |
| 2763 uint32_t index, | 2781 uint32_t index, |
| 2764 bool continue_search); | 2782 bool continue_search); |
| 2765 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithoutInterceptor( | 2783 static PropertyAttributes GetElementAttributeWithoutInterceptor( |
| 2766 JSReceiver* receiver, | 2784 Handle<JSObject> object, |
| 2785 Handle<JSReceiver> receiver, |
| 2767 uint32_t index, | 2786 uint32_t index, |
| 2768 bool continue_search); | 2787 bool continue_search); |
| 2769 static Handle<Object> SetElementWithCallback( | 2788 static Handle<Object> SetElementWithCallback( |
| 2770 Handle<JSObject> object, | 2789 Handle<JSObject> object, |
| 2771 Handle<Object> structure, | 2790 Handle<Object> structure, |
| 2772 uint32_t index, | 2791 uint32_t index, |
| 2773 Handle<Object> value, | 2792 Handle<Object> value, |
| 2774 Handle<JSObject> holder, | 2793 Handle<JSObject> holder, |
| 2775 StrictModeFlag strict_mode); | 2794 StrictMode strict_mode); |
| 2776 static Handle<Object> SetElementWithInterceptor( | 2795 static Handle<Object> SetElementWithInterceptor( |
| 2777 Handle<JSObject> object, | 2796 Handle<JSObject> object, |
| 2778 uint32_t index, | 2797 uint32_t index, |
| 2779 Handle<Object> value, | 2798 Handle<Object> value, |
| 2780 PropertyAttributes attributes, | 2799 PropertyAttributes attributes, |
| 2781 StrictModeFlag strict_mode, | 2800 StrictMode strict_mode, |
| 2782 bool check_prototype, | 2801 bool check_prototype, |
| 2783 SetPropertyMode set_mode); | 2802 SetPropertyMode set_mode); |
| 2784 static Handle<Object> SetElementWithoutInterceptor( | 2803 static Handle<Object> SetElementWithoutInterceptor( |
| 2785 Handle<JSObject> object, | 2804 Handle<JSObject> object, |
| 2786 uint32_t index, | 2805 uint32_t index, |
| 2787 Handle<Object> value, | 2806 Handle<Object> value, |
| 2788 PropertyAttributes attributes, | 2807 PropertyAttributes attributes, |
| 2789 StrictModeFlag strict_mode, | 2808 StrictMode strict_mode, |
| 2790 bool check_prototype, | 2809 bool check_prototype, |
| 2791 SetPropertyMode set_mode); | 2810 SetPropertyMode set_mode); |
| 2792 static Handle<Object> SetElementWithCallbackSetterInPrototypes( | 2811 static Handle<Object> SetElementWithCallbackSetterInPrototypes( |
| 2793 Handle<JSObject> object, | 2812 Handle<JSObject> object, |
| 2794 uint32_t index, | 2813 uint32_t index, |
| 2795 Handle<Object> value, | 2814 Handle<Object> value, |
| 2796 bool* found, | 2815 bool* found, |
| 2797 StrictModeFlag strict_mode); | 2816 StrictMode strict_mode); |
| 2798 static Handle<Object> SetDictionaryElement( | 2817 static Handle<Object> SetDictionaryElement( |
| 2799 Handle<JSObject> object, | 2818 Handle<JSObject> object, |
| 2800 uint32_t index, | 2819 uint32_t index, |
| 2801 Handle<Object> value, | 2820 Handle<Object> value, |
| 2802 PropertyAttributes attributes, | 2821 PropertyAttributes attributes, |
| 2803 StrictModeFlag strict_mode, | 2822 StrictMode strict_mode, |
| 2804 bool check_prototype, | 2823 bool check_prototype, |
| 2805 SetPropertyMode set_mode = SET_PROPERTY); | 2824 SetPropertyMode set_mode = SET_PROPERTY); |
| 2806 static Handle<Object> SetFastDoubleElement( | 2825 static Handle<Object> SetFastDoubleElement( |
| 2807 Handle<JSObject> object, | 2826 Handle<JSObject> object, |
| 2808 uint32_t index, | 2827 uint32_t index, |
| 2809 Handle<Object> value, | 2828 Handle<Object> value, |
| 2810 StrictModeFlag strict_mode, | 2829 StrictMode strict_mode, |
| 2811 bool check_prototype = true); | 2830 bool check_prototype = true); |
| 2812 | 2831 |
| 2813 // Searches the prototype chain for property 'name'. If it is found and | 2832 // Searches the prototype chain for property 'name'. If it is found and |
| 2814 // has a setter, invoke it and set '*done' to true. If it is found and is | 2833 // has a setter, invoke it and set '*done' to true. If it is found and is |
| 2815 // read-only, reject and set '*done' to true. Otherwise, set '*done' to | 2834 // read-only, reject and set '*done' to true. Otherwise, set '*done' to |
| 2816 // false. Can throw and return an empty handle with '*done==true'. | 2835 // false. Can throw and return an empty handle with '*done==true'. |
| 2817 static Handle<Object> SetPropertyViaPrototypes( | 2836 static Handle<Object> SetPropertyViaPrototypes( |
| 2818 Handle<JSObject> object, | 2837 Handle<JSObject> object, |
| 2819 Handle<Name> name, | 2838 Handle<Name> name, |
| 2820 Handle<Object> value, | 2839 Handle<Object> value, |
| 2821 PropertyAttributes attributes, | 2840 PropertyAttributes attributes, |
| 2822 StrictModeFlag strict_mode, | 2841 StrictMode strict_mode, |
| 2823 bool* done); | 2842 bool* done); |
| 2824 static Handle<Object> SetPropertyPostInterceptor( | 2843 static Handle<Object> SetPropertyPostInterceptor( |
| 2825 Handle<JSObject> object, | 2844 Handle<JSObject> object, |
| 2826 Handle<Name> name, | 2845 Handle<Name> name, |
| 2827 Handle<Object> value, | 2846 Handle<Object> value, |
| 2828 PropertyAttributes attributes, | 2847 PropertyAttributes attributes, |
| 2829 StrictModeFlag strict_mode); | 2848 StrictMode strict_mode); |
| 2830 static Handle<Object> SetPropertyUsingTransition( | 2849 static Handle<Object> SetPropertyUsingTransition( |
| 2831 Handle<JSObject> object, | 2850 Handle<JSObject> object, |
| 2832 LookupResult* lookup, | 2851 LookupResult* lookup, |
| 2833 Handle<Name> name, | 2852 Handle<Name> name, |
| 2834 Handle<Object> value, | 2853 Handle<Object> value, |
| 2835 PropertyAttributes attributes); | 2854 PropertyAttributes attributes); |
| 2836 static Handle<Object> SetPropertyWithFailedAccessCheck( | 2855 static Handle<Object> SetPropertyWithFailedAccessCheck( |
| 2837 Handle<JSObject> object, | 2856 Handle<JSObject> object, |
| 2838 LookupResult* result, | 2857 LookupResult* result, |
| 2839 Handle<Name> name, | 2858 Handle<Name> name, |
| 2840 Handle<Object> value, | 2859 Handle<Object> value, |
| 2841 bool check_prototype, | 2860 bool check_prototype, |
| 2842 StrictModeFlag strict_mode); | 2861 StrictMode strict_mode); |
| 2843 | 2862 |
| 2844 // Add a property to an object. | 2863 // Add a property to an object. |
| 2845 static Handle<Object> AddProperty( | 2864 static Handle<Object> AddProperty( |
| 2846 Handle<JSObject> object, | 2865 Handle<JSObject> object, |
| 2847 Handle<Name> name, | 2866 Handle<Name> name, |
| 2848 Handle<Object> value, | 2867 Handle<Object> value, |
| 2849 PropertyAttributes attributes, | 2868 PropertyAttributes attributes, |
| 2850 StrictModeFlag strict_mode, | 2869 StrictMode strict_mode, |
| 2851 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, | 2870 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, |
| 2852 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, | 2871 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, |
| 2853 ValueType value_type = OPTIMAL_REPRESENTATION, | 2872 ValueType value_type = OPTIMAL_REPRESENTATION, |
| 2854 StoreMode mode = ALLOW_AS_CONSTANT, | 2873 StoreMode mode = ALLOW_AS_CONSTANT, |
| 2855 TransitionFlag flag = INSERT_TRANSITION); | 2874 TransitionFlag flag = INSERT_TRANSITION); |
| 2856 | 2875 |
| 2857 // Add a constant function property to a fast-case object. | 2876 // Add a constant function property to a fast-case object. |
| 2858 // This leaves a CONSTANT_TRANSITION in the old map, and | 2877 // This leaves a CONSTANT_TRANSITION in the old map, and |
| 2859 // if it is called on a second object with this map, a | 2878 // if it is called on a second object with this map, a |
| 2860 // normal property is added instead, with a map transition. | 2879 // normal property is added instead, with a map transition. |
| 2861 // This avoids the creation of many maps with the same constant | 2880 // This avoids the creation of many maps with the same constant |
| 2862 // function, all orphaned. | 2881 // function, all orphaned. |
| 2863 static void AddConstantProperty(Handle<JSObject> object, | 2882 static void AddConstantProperty(Handle<JSObject> object, |
| 2864 Handle<Name> name, | 2883 Handle<Name> name, |
| 2865 Handle<Object> constant, | 2884 Handle<Object> constant, |
| 2866 PropertyAttributes attributes, | 2885 PropertyAttributes attributes, |
| 2867 TransitionFlag flag); | 2886 TransitionFlag flag); |
| 2868 | 2887 |
| 2869 // Add a property to a fast-case object. | 2888 // Add a property to a fast-case object. |
| 2870 static void AddFastProperty(Handle<JSObject> object, | 2889 static void AddFastProperty(Handle<JSObject> object, |
| 2871 Handle<Name> name, | 2890 Handle<Name> name, |
| 2872 Handle<Object> value, | 2891 Handle<Object> value, |
| 2873 PropertyAttributes attributes, | 2892 PropertyAttributes attributes, |
| 2874 StoreFromKeyed store_mode, | 2893 StoreFromKeyed store_mode, |
| 2875 ValueType value_type, | 2894 ValueType value_type, |
| 2876 TransitionFlag flag); | 2895 TransitionFlag flag); |
| 2877 | 2896 |
| 2878 // Add a property to a fast-case object using a map transition to | |
| 2879 // new_map. | |
| 2880 static void AddFastPropertyUsingMap(Handle<JSObject> object, | |
| 2881 Handle<Map> new_map, | |
| 2882 Handle<Name> name, | |
| 2883 Handle<Object> value, | |
| 2884 int field_index, | |
| 2885 Representation representation); | |
| 2886 | |
| 2887 // Add a property to a slow-case object. | 2897 // Add a property to a slow-case object. |
| 2888 static void AddSlowProperty(Handle<JSObject> object, | 2898 static void AddSlowProperty(Handle<JSObject> object, |
| 2889 Handle<Name> name, | 2899 Handle<Name> name, |
| 2890 Handle<Object> value, | 2900 Handle<Object> value, |
| 2891 PropertyAttributes attributes); | 2901 PropertyAttributes attributes); |
| 2892 | 2902 |
| 2893 static Handle<Object> DeleteProperty(Handle<JSObject> object, | 2903 static Handle<Object> DeleteProperty(Handle<JSObject> object, |
| 2894 Handle<Name> name, | 2904 Handle<Name> name, |
| 2895 DeleteMode mode); | 2905 DeleteMode mode); |
| 2896 static Handle<Object> DeletePropertyPostInterceptor(Handle<JSObject> object, | 2906 static Handle<Object> DeletePropertyPostInterceptor(Handle<JSObject> object, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2913 bool ReferencesObjectFromElements(FixedArray* elements, | 2923 bool ReferencesObjectFromElements(FixedArray* elements, |
| 2914 ElementsKind kind, | 2924 ElementsKind kind, |
| 2915 Object* object); | 2925 Object* object); |
| 2916 | 2926 |
| 2917 // Returns true if most of the elements backing storage is used. | 2927 // Returns true if most of the elements backing storage is used. |
| 2918 bool HasDenseElements(); | 2928 bool HasDenseElements(); |
| 2919 | 2929 |
| 2920 // Gets the current elements capacity and the number of used elements. | 2930 // Gets the current elements capacity and the number of used elements. |
| 2921 void GetElementsCapacityAndUsage(int* capacity, int* used); | 2931 void GetElementsCapacityAndUsage(int* capacity, int* used); |
| 2922 | 2932 |
| 2923 bool CanSetCallback(Name* name); | 2933 static bool CanSetCallback(Handle<JSObject> object, Handle<Name> name); |
| 2924 static void SetElementCallback(Handle<JSObject> object, | 2934 static void SetElementCallback(Handle<JSObject> object, |
| 2925 uint32_t index, | 2935 uint32_t index, |
| 2926 Handle<Object> structure, | 2936 Handle<Object> structure, |
| 2927 PropertyAttributes attributes); | 2937 PropertyAttributes attributes); |
| 2928 static void SetPropertyCallback(Handle<JSObject> object, | 2938 static void SetPropertyCallback(Handle<JSObject> object, |
| 2929 Handle<Name> name, | 2939 Handle<Name> name, |
| 2930 Handle<Object> structure, | 2940 Handle<Object> structure, |
| 2931 PropertyAttributes attributes); | 2941 PropertyAttributes attributes); |
| 2932 static void DefineElementAccessor(Handle<JSObject> object, | 2942 static void DefineElementAccessor(Handle<JSObject> object, |
| 2933 uint32_t index, | 2943 uint32_t index, |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3152 DECLARE_VERIFIER(FixedDoubleArray) | 3162 DECLARE_VERIFIER(FixedDoubleArray) |
| 3153 | 3163 |
| 3154 private: | 3164 private: |
| 3155 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray); | 3165 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray); |
| 3156 }; | 3166 }; |
| 3157 | 3167 |
| 3158 | 3168 |
| 3159 // ConstantPoolArray describes a fixed-sized array containing constant pool | 3169 // ConstantPoolArray describes a fixed-sized array containing constant pool |
| 3160 // entires. | 3170 // entires. |
| 3161 // The format of the pool is: | 3171 // The format of the pool is: |
| 3162 // [0]: Field holding the first index which is a pointer entry | 3172 // [0]: Field holding the first index which is a raw code target pointer entry |
| 3163 // [1]: Field holding the first index which is a int32 entry | 3173 // [1]: Field holding the first index which is a heap pointer entry |
| 3164 // [2] ... [first_ptr_index() - 1]: 64 bit entries | 3174 // [2]: Field holding the first index which is a int32 entry |
| 3165 // [first_ptr_index()] ... [first_int32_index() - 1]: pointer entries | 3175 // [3] ... [first_code_ptr_index() - 1] : 64 bit entries |
| 3166 // [first_int32_index()] ... [length - 1]: 32 bit entries | 3176 // [first_code_ptr_index()] ... [first_heap_ptr_index() - 1] : code pointers |
| 3177 // [first_heap_ptr_index()] ... [first_int32_index() - 1] : heap pointers |
| 3178 // [first_int32_index()] ... [length - 1] : 32 bit entries |
| 3167 class ConstantPoolArray: public FixedArrayBase { | 3179 class ConstantPoolArray: public FixedArrayBase { |
| 3168 public: | 3180 public: |
| 3169 // Getters for the field storing the first index for different type entries. | 3181 // Getters for the field storing the first index for different type entries. |
| 3170 inline int first_ptr_index(); | 3182 inline int first_code_ptr_index(); |
| 3183 inline int first_heap_ptr_index(); |
| 3171 inline int first_int64_index(); | 3184 inline int first_int64_index(); |
| 3172 inline int first_int32_index(); | 3185 inline int first_int32_index(); |
| 3173 | 3186 |
| 3174 // Getters for counts of different type entries. | 3187 // Getters for counts of different type entries. |
| 3175 inline int count_of_ptr_entries(); | 3188 inline int count_of_code_ptr_entries(); |
| 3189 inline int count_of_heap_ptr_entries(); |
| 3176 inline int count_of_int64_entries(); | 3190 inline int count_of_int64_entries(); |
| 3177 inline int count_of_int32_entries(); | 3191 inline int count_of_int32_entries(); |
| 3178 | 3192 |
| 3179 // Setter and getter for pool elements. | 3193 // Setter and getter for pool elements. |
| 3180 inline Object* get_ptr_entry(int index); | 3194 inline Address get_code_ptr_entry(int index); |
| 3195 inline Object* get_heap_ptr_entry(int index); |
| 3181 inline int64_t get_int64_entry(int index); | 3196 inline int64_t get_int64_entry(int index); |
| 3182 inline int32_t get_int32_entry(int index); | 3197 inline int32_t get_int32_entry(int index); |
| 3183 inline double get_int64_entry_as_double(int index); | 3198 inline double get_int64_entry_as_double(int index); |
| 3184 | 3199 |
| 3200 inline void set(int index, Address value); |
| 3185 inline void set(int index, Object* value); | 3201 inline void set(int index, Object* value); |
| 3186 inline void set(int index, int64_t value); | 3202 inline void set(int index, int64_t value); |
| 3187 inline void set(int index, double value); | 3203 inline void set(int index, double value); |
| 3188 inline void set(int index, int32_t value); | 3204 inline void set(int index, int32_t value); |
| 3189 | 3205 |
| 3190 // Set up initial state. | 3206 // Set up initial state. |
| 3191 inline void SetEntryCounts(int number_of_int64_entries, | 3207 inline void SetEntryCounts(int number_of_int64_entries, |
| 3192 int number_of_ptr_entries, | 3208 int number_of_code_ptr_entries, |
| 3209 int number_of_heap_ptr_entries, |
| 3193 int number_of_int32_entries); | 3210 int number_of_int32_entries); |
| 3194 | 3211 |
| 3195 // Copy operations | 3212 // Copy operations |
| 3196 MUST_USE_RESULT inline MaybeObject* Copy(); | 3213 MUST_USE_RESULT inline MaybeObject* Copy(); |
| 3197 | 3214 |
| 3198 // Garbage collection support. | 3215 // Garbage collection support. |
| 3199 inline static int SizeFor(int number_of_int64_entries, | 3216 inline static int SizeFor(int number_of_int64_entries, |
| 3200 int number_of_ptr_entries, | 3217 int number_of_code_ptr_entries, |
| 3218 int number_of_heap_ptr_entries, |
| 3201 int number_of_int32_entries) { | 3219 int number_of_int32_entries) { |
| 3202 return RoundUp(OffsetAt(number_of_int64_entries, | 3220 return RoundUp(OffsetAt(number_of_int64_entries, |
| 3203 number_of_ptr_entries, | 3221 number_of_code_ptr_entries, |
| 3222 number_of_heap_ptr_entries, |
| 3204 number_of_int32_entries), | 3223 number_of_int32_entries), |
| 3205 kPointerSize); | 3224 kPointerSize); |
| 3206 } | 3225 } |
| 3207 | 3226 |
| 3208 // Code Generation support. | 3227 // Code Generation support. |
| 3209 inline int OffsetOfElementAt(int index) { | 3228 inline int OffsetOfElementAt(int index) { |
| 3210 ASSERT(index < length()); | 3229 ASSERT(index < length()); |
| 3211 if (index >= first_int32_index()) { | 3230 if (index >= first_int32_index()) { |
| 3212 return OffsetAt(count_of_int64_entries(), count_of_ptr_entries(), | 3231 return OffsetAt(count_of_int64_entries(), count_of_code_ptr_entries(), |
| 3213 index - first_int32_index()); | 3232 count_of_heap_ptr_entries(), index - first_int32_index()); |
| 3214 } else if (index >= first_ptr_index()) { | 3233 } else if (index >= first_heap_ptr_index()) { |
| 3215 return OffsetAt(count_of_int64_entries(), index - first_ptr_index(), 0); | 3234 return OffsetAt(count_of_int64_entries(), count_of_code_ptr_entries(), |
| 3235 index - first_heap_ptr_index(), 0); |
| 3236 } else if (index >= first_code_ptr_index()) { |
| 3237 return OffsetAt(count_of_int64_entries(), index - first_code_ptr_index(), |
| 3238 0, 0); |
| 3216 } else { | 3239 } else { |
| 3217 return OffsetAt(index, 0, 0); | 3240 return OffsetAt(index, 0, 0, 0); |
| 3218 } | 3241 } |
| 3219 } | 3242 } |
| 3220 | 3243 |
| 3221 // Casting. | 3244 // Casting. |
| 3222 static inline ConstantPoolArray* cast(Object* obj); | 3245 static inline ConstantPoolArray* cast(Object* obj); |
| 3223 | 3246 |
| 3247 // Garbage collection support. |
| 3248 Object** RawFieldOfElementAt(int index) { |
| 3249 return HeapObject::RawField(this, OffsetOfElementAt(index)); |
| 3250 } |
| 3251 |
| 3224 // Layout description. | 3252 // Layout description. |
| 3225 static const int kFirstPointerIndexOffset = FixedArray::kHeaderSize; | 3253 static const int kFirstCodePointerIndexOffset = FixedArray::kHeaderSize; |
| 3254 static const int kFirstHeapPointerIndexOffset = |
| 3255 kFirstCodePointerIndexOffset + kPointerSize; |
| 3226 static const int kFirstInt32IndexOffset = | 3256 static const int kFirstInt32IndexOffset = |
| 3227 kFirstPointerIndexOffset + kPointerSize; | 3257 kFirstHeapPointerIndexOffset + kPointerSize; |
| 3228 static const int kFirstOffset = kFirstInt32IndexOffset + kPointerSize; | 3258 static const int kFirstOffset = kFirstInt32IndexOffset + kPointerSize; |
| 3229 | 3259 |
| 3230 // Dispatched behavior. | 3260 // Dispatched behavior. |
| 3231 void ConstantPoolIterateBody(ObjectVisitor* v); | 3261 void ConstantPoolIterateBody(ObjectVisitor* v); |
| 3232 | 3262 |
| 3233 DECLARE_PRINTER(ConstantPoolArray) | 3263 DECLARE_PRINTER(ConstantPoolArray) |
| 3234 DECLARE_VERIFIER(ConstantPoolArray) | 3264 DECLARE_VERIFIER(ConstantPoolArray) |
| 3235 | 3265 |
| 3236 private: | 3266 private: |
| 3237 inline void set_first_ptr_index(int value); | 3267 inline void set_first_code_ptr_index(int value); |
| 3268 inline void set_first_heap_ptr_index(int value); |
| 3238 inline void set_first_int32_index(int value); | 3269 inline void set_first_int32_index(int value); |
| 3239 | 3270 |
| 3240 inline static int OffsetAt(int number_of_int64_entries, | 3271 inline static int OffsetAt(int number_of_int64_entries, |
| 3241 int number_of_ptr_entries, | 3272 int number_of_code_ptr_entries, |
| 3273 int number_of_heap_ptr_entries, |
| 3242 int number_of_int32_entries) { | 3274 int number_of_int32_entries) { |
| 3243 return kFirstOffset | 3275 return kFirstOffset |
| 3244 + (number_of_int64_entries * kInt64Size) | 3276 + (number_of_int64_entries * kInt64Size) |
| 3245 + (number_of_ptr_entries * kPointerSize) | 3277 + (number_of_code_ptr_entries * kPointerSize) |
| 3278 + (number_of_heap_ptr_entries * kPointerSize) |
| 3246 + (number_of_int32_entries * kInt32Size); | 3279 + (number_of_int32_entries * kInt32Size); |
| 3247 } | 3280 } |
| 3248 | 3281 |
| 3249 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolArray); | 3282 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolArray); |
| 3250 }; | 3283 }; |
| 3251 | 3284 |
| 3252 | 3285 |
| 3253 // DescriptorArrays are fixed arrays used to hold instance descriptors. | 3286 // DescriptorArrays are fixed arrays used to hold instance descriptors. |
| 3254 // The format of the these objects is: | 3287 // The format of the these objects is: |
| 3255 // [0]: Number of descriptors | 3288 // [0]: Number of descriptors |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3996 | 4029 |
| 3997 | 4030 |
| 3998 class NameDictionary: public Dictionary<NameDictionaryShape, Name*> { | 4031 class NameDictionary: public Dictionary<NameDictionaryShape, Name*> { |
| 3999 public: | 4032 public: |
| 4000 static inline NameDictionary* cast(Object* obj) { | 4033 static inline NameDictionary* cast(Object* obj) { |
| 4001 ASSERT(obj->IsDictionary()); | 4034 ASSERT(obj->IsDictionary()); |
| 4002 return reinterpret_cast<NameDictionary*>(obj); | 4035 return reinterpret_cast<NameDictionary*>(obj); |
| 4003 } | 4036 } |
| 4004 | 4037 |
| 4005 // Copies enumerable keys to preallocated fixed array. | 4038 // Copies enumerable keys to preallocated fixed array. |
| 4006 FixedArray* CopyEnumKeysTo(FixedArray* storage); | 4039 void CopyEnumKeysTo(FixedArray* storage); |
| 4007 static void DoGenerateNewEnumerationIndices( | 4040 static void DoGenerateNewEnumerationIndices( |
| 4008 Handle<NameDictionary> dictionary); | 4041 Handle<NameDictionary> dictionary); |
| 4009 | 4042 |
| 4010 // For transforming properties of a JSObject. | 4043 // For transforming properties of a JSObject. |
| 4011 MUST_USE_RESULT MaybeObject* TransformPropertiesToFastFor( | 4044 MUST_USE_RESULT MaybeObject* TransformPropertiesToFastFor( |
| 4012 JSObject* obj, | 4045 JSObject* obj, |
| 4013 int unused_property_fields); | 4046 int unused_property_fields); |
| 4014 | 4047 |
| 4015 // Find entry for key, otherwise return kNotFound. Optimized version of | 4048 // Find entry for key, otherwise return kNotFound. Optimized version of |
| 4016 // HashTable::FindEntry. | 4049 // HashTable::FindEntry. |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4310 class ScopeInfo : public FixedArray { | 4343 class ScopeInfo : public FixedArray { |
| 4311 public: | 4344 public: |
| 4312 static inline ScopeInfo* cast(Object* object); | 4345 static inline ScopeInfo* cast(Object* object); |
| 4313 | 4346 |
| 4314 // Return the type of this scope. | 4347 // Return the type of this scope. |
| 4315 ScopeType scope_type(); | 4348 ScopeType scope_type(); |
| 4316 | 4349 |
| 4317 // Does this scope call eval? | 4350 // Does this scope call eval? |
| 4318 bool CallsEval(); | 4351 bool CallsEval(); |
| 4319 | 4352 |
| 4320 // Return the language mode of this scope. | 4353 // Return the strict mode of this scope. |
| 4321 LanguageMode language_mode(); | 4354 StrictMode strict_mode(); |
| 4322 | 4355 |
| 4323 // Does this scope make a non-strict eval call? | 4356 // Does this scope make a sloppy eval call? |
| 4324 bool CallsNonStrictEval() { | 4357 bool CallsSloppyEval() { return CallsEval() && strict_mode() == SLOPPY; } |
| 4325 return CallsEval() && (language_mode() == CLASSIC_MODE); | |
| 4326 } | |
| 4327 | 4358 |
| 4328 // Return the total number of locals allocated on the stack and in the | 4359 // Return the total number of locals allocated on the stack and in the |
| 4329 // context. This includes the parameters that are allocated in the context. | 4360 // context. This includes the parameters that are allocated in the context. |
| 4330 int LocalCount(); | 4361 int LocalCount(); |
| 4331 | 4362 |
| 4332 // Return the number of stack slots for code. This number consists of two | 4363 // Return the number of stack slots for code. This number consists of two |
| 4333 // parts: | 4364 // parts: |
| 4334 // 1. One stack slot per stack allocated local. | 4365 // 1. One stack slot per stack allocated local. |
| 4335 // 2. One stack slot for the function name if it is stack allocated. | 4366 // 2. One stack slot for the function name if it is stack allocated. |
| 4336 int StackSlotCount(); | 4367 int StackSlotCount(); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4490 enum FunctionVariableInfo { | 4521 enum FunctionVariableInfo { |
| 4491 NONE, // No function name present. | 4522 NONE, // No function name present. |
| 4492 STACK, // Function | 4523 STACK, // Function |
| 4493 CONTEXT, | 4524 CONTEXT, |
| 4494 UNUSED | 4525 UNUSED |
| 4495 }; | 4526 }; |
| 4496 | 4527 |
| 4497 // Properties of scopes. | 4528 // Properties of scopes. |
| 4498 class ScopeTypeField: public BitField<ScopeType, 0, 3> {}; | 4529 class ScopeTypeField: public BitField<ScopeType, 0, 3> {}; |
| 4499 class CallsEvalField: public BitField<bool, 3, 1> {}; | 4530 class CallsEvalField: public BitField<bool, 3, 1> {}; |
| 4500 class LanguageModeField: public BitField<LanguageMode, 4, 2> {}; | 4531 class StrictModeField: public BitField<StrictMode, 4, 1> {}; |
| 4501 class FunctionVariableField: public BitField<FunctionVariableInfo, 6, 2> {}; | 4532 class FunctionVariableField: public BitField<FunctionVariableInfo, 5, 2> {}; |
| 4502 class FunctionVariableMode: public BitField<VariableMode, 8, 3> {}; | 4533 class FunctionVariableMode: public BitField<VariableMode, 7, 3> {}; |
| 4503 | 4534 |
| 4504 // BitFields representing the encoded information for context locals in the | 4535 // BitFields representing the encoded information for context locals in the |
| 4505 // ContextLocalInfoEntries part. | 4536 // ContextLocalInfoEntries part. |
| 4506 class ContextLocalMode: public BitField<VariableMode, 0, 3> {}; | 4537 class ContextLocalMode: public BitField<VariableMode, 0, 3> {}; |
| 4507 class ContextLocalInitFlag: public BitField<InitializationFlag, 3, 1> {}; | 4538 class ContextLocalInitFlag: public BitField<InitializationFlag, 3, 1> {}; |
| 4508 }; | 4539 }; |
| 4509 | 4540 |
| 4510 | 4541 |
| 4511 // The cache for maps used by normalized (dictionary mode) objects. | 4542 // The cache for maps used by normalized (dictionary mode) objects. |
| 4512 // Such maps do not have property descriptors, so a typical program | 4543 // Such maps do not have property descriptors, so a typical program |
| (...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5459 | 5490 |
| 5460 template<typename StaticVisitor> | 5491 template<typename StaticVisitor> |
| 5461 inline void CodeIterateBody(Heap* heap); | 5492 inline void CodeIterateBody(Heap* heap); |
| 5462 | 5493 |
| 5463 DECLARE_PRINTER(Code) | 5494 DECLARE_PRINTER(Code) |
| 5464 DECLARE_VERIFIER(Code) | 5495 DECLARE_VERIFIER(Code) |
| 5465 | 5496 |
| 5466 void ClearInlineCaches(); | 5497 void ClearInlineCaches(); |
| 5467 void ClearInlineCaches(Kind kind); | 5498 void ClearInlineCaches(Kind kind); |
| 5468 | 5499 |
| 5469 void ClearTypeFeedbackInfo(Heap* heap); | |
| 5470 | |
| 5471 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); | 5500 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); |
| 5472 uint32_t TranslateAstIdToPcOffset(BailoutId ast_id); | 5501 uint32_t TranslateAstIdToPcOffset(BailoutId ast_id); |
| 5473 | 5502 |
| 5474 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, | 5503 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, |
| 5475 enum Age { | 5504 enum Age { |
| 5476 kNotExecutedCodeAge = -2, | 5505 kNotExecutedCodeAge = -2, |
| 5477 kExecutedOnceCodeAge = -1, | 5506 kExecutedOnceCodeAge = -1, |
| 5478 kNoAgeCodeAge = 0, | 5507 kNoAgeCodeAge = 0, |
| 5479 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) | 5508 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) |
| 5480 kAfterLastCodeAge, | 5509 kAfterLastCodeAge, |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5905 } | 5934 } |
| 5906 | 5935 |
| 5907 inline bool has_fast_double_elements() { | 5936 inline bool has_fast_double_elements() { |
| 5908 return IsFastDoubleElementsKind(elements_kind()); | 5937 return IsFastDoubleElementsKind(elements_kind()); |
| 5909 } | 5938 } |
| 5910 | 5939 |
| 5911 inline bool has_fast_elements() { | 5940 inline bool has_fast_elements() { |
| 5912 return IsFastElementsKind(elements_kind()); | 5941 return IsFastElementsKind(elements_kind()); |
| 5913 } | 5942 } |
| 5914 | 5943 |
| 5915 inline bool has_non_strict_arguments_elements() { | 5944 inline bool has_sloppy_arguments_elements() { |
| 5916 return elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS; | 5945 return elements_kind() == SLOPPY_ARGUMENTS_ELEMENTS; |
| 5917 } | 5946 } |
| 5918 | 5947 |
| 5919 inline bool has_external_array_elements() { | 5948 inline bool has_external_array_elements() { |
| 5920 return IsExternalArrayElementsKind(elements_kind()); | 5949 return IsExternalArrayElementsKind(elements_kind()); |
| 5921 } | 5950 } |
| 5922 | 5951 |
| 5923 inline bool has_fixed_typed_array_elements() { | 5952 inline bool has_fixed_typed_array_elements() { |
| 5924 return IsFixedTypedArrayElementsKind(elements_kind()); | 5953 return IsFixedTypedArrayElementsKind(elements_kind()); |
| 5925 } | 5954 } |
| 5926 | 5955 |
| 5927 inline bool has_dictionary_elements() { | 5956 inline bool has_dictionary_elements() { |
| 5928 return IsDictionaryElementsKind(elements_kind()); | 5957 return IsDictionaryElementsKind(elements_kind()); |
| 5929 } | 5958 } |
| 5930 | 5959 |
| 5931 inline bool has_slow_elements_kind() { | 5960 inline bool has_slow_elements_kind() { |
| 5932 return elements_kind() == DICTIONARY_ELEMENTS | 5961 return elements_kind() == DICTIONARY_ELEMENTS |
| 5933 || elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS; | 5962 || elements_kind() == SLOPPY_ARGUMENTS_ELEMENTS; |
| 5934 } | 5963 } |
| 5935 | 5964 |
| 5936 static bool IsValidElementsTransition(ElementsKind from_kind, | 5965 static bool IsValidElementsTransition(ElementsKind from_kind, |
| 5937 ElementsKind to_kind); | 5966 ElementsKind to_kind); |
| 5938 | 5967 |
| 5939 // Returns true if the current map doesn't have DICTIONARY_ELEMENTS but if a | 5968 // Returns true if the current map doesn't have DICTIONARY_ELEMENTS but if a |
| 5940 // map with DICTIONARY_ELEMENTS was found in the prototype chain. | 5969 // map with DICTIONARY_ELEMENTS was found in the prototype chain. |
| 5941 bool DictionaryElementsInPrototypeChainOnly(); | 5970 bool DictionaryElementsInPrototypeChainOnly(); |
| 5942 | 5971 |
| 5943 inline bool HasTransitionArray(); | 5972 inline bool HasTransitionArray(); |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6507 // [id]: the script id. | 6536 // [id]: the script id. |
| 6508 DECL_ACCESSORS(id, Smi) | 6537 DECL_ACCESSORS(id, Smi) |
| 6509 | 6538 |
| 6510 // [line_offset]: script line offset in resource from where it was extracted. | 6539 // [line_offset]: script line offset in resource from where it was extracted. |
| 6511 DECL_ACCESSORS(line_offset, Smi) | 6540 DECL_ACCESSORS(line_offset, Smi) |
| 6512 | 6541 |
| 6513 // [column_offset]: script column offset in resource from where it was | 6542 // [column_offset]: script column offset in resource from where it was |
| 6514 // extracted. | 6543 // extracted. |
| 6515 DECL_ACCESSORS(column_offset, Smi) | 6544 DECL_ACCESSORS(column_offset, Smi) |
| 6516 | 6545 |
| 6517 // [data]: additional data associated with this script. | |
| 6518 DECL_ACCESSORS(data, Object) | |
| 6519 | |
| 6520 // [context_data]: context data for the context this script was compiled in. | 6546 // [context_data]: context data for the context this script was compiled in. |
| 6521 DECL_ACCESSORS(context_data, Object) | 6547 DECL_ACCESSORS(context_data, Object) |
| 6522 | 6548 |
| 6523 // [wrapper]: the wrapper cache. | 6549 // [wrapper]: the wrapper cache. |
| 6524 DECL_ACCESSORS(wrapper, Foreign) | 6550 DECL_ACCESSORS(wrapper, Foreign) |
| 6525 | 6551 |
| 6526 // [type]: the script type. | 6552 // [type]: the script type. |
| 6527 DECL_ACCESSORS(type, Smi) | 6553 DECL_ACCESSORS(type, Smi) |
| 6528 | 6554 |
| 6529 // [line_ends]: FixedArray of line ends positions. | 6555 // [line_ends]: FixedArray of line ends positions. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6563 inline bool HasValidSource(); | 6589 inline bool HasValidSource(); |
| 6564 | 6590 |
| 6565 // Dispatched behavior. | 6591 // Dispatched behavior. |
| 6566 DECLARE_PRINTER(Script) | 6592 DECLARE_PRINTER(Script) |
| 6567 DECLARE_VERIFIER(Script) | 6593 DECLARE_VERIFIER(Script) |
| 6568 | 6594 |
| 6569 static const int kSourceOffset = HeapObject::kHeaderSize; | 6595 static const int kSourceOffset = HeapObject::kHeaderSize; |
| 6570 static const int kNameOffset = kSourceOffset + kPointerSize; | 6596 static const int kNameOffset = kSourceOffset + kPointerSize; |
| 6571 static const int kLineOffsetOffset = kNameOffset + kPointerSize; | 6597 static const int kLineOffsetOffset = kNameOffset + kPointerSize; |
| 6572 static const int kColumnOffsetOffset = kLineOffsetOffset + kPointerSize; | 6598 static const int kColumnOffsetOffset = kLineOffsetOffset + kPointerSize; |
| 6573 static const int kDataOffset = kColumnOffsetOffset + kPointerSize; | 6599 static const int kContextOffset = kColumnOffsetOffset + kPointerSize; |
| 6574 static const int kContextOffset = kDataOffset + kPointerSize; | |
| 6575 static const int kWrapperOffset = kContextOffset + kPointerSize; | 6600 static const int kWrapperOffset = kContextOffset + kPointerSize; |
| 6576 static const int kTypeOffset = kWrapperOffset + kPointerSize; | 6601 static const int kTypeOffset = kWrapperOffset + kPointerSize; |
| 6577 static const int kLineEndsOffset = kTypeOffset + kPointerSize; | 6602 static const int kLineEndsOffset = kTypeOffset + kPointerSize; |
| 6578 static const int kIdOffset = kLineEndsOffset + kPointerSize; | 6603 static const int kIdOffset = kLineEndsOffset + kPointerSize; |
| 6579 static const int kEvalFromSharedOffset = kIdOffset + kPointerSize; | 6604 static const int kEvalFromSharedOffset = kIdOffset + kPointerSize; |
| 6580 static const int kEvalFrominstructionsOffsetOffset = | 6605 static const int kEvalFrominstructionsOffsetOffset = |
| 6581 kEvalFromSharedOffset + kPointerSize; | 6606 kEvalFromSharedOffset + kPointerSize; |
| 6582 static const int kFlagsOffset = | 6607 static const int kFlagsOffset = |
| 6583 kEvalFrominstructionsOffsetOffset + kPointerSize; | 6608 kEvalFrominstructionsOffsetOffset + kPointerSize; |
| 6584 static const int kSize = kFlagsOffset + kPointerSize; | 6609 static const int kSize = kFlagsOffset + kPointerSize; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6660 FixedArray* GetLiteralsFromOptimizedCodeMap(int index); | 6685 FixedArray* GetLiteralsFromOptimizedCodeMap(int index); |
| 6661 | 6686 |
| 6662 Code* GetCodeFromOptimizedCodeMap(int index); | 6687 Code* GetCodeFromOptimizedCodeMap(int index); |
| 6663 | 6688 |
| 6664 // Clear optimized code map. | 6689 // Clear optimized code map. |
| 6665 void ClearOptimizedCodeMap(); | 6690 void ClearOptimizedCodeMap(); |
| 6666 | 6691 |
| 6667 // Removed a specific optimized code object from the optimized code map. | 6692 // Removed a specific optimized code object from the optimized code map. |
| 6668 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); | 6693 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); |
| 6669 | 6694 |
| 6695 void ClearTypeFeedbackInfo(Heap* heap); |
| 6696 |
| 6670 // Trims the optimized code map after entries have been removed. | 6697 // Trims the optimized code map after entries have been removed. |
| 6671 void TrimOptimizedCodeMap(int shrink_by); | 6698 void TrimOptimizedCodeMap(int shrink_by); |
| 6672 | 6699 |
| 6673 // Add a new entry to the optimized code map. | 6700 // Add a new entry to the optimized code map. |
| 6674 MUST_USE_RESULT MaybeObject* AddToOptimizedCodeMap(Context* native_context, | 6701 MUST_USE_RESULT MaybeObject* AddToOptimizedCodeMap(Context* native_context, |
| 6675 Code* code, | 6702 Code* code, |
| 6676 FixedArray* literals, | 6703 FixedArray* literals, |
| 6677 BailoutId osr_ast_id); | 6704 BailoutId osr_ast_id); |
| 6678 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, | 6705 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, |
| 6679 Handle<Context> native_context, | 6706 Handle<Context> native_context, |
| 6680 Handle<Code> code, | 6707 Handle<Code> code, |
| 6681 Handle<FixedArray> literals, | 6708 Handle<FixedArray> literals, |
| 6682 BailoutId osr_ast_id); | 6709 BailoutId osr_ast_id); |
| 6683 | 6710 |
| 6684 // Layout description of the optimized code map. | 6711 // Layout description of the optimized code map. |
| 6685 static const int kNextMapIndex = 0; | 6712 static const int kNextMapIndex = 0; |
| 6686 static const int kEntriesStart = 1; | 6713 static const int kEntriesStart = 1; |
| 6687 static const int kContextOffset = 0; | 6714 static const int kContextOffset = 0; |
| 6688 static const int kCachedCodeOffset = 1; | 6715 static const int kCachedCodeOffset = 1; |
| 6689 static const int kLiteralsOffset = 2; | 6716 static const int kLiteralsOffset = 2; |
| 6690 static const int kOsrAstIdOffset = 3; | 6717 static const int kOsrAstIdOffset = 3; |
| 6691 static const int kEntryLength = 4; | 6718 static const int kEntryLength = 4; |
| 6692 static const int kFirstContextSlot = FixedArray::kHeaderSize + | |
| 6693 (kEntriesStart + kContextOffset) * kPointerSize; | |
| 6694 static const int kFirstCodeSlot = FixedArray::kHeaderSize + | |
| 6695 (kEntriesStart + kCachedCodeOffset) * kPointerSize; | |
| 6696 static const int kFirstOsrAstIdSlot = FixedArray::kHeaderSize + | |
| 6697 (kEntriesStart + kOsrAstIdOffset) * kPointerSize; | |
| 6698 static const int kSecondEntryIndex = kEntryLength + kEntriesStart; | |
| 6699 static const int kInitialLength = kEntriesStart + kEntryLength; | 6719 static const int kInitialLength = kEntriesStart + kEntryLength; |
| 6700 | 6720 |
| 6701 // [scope_info]: Scope info. | 6721 // [scope_info]: Scope info. |
| 6702 DECL_ACCESSORS(scope_info, ScopeInfo) | 6722 DECL_ACCESSORS(scope_info, ScopeInfo) |
| 6703 | 6723 |
| 6704 // [construct stub]: Code stub for constructing instances of this function. | 6724 // [construct stub]: Code stub for constructing instances of this function. |
| 6705 DECL_ACCESSORS(construct_stub, Code) | 6725 DECL_ACCESSORS(construct_stub, Code) |
| 6706 | 6726 |
| 6707 // Returns if this function has been compiled to native code yet. | 6727 // Returns if this function has been compiled to native code yet. |
| 6708 inline bool is_compiled(); | 6728 inline bool is_compiled(); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6775 // Important: inobject slack tracking is not attempted during the snapshot | 6795 // Important: inobject slack tracking is not attempted during the snapshot |
| 6776 // creation. | 6796 // creation. |
| 6777 | 6797 |
| 6778 static const int kGenerousAllocationCount = 8; | 6798 static const int kGenerousAllocationCount = 8; |
| 6779 | 6799 |
| 6780 // [construction_count]: Counter for constructor calls made during | 6800 // [construction_count]: Counter for constructor calls made during |
| 6781 // the tracking phase. | 6801 // the tracking phase. |
| 6782 inline int construction_count(); | 6802 inline int construction_count(); |
| 6783 inline void set_construction_count(int value); | 6803 inline void set_construction_count(int value); |
| 6784 | 6804 |
| 6805 // [feedback_vector] - accumulates ast node feedback from full-codegen and |
| 6806 // (increasingly) from crankshafted code where sufficient feedback isn't |
| 6807 // available. Currently the field is duplicated in |
| 6808 // TypeFeedbackInfo::feedback_vector, but the allocation is done here. |
| 6809 DECL_ACCESSORS(feedback_vector, FixedArray) |
| 6810 |
| 6785 // [initial_map]: initial map of the first function called as a constructor. | 6811 // [initial_map]: initial map of the first function called as a constructor. |
| 6786 // Saved for the duration of the tracking phase. | 6812 // Saved for the duration of the tracking phase. |
| 6787 // This is a weak link (GC resets it to undefined_value if no other live | 6813 // This is a weak link (GC resets it to undefined_value if no other live |
| 6788 // object reference this map). | 6814 // object reference this map). |
| 6789 DECL_ACCESSORS(initial_map, Object) | 6815 DECL_ACCESSORS(initial_map, Object) |
| 6790 | 6816 |
| 6791 // True if the initial_map is not undefined and the countdown stub is | 6817 // True if the initial_map is not undefined and the countdown stub is |
| 6792 // installed. | 6818 // installed. |
| 6793 inline bool IsInobjectSlackTrackingInProgress(); | 6819 inline bool IsInobjectSlackTrackingInProgress(); |
| 6794 | 6820 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6907 // the function through program execution but through other means (e.g. heap | 6933 // the function through program execution but through other means (e.g. heap |
| 6908 // iteration by the debugger). | 6934 // iteration by the debugger). |
| 6909 DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation_without_context) | 6935 DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation_without_context) |
| 6910 | 6936 |
| 6911 // Indicates whether optimizations have been disabled for this | 6937 // Indicates whether optimizations have been disabled for this |
| 6912 // shared function info. If a function is repeatedly optimized or if | 6938 // shared function info. If a function is repeatedly optimized or if |
| 6913 // we cannot optimize the function we disable optimization to avoid | 6939 // we cannot optimize the function we disable optimization to avoid |
| 6914 // spending time attempting to optimize it again. | 6940 // spending time attempting to optimize it again. |
| 6915 DECL_BOOLEAN_ACCESSORS(optimization_disabled) | 6941 DECL_BOOLEAN_ACCESSORS(optimization_disabled) |
| 6916 | 6942 |
| 6917 // Indicates the language mode of the function's code as defined by the | 6943 // Indicates the language mode. |
| 6918 // current harmony drafts for the next ES language standard. Possible | 6944 inline StrictMode strict_mode(); |
| 6919 // values are: | 6945 inline void set_strict_mode(StrictMode strict_mode); |
| 6920 // 1. CLASSIC_MODE - Unrestricted syntax and semantics, same as in ES5. | |
| 6921 // 2. STRICT_MODE - Restricted syntax and semantics, same as in ES5. | |
| 6922 // 3. EXTENDED_MODE - Only available under the harmony flag, not part of ES5. | |
| 6923 inline LanguageMode language_mode(); | |
| 6924 inline void set_language_mode(LanguageMode language_mode); | |
| 6925 | |
| 6926 // Indicates whether the language mode of this function is CLASSIC_MODE. | |
| 6927 inline bool is_classic_mode(); | |
| 6928 | |
| 6929 // Indicates whether the language mode of this function is EXTENDED_MODE. | |
| 6930 inline bool is_extended_mode(); | |
| 6931 | 6946 |
| 6932 // False if the function definitely does not allocate an arguments object. | 6947 // False if the function definitely does not allocate an arguments object. |
| 6933 DECL_BOOLEAN_ACCESSORS(uses_arguments) | 6948 DECL_BOOLEAN_ACCESSORS(uses_arguments) |
| 6934 | 6949 |
| 6935 // True if the function has any duplicated parameter names. | 6950 // True if the function has any duplicated parameter names. |
| 6936 DECL_BOOLEAN_ACCESSORS(has_duplicate_parameters) | 6951 DECL_BOOLEAN_ACCESSORS(has_duplicate_parameters) |
| 6937 | 6952 |
| 6938 // Indicates whether the function is a native function. | 6953 // Indicates whether the function is a native function. |
| 6939 // These needs special treatment in .call and .apply since | 6954 // These needs special treatment in .call and .apply since |
| 6940 // null passed as the receiver should not be translated to the | 6955 // null passed as the receiver should not be translated to the |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7066 static const int kOptimizedCodeMapOffset = kCodeOffset + kPointerSize; | 7081 static const int kOptimizedCodeMapOffset = kCodeOffset + kPointerSize; |
| 7067 static const int kScopeInfoOffset = kOptimizedCodeMapOffset + kPointerSize; | 7082 static const int kScopeInfoOffset = kOptimizedCodeMapOffset + kPointerSize; |
| 7068 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; | 7083 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; |
| 7069 static const int kInstanceClassNameOffset = | 7084 static const int kInstanceClassNameOffset = |
| 7070 kConstructStubOffset + kPointerSize; | 7085 kConstructStubOffset + kPointerSize; |
| 7071 static const int kFunctionDataOffset = | 7086 static const int kFunctionDataOffset = |
| 7072 kInstanceClassNameOffset + kPointerSize; | 7087 kInstanceClassNameOffset + kPointerSize; |
| 7073 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; | 7088 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; |
| 7074 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; | 7089 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; |
| 7075 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; | 7090 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; |
| 7091 static const int kFeedbackVectorOffset = |
| 7092 kInferredNameOffset + kPointerSize; |
| 7076 static const int kInitialMapOffset = | 7093 static const int kInitialMapOffset = |
| 7077 kInferredNameOffset + kPointerSize; | 7094 kFeedbackVectorOffset + kPointerSize; |
| 7078 // ast_node_count is a Smi field. It could be grouped with another Smi field | 7095 // ast_node_count is a Smi field. It could be grouped with another Smi field |
| 7079 // into a PSEUDO_SMI_ACCESSORS pair (on x64), if one becomes available. | 7096 // into a PSEUDO_SMI_ACCESSORS pair (on x64), if one becomes available. |
| 7080 static const int kAstNodeCountOffset = | 7097 static const int kAstNodeCountOffset = |
| 7081 kInitialMapOffset + kPointerSize; | 7098 kInitialMapOffset + kPointerSize; |
| 7082 #if V8_HOST_ARCH_32_BIT | 7099 #if V8_HOST_ARCH_32_BIT |
| 7083 // Smi fields. | 7100 // Smi fields. |
| 7084 static const int kLengthOffset = | 7101 static const int kLengthOffset = |
| 7085 kAstNodeCountOffset + kPointerSize; | 7102 kAstNodeCountOffset + kPointerSize; |
| 7086 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; | 7103 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; |
| 7087 static const int kExpectedNofPropertiesOffset = | 7104 static const int kExpectedNofPropertiesOffset = |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7169 static const int kStartPositionShift = 2; | 7186 static const int kStartPositionShift = 2; |
| 7170 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); | 7187 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); |
| 7171 | 7188 |
| 7172 // Bit positions in compiler_hints. | 7189 // Bit positions in compiler_hints. |
| 7173 enum CompilerHints { | 7190 enum CompilerHints { |
| 7174 kAllowLazyCompilation, | 7191 kAllowLazyCompilation, |
| 7175 kAllowLazyCompilationWithoutContext, | 7192 kAllowLazyCompilationWithoutContext, |
| 7176 kLiveObjectsMayExist, | 7193 kLiveObjectsMayExist, |
| 7177 kOptimizationDisabled, | 7194 kOptimizationDisabled, |
| 7178 kStrictModeFunction, | 7195 kStrictModeFunction, |
| 7179 kExtendedModeFunction, | |
| 7180 kUsesArguments, | 7196 kUsesArguments, |
| 7181 kHasDuplicateParameters, | 7197 kHasDuplicateParameters, |
| 7182 kNative, | 7198 kNative, |
| 7183 kInlineBuiltin, | 7199 kInlineBuiltin, |
| 7184 kBoundFunction, | 7200 kBoundFunction, |
| 7185 kIsAnonymous, | 7201 kIsAnonymous, |
| 7186 kNameShouldPrintAsAnonymous, | 7202 kNameShouldPrintAsAnonymous, |
| 7187 kIsFunction, | 7203 kIsFunction, |
| 7188 kDontOptimize, | 7204 kDontOptimize, |
| 7189 kDontInline, | 7205 kDontInline, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 7214 STATIC_ASSERT(SharedFunctionInfo::kCompilerHintsCount <= | 7230 STATIC_ASSERT(SharedFunctionInfo::kCompilerHintsCount <= |
| 7215 SharedFunctionInfo::kCompilerHintsSize * kBitsPerByte); | 7231 SharedFunctionInfo::kCompilerHintsSize * kBitsPerByte); |
| 7216 | 7232 |
| 7217 public: | 7233 public: |
| 7218 // Constants for optimizing codegen for strict mode function and | 7234 // Constants for optimizing codegen for strict mode function and |
| 7219 // native tests. | 7235 // native tests. |
| 7220 // Allows to use byte-width instructions. | 7236 // Allows to use byte-width instructions. |
| 7221 static const int kStrictModeBitWithinByte = | 7237 static const int kStrictModeBitWithinByte = |
| 7222 (kStrictModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte; | 7238 (kStrictModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte; |
| 7223 | 7239 |
| 7224 static const int kExtendedModeBitWithinByte = | |
| 7225 (kExtendedModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte; | |
| 7226 | |
| 7227 static const int kNativeBitWithinByte = | 7240 static const int kNativeBitWithinByte = |
| 7228 (kNative + kCompilerHintsSmiTagSize) % kBitsPerByte; | 7241 (kNative + kCompilerHintsSmiTagSize) % kBitsPerByte; |
| 7229 | 7242 |
| 7230 #if __BYTE_ORDER == __LITTLE_ENDIAN | 7243 #if __BYTE_ORDER == __LITTLE_ENDIAN |
| 7231 static const int kStrictModeByteOffset = kCompilerHintsOffset + | 7244 static const int kStrictModeByteOffset = kCompilerHintsOffset + |
| 7232 (kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte; | 7245 (kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte; |
| 7233 static const int kExtendedModeByteOffset = kCompilerHintsOffset + | |
| 7234 (kExtendedModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte; | |
| 7235 static const int kNativeByteOffset = kCompilerHintsOffset + | 7246 static const int kNativeByteOffset = kCompilerHintsOffset + |
| 7236 (kNative + kCompilerHintsSmiTagSize) / kBitsPerByte; | 7247 (kNative + kCompilerHintsSmiTagSize) / kBitsPerByte; |
| 7237 #elif __BYTE_ORDER == __BIG_ENDIAN | 7248 #elif __BYTE_ORDER == __BIG_ENDIAN |
| 7238 static const int kStrictModeByteOffset = kCompilerHintsOffset + | 7249 static const int kStrictModeByteOffset = kCompilerHintsOffset + |
| 7239 (kCompilerHintsSize - 1) - | 7250 (kCompilerHintsSize - 1) - |
| 7240 ((kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte); | 7251 ((kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte); |
| 7241 static const int kExtendedModeByteOffset = kCompilerHintsOffset + | |
| 7242 (kCompilerHintsSize - 1) - | |
| 7243 ((kExtendedModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte); | |
| 7244 static const int kNativeByteOffset = kCompilerHintsOffset + | 7252 static const int kNativeByteOffset = kCompilerHintsOffset + |
| 7245 (kCompilerHintsSize - 1) - | 7253 (kCompilerHintsSize - 1) - |
| 7246 ((kNative + kCompilerHintsSmiTagSize) / kBitsPerByte); | 7254 ((kNative + kCompilerHintsSmiTagSize) / kBitsPerByte); |
| 7247 #else | 7255 #else |
| 7248 #error Unknown byte ordering | 7256 #error Unknown byte ordering |
| 7249 #endif | 7257 #endif |
| 7250 | 7258 |
| 7251 private: | 7259 private: |
| 7252 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); | 7260 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); |
| 7253 }; | 7261 }; |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7984 }; | 7992 }; |
| 7985 | 7993 |
| 7986 | 7994 |
| 7987 class CompilationCacheTable: public HashTable<CompilationCacheShape, | 7995 class CompilationCacheTable: public HashTable<CompilationCacheShape, |
| 7988 HashTableKey*> { | 7996 HashTableKey*> { |
| 7989 public: | 7997 public: |
| 7990 // Find cached value for a string key, otherwise return null. | 7998 // Find cached value for a string key, otherwise return null. |
| 7991 Object* Lookup(String* src, Context* context); | 7999 Object* Lookup(String* src, Context* context); |
| 7992 Object* LookupEval(String* src, | 8000 Object* LookupEval(String* src, |
| 7993 Context* context, | 8001 Context* context, |
| 7994 LanguageMode language_mode, | 8002 StrictMode strict_mode, |
| 7995 int scope_position); | 8003 int scope_position); |
| 7996 Object* LookupRegExp(String* source, JSRegExp::Flags flags); | 8004 Object* LookupRegExp(String* source, JSRegExp::Flags flags); |
| 7997 MUST_USE_RESULT MaybeObject* Put(String* src, | 8005 MUST_USE_RESULT MaybeObject* Put(String* src, |
| 7998 Context* context, | 8006 Context* context, |
| 7999 Object* value); | 8007 Object* value); |
| 8000 MUST_USE_RESULT MaybeObject* PutEval(String* src, | 8008 MUST_USE_RESULT MaybeObject* PutEval(String* src, |
| 8001 Context* context, | 8009 Context* context, |
| 8002 SharedFunctionInfo* value, | 8010 SharedFunctionInfo* value, |
| 8003 int scope_position); | 8011 int scope_position); |
| 8004 MUST_USE_RESULT MaybeObject* PutRegExp(String* src, | 8012 MUST_USE_RESULT MaybeObject* PutRegExp(String* src, |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8162 inline void change_ic_with_type_info_count(int count); | 8170 inline void change_ic_with_type_info_count(int count); |
| 8163 | 8171 |
| 8164 inline void initialize_storage(); | 8172 inline void initialize_storage(); |
| 8165 | 8173 |
| 8166 inline void change_own_type_change_checksum(); | 8174 inline void change_own_type_change_checksum(); |
| 8167 inline int own_type_change_checksum(); | 8175 inline int own_type_change_checksum(); |
| 8168 | 8176 |
| 8169 inline void set_inlined_type_change_checksum(int checksum); | 8177 inline void set_inlined_type_change_checksum(int checksum); |
| 8170 inline bool matches_inlined_type_change_checksum(int checksum); | 8178 inline bool matches_inlined_type_change_checksum(int checksum); |
| 8171 | 8179 |
| 8172 DECL_ACCESSORS(feedback_vector, FixedArray) | |
| 8173 | |
| 8174 static inline TypeFeedbackInfo* cast(Object* obj); | 8180 static inline TypeFeedbackInfo* cast(Object* obj); |
| 8175 | 8181 |
| 8176 // Dispatched behavior. | 8182 // Dispatched behavior. |
| 8177 DECLARE_PRINTER(TypeFeedbackInfo) | 8183 DECLARE_PRINTER(TypeFeedbackInfo) |
| 8178 DECLARE_VERIFIER(TypeFeedbackInfo) | 8184 DECLARE_VERIFIER(TypeFeedbackInfo) |
| 8179 | 8185 |
| 8180 static const int kStorage1Offset = HeapObject::kHeaderSize; | 8186 static const int kStorage1Offset = HeapObject::kHeaderSize; |
| 8181 static const int kStorage2Offset = kStorage1Offset + kPointerSize; | 8187 static const int kStorage2Offset = kStorage1Offset + kPointerSize; |
| 8182 static const int kFeedbackVectorOffset = | 8188 static const int kSize = kStorage2Offset + kPointerSize; |
| 8183 kStorage2Offset + kPointerSize; | |
| 8184 static const int kSize = kFeedbackVectorOffset + kPointerSize; | |
| 8185 | 8189 |
| 8190 // TODO(mvstanton): move these sentinel declarations to shared function info. |
| 8186 // The object that indicates an uninitialized cache. | 8191 // The object that indicates an uninitialized cache. |
| 8187 static inline Handle<Object> UninitializedSentinel(Isolate* isolate); | 8192 static inline Handle<Object> UninitializedSentinel(Isolate* isolate); |
| 8188 | 8193 |
| 8189 // The object that indicates a megamorphic state. | 8194 // The object that indicates a megamorphic state. |
| 8190 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate); | 8195 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate); |
| 8191 | 8196 |
| 8192 // The object that indicates a monomorphic state of Array with | 8197 // The object that indicates a monomorphic state of Array with |
| 8193 // ElementsKind | 8198 // ElementsKind |
| 8194 static inline Handle<Object> MonomorphicArraySentinel(Isolate* isolate, | 8199 static inline Handle<Object> MonomorphicArraySentinel(Isolate* isolate, |
| 8195 ElementsKind elements_kind); | 8200 ElementsKind elements_kind); |
| 8196 | 8201 |
| 8197 // A raw version of the uninitialized sentinel that's safe to read during | 8202 // A raw version of the uninitialized sentinel that's safe to read during |
| 8198 // garbage collection (e.g., for patching the cache). | 8203 // garbage collection (e.g., for patching the cache). |
| 8199 static inline Object* RawUninitializedSentinel(Heap* heap); | 8204 static inline Object* RawUninitializedSentinel(Heap* heap); |
| 8200 | 8205 |
| 8201 static const int kForInFastCaseMarker = 0; | |
| 8202 static const int kForInSlowCaseMarker = 1; | |
| 8203 | |
| 8204 private: | 8206 private: |
| 8205 static const int kTypeChangeChecksumBits = 7; | 8207 static const int kTypeChangeChecksumBits = 7; |
| 8206 | 8208 |
| 8207 class ICTotalCountField: public BitField<int, 0, | 8209 class ICTotalCountField: public BitField<int, 0, |
| 8208 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT | 8210 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT |
| 8209 class OwnTypeChangeChecksum: public BitField<int, | 8211 class OwnTypeChangeChecksum: public BitField<int, |
| 8210 kSmiValueSize - kTypeChangeChecksumBits, | 8212 kSmiValueSize - kTypeChangeChecksumBits, |
| 8211 kTypeChangeChecksumBits> {}; // NOLINT | 8213 kTypeChangeChecksumBits> {}; // NOLINT |
| 8212 class ICsWithTypeInfoCountField: public BitField<int, 0, | 8214 class ICsWithTypeInfoCountField: public BitField<int, 0, |
| 8213 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT | 8215 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8427 DECLARE_PRINTER(AllocationMemento) | 8429 DECLARE_PRINTER(AllocationMemento) |
| 8428 DECLARE_VERIFIER(AllocationMemento) | 8430 DECLARE_VERIFIER(AllocationMemento) |
| 8429 | 8431 |
| 8430 static inline AllocationMemento* cast(Object* obj); | 8432 static inline AllocationMemento* cast(Object* obj); |
| 8431 | 8433 |
| 8432 private: | 8434 private: |
| 8433 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationMemento); | 8435 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationMemento); |
| 8434 }; | 8436 }; |
| 8435 | 8437 |
| 8436 | 8438 |
| 8437 // Representation of a slow alias as part of a non-strict arguments objects. | 8439 // Representation of a slow alias as part of a sloppy arguments objects. |
| 8438 // For fast aliases (if HasNonStrictArgumentsElements()): | 8440 // For fast aliases (if HasSloppyArgumentsElements()): |
| 8439 // - the parameter map contains an index into the context | 8441 // - the parameter map contains an index into the context |
| 8440 // - all attributes of the element have default values | 8442 // - all attributes of the element have default values |
| 8441 // For slow aliases (if HasDictionaryArgumentsElements()): | 8443 // For slow aliases (if HasDictionaryArgumentsElements()): |
| 8442 // - the parameter map contains no fast alias mapping (i.e. the hole) | 8444 // - the parameter map contains no fast alias mapping (i.e. the hole) |
| 8443 // - this struct (in the slow backing store) contains an index into the context | 8445 // - this struct (in the slow backing store) contains an index into the context |
| 8444 // - all attributes are available as part if the property details | 8446 // - all attributes are available as part if the property details |
| 8445 class AliasedArgumentsEntry: public Struct { | 8447 class AliasedArgumentsEntry: public Struct { |
| 8446 public: | 8448 public: |
| 8447 inline int aliased_context_slot(); | 8449 inline int aliased_context_slot(); |
| 8448 inline void set_aliased_context_slot(int count); | 8450 inline void set_aliased_context_slot(int count); |
| (...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9606 // If the handler defines an accessor property with a setter, invoke it. | 9608 // If the handler defines an accessor property with a setter, invoke it. |
| 9607 // If it defines an accessor property without a setter, or a data property | 9609 // If it defines an accessor property without a setter, or a data property |
| 9608 // that is read-only, throw. In all these cases set '*done' to true, | 9610 // that is read-only, throw. In all these cases set '*done' to true, |
| 9609 // otherwise set it to false. | 9611 // otherwise set it to false. |
| 9610 static Handle<Object> SetPropertyViaPrototypesWithHandler( | 9612 static Handle<Object> SetPropertyViaPrototypesWithHandler( |
| 9611 Handle<JSProxy> proxy, | 9613 Handle<JSProxy> proxy, |
| 9612 Handle<JSReceiver> receiver, | 9614 Handle<JSReceiver> receiver, |
| 9613 Handle<Name> name, | 9615 Handle<Name> name, |
| 9614 Handle<Object> value, | 9616 Handle<Object> value, |
| 9615 PropertyAttributes attributes, | 9617 PropertyAttributes attributes, |
| 9616 StrictModeFlag strict_mode, | 9618 StrictMode strict_mode, |
| 9617 bool* done); | 9619 bool* done); |
| 9618 | 9620 |
| 9619 MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler( | 9621 static PropertyAttributes GetPropertyAttributeWithHandler( |
| 9620 JSReceiver* receiver, | 9622 Handle<JSProxy> proxy, |
| 9621 Name* name); | 9623 Handle<JSReceiver> receiver, |
| 9622 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithHandler( | 9624 Handle<Name> name); |
| 9623 JSReceiver* receiver, | 9625 static PropertyAttributes GetElementAttributeWithHandler( |
| 9626 Handle<JSProxy> proxy, |
| 9627 Handle<JSReceiver> receiver, |
| 9624 uint32_t index); | 9628 uint32_t index); |
| 9625 | 9629 |
| 9626 // Turn the proxy into an (empty) JSObject. | 9630 // Turn the proxy into an (empty) JSObject. |
| 9627 static void Fix(Handle<JSProxy> proxy); | 9631 static void Fix(Handle<JSProxy> proxy); |
| 9628 | 9632 |
| 9629 // Initializes the body after the handler slot. | 9633 // Initializes the body after the handler slot. |
| 9630 inline void InitializeBody(int object_size, Object* value); | 9634 inline void InitializeBody(int object_size, Object* value); |
| 9631 | 9635 |
| 9632 // Invoke a trap by name. If the trap does not exist on this's handler, | 9636 // Invoke a trap by name. If the trap does not exist on this's handler, |
| 9633 // but derived_trap is non-NULL, invoke that instead. May cause GC. | 9637 // but derived_trap is non-NULL, invoke that instead. May cause GC. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 9657 kSize> BodyDescriptor; | 9661 kSize> BodyDescriptor; |
| 9658 | 9662 |
| 9659 private: | 9663 private: |
| 9660 friend class JSReceiver; | 9664 friend class JSReceiver; |
| 9661 | 9665 |
| 9662 static Handle<Object> SetPropertyWithHandler(Handle<JSProxy> proxy, | 9666 static Handle<Object> SetPropertyWithHandler(Handle<JSProxy> proxy, |
| 9663 Handle<JSReceiver> receiver, | 9667 Handle<JSReceiver> receiver, |
| 9664 Handle<Name> name, | 9668 Handle<Name> name, |
| 9665 Handle<Object> value, | 9669 Handle<Object> value, |
| 9666 PropertyAttributes attributes, | 9670 PropertyAttributes attributes, |
| 9667 StrictModeFlag strict_mode); | 9671 StrictMode strict_mode); |
| 9668 static Handle<Object> SetElementWithHandler(Handle<JSProxy> proxy, | 9672 static Handle<Object> SetElementWithHandler(Handle<JSProxy> proxy, |
| 9669 Handle<JSReceiver> receiver, | 9673 Handle<JSReceiver> receiver, |
| 9670 uint32_t index, | 9674 uint32_t index, |
| 9671 Handle<Object> value, | 9675 Handle<Object> value, |
| 9672 StrictModeFlag strict_mode); | 9676 StrictMode strict_mode); |
| 9673 | 9677 |
| 9674 static bool HasPropertyWithHandler(Handle<JSProxy> proxy, Handle<Name> name); | 9678 static bool HasPropertyWithHandler(Handle<JSProxy> proxy, Handle<Name> name); |
| 9675 static bool HasElementWithHandler(Handle<JSProxy> proxy, uint32_t index); | 9679 static bool HasElementWithHandler(Handle<JSProxy> proxy, uint32_t index); |
| 9676 | 9680 |
| 9677 static Handle<Object> DeletePropertyWithHandler(Handle<JSProxy> proxy, | 9681 static Handle<Object> DeletePropertyWithHandler(Handle<JSProxy> proxy, |
| 9678 Handle<Name> name, | 9682 Handle<Name> name, |
| 9679 DeleteMode mode); | 9683 DeleteMode mode); |
| 9680 static Handle<Object> DeleteElementWithHandler(Handle<JSProxy> proxy, | 9684 static Handle<Object> DeleteElementWithHandler(Handle<JSProxy> proxy, |
| 9681 uint32_t index, | 9685 uint32_t index, |
| 9682 DeleteMode mode); | 9686 DeleteMode mode); |
| (...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10777 } else { | 10781 } else { |
| 10778 value &= ~(1 << bit_position); | 10782 value &= ~(1 << bit_position); |
| 10779 } | 10783 } |
| 10780 return value; | 10784 return value; |
| 10781 } | 10785 } |
| 10782 }; | 10786 }; |
| 10783 | 10787 |
| 10784 } } // namespace v8::internal | 10788 } } // namespace v8::internal |
| 10785 | 10789 |
| 10786 #endif // V8_OBJECTS_H_ | 10790 #endif // V8_OBJECTS_H_ |
| OLD | NEW |