| 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 1972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1983 // Internal properties (e.g. the hidden properties dictionary) might | 1983 // Internal properties (e.g. the hidden properties dictionary) might |
| 1984 // be added even though the receiver is non-extensible. | 1984 // be added even though the receiver is non-extensible. |
| 1985 enum ExtensibilityCheck { | 1985 enum ExtensibilityCheck { |
| 1986 PERFORM_EXTENSIBILITY_CHECK, | 1986 PERFORM_EXTENSIBILITY_CHECK, |
| 1987 OMIT_EXTENSIBILITY_CHECK | 1987 OMIT_EXTENSIBILITY_CHECK |
| 1988 }; | 1988 }; |
| 1989 | 1989 |
| 1990 // Casting. | 1990 // Casting. |
| 1991 static inline JSReceiver* cast(Object* obj); | 1991 static inline JSReceiver* cast(Object* obj); |
| 1992 | 1992 |
| 1993 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5. |
| 1993 static Handle<Object> SetProperty(Handle<JSReceiver> object, | 1994 static Handle<Object> SetProperty(Handle<JSReceiver> object, |
| 1994 Handle<Name> key, | 1995 Handle<Name> key, |
| 1995 Handle<Object> value, | 1996 Handle<Object> value, |
| 1996 PropertyAttributes attributes, | 1997 PropertyAttributes attributes, |
| 1997 StrictModeFlag strict_mode); | 1998 StrictModeFlag strict_mode, |
| 1999 StoreFromKeyed store_mode = |
| 2000 MAY_BE_STORE_FROM_KEYED); |
| 1998 static Handle<Object> SetElement(Handle<JSReceiver> object, | 2001 static Handle<Object> SetElement(Handle<JSReceiver> object, |
| 1999 uint32_t index, | 2002 uint32_t index, |
| 2000 Handle<Object> value, | 2003 Handle<Object> value, |
| 2001 PropertyAttributes attributes, | 2004 PropertyAttributes attributes, |
| 2002 StrictModeFlag strict_mode); | 2005 StrictModeFlag strict_mode); |
| 2003 | 2006 |
| 2004 MUST_USE_RESULT static MaybeObject* SetPropertyOrFail( | 2007 // Implementation of [[HasProperty]], ECMA-262 5th edition, section 8.12.6. |
| 2005 Handle<JSReceiver> object, | 2008 static inline bool HasProperty(Handle<JSReceiver> object, Handle<Name> name); |
| 2006 Handle<Name> key, | 2009 static inline bool HasLocalProperty(Handle<JSReceiver>, Handle<Name> name); |
| 2007 Handle<Object> value, | 2010 static inline bool HasElement(Handle<JSReceiver> object, uint32_t index); |
| 2008 PropertyAttributes attributes, | 2011 static inline bool HasLocalElement(Handle<JSReceiver> object, uint32_t index); |
| 2009 StrictModeFlag strict_mode, | |
| 2010 StoreFromKeyed store_from_keyed = MAY_BE_STORE_FROM_KEYED); | |
| 2011 | 2012 |
| 2012 // Can cause GC. | 2013 // Implementation of [[Delete]], ECMA-262 5th edition, section 8.12.7. |
| 2013 MUST_USE_RESULT MaybeObject* SetProperty( | |
| 2014 Name* key, | |
| 2015 Object* value, | |
| 2016 PropertyAttributes attributes, | |
| 2017 StrictModeFlag strict_mode, | |
| 2018 StoreFromKeyed store_from_keyed = MAY_BE_STORE_FROM_KEYED); | |
| 2019 MUST_USE_RESULT MaybeObject* SetProperty( | |
| 2020 LookupResult* result, | |
| 2021 Name* key, | |
| 2022 Object* value, | |
| 2023 PropertyAttributes attributes, | |
| 2024 StrictModeFlag strict_mode, | |
| 2025 StoreFromKeyed store_from_keyed = MAY_BE_STORE_FROM_KEYED); | |
| 2026 MUST_USE_RESULT MaybeObject* SetPropertyWithDefinedSetter(JSReceiver* setter, | |
| 2027 Object* value); | |
| 2028 | |
| 2029 static Handle<Object> DeleteProperty(Handle<JSReceiver> object, | 2014 static Handle<Object> DeleteProperty(Handle<JSReceiver> object, |
| 2030 Handle<Name> name, | 2015 Handle<Name> name, |
| 2031 DeleteMode mode = NORMAL_DELETION); | 2016 DeleteMode mode = NORMAL_DELETION); |
| 2032 static Handle<Object> DeleteElement(Handle<JSReceiver> object, | 2017 static Handle<Object> DeleteElement(Handle<JSReceiver> object, |
| 2033 uint32_t index, | 2018 uint32_t index, |
| 2034 DeleteMode mode = NORMAL_DELETION); | 2019 DeleteMode mode = NORMAL_DELETION); |
| 2035 | 2020 |
| 2036 // Tests for the fast common case for property enumeration. | 2021 // Tests for the fast common case for property enumeration. |
| 2037 bool IsSimpleEnum(); | 2022 bool IsSimpleEnum(); |
| 2038 | 2023 |
| 2039 // Returns the class name ([[Class]] property in the specification). | 2024 // Returns the class name ([[Class]] property in the specification). |
| 2040 String* class_name(); | 2025 String* class_name(); |
| 2041 | 2026 |
| 2042 // Returns the constructor name (the name (possibly, inferred name) of the | 2027 // Returns the constructor name (the name (possibly, inferred name) of the |
| 2043 // function that was used to instantiate the object). | 2028 // function that was used to instantiate the object). |
| 2044 String* constructor_name(); | 2029 String* constructor_name(); |
| 2045 | 2030 |
| 2046 inline PropertyAttributes GetPropertyAttribute(Name* name); | 2031 inline PropertyAttributes GetPropertyAttribute(Name* name); |
| 2047 PropertyAttributes GetPropertyAttributeWithReceiver(JSReceiver* receiver, | 2032 PropertyAttributes GetPropertyAttributeWithReceiver(JSReceiver* receiver, |
| 2048 Name* name); | 2033 Name* name); |
| 2049 PropertyAttributes GetLocalPropertyAttribute(Name* name); | 2034 PropertyAttributes GetLocalPropertyAttribute(Name* name); |
| 2050 | 2035 |
| 2051 inline PropertyAttributes GetElementAttribute(uint32_t index); | 2036 inline PropertyAttributes GetElementAttribute(uint32_t index); |
| 2052 inline PropertyAttributes GetLocalElementAttribute(uint32_t index); | 2037 inline PropertyAttributes GetLocalElementAttribute(uint32_t index); |
| 2053 | 2038 |
| 2054 // Can cause a GC. | |
| 2055 inline bool HasProperty(Name* name); | |
| 2056 inline bool HasLocalProperty(Name* name); | |
| 2057 inline bool HasElement(uint32_t index); | |
| 2058 inline bool HasLocalElement(uint32_t index); | |
| 2059 | |
| 2060 // Return the object's prototype (might be Heap::null_value()). | 2039 // Return the object's prototype (might be Heap::null_value()). |
| 2061 inline Object* GetPrototype(); | 2040 inline Object* GetPrototype(); |
| 2062 | 2041 |
| 2063 // Return the constructor function (may be Heap::null_value()). | 2042 // Return the constructor function (may be Heap::null_value()). |
| 2064 inline Object* GetConstructor(); | 2043 inline Object* GetConstructor(); |
| 2065 | 2044 |
| 2066 // Retrieves a permanent object identity hash code. The undefined value might | 2045 // Retrieves a permanent object identity hash code. The undefined value might |
| 2067 // be returned in case no hash was created yet and OMIT_CREATION was used. | 2046 // be returned in case no hash was created yet and OMIT_CREATION was used. |
| 2068 inline MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); | 2047 inline MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); |
| 2069 | 2048 |
| 2070 // Lookup a property. If found, the result is valid and has | 2049 // Lookup a property. If found, the result is valid and has |
| 2071 // detailed information. | 2050 // detailed information. |
| 2072 void LocalLookup(Name* name, LookupResult* result, | 2051 void LocalLookup(Name* name, LookupResult* result, |
| 2073 bool search_hidden_prototypes = false); | 2052 bool search_hidden_prototypes = false); |
| 2074 void Lookup(Name* name, LookupResult* result); | 2053 void Lookup(Name* name, LookupResult* result); |
| 2075 | 2054 |
| 2076 protected: | 2055 protected: |
| 2077 Smi* GenerateIdentityHash(); | 2056 Smi* GenerateIdentityHash(); |
| 2078 | 2057 |
| 2058 static Handle<Object> SetPropertyWithDefinedSetter(Handle<JSReceiver> object, |
| 2059 Handle<JSReceiver> setter, |
| 2060 Handle<Object> value); |
| 2061 |
| 2079 private: | 2062 private: |
| 2080 PropertyAttributes GetPropertyAttributeForResult(JSReceiver* receiver, | 2063 PropertyAttributes GetPropertyAttributeForResult(JSReceiver* receiver, |
| 2081 LookupResult* result, | 2064 LookupResult* result, |
| 2082 Name* name, | 2065 Name* name, |
| 2083 bool continue_search); | 2066 bool continue_search); |
| 2084 | 2067 |
| 2068 static Handle<Object> SetProperty(Handle<JSReceiver> receiver, |
| 2069 LookupResult* result, |
| 2070 Handle<Name> key, |
| 2071 Handle<Object> value, |
| 2072 PropertyAttributes attributes, |
| 2073 StrictModeFlag strict_mode, |
| 2074 StoreFromKeyed store_from_keyed); |
| 2075 |
| 2085 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); | 2076 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); |
| 2086 }; | 2077 }; |
| 2087 | 2078 |
| 2088 // The JSObject describes real heap allocated JavaScript objects with | 2079 // The JSObject describes real heap allocated JavaScript objects with |
| 2089 // properties. | 2080 // properties. |
| 2090 // Note that the map of JSObject changes during execution to enable inline | 2081 // Note that the map of JSObject changes during execution to enable inline |
| 2091 // caching. | 2082 // caching. |
| 2092 class JSObject: public JSReceiver { | 2083 class JSObject: public JSReceiver { |
| 2093 public: | 2084 public: |
| 2094 // [properties]: Backing storage for properties. | 2085 // [properties]: Backing storage for properties. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2168 // Returns the number of non-undefined values. | 2159 // Returns the number of non-undefined values. |
| 2169 MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit); | 2160 MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit); |
| 2170 // As PrepareElementsForSort, but only on objects where elements is | 2161 // As PrepareElementsForSort, but only on objects where elements is |
| 2171 // a dictionary, and it will stay a dictionary. | 2162 // a dictionary, and it will stay a dictionary. |
| 2172 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); | 2163 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); |
| 2173 | 2164 |
| 2174 MUST_USE_RESULT MaybeObject* GetPropertyWithCallback(Object* receiver, | 2165 MUST_USE_RESULT MaybeObject* GetPropertyWithCallback(Object* receiver, |
| 2175 Object* structure, | 2166 Object* structure, |
| 2176 Name* name); | 2167 Name* name); |
| 2177 | 2168 |
| 2178 // Can cause GC. | 2169 static Handle<Object> SetPropertyWithCallback( |
| 2179 MUST_USE_RESULT MaybeObject* SetPropertyForResult(LookupResult* result, | 2170 Handle<JSObject> object, |
| 2180 Name* key, | 2171 Handle<Object> structure, |
| 2181 Object* value, | 2172 Handle<Name> name, |
| 2182 PropertyAttributes attributes, | 2173 Handle<Object> value, |
| 2183 StrictModeFlag strict_mode, | 2174 Handle<JSObject> holder, |
| 2184 StoreFromKeyed store_mode); | |
| 2185 MUST_USE_RESULT MaybeObject* SetPropertyWithFailedAccessCheck( | |
| 2186 LookupResult* result, | |
| 2187 Name* name, | |
| 2188 Object* value, | |
| 2189 bool check_prototype, | |
| 2190 StrictModeFlag strict_mode); | 2175 StrictModeFlag strict_mode); |
| 2191 MUST_USE_RESULT MaybeObject* SetPropertyWithCallback( | 2176 |
| 2192 Object* structure, | 2177 static Handle<Object> SetPropertyWithInterceptor( |
| 2193 Name* name, | 2178 Handle<JSObject> object, |
| 2194 Object* value, | 2179 Handle<Name> name, |
| 2195 JSObject* holder, | 2180 Handle<Object> value, |
| 2196 StrictModeFlag strict_mode); | |
| 2197 MUST_USE_RESULT MaybeObject* SetPropertyWithInterceptor( | |
| 2198 Name* name, | |
| 2199 Object* value, | |
| 2200 PropertyAttributes attributes, | 2181 PropertyAttributes attributes, |
| 2201 StrictModeFlag strict_mode); | 2182 StrictModeFlag strict_mode); |
| 2202 MUST_USE_RESULT MaybeObject* SetPropertyPostInterceptor( | 2183 |
| 2203 Name* name, | 2184 static Handle<Object> SetPropertyForResult( |
| 2204 Object* value, | 2185 Handle<JSObject> object, |
| 2186 LookupResult* result, |
| 2187 Handle<Name> name, |
| 2188 Handle<Object> value, |
| 2205 PropertyAttributes attributes, | 2189 PropertyAttributes attributes, |
| 2206 StrictModeFlag strict_mode, | 2190 StrictModeFlag strict_mode, |
| 2207 StoreMode mode = ALLOW_AS_CONSTANT); | 2191 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); |
| 2208 | 2192 |
| 2209 static Handle<Object> SetLocalPropertyIgnoreAttributes( | 2193 static Handle<Object> SetLocalPropertyIgnoreAttributes( |
| 2210 Handle<JSObject> object, | 2194 Handle<JSObject> object, |
| 2211 Handle<Name> key, | 2195 Handle<Name> key, |
| 2212 Handle<Object> value, | 2196 Handle<Object> value, |
| 2213 PropertyAttributes attributes, | 2197 PropertyAttributes attributes, |
| 2214 ValueType value_type = OPTIMAL_REPRESENTATION, | 2198 ValueType value_type = OPTIMAL_REPRESENTATION, |
| 2215 StoreMode mode = ALLOW_AS_CONSTANT, | 2199 StoreMode mode = ALLOW_AS_CONSTANT, |
| 2216 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK); | 2200 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK); |
| 2217 | 2201 |
| 2218 static inline Handle<String> ExpectedTransitionKey(Handle<Map> map); | 2202 static inline Handle<String> ExpectedTransitionKey(Handle<Map> map); |
| 2219 static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map); | 2203 static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map); |
| 2220 | 2204 |
| 2221 // Try to follow an existing transition to a field with attributes NONE. The | 2205 // Try to follow an existing transition to a field with attributes NONE. The |
| 2222 // return value indicates whether the transition was successful. | 2206 // return value indicates whether the transition was successful. |
| 2223 static inline Handle<Map> FindTransitionToField(Handle<Map> map, | 2207 static inline Handle<Map> FindTransitionToField(Handle<Map> map, |
| 2224 Handle<Name> key); | 2208 Handle<Name> key); |
| 2225 | 2209 |
| 2226 inline int LastAddedFieldIndex(); | 2210 inline int LastAddedFieldIndex(); |
| 2227 | 2211 |
| 2228 // Extend the receiver with a single fast property appeared first in the | 2212 // Extend the receiver with a single fast property appeared first in the |
| 2229 // passed map. This also extends the property backing store if necessary. | 2213 // passed map. This also extends the property backing store if necessary. |
| 2230 static void AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map); | 2214 static void AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map); |
| 2231 inline MUST_USE_RESULT MaybeObject* AllocateStorageForMap(Map* map); | 2215 inline MUST_USE_RESULT MaybeObject* AllocateStorageForMap(Map* map); |
| 2232 | 2216 |
| 2233 static void MigrateInstance(Handle<JSObject> instance); | 2217 static void MigrateInstance(Handle<JSObject> instance); |
| 2234 inline MUST_USE_RESULT MaybeObject* MigrateInstance(); | |
| 2235 | 2218 |
| 2236 static Handle<Object> TryMigrateInstance(Handle<JSObject> instance); | 2219 static Handle<Object> TryMigrateInstance(Handle<JSObject> instance); |
| 2237 inline MUST_USE_RESULT MaybeObject* TryMigrateInstance(); | 2220 inline MUST_USE_RESULT MaybeObject* TryMigrateInstance(); |
| 2238 | 2221 |
| 2239 // Can cause GC. | 2222 // Can cause GC. |
| 2240 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributesTrampoline( | 2223 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributesTrampoline( |
| 2241 Name* key, | 2224 Name* key, |
| 2242 Object* value, | 2225 Object* value, |
| 2243 PropertyAttributes attributes, | 2226 PropertyAttributes attributes, |
| 2244 ValueType value_type = OPTIMAL_REPRESENTATION, | 2227 ValueType value_type = OPTIMAL_REPRESENTATION, |
| 2245 StoreMode mode = ALLOW_AS_CONSTANT, | 2228 StoreMode mode = ALLOW_AS_CONSTANT, |
| 2246 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK); | 2229 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK); |
| 2247 | 2230 |
| 2248 // Retrieve a value in a normalized object given a lookup result. | 2231 // Retrieve a value in a normalized object given a lookup result. |
| 2249 // Handles the special representation of JS global objects. | 2232 // Handles the special representation of JS global objects. |
| 2250 Object* GetNormalizedProperty(LookupResult* result); | 2233 Object* GetNormalizedProperty(LookupResult* result); |
| 2251 | 2234 |
| 2252 // Sets the property value in a normalized object given (key, value). | |
| 2253 // Handles the special representation of JS global objects. | |
| 2254 static Handle<Object> SetNormalizedProperty(Handle<JSObject> object, | |
| 2255 LookupResult* result, | |
| 2256 Handle<Object> value); | |
| 2257 | |
| 2258 // Sets the property value in a normalized object given a lookup result. | 2235 // Sets the property value in a normalized object given a lookup result. |
| 2259 // Handles the special representation of JS global objects. | 2236 // Handles the special representation of JS global objects. |
| 2260 MUST_USE_RESULT MaybeObject* SetNormalizedProperty(LookupResult* result, | 2237 static void SetNormalizedProperty(Handle<JSObject> object, |
| 2261 Object* value); | 2238 LookupResult* result, |
| 2239 Handle<Object> value); |
| 2262 | 2240 |
| 2263 // Sets the property value in a normalized object given (key, value, details). | 2241 // Sets the property value in a normalized object given (key, value, details). |
| 2264 // Handles the special representation of JS global objects. | 2242 // Handles the special representation of JS global objects. |
| 2265 static Handle<Object> SetNormalizedProperty(Handle<JSObject> object, | 2243 static void SetNormalizedProperty(Handle<JSObject> object, |
| 2266 Handle<Name> key, | 2244 Handle<Name> key, |
| 2267 Handle<Object> value, | 2245 Handle<Object> value, |
| 2268 PropertyDetails details); | 2246 PropertyDetails details); |
| 2269 | |
| 2270 MUST_USE_RESULT MaybeObject* SetNormalizedProperty(Name* name, | |
| 2271 Object* value, | |
| 2272 PropertyDetails details); | |
| 2273 | 2247 |
| 2274 static void OptimizeAsPrototype(Handle<JSObject> object); | 2248 static void OptimizeAsPrototype(Handle<JSObject> object); |
| 2275 | 2249 |
| 2276 // Retrieve interceptors. | 2250 // Retrieve interceptors. |
| 2277 InterceptorInfo* GetNamedInterceptor(); | 2251 InterceptorInfo* GetNamedInterceptor(); |
| 2278 InterceptorInfo* GetIndexedInterceptor(); | 2252 InterceptorInfo* GetIndexedInterceptor(); |
| 2279 | 2253 |
| 2280 // Used from JSReceiver. | 2254 // Used from JSReceiver. |
| 2281 PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver, | 2255 PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver, |
| 2282 Name* name, | 2256 Name* name, |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2489 inline int GetInternalFieldCount(); | 2463 inline int GetInternalFieldCount(); |
| 2490 inline int GetInternalFieldOffset(int index); | 2464 inline int GetInternalFieldOffset(int index); |
| 2491 inline Object* GetInternalField(int index); | 2465 inline Object* GetInternalField(int index); |
| 2492 inline void SetInternalField(int index, Object* value); | 2466 inline void SetInternalField(int index, Object* value); |
| 2493 inline void SetInternalField(int index, Smi* value); | 2467 inline void SetInternalField(int index, Smi* value); |
| 2494 | 2468 |
| 2495 // The following lookup functions skip interceptors. | 2469 // The following lookup functions skip interceptors. |
| 2496 void LocalLookupRealNamedProperty(Name* name, LookupResult* result); | 2470 void LocalLookupRealNamedProperty(Name* name, LookupResult* result); |
| 2497 void LookupRealNamedProperty(Name* name, LookupResult* result); | 2471 void LookupRealNamedProperty(Name* name, LookupResult* result); |
| 2498 void LookupRealNamedPropertyInPrototypes(Name* name, LookupResult* result); | 2472 void LookupRealNamedPropertyInPrototypes(Name* name, LookupResult* result); |
| 2499 MUST_USE_RESULT MaybeObject* SetElementWithCallbackSetterInPrototypes( | |
| 2500 uint32_t index, Object* value, bool* found, StrictModeFlag strict_mode); | |
| 2501 void LookupCallbackProperty(Name* name, LookupResult* result); | 2473 void LookupCallbackProperty(Name* name, LookupResult* result); |
| 2502 | 2474 |
| 2503 // Returns the number of properties on this object filtering out properties | 2475 // Returns the number of properties on this object filtering out properties |
| 2504 // with the specified attributes (ignoring interceptors). | 2476 // with the specified attributes (ignoring interceptors). |
| 2505 int NumberOfLocalProperties(PropertyAttributes filter = NONE); | 2477 int NumberOfLocalProperties(PropertyAttributes filter = NONE); |
| 2506 // Fill in details for properties into storage starting at the specified | 2478 // Fill in details for properties into storage starting at the specified |
| 2507 // index. | 2479 // index. |
| 2508 void GetLocalPropertyNames( | 2480 void GetLocalPropertyNames( |
| 2509 FixedArray* storage, int index, PropertyAttributes filter = NONE); | 2481 FixedArray* storage, int index, PropertyAttributes filter = NONE); |
| 2510 | 2482 |
| 2511 // Returns the number of properties on this object filtering out properties | 2483 // Returns the number of properties on this object filtering out properties |
| 2512 // with the specified attributes (ignoring interceptors). | 2484 // with the specified attributes (ignoring interceptors). |
| 2513 int NumberOfLocalElements(PropertyAttributes filter); | 2485 int NumberOfLocalElements(PropertyAttributes filter); |
| 2514 // Returns the number of enumerable elements (ignoring interceptors). | 2486 // Returns the number of enumerable elements (ignoring interceptors). |
| 2515 int NumberOfEnumElements(); | 2487 int NumberOfEnumElements(); |
| 2516 // Returns the number of elements on this object filtering out elements | 2488 // Returns the number of elements on this object filtering out elements |
| 2517 // with the specified attributes (ignoring interceptors). | 2489 // with the specified attributes (ignoring interceptors). |
| 2518 int GetLocalElementKeys(FixedArray* storage, PropertyAttributes filter); | 2490 int GetLocalElementKeys(FixedArray* storage, PropertyAttributes filter); |
| 2519 // Count and fill in the enumerable elements into storage. | 2491 // Count and fill in the enumerable elements into storage. |
| 2520 // (storage->length() == NumberOfEnumElements()). | 2492 // (storage->length() == NumberOfEnumElements()). |
| 2521 // If storage is NULL, will count the elements without adding | 2493 // If storage is NULL, will count the elements without adding |
| 2522 // them to any storage. | 2494 // them to any storage. |
| 2523 // Returns the number of enumerable elements. | 2495 // Returns the number of enumerable elements. |
| 2524 int GetEnumElementKeys(FixedArray* storage); | 2496 int GetEnumElementKeys(FixedArray* storage); |
| 2525 | 2497 |
| 2526 // Add a property to a fast-case object using a map transition to | |
| 2527 // new_map. | |
| 2528 MUST_USE_RESULT MaybeObject* AddFastPropertyUsingMap( | |
| 2529 Map* new_map, | |
| 2530 Name* name, | |
| 2531 Object* value, | |
| 2532 int field_index, | |
| 2533 Representation representation); | |
| 2534 | |
| 2535 // Add a constant function property to a fast-case object. | |
| 2536 // This leaves a CONSTANT_TRANSITION in the old map, and | |
| 2537 // if it is called on a second object with this map, a | |
| 2538 // normal property is added instead, with a map transition. | |
| 2539 // This avoids the creation of many maps with the same constant | |
| 2540 // function, all orphaned. | |
| 2541 MUST_USE_RESULT MaybeObject* AddConstantProperty( | |
| 2542 Name* name, | |
| 2543 Object* constant, | |
| 2544 PropertyAttributes attributes, | |
| 2545 TransitionFlag flag); | |
| 2546 | |
| 2547 MUST_USE_RESULT MaybeObject* ReplaceSlowProperty( | |
| 2548 Name* name, | |
| 2549 Object* value, | |
| 2550 PropertyAttributes attributes); | |
| 2551 | |
| 2552 // Returns a new map with all transitions dropped from the object's current | 2498 // Returns a new map with all transitions dropped from the object's current |
| 2553 // map and the ElementsKind set. | 2499 // map and the ElementsKind set. |
| 2554 static Handle<Map> GetElementsTransitionMap(Handle<JSObject> object, | 2500 static Handle<Map> GetElementsTransitionMap(Handle<JSObject> object, |
| 2555 ElementsKind to_kind); | 2501 ElementsKind to_kind); |
| 2556 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( | 2502 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( |
| 2557 Isolate* isolate, | 2503 Isolate* isolate, |
| 2558 ElementsKind elements_kind); | 2504 ElementsKind elements_kind); |
| 2559 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( | 2505 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( |
| 2560 ElementsKind elements_kind); | 2506 ElementsKind elements_kind); |
| 2561 | 2507 |
| 2562 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, | 2508 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, |
| 2563 ElementsKind to_kind); | 2509 ElementsKind to_kind); |
| 2564 | 2510 |
| 2565 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); | 2511 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); |
| 2566 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind); | 2512 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind); |
| 2567 | 2513 |
| 2514 static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map); |
| 2568 MUST_USE_RESULT MaybeObject* MigrateToMap(Map* new_map); | 2515 MUST_USE_RESULT MaybeObject* MigrateToMap(Map* new_map); |
| 2569 MUST_USE_RESULT MaybeObject* GeneralizeFieldRepresentation( | 2516 static void GeneralizeFieldRepresentation(Handle<JSObject> object, |
| 2570 int modify_index, | 2517 int modify_index, |
| 2571 Representation new_representation, | 2518 Representation new_representation, |
| 2572 StoreMode store_mode); | 2519 StoreMode store_mode); |
| 2573 | |
| 2574 // Add a property to a fast-case object. | |
| 2575 MUST_USE_RESULT MaybeObject* AddFastProperty( | |
| 2576 Name* name, | |
| 2577 Object* value, | |
| 2578 PropertyAttributes attributes, | |
| 2579 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, | |
| 2580 ValueType value_type = OPTIMAL_REPRESENTATION, | |
| 2581 TransitionFlag flag = INSERT_TRANSITION); | |
| 2582 | |
| 2583 // Add a property to a slow-case object. | |
| 2584 MUST_USE_RESULT MaybeObject* AddSlowProperty(Name* name, | |
| 2585 Object* value, | |
| 2586 PropertyAttributes attributes); | |
| 2587 | |
| 2588 // Add a property to an object. May cause GC. | |
| 2589 MUST_USE_RESULT MaybeObject* AddProperty( | |
| 2590 Name* name, | |
| 2591 Object* value, | |
| 2592 PropertyAttributes attributes, | |
| 2593 StrictModeFlag strict_mode, | |
| 2594 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, | |
| 2595 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, | |
| 2596 ValueType value_type = OPTIMAL_REPRESENTATION, | |
| 2597 StoreMode mode = ALLOW_AS_CONSTANT, | |
| 2598 TransitionFlag flag = INSERT_TRANSITION); | |
| 2599 | 2520 |
| 2600 // Convert the object to use the canonical dictionary | 2521 // Convert the object to use the canonical dictionary |
| 2601 // representation. If the object is expected to have additional properties | 2522 // representation. If the object is expected to have additional properties |
| 2602 // added this number can be indicated to have the backing store allocated to | 2523 // added this number can be indicated to have the backing store allocated to |
| 2603 // an initial capacity for holding these properties. | 2524 // an initial capacity for holding these properties. |
| 2604 static void NormalizeProperties(Handle<JSObject> object, | 2525 static void NormalizeProperties(Handle<JSObject> object, |
| 2605 PropertyNormalizationMode mode, | 2526 PropertyNormalizationMode mode, |
| 2606 int expected_additional_properties); | 2527 int expected_additional_properties); |
| 2607 | 2528 |
| 2608 MUST_USE_RESULT MaybeObject* NormalizeProperties( | 2529 MUST_USE_RESULT MaybeObject* NormalizeProperties( |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2657 bool ReferencesObject(Object* obj); | 2578 bool ReferencesObject(Object* obj); |
| 2658 | 2579 |
| 2659 // Casting. | 2580 // Casting. |
| 2660 static inline JSObject* cast(Object* obj); | 2581 static inline JSObject* cast(Object* obj); |
| 2661 | 2582 |
| 2662 // Disalow further properties to be added to the object. | 2583 // Disalow further properties to be added to the object. |
| 2663 static Handle<Object> PreventExtensions(Handle<JSObject> object); | 2584 static Handle<Object> PreventExtensions(Handle<JSObject> object); |
| 2664 MUST_USE_RESULT MaybeObject* PreventExtensions(); | 2585 MUST_USE_RESULT MaybeObject* PreventExtensions(); |
| 2665 | 2586 |
| 2666 // ES5 Object.freeze | 2587 // ES5 Object.freeze |
| 2667 MUST_USE_RESULT MaybeObject* Freeze(Isolate* isolate); | 2588 static Handle<Object> Freeze(Handle<JSObject> object); |
| 2668 | |
| 2669 | 2589 |
| 2670 // Called the first time an object is observed with ES7 Object.observe. | 2590 // Called the first time an object is observed with ES7 Object.observe. |
| 2671 MUST_USE_RESULT MaybeObject* SetObserved(Isolate* isolate); | 2591 MUST_USE_RESULT MaybeObject* SetObserved(Isolate* isolate); |
| 2672 | 2592 |
| 2673 // Copy object. | 2593 // Copy object. |
| 2674 static Handle<JSObject> Copy(Handle<JSObject> object); | 2594 static Handle<JSObject> Copy(Handle<JSObject> object); |
| 2675 static Handle<JSObject> DeepCopy(Handle<JSObject> object); | 2595 static Handle<JSObject> DeepCopy(Handle<JSObject> object); |
| 2676 | 2596 |
| 2677 // Dispatched behavior. | 2597 // Dispatched behavior. |
| 2678 void JSObjectShortPrint(StringStream* accumulator); | 2598 void JSObjectShortPrint(StringStream* accumulator); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2768 Handle<Name> name, | 2688 Handle<Name> name, |
| 2769 Handle<Object> old_value); | 2689 Handle<Object> old_value); |
| 2770 | 2690 |
| 2771 // Deliver change records to observers. May cause GC. | 2691 // Deliver change records to observers. May cause GC. |
| 2772 static void DeliverChangeRecords(Isolate* isolate); | 2692 static void DeliverChangeRecords(Isolate* isolate); |
| 2773 | 2693 |
| 2774 private: | 2694 private: |
| 2775 friend class DictionaryElementsAccessor; | 2695 friend class DictionaryElementsAccessor; |
| 2776 friend class JSReceiver; | 2696 friend class JSReceiver; |
| 2777 | 2697 |
| 2778 // TODO(mstarzinger): Soon to be handlified. | |
| 2779 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes( | |
| 2780 Name* key, | |
| 2781 Object* value, | |
| 2782 PropertyAttributes attributes, | |
| 2783 ValueType value_type = OPTIMAL_REPRESENTATION, | |
| 2784 StoreMode mode = ALLOW_AS_CONSTANT, | |
| 2785 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK); | |
| 2786 | |
| 2787 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, | 2698 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, |
| 2788 Object* structure, | 2699 Object* structure, |
| 2789 uint32_t index, | 2700 uint32_t index, |
| 2790 Object* holder); | 2701 Object* holder); |
| 2791 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor( | 2702 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor( |
| 2792 JSReceiver* receiver, | 2703 JSReceiver* receiver, |
| 2793 uint32_t index, | 2704 uint32_t index, |
| 2794 bool continue_search); | 2705 bool continue_search); |
| 2795 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithoutInterceptor( | 2706 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithoutInterceptor( |
| 2796 JSReceiver* receiver, | 2707 JSReceiver* receiver, |
| 2797 uint32_t index, | 2708 uint32_t index, |
| 2798 bool continue_search); | 2709 bool continue_search); |
| 2799 MUST_USE_RESULT MaybeObject* SetElementWithCallback( | 2710 static Handle<Object> SetElementWithCallback( |
| 2800 Object* structure, | 2711 Handle<JSObject> object, |
| 2712 Handle<Object> structure, |
| 2801 uint32_t index, | 2713 uint32_t index, |
| 2802 Object* value, | 2714 Handle<Object> value, |
| 2803 JSObject* holder, | 2715 Handle<JSObject> holder, |
| 2804 StrictModeFlag strict_mode); | 2716 StrictModeFlag strict_mode); |
| 2805 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor( | 2717 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor( |
| 2806 uint32_t index, | 2718 uint32_t index, |
| 2807 Object* value, | 2719 Object* value, |
| 2808 PropertyAttributes attributes, | 2720 PropertyAttributes attributes, |
| 2809 StrictModeFlag strict_mode, | 2721 StrictModeFlag strict_mode, |
| 2810 bool check_prototype, | 2722 bool check_prototype, |
| 2811 SetPropertyMode set_mode); | 2723 SetPropertyMode set_mode); |
| 2812 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor( | 2724 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor( |
| 2813 uint32_t index, | 2725 uint32_t index, |
| 2814 Object* value, | 2726 Object* value, |
| 2815 PropertyAttributes attributes, | 2727 PropertyAttributes attributes, |
| 2816 StrictModeFlag strict_mode, | 2728 StrictModeFlag strict_mode, |
| 2817 bool check_prototype, | 2729 bool check_prototype, |
| 2818 SetPropertyMode set_mode); | 2730 SetPropertyMode set_mode); |
| 2731 MUST_USE_RESULT MaybeObject* SetElementWithCallbackSetterInPrototypes( |
| 2732 uint32_t index, |
| 2733 Object* value, |
| 2734 bool* found, |
| 2735 StrictModeFlag strict_mode); |
| 2819 | 2736 |
| 2820 // Searches the prototype chain for property 'name'. If it is found and | 2737 // Searches the prototype chain for property 'name'. If it is found and |
| 2821 // has a setter, invoke it and set '*done' to true. If it is found and is | 2738 // has a setter, invoke it and set '*done' to true. If it is found and is |
| 2822 // read-only, reject and set '*done' to true. Otherwise, set '*done' to | 2739 // read-only, reject and set '*done' to true. Otherwise, set '*done' to |
| 2823 // false. Can cause GC and can return a failure result with '*done==true'. | 2740 // false. Can throw and return an empty handle with '*done==true'. |
| 2824 MUST_USE_RESULT MaybeObject* SetPropertyViaPrototypes( | 2741 static Handle<Object> SetPropertyViaPrototypes( |
| 2825 Name* name, | 2742 Handle<JSObject> object, |
| 2826 Object* value, | 2743 Handle<Name> name, |
| 2744 Handle<Object> value, |
| 2827 PropertyAttributes attributes, | 2745 PropertyAttributes attributes, |
| 2828 StrictModeFlag strict_mode, | 2746 StrictModeFlag strict_mode, |
| 2829 bool* done); | 2747 bool* done); |
| 2748 static Handle<Object> SetPropertyPostInterceptor( |
| 2749 Handle<JSObject> object, |
| 2750 Handle<Name> name, |
| 2751 Handle<Object> value, |
| 2752 PropertyAttributes attributes, |
| 2753 StrictModeFlag strict_mode); |
| 2754 static Handle<Object> SetPropertyUsingTransition( |
| 2755 Handle<JSObject> object, |
| 2756 LookupResult* lookup, |
| 2757 Handle<Name> name, |
| 2758 Handle<Object> value, |
| 2759 PropertyAttributes attributes); |
| 2760 static Handle<Object> SetPropertyWithFailedAccessCheck( |
| 2761 Handle<JSObject> object, |
| 2762 LookupResult* result, |
| 2763 Handle<Name> name, |
| 2764 Handle<Object> value, |
| 2765 bool check_prototype, |
| 2766 StrictModeFlag strict_mode); |
| 2767 |
| 2768 // Add a property to an object. |
| 2769 static Handle<Object> AddProperty( |
| 2770 Handle<JSObject> object, |
| 2771 Handle<Name> name, |
| 2772 Handle<Object> value, |
| 2773 PropertyAttributes attributes, |
| 2774 StrictModeFlag strict_mode, |
| 2775 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, |
| 2776 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, |
| 2777 ValueType value_type = OPTIMAL_REPRESENTATION, |
| 2778 StoreMode mode = ALLOW_AS_CONSTANT, |
| 2779 TransitionFlag flag = INSERT_TRANSITION); |
| 2780 |
| 2781 // Add a constant function property to a fast-case object. |
| 2782 // This leaves a CONSTANT_TRANSITION in the old map, and |
| 2783 // if it is called on a second object with this map, a |
| 2784 // normal property is added instead, with a map transition. |
| 2785 // This avoids the creation of many maps with the same constant |
| 2786 // function, all orphaned. |
| 2787 static void AddConstantProperty(Handle<JSObject> object, |
| 2788 Handle<Name> name, |
| 2789 Handle<Object> constant, |
| 2790 PropertyAttributes attributes, |
| 2791 TransitionFlag flag); |
| 2792 |
| 2793 // Add a property to a fast-case object. |
| 2794 static void AddFastProperty(Handle<JSObject> object, |
| 2795 Handle<Name> name, |
| 2796 Handle<Object> value, |
| 2797 PropertyAttributes attributes, |
| 2798 StoreFromKeyed store_mode, |
| 2799 ValueType value_type, |
| 2800 TransitionFlag flag); |
| 2801 |
| 2802 // Add a property to a fast-case object using a map transition to |
| 2803 // new_map. |
| 2804 static void AddFastPropertyUsingMap(Handle<JSObject> object, |
| 2805 Handle<Map> new_map, |
| 2806 Handle<Name> name, |
| 2807 Handle<Object> value, |
| 2808 int field_index, |
| 2809 Representation representation); |
| 2810 |
| 2811 // Add a property to a slow-case object. |
| 2812 static void AddSlowProperty(Handle<JSObject> object, |
| 2813 Handle<Name> name, |
| 2814 Handle<Object> value, |
| 2815 PropertyAttributes attributes); |
| 2830 | 2816 |
| 2831 static Handle<Object> DeleteProperty(Handle<JSObject> object, | 2817 static Handle<Object> DeleteProperty(Handle<JSObject> object, |
| 2832 Handle<Name> name, | 2818 Handle<Name> name, |
| 2833 DeleteMode mode); | 2819 DeleteMode mode); |
| 2834 static Handle<Object> DeletePropertyPostInterceptor(Handle<JSObject> object, | 2820 static Handle<Object> DeletePropertyPostInterceptor(Handle<JSObject> object, |
| 2835 Handle<Name> name, | 2821 Handle<Name> name, |
| 2836 DeleteMode mode); | 2822 DeleteMode mode); |
| 2837 static Handle<Object> DeletePropertyWithInterceptor(Handle<JSObject> object, | 2823 static Handle<Object> DeletePropertyWithInterceptor(Handle<JSObject> object, |
| 2838 Handle<Name> name); | 2824 Handle<Name> name); |
| 2839 | 2825 |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3209 // array. | 3195 // array. |
| 3210 inline void Append(Descriptor* desc, const WhitenessWitness&); | 3196 inline void Append(Descriptor* desc, const WhitenessWitness&); |
| 3211 inline void Append(Descriptor* desc); | 3197 inline void Append(Descriptor* desc); |
| 3212 | 3198 |
| 3213 // Transfer a complete descriptor from the src descriptor array to this | 3199 // Transfer a complete descriptor from the src descriptor array to this |
| 3214 // descriptor array. | 3200 // descriptor array. |
| 3215 void CopyFrom(int dst_index, | 3201 void CopyFrom(int dst_index, |
| 3216 DescriptorArray* src, | 3202 DescriptorArray* src, |
| 3217 int src_index, | 3203 int src_index, |
| 3218 const WhitenessWitness&); | 3204 const WhitenessWitness&); |
| 3205 static Handle<DescriptorArray> Merge(Handle<DescriptorArray> desc, |
| 3206 int verbatim, |
| 3207 int valid, |
| 3208 int new_size, |
| 3209 int modify_index, |
| 3210 StoreMode store_mode, |
| 3211 Handle<DescriptorArray> other); |
| 3219 MUST_USE_RESULT MaybeObject* Merge(int verbatim, | 3212 MUST_USE_RESULT MaybeObject* Merge(int verbatim, |
| 3220 int valid, | 3213 int valid, |
| 3221 int new_size, | 3214 int new_size, |
| 3222 int modify_index, | 3215 int modify_index, |
| 3223 StoreMode store_mode, | 3216 StoreMode store_mode, |
| 3224 DescriptorArray* other); | 3217 DescriptorArray* other); |
| 3225 | 3218 |
| 3226 bool IsMoreGeneralThan(int verbatim, | 3219 bool IsMoreGeneralThan(int verbatim, |
| 3227 int valid, | 3220 int valid, |
| 3228 int new_size, | 3221 int new_size, |
| 3229 DescriptorArray* other); | 3222 DescriptorArray* other); |
| 3230 | 3223 |
| 3231 MUST_USE_RESULT MaybeObject* CopyUpTo(int enumeration_index) { | 3224 MUST_USE_RESULT MaybeObject* CopyUpTo(int enumeration_index) { |
| 3232 return CopyUpToAddAttributes(enumeration_index, NONE); | 3225 return CopyUpToAddAttributes(enumeration_index, NONE); |
| 3233 } | 3226 } |
| 3234 | 3227 |
| 3228 static Handle<DescriptorArray> CopyUpToAddAttributes( |
| 3229 Handle<DescriptorArray> desc, |
| 3230 int enumeration_index, |
| 3231 PropertyAttributes attributes); |
| 3235 MUST_USE_RESULT MaybeObject* CopyUpToAddAttributes( | 3232 MUST_USE_RESULT MaybeObject* CopyUpToAddAttributes( |
| 3236 int enumeration_index, | 3233 int enumeration_index, |
| 3237 PropertyAttributes attributes); | 3234 PropertyAttributes attributes); |
| 3238 | 3235 |
| 3239 // Sort the instance descriptors by the hash codes of their keys. | 3236 // Sort the instance descriptors by the hash codes of their keys. |
| 3240 void Sort(); | 3237 void Sort(); |
| 3241 | 3238 |
| 3242 // Search the instance descriptors for given name. | 3239 // Search the instance descriptors for given name. |
| 3243 INLINE(int Search(Name* name, int number_of_own_descriptors)); | 3240 INLINE(int Search(Name* name, int number_of_own_descriptors)); |
| 3244 | 3241 |
| (...skipping 2406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5651 | 5648 |
| 5652 bool InstancesNeedRewriting(Map* target, | 5649 bool InstancesNeedRewriting(Map* target, |
| 5653 int target_number_of_fields, | 5650 int target_number_of_fields, |
| 5654 int target_inobject, | 5651 int target_inobject, |
| 5655 int target_unused); | 5652 int target_unused); |
| 5656 static Handle<Map> GeneralizeRepresentation( | 5653 static Handle<Map> GeneralizeRepresentation( |
| 5657 Handle<Map> map, | 5654 Handle<Map> map, |
| 5658 int modify_index, | 5655 int modify_index, |
| 5659 Representation new_representation, | 5656 Representation new_representation, |
| 5660 StoreMode store_mode); | 5657 StoreMode store_mode); |
| 5661 MUST_USE_RESULT MaybeObject* GeneralizeRepresentation( | 5658 static Handle<Map> CopyGeneralizeAllRepresentations( |
| 5662 int modify_index, | 5659 Handle<Map> map, |
| 5663 Representation representation, | |
| 5664 StoreMode store_mode); | |
| 5665 MUST_USE_RESULT MaybeObject* CopyGeneralizeAllRepresentations( | |
| 5666 int modify_index, | 5660 int modify_index, |
| 5667 StoreMode store_mode, | 5661 StoreMode store_mode, |
| 5668 PropertyAttributes attributes, | 5662 PropertyAttributes attributes, |
| 5669 const char* reason); | 5663 const char* reason); |
| 5670 | 5664 |
| 5671 void PrintGeneralization(FILE* file, | 5665 void PrintGeneralization(FILE* file, |
| 5672 const char* reason, | 5666 const char* reason, |
| 5673 int modify_index, | 5667 int modify_index, |
| 5674 int split, | 5668 int split, |
| 5675 int descriptors, | 5669 int descriptors, |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5830 // Returns a non-deprecated version of the input. If the input was not | 5824 // Returns a non-deprecated version of the input. If the input was not |
| 5831 // deprecated, it is directly returned. Otherwise, the non-deprecated version | 5825 // deprecated, it is directly returned. Otherwise, the non-deprecated version |
| 5832 // is found by re-transitioning from the root of the transition tree using the | 5826 // is found by re-transitioning from the root of the transition tree using the |
| 5833 // descriptor array of the map. Returns NULL if no updated map is found. | 5827 // descriptor array of the map. Returns NULL if no updated map is found. |
| 5834 Map* CurrentMapForDeprecated(); | 5828 Map* CurrentMapForDeprecated(); |
| 5835 | 5829 |
| 5836 MUST_USE_RESULT MaybeObject* RawCopy(int instance_size); | 5830 MUST_USE_RESULT MaybeObject* RawCopy(int instance_size); |
| 5837 MUST_USE_RESULT MaybeObject* CopyWithPreallocatedFieldDescriptors(); | 5831 MUST_USE_RESULT MaybeObject* CopyWithPreallocatedFieldDescriptors(); |
| 5838 static Handle<Map> CopyDropDescriptors(Handle<Map> map); | 5832 static Handle<Map> CopyDropDescriptors(Handle<Map> map); |
| 5839 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); | 5833 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); |
| 5834 static Handle<Map> CopyReplaceDescriptors(Handle<Map> map, |
| 5835 Handle<DescriptorArray> descriptors, |
| 5836 TransitionFlag flag, |
| 5837 Handle<Name> name); |
| 5840 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptors( | 5838 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptors( |
| 5841 DescriptorArray* descriptors, | 5839 DescriptorArray* descriptors, |
| 5842 TransitionFlag flag, | 5840 TransitionFlag flag, |
| 5843 Name* name = NULL, | 5841 Name* name = NULL, |
| 5844 SimpleTransitionFlag simple_flag = FULL_TRANSITION); | 5842 SimpleTransitionFlag simple_flag = FULL_TRANSITION); |
| 5843 static Handle<Map> CopyInstallDescriptors( |
| 5844 Handle<Map> map, |
| 5845 int new_descriptor, |
| 5846 Handle<DescriptorArray> descriptors); |
| 5845 MUST_USE_RESULT MaybeObject* CopyInstallDescriptors( | 5847 MUST_USE_RESULT MaybeObject* CopyInstallDescriptors( |
| 5846 int new_descriptor, | 5848 int new_descriptor, |
| 5847 DescriptorArray* descriptors); | 5849 DescriptorArray* descriptors); |
| 5848 MUST_USE_RESULT MaybeObject* ShareDescriptor(DescriptorArray* descriptors, | 5850 MUST_USE_RESULT MaybeObject* ShareDescriptor(DescriptorArray* descriptors, |
| 5849 Descriptor* descriptor); | 5851 Descriptor* descriptor); |
| 5850 MUST_USE_RESULT MaybeObject* CopyAddDescriptor(Descriptor* descriptor, | 5852 MUST_USE_RESULT MaybeObject* CopyAddDescriptor(Descriptor* descriptor, |
| 5851 TransitionFlag flag); | 5853 TransitionFlag flag); |
| 5852 MUST_USE_RESULT MaybeObject* CopyInsertDescriptor(Descriptor* descriptor, | 5854 MUST_USE_RESULT MaybeObject* CopyInsertDescriptor(Descriptor* descriptor, |
| 5853 TransitionFlag flag); | 5855 TransitionFlag flag); |
| 5854 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptor( | 5856 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptor( |
| (...skipping 2021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7876 TRACK_ALLOCATION_SITE, | 7878 TRACK_ALLOCATION_SITE, |
| 7877 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE | 7879 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE |
| 7878 }; | 7880 }; |
| 7879 | 7881 |
| 7880 | 7882 |
| 7881 class AllocationSite: public Struct { | 7883 class AllocationSite: public Struct { |
| 7882 public: | 7884 public: |
| 7883 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; | 7885 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; |
| 7884 | 7886 |
| 7885 DECL_ACCESSORS(transition_info, Object) | 7887 DECL_ACCESSORS(transition_info, Object) |
| 7888 DECL_ACCESSORS(dependent_code, DependentCode) |
| 7886 DECL_ACCESSORS(weak_next, Object) | 7889 DECL_ACCESSORS(weak_next, Object) |
| 7887 | 7890 |
| 7888 void Initialize() { | 7891 inline void Initialize(); |
| 7889 SetElementsKind(GetInitialFastElementsKind()); | |
| 7890 } | |
| 7891 | 7892 |
| 7892 ElementsKind GetElementsKind() { | 7893 ElementsKind GetElementsKind() { |
| 7893 ASSERT(!IsLiteralSite()); | 7894 ASSERT(!IsLiteralSite()); |
| 7894 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); | 7895 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); |
| 7895 } | 7896 } |
| 7896 | 7897 |
| 7897 void SetElementsKind(ElementsKind kind) { | 7898 void SetElementsKind(ElementsKind kind) { |
| 7898 set_transition_info(Smi::FromInt(static_cast<int>(kind))); | 7899 set_transition_info(Smi::FromInt(static_cast<int>(kind))); |
| 7899 } | 7900 } |
| 7900 | 7901 |
| 7901 bool IsLiteralSite() { | 7902 bool IsLiteralSite() { |
| 7902 // If transition_info is a smi, then it represents an ElementsKind | 7903 // If transition_info is a smi, then it represents an ElementsKind |
| 7903 // for a constructed array. Otherwise, it must be a boilerplate | 7904 // for a constructed array. Otherwise, it must be a boilerplate |
| 7904 // for an array literal | 7905 // for an array literal |
| 7905 return transition_info()->IsJSArray(); | 7906 return transition_info()->IsJSArray(); |
| 7906 } | 7907 } |
| 7907 | 7908 |
| 7908 DECLARE_PRINTER(AllocationSite) | 7909 DECLARE_PRINTER(AllocationSite) |
| 7909 DECLARE_VERIFIER(AllocationSite) | 7910 DECLARE_VERIFIER(AllocationSite) |
| 7910 | 7911 |
| 7911 static inline AllocationSite* cast(Object* obj); | 7912 static inline AllocationSite* cast(Object* obj); |
| 7912 static inline AllocationSiteMode GetMode( | 7913 static inline AllocationSiteMode GetMode( |
| 7913 ElementsKind boilerplate_elements_kind); | 7914 ElementsKind boilerplate_elements_kind); |
| 7914 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | 7915 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); |
| 7915 static inline bool CanTrack(InstanceType type); | 7916 static inline bool CanTrack(InstanceType type); |
| 7916 | 7917 |
| 7917 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; | 7918 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; |
| 7918 static const int kWeakNextOffset = kTransitionInfoOffset + kPointerSize; | 7919 static const int kDependentCodeOffset = kTransitionInfoOffset + kPointerSize; |
| 7920 static const int kWeakNextOffset = kDependentCodeOffset + kPointerSize; |
| 7919 static const int kSize = kWeakNextOffset + kPointerSize; | 7921 static const int kSize = kWeakNextOffset + kPointerSize; |
| 7920 | 7922 |
| 7921 typedef FixedBodyDescriptor<HeapObject::kHeaderSize, | 7923 typedef FixedBodyDescriptor<HeapObject::kHeaderSize, |
| 7922 kTransitionInfoOffset + kPointerSize, | 7924 kDependentCodeOffset + kPointerSize, |
| 7923 kSize> BodyDescriptor; | 7925 kSize> BodyDescriptor; |
| 7924 | 7926 |
| 7925 private: | 7927 private: |
| 7926 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); | 7928 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); |
| 7927 }; | 7929 }; |
| 7928 | 7930 |
| 7929 | 7931 |
| 7930 class AllocationMemento: public Struct { | 7932 class AllocationMemento: public Struct { |
| 7931 public: | 7933 public: |
| 7932 static const int kAllocationSiteOffset = HeapObject::kHeaderSize; | 7934 static const int kAllocationSiteOffset = HeapObject::kHeaderSize; |
| (...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9053 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 9055 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
| 9054 | 9056 |
| 9055 // [dependent_code]: dependent code that depends on the type of the global | 9057 // [dependent_code]: dependent code that depends on the type of the global |
| 9056 // property. | 9058 // property. |
| 9057 DECL_ACCESSORS(dependent_code, DependentCode) | 9059 DECL_ACCESSORS(dependent_code, DependentCode) |
| 9058 | 9060 |
| 9059 // Sets the value of the cell and updates the type field to be the union | 9061 // Sets the value of the cell and updates the type field to be the union |
| 9060 // of the cell's current type and the value's type. If the change causes | 9062 // of the cell's current type and the value's type. If the change causes |
| 9061 // a change of the type of the cell's contents, code dependent on the cell | 9063 // a change of the type of the cell's contents, code dependent on the cell |
| 9062 // will be deoptimized. | 9064 // will be deoptimized. |
| 9065 static void SetValueInferType(Handle<PropertyCell> cell, |
| 9066 Handle<Object> value, |
| 9067 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
| 9063 MUST_USE_RESULT MaybeObject* SetValueInferType( | 9068 MUST_USE_RESULT MaybeObject* SetValueInferType( |
| 9064 Object* value, | 9069 Object* value, |
| 9065 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 9070 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
| 9066 | 9071 |
| 9067 // Casting. | 9072 // Casting. |
| 9068 static inline PropertyCell* cast(Object* obj); | 9073 static inline PropertyCell* cast(Object* obj); |
| 9069 | 9074 |
| 9070 inline Address TypeAddress() { | 9075 inline Address TypeAddress() { |
| 9071 return address() + kTypeOffset; | 9076 return address() + kTypeOffset; |
| 9072 } | 9077 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9105 public: | 9110 public: |
| 9106 // [handler]: The handler property. | 9111 // [handler]: The handler property. |
| 9107 DECL_ACCESSORS(handler, Object) | 9112 DECL_ACCESSORS(handler, Object) |
| 9108 | 9113 |
| 9109 // [hash]: The hash code property (undefined if not initialized yet). | 9114 // [hash]: The hash code property (undefined if not initialized yet). |
| 9110 DECL_ACCESSORS(hash, Object) | 9115 DECL_ACCESSORS(hash, Object) |
| 9111 | 9116 |
| 9112 // Casting. | 9117 // Casting. |
| 9113 static inline JSProxy* cast(Object* obj); | 9118 static inline JSProxy* cast(Object* obj); |
| 9114 | 9119 |
| 9115 bool HasPropertyWithHandler(Name* name); | |
| 9116 bool HasElementWithHandler(uint32_t index); | |
| 9117 | |
| 9118 MUST_USE_RESULT MaybeObject* GetPropertyWithHandler( | 9120 MUST_USE_RESULT MaybeObject* GetPropertyWithHandler( |
| 9119 Object* receiver, | 9121 Object* receiver, |
| 9120 Name* name); | 9122 Name* name); |
| 9121 MUST_USE_RESULT MaybeObject* GetElementWithHandler( | 9123 MUST_USE_RESULT MaybeObject* GetElementWithHandler( |
| 9122 Object* receiver, | 9124 Object* receiver, |
| 9123 uint32_t index); | 9125 uint32_t index); |
| 9124 | 9126 |
| 9125 MUST_USE_RESULT MaybeObject* SetPropertyWithHandler( | |
| 9126 JSReceiver* receiver, | |
| 9127 Name* name, | |
| 9128 Object* value, | |
| 9129 PropertyAttributes attributes, | |
| 9130 StrictModeFlag strict_mode); | |
| 9131 | |
| 9132 // If the handler defines an accessor property with a setter, invoke it. | 9127 // If the handler defines an accessor property with a setter, invoke it. |
| 9133 // If it defines an accessor property without a setter, or a data property | 9128 // If it defines an accessor property without a setter, or a data property |
| 9134 // that is read-only, throw. In all these cases set '*done' to true, | 9129 // that is read-only, throw. In all these cases set '*done' to true, |
| 9135 // otherwise set it to false. | 9130 // otherwise set it to false. |
| 9136 MUST_USE_RESULT MaybeObject* SetPropertyViaPrototypesWithHandler( | 9131 static Handle<Object> SetPropertyViaPrototypesWithHandler( |
| 9137 JSReceiver* receiver, | 9132 Handle<JSProxy> proxy, |
| 9138 Name* name, | 9133 Handle<JSReceiver> receiver, |
| 9139 Object* value, | 9134 Handle<Name> name, |
| 9135 Handle<Object> value, |
| 9140 PropertyAttributes attributes, | 9136 PropertyAttributes attributes, |
| 9141 StrictModeFlag strict_mode, | 9137 StrictModeFlag strict_mode, |
| 9142 bool* done); | 9138 bool* done); |
| 9143 | 9139 |
| 9144 MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler( | 9140 MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler( |
| 9145 JSReceiver* receiver, | 9141 JSReceiver* receiver, |
| 9146 Name* name); | 9142 Name* name); |
| 9147 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithHandler( | 9143 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithHandler( |
| 9148 JSReceiver* receiver, | 9144 JSReceiver* receiver, |
| 9149 uint32_t index); | 9145 uint32_t index); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 9177 | 9173 |
| 9178 STATIC_CHECK(kPaddingSize >= 0); | 9174 STATIC_CHECK(kPaddingSize >= 0); |
| 9179 | 9175 |
| 9180 typedef FixedBodyDescriptor<kHandlerOffset, | 9176 typedef FixedBodyDescriptor<kHandlerOffset, |
| 9181 kPaddingOffset, | 9177 kPaddingOffset, |
| 9182 kSize> BodyDescriptor; | 9178 kSize> BodyDescriptor; |
| 9183 | 9179 |
| 9184 private: | 9180 private: |
| 9185 friend class JSReceiver; | 9181 friend class JSReceiver; |
| 9186 | 9182 |
| 9183 static Handle<Object> SetPropertyWithHandler(Handle<JSProxy> proxy, |
| 9184 Handle<JSReceiver> receiver, |
| 9185 Handle<Name> name, |
| 9186 Handle<Object> value, |
| 9187 PropertyAttributes attributes, |
| 9188 StrictModeFlag strict_mode); |
| 9187 static Handle<Object> SetElementWithHandler(Handle<JSProxy> proxy, | 9189 static Handle<Object> SetElementWithHandler(Handle<JSProxy> proxy, |
| 9188 Handle<JSReceiver> receiver, | 9190 Handle<JSReceiver> receiver, |
| 9189 uint32_t index, | 9191 uint32_t index, |
| 9190 Handle<Object> value, | 9192 Handle<Object> value, |
| 9191 StrictModeFlag strict_mode); | 9193 StrictModeFlag strict_mode); |
| 9192 | 9194 |
| 9195 static bool HasPropertyWithHandler(Handle<JSProxy> proxy, Handle<Name> name); |
| 9196 static bool HasElementWithHandler(Handle<JSProxy> proxy, uint32_t index); |
| 9197 |
| 9193 static Handle<Object> DeletePropertyWithHandler(Handle<JSProxy> proxy, | 9198 static Handle<Object> DeletePropertyWithHandler(Handle<JSProxy> proxy, |
| 9194 Handle<Name> name, | 9199 Handle<Name> name, |
| 9195 DeleteMode mode); | 9200 DeleteMode mode); |
| 9196 static Handle<Object> DeleteElementWithHandler(Handle<JSProxy> proxy, | 9201 static Handle<Object> DeleteElementWithHandler(Handle<JSProxy> proxy, |
| 9197 uint32_t index, | 9202 uint32_t index, |
| 9198 DeleteMode mode); | 9203 DeleteMode mode); |
| 9199 | 9204 |
| 9200 MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); | 9205 MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); |
| 9201 static Handle<Object> GetIdentityHash(Handle<JSProxy> proxy, | 9206 static Handle<Object> GetIdentityHash(Handle<JSProxy> proxy, |
| 9202 CreationFlag flag); | 9207 CreationFlag flag); |
| (...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10285 } else { | 10290 } else { |
| 10286 value &= ~(1 << bit_position); | 10291 value &= ~(1 << bit_position); |
| 10287 } | 10292 } |
| 10288 return value; | 10293 return value; |
| 10289 } | 10294 } |
| 10290 }; | 10295 }; |
| 10291 | 10296 |
| 10292 } } // namespace v8::internal | 10297 } } // namespace v8::internal |
| 10293 | 10298 |
| 10294 #endif // V8_OBJECTS_H_ | 10299 #endif // V8_OBJECTS_H_ |
| OLD | NEW |