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 1932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1943 // Internal properties (e.g. the hidden properties dictionary) might | 1943 // Internal properties (e.g. the hidden properties dictionary) might |
1944 // be added even though the receiver is non-extensible. | 1944 // be added even though the receiver is non-extensible. |
1945 enum ExtensibilityCheck { | 1945 enum ExtensibilityCheck { |
1946 PERFORM_EXTENSIBILITY_CHECK, | 1946 PERFORM_EXTENSIBILITY_CHECK, |
1947 OMIT_EXTENSIBILITY_CHECK | 1947 OMIT_EXTENSIBILITY_CHECK |
1948 }; | 1948 }; |
1949 | 1949 |
1950 // Casting. | 1950 // Casting. |
1951 static inline JSReceiver* cast(Object* obj); | 1951 static inline JSReceiver* cast(Object* obj); |
1952 | 1952 |
1953 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5. | |
1954 static Handle<Object> SetProperty(Handle<JSReceiver> object, | 1953 static Handle<Object> SetProperty(Handle<JSReceiver> object, |
1955 Handle<Name> key, | 1954 Handle<Name> key, |
1956 Handle<Object> value, | 1955 Handle<Object> value, |
1957 PropertyAttributes attributes, | 1956 PropertyAttributes attributes, |
1958 StrictModeFlag strict_mode, | 1957 StrictModeFlag strict_mode); |
1959 StoreFromKeyed store_mode = | |
1960 MAY_BE_STORE_FROM_KEYED); | |
1961 static Handle<Object> SetElement(Handle<JSReceiver> object, | 1958 static Handle<Object> SetElement(Handle<JSReceiver> object, |
1962 uint32_t index, | 1959 uint32_t index, |
1963 Handle<Object> value, | 1960 Handle<Object> value, |
1964 PropertyAttributes attributes, | 1961 PropertyAttributes attributes, |
1965 StrictModeFlag strict_mode); | 1962 StrictModeFlag strict_mode); |
1966 | 1963 |
| 1964 MUST_USE_RESULT static MaybeObject* SetPropertyOrFail( |
| 1965 Handle<JSReceiver> object, |
| 1966 Handle<Name> key, |
| 1967 Handle<Object> value, |
| 1968 PropertyAttributes attributes, |
| 1969 StrictModeFlag strict_mode, |
| 1970 StoreFromKeyed store_from_keyed = MAY_BE_STORE_FROM_KEYED); |
| 1971 |
| 1972 // Can cause GC. |
| 1973 MUST_USE_RESULT MaybeObject* SetProperty( |
| 1974 Name* key, |
| 1975 Object* value, |
| 1976 PropertyAttributes attributes, |
| 1977 StrictModeFlag strict_mode, |
| 1978 StoreFromKeyed store_from_keyed = MAY_BE_STORE_FROM_KEYED); |
| 1979 MUST_USE_RESULT MaybeObject* SetProperty( |
| 1980 LookupResult* result, |
| 1981 Name* key, |
| 1982 Object* value, |
| 1983 PropertyAttributes attributes, |
| 1984 StrictModeFlag strict_mode, |
| 1985 StoreFromKeyed store_from_keyed = MAY_BE_STORE_FROM_KEYED); |
1967 MUST_USE_RESULT MaybeObject* SetPropertyWithDefinedSetter(JSReceiver* setter, | 1986 MUST_USE_RESULT MaybeObject* SetPropertyWithDefinedSetter(JSReceiver* setter, |
1968 Object* value); | 1987 Object* value); |
1969 | 1988 |
1970 // Implementation of [[HasProperty]], ECMA-262 5th edition, section 8.12.6. | |
1971 static inline bool HasProperty(Handle<JSReceiver> object, Handle<Name> name); | |
1972 static inline bool HasLocalProperty(Handle<JSReceiver>, Handle<Name> name); | |
1973 static inline bool HasElement(Handle<JSReceiver> object, uint32_t index); | |
1974 static inline bool HasLocalElement(Handle<JSReceiver> object, uint32_t index); | |
1975 | |
1976 // Implementation of [[Delete]], ECMA-262 5th edition, section 8.12.7. | |
1977 static Handle<Object> DeleteProperty(Handle<JSReceiver> object, | 1989 static Handle<Object> DeleteProperty(Handle<JSReceiver> object, |
1978 Handle<Name> name, | 1990 Handle<Name> name, |
1979 DeleteMode mode = NORMAL_DELETION); | 1991 DeleteMode mode = NORMAL_DELETION); |
1980 static Handle<Object> DeleteElement(Handle<JSReceiver> object, | 1992 static Handle<Object> DeleteElement(Handle<JSReceiver> object, |
1981 uint32_t index, | 1993 uint32_t index, |
1982 DeleteMode mode = NORMAL_DELETION); | 1994 DeleteMode mode = NORMAL_DELETION); |
1983 | 1995 |
1984 // Tests for the fast common case for property enumeration. | 1996 // Tests for the fast common case for property enumeration. |
1985 bool IsSimpleEnum(); | 1997 bool IsSimpleEnum(); |
1986 | 1998 |
1987 // Returns the class name ([[Class]] property in the specification). | 1999 // Returns the class name ([[Class]] property in the specification). |
1988 String* class_name(); | 2000 String* class_name(); |
1989 | 2001 |
1990 // Returns the constructor name (the name (possibly, inferred name) of the | 2002 // Returns the constructor name (the name (possibly, inferred name) of the |
1991 // function that was used to instantiate the object). | 2003 // function that was used to instantiate the object). |
1992 String* constructor_name(); | 2004 String* constructor_name(); |
1993 | 2005 |
1994 inline PropertyAttributes GetPropertyAttribute(Name* name); | 2006 inline PropertyAttributes GetPropertyAttribute(Name* name); |
1995 PropertyAttributes GetPropertyAttributeWithReceiver(JSReceiver* receiver, | 2007 PropertyAttributes GetPropertyAttributeWithReceiver(JSReceiver* receiver, |
1996 Name* name); | 2008 Name* name); |
1997 PropertyAttributes GetLocalPropertyAttribute(Name* name); | 2009 PropertyAttributes GetLocalPropertyAttribute(Name* name); |
1998 | 2010 |
1999 inline PropertyAttributes GetElementAttribute(uint32_t index); | 2011 inline PropertyAttributes GetElementAttribute(uint32_t index); |
2000 inline PropertyAttributes GetLocalElementAttribute(uint32_t index); | 2012 inline PropertyAttributes GetLocalElementAttribute(uint32_t index); |
2001 | 2013 |
| 2014 // Can cause a GC. |
| 2015 inline bool HasProperty(Name* name); |
| 2016 inline bool HasLocalProperty(Name* name); |
| 2017 inline bool HasElement(uint32_t index); |
| 2018 inline bool HasLocalElement(uint32_t index); |
| 2019 |
2002 // Return the object's prototype (might be Heap::null_value()). | 2020 // Return the object's prototype (might be Heap::null_value()). |
2003 inline Object* GetPrototype(); | 2021 inline Object* GetPrototype(); |
2004 | 2022 |
2005 // Return the constructor function (may be Heap::null_value()). | 2023 // Return the constructor function (may be Heap::null_value()). |
2006 inline Object* GetConstructor(); | 2024 inline Object* GetConstructor(); |
2007 | 2025 |
2008 // Retrieves a permanent object identity hash code. The undefined value might | 2026 // Retrieves a permanent object identity hash code. The undefined value might |
2009 // be returned in case no hash was created yet and OMIT_CREATION was used. | 2027 // be returned in case no hash was created yet and OMIT_CREATION was used. |
2010 inline MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); | 2028 inline MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); |
2011 | 2029 |
2012 // Lookup a property. If found, the result is valid and has | 2030 // Lookup a property. If found, the result is valid and has |
2013 // detailed information. | 2031 // detailed information. |
2014 void LocalLookup(Name* name, LookupResult* result, | 2032 void LocalLookup(Name* name, LookupResult* result, |
2015 bool search_hidden_prototypes = false); | 2033 bool search_hidden_prototypes = false); |
2016 void Lookup(Name* name, LookupResult* result); | 2034 void Lookup(Name* name, LookupResult* result); |
2017 | 2035 |
2018 protected: | 2036 protected: |
2019 Smi* GenerateIdentityHash(); | 2037 Smi* GenerateIdentityHash(); |
2020 | 2038 |
2021 private: | 2039 private: |
2022 PropertyAttributes GetPropertyAttributeForResult(JSReceiver* receiver, | 2040 PropertyAttributes GetPropertyAttributeForResult(JSReceiver* receiver, |
2023 LookupResult* result, | 2041 LookupResult* result, |
2024 Name* name, | 2042 Name* name, |
2025 bool continue_search); | 2043 bool continue_search); |
2026 | 2044 |
2027 static Handle<Object> SetProperty(Handle<JSReceiver> receiver, | |
2028 LookupResult* result, | |
2029 Handle<Name> key, | |
2030 Handle<Object> value, | |
2031 PropertyAttributes attributes, | |
2032 StrictModeFlag strict_mode, | |
2033 StoreFromKeyed store_from_keyed); | |
2034 | |
2035 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); | 2045 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); |
2036 }; | 2046 }; |
2037 | 2047 |
2038 // The JSObject describes real heap allocated JavaScript objects with | 2048 // The JSObject describes real heap allocated JavaScript objects with |
2039 // properties. | 2049 // properties. |
2040 // Note that the map of JSObject changes during execution to enable inline | 2050 // Note that the map of JSObject changes during execution to enable inline |
2041 // caching. | 2051 // caching. |
2042 class JSObject: public JSReceiver { | 2052 class JSObject: public JSReceiver { |
2043 public: | 2053 public: |
2044 // [properties]: Backing storage for properties. | 2054 // [properties]: Backing storage for properties. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2118 // Returns the number of non-undefined values. | 2128 // Returns the number of non-undefined values. |
2119 MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit); | 2129 MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit); |
2120 // As PrepareElementsForSort, but only on objects where elements is | 2130 // As PrepareElementsForSort, but only on objects where elements is |
2121 // a dictionary, and it will stay a dictionary. | 2131 // a dictionary, and it will stay a dictionary. |
2122 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); | 2132 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); |
2123 | 2133 |
2124 MUST_USE_RESULT MaybeObject* GetPropertyWithCallback(Object* receiver, | 2134 MUST_USE_RESULT MaybeObject* GetPropertyWithCallback(Object* receiver, |
2125 Object* structure, | 2135 Object* structure, |
2126 Name* name); | 2136 Name* name); |
2127 | 2137 |
| 2138 // Can cause GC. |
| 2139 MUST_USE_RESULT MaybeObject* SetPropertyForResult(LookupResult* result, |
| 2140 Name* key, |
| 2141 Object* value, |
| 2142 PropertyAttributes attributes, |
| 2143 StrictModeFlag strict_mode, |
| 2144 StoreFromKeyed store_mode); |
2128 MUST_USE_RESULT MaybeObject* SetPropertyWithFailedAccessCheck( | 2145 MUST_USE_RESULT MaybeObject* SetPropertyWithFailedAccessCheck( |
2129 LookupResult* result, | 2146 LookupResult* result, |
2130 Name* name, | 2147 Name* name, |
2131 Object* value, | 2148 Object* value, |
2132 bool check_prototype, | 2149 bool check_prototype, |
2133 StrictModeFlag strict_mode); | 2150 StrictModeFlag strict_mode); |
2134 MUST_USE_RESULT MaybeObject* SetPropertyWithCallback( | 2151 MUST_USE_RESULT MaybeObject* SetPropertyWithCallback( |
2135 Object* structure, | 2152 Object* structure, |
2136 Name* name, | 2153 Name* name, |
2137 Object* value, | 2154 Object* value, |
2138 JSObject* holder, | 2155 JSObject* holder, |
2139 StrictModeFlag strict_mode); | 2156 StrictModeFlag strict_mode); |
2140 static Handle<Object> SetPropertyWithInterceptor( | 2157 MUST_USE_RESULT MaybeObject* SetPropertyWithInterceptor( |
2141 Handle<JSObject> object, | 2158 Name* name, |
2142 Handle<Name> name, | 2159 Object* value, |
2143 Handle<Object> value, | |
2144 PropertyAttributes attributes, | 2160 PropertyAttributes attributes, |
2145 StrictModeFlag strict_mode); | 2161 StrictModeFlag strict_mode); |
2146 | 2162 MUST_USE_RESULT MaybeObject* SetPropertyPostInterceptor( |
2147 static Handle<Object> SetPropertyForResult( | 2163 Name* name, |
2148 Handle<JSObject> object, | 2164 Object* value, |
2149 LookupResult* result, | |
2150 Handle<Name> name, | |
2151 Handle<Object> value, | |
2152 PropertyAttributes attributes, | 2165 PropertyAttributes attributes, |
2153 StrictModeFlag strict_mode, | 2166 StrictModeFlag strict_mode, |
2154 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); | 2167 StoreMode mode = ALLOW_AS_CONSTANT); |
2155 | 2168 |
2156 static Handle<Object> SetLocalPropertyIgnoreAttributes( | 2169 static Handle<Object> SetLocalPropertyIgnoreAttributes( |
2157 Handle<JSObject> object, | 2170 Handle<JSObject> object, |
2158 Handle<Name> key, | 2171 Handle<Name> key, |
2159 Handle<Object> value, | 2172 Handle<Object> value, |
2160 PropertyAttributes attributes, | 2173 PropertyAttributes attributes, |
2161 ValueType value_type = OPTIMAL_REPRESENTATION, | 2174 ValueType value_type = OPTIMAL_REPRESENTATION, |
2162 StoreMode mode = ALLOW_AS_CONSTANT, | 2175 StoreMode mode = ALLOW_AS_CONSTANT, |
2163 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK); | 2176 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK); |
2164 | 2177 |
2165 static inline Handle<String> ExpectedTransitionKey(Handle<Map> map); | 2178 static inline Handle<String> ExpectedTransitionKey(Handle<Map> map); |
2166 static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map); | 2179 static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map); |
2167 | 2180 |
2168 // Try to follow an existing transition to a field with attributes NONE. The | 2181 // Try to follow an existing transition to a field with attributes NONE. The |
2169 // return value indicates whether the transition was successful. | 2182 // return value indicates whether the transition was successful. |
2170 static inline Handle<Map> FindTransitionToField(Handle<Map> map, | 2183 static inline Handle<Map> FindTransitionToField(Handle<Map> map, |
2171 Handle<Name> key); | 2184 Handle<Name> key); |
2172 | 2185 |
2173 inline int LastAddedFieldIndex(); | 2186 inline int LastAddedFieldIndex(); |
2174 | 2187 |
2175 // Extend the receiver with a single fast property appeared first in the | 2188 // Extend the receiver with a single fast property appeared first in the |
2176 // passed map. This also extends the property backing store if necessary. | 2189 // passed map. This also extends the property backing store if necessary. |
2177 static void AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map); | 2190 static void AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map); |
2178 inline MUST_USE_RESULT MaybeObject* AllocateStorageForMap(Map* map); | 2191 inline MUST_USE_RESULT MaybeObject* AllocateStorageForMap(Map* map); |
2179 | 2192 |
2180 static void MigrateInstance(Handle<JSObject> instance); | 2193 static void MigrateInstance(Handle<JSObject> instance); |
| 2194 inline MUST_USE_RESULT MaybeObject* MigrateInstance(); |
2181 | 2195 |
2182 static Handle<Object> TryMigrateInstance(Handle<JSObject> instance); | 2196 static Handle<Object> TryMigrateInstance(Handle<JSObject> instance); |
2183 inline MUST_USE_RESULT MaybeObject* TryMigrateInstance(); | 2197 inline MUST_USE_RESULT MaybeObject* TryMigrateInstance(); |
2184 | 2198 |
2185 // Can cause GC. | 2199 // Can cause GC. |
2186 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributesTrampoline( | 2200 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributesTrampoline( |
2187 Name* key, | 2201 Name* key, |
2188 Object* value, | 2202 Object* value, |
2189 PropertyAttributes attributes, | 2203 PropertyAttributes attributes, |
2190 ValueType value_type = OPTIMAL_REPRESENTATION, | 2204 ValueType value_type = OPTIMAL_REPRESENTATION, |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2462 // Returns the number of elements on this object filtering out elements | 2476 // Returns the number of elements on this object filtering out elements |
2463 // with the specified attributes (ignoring interceptors). | 2477 // with the specified attributes (ignoring interceptors). |
2464 int GetLocalElementKeys(FixedArray* storage, PropertyAttributes filter); | 2478 int GetLocalElementKeys(FixedArray* storage, PropertyAttributes filter); |
2465 // Count and fill in the enumerable elements into storage. | 2479 // Count and fill in the enumerable elements into storage. |
2466 // (storage->length() == NumberOfEnumElements()). | 2480 // (storage->length() == NumberOfEnumElements()). |
2467 // If storage is NULL, will count the elements without adding | 2481 // If storage is NULL, will count the elements without adding |
2468 // them to any storage. | 2482 // them to any storage. |
2469 // Returns the number of enumerable elements. | 2483 // Returns the number of enumerable elements. |
2470 int GetEnumElementKeys(FixedArray* storage); | 2484 int GetEnumElementKeys(FixedArray* storage); |
2471 | 2485 |
| 2486 // Add a property to a fast-case object using a map transition to |
| 2487 // new_map. |
| 2488 MUST_USE_RESULT MaybeObject* AddFastPropertyUsingMap( |
| 2489 Map* new_map, |
| 2490 Name* name, |
| 2491 Object* value, |
| 2492 int field_index, |
| 2493 Representation representation); |
| 2494 |
| 2495 // Add a constant function property to a fast-case object. |
| 2496 // This leaves a CONSTANT_TRANSITION in the old map, and |
| 2497 // if it is called on a second object with this map, a |
| 2498 // normal property is added instead, with a map transition. |
| 2499 // This avoids the creation of many maps with the same constant |
| 2500 // function, all orphaned. |
| 2501 MUST_USE_RESULT MaybeObject* AddConstantProperty( |
| 2502 Name* name, |
| 2503 Object* constant, |
| 2504 PropertyAttributes attributes, |
| 2505 TransitionFlag flag); |
| 2506 |
| 2507 MUST_USE_RESULT MaybeObject* ReplaceSlowProperty( |
| 2508 Name* name, |
| 2509 Object* value, |
| 2510 PropertyAttributes attributes); |
| 2511 |
2472 // Returns a new map with all transitions dropped from the object's current | 2512 // Returns a new map with all transitions dropped from the object's current |
2473 // map and the ElementsKind set. | 2513 // map and the ElementsKind set. |
2474 static Handle<Map> GetElementsTransitionMap(Handle<JSObject> object, | 2514 static Handle<Map> GetElementsTransitionMap(Handle<JSObject> object, |
2475 ElementsKind to_kind); | 2515 ElementsKind to_kind); |
2476 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( | 2516 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( |
2477 Isolate* isolate, | 2517 Isolate* isolate, |
2478 ElementsKind elements_kind); | 2518 ElementsKind elements_kind); |
2479 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( | 2519 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( |
2480 ElementsKind elements_kind); | 2520 ElementsKind elements_kind); |
2481 | 2521 |
2482 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, | 2522 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, |
2483 ElementsKind to_kind); | 2523 ElementsKind to_kind); |
2484 | 2524 |
2485 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); | 2525 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); |
2486 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind); | 2526 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind); |
2487 | 2527 |
2488 static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map); | |
2489 MUST_USE_RESULT MaybeObject* MigrateToMap(Map* new_map); | 2528 MUST_USE_RESULT MaybeObject* MigrateToMap(Map* new_map); |
2490 static void GeneralizeFieldRepresentation(Handle<JSObject> object, | 2529 MUST_USE_RESULT MaybeObject* GeneralizeFieldRepresentation( |
2491 int modify_index, | 2530 int modify_index, |
2492 Representation new_representation, | 2531 Representation new_representation, |
2493 StoreMode store_mode); | 2532 StoreMode store_mode); |
| 2533 |
| 2534 // Add a property to a fast-case object. |
| 2535 MUST_USE_RESULT MaybeObject* AddFastProperty( |
| 2536 Name* name, |
| 2537 Object* value, |
| 2538 PropertyAttributes attributes, |
| 2539 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, |
| 2540 ValueType value_type = OPTIMAL_REPRESENTATION, |
| 2541 TransitionFlag flag = INSERT_TRANSITION); |
| 2542 |
| 2543 // Add a property to a slow-case object. |
| 2544 MUST_USE_RESULT MaybeObject* AddSlowProperty(Name* name, |
| 2545 Object* value, |
| 2546 PropertyAttributes attributes); |
| 2547 |
| 2548 // Add a property to an object. May cause GC. |
| 2549 MUST_USE_RESULT MaybeObject* AddProperty( |
| 2550 Name* name, |
| 2551 Object* value, |
| 2552 PropertyAttributes attributes, |
| 2553 StrictModeFlag strict_mode, |
| 2554 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, |
| 2555 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, |
| 2556 ValueType value_type = OPTIMAL_REPRESENTATION, |
| 2557 StoreMode mode = ALLOW_AS_CONSTANT, |
| 2558 TransitionFlag flag = INSERT_TRANSITION); |
2494 | 2559 |
2495 // Convert the object to use the canonical dictionary | 2560 // Convert the object to use the canonical dictionary |
2496 // representation. If the object is expected to have additional properties | 2561 // representation. If the object is expected to have additional properties |
2497 // added this number can be indicated to have the backing store allocated to | 2562 // added this number can be indicated to have the backing store allocated to |
2498 // an initial capacity for holding these properties. | 2563 // an initial capacity for holding these properties. |
2499 static void NormalizeProperties(Handle<JSObject> object, | 2564 static void NormalizeProperties(Handle<JSObject> object, |
2500 PropertyNormalizationMode mode, | 2565 PropertyNormalizationMode mode, |
2501 int expected_additional_properties); | 2566 int expected_additional_properties); |
2502 | 2567 |
2503 MUST_USE_RESULT MaybeObject* NormalizeProperties( | 2568 MUST_USE_RESULT MaybeObject* NormalizeProperties( |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2558 static Handle<Object> PreventExtensions(Handle<JSObject> object); | 2623 static Handle<Object> PreventExtensions(Handle<JSObject> object); |
2559 MUST_USE_RESULT MaybeObject* PreventExtensions(); | 2624 MUST_USE_RESULT MaybeObject* PreventExtensions(); |
2560 | 2625 |
2561 // ES5 Object.freeze | 2626 // ES5 Object.freeze |
2562 MUST_USE_RESULT MaybeObject* Freeze(Isolate* isolate); | 2627 MUST_USE_RESULT MaybeObject* Freeze(Isolate* isolate); |
2563 | 2628 |
2564 | 2629 |
2565 // Called the first time an object is observed with ES7 Object.observe. | 2630 // Called the first time an object is observed with ES7 Object.observe. |
2566 MUST_USE_RESULT MaybeObject* SetObserved(Isolate* isolate); | 2631 MUST_USE_RESULT MaybeObject* SetObserved(Isolate* isolate); |
2567 | 2632 |
2568 // Copy object. | 2633 // Copy object |
2569 static Handle<JSObject> Copy(Handle<JSObject> object); | 2634 MUST_USE_RESULT MaybeObject* DeepCopy(Isolate* isolate); |
2570 static Handle<JSObject> DeepCopy(Handle<JSObject> object); | |
2571 | 2635 |
2572 // Dispatched behavior. | 2636 // Dispatched behavior. |
2573 void JSObjectShortPrint(StringStream* accumulator); | 2637 void JSObjectShortPrint(StringStream* accumulator); |
2574 DECLARE_PRINTER(JSObject) | 2638 DECLARE_PRINTER(JSObject) |
2575 DECLARE_VERIFIER(JSObject) | 2639 DECLARE_VERIFIER(JSObject) |
2576 #ifdef OBJECT_PRINT | 2640 #ifdef OBJECT_PRINT |
2577 void PrintProperties(FILE* out = stdout); | 2641 void PrintProperties(FILE* out = stdout); |
2578 void PrintElements(FILE* out = stdout); | 2642 void PrintElements(FILE* out = stdout); |
2579 void PrintTransitions(FILE* out = stdout); | 2643 void PrintTransitions(FILE* out = stdout); |
2580 #endif | 2644 #endif |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2663 Handle<Name> name, | 2727 Handle<Name> name, |
2664 Handle<Object> old_value); | 2728 Handle<Object> old_value); |
2665 | 2729 |
2666 // Deliver change records to observers. May cause GC. | 2730 // Deliver change records to observers. May cause GC. |
2667 static void DeliverChangeRecords(Isolate* isolate); | 2731 static void DeliverChangeRecords(Isolate* isolate); |
2668 | 2732 |
2669 private: | 2733 private: |
2670 friend class DictionaryElementsAccessor; | 2734 friend class DictionaryElementsAccessor; |
2671 friend class JSReceiver; | 2735 friend class JSReceiver; |
2672 | 2736 |
| 2737 // TODO(mstarzinger): Soon to be handlified. |
| 2738 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes( |
| 2739 Name* key, |
| 2740 Object* value, |
| 2741 PropertyAttributes attributes, |
| 2742 ValueType value_type = OPTIMAL_REPRESENTATION, |
| 2743 StoreMode mode = ALLOW_AS_CONSTANT, |
| 2744 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK); |
| 2745 |
2673 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, | 2746 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, |
2674 Object* structure, | 2747 Object* structure, |
2675 uint32_t index, | 2748 uint32_t index, |
2676 Object* holder); | 2749 Object* holder); |
2677 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor( | 2750 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor( |
2678 JSReceiver* receiver, | 2751 JSReceiver* receiver, |
2679 uint32_t index, | 2752 uint32_t index, |
2680 bool continue_search); | 2753 bool continue_search); |
2681 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithoutInterceptor( | 2754 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithoutInterceptor( |
2682 JSReceiver* receiver, | 2755 JSReceiver* receiver, |
(...skipping 16 matching lines...) Expand all Loading... |
2699 uint32_t index, | 2772 uint32_t index, |
2700 Object* value, | 2773 Object* value, |
2701 PropertyAttributes attributes, | 2774 PropertyAttributes attributes, |
2702 StrictModeFlag strict_mode, | 2775 StrictModeFlag strict_mode, |
2703 bool check_prototype, | 2776 bool check_prototype, |
2704 SetPropertyMode set_mode); | 2777 SetPropertyMode set_mode); |
2705 | 2778 |
2706 // Searches the prototype chain for property 'name'. If it is found and | 2779 // Searches the prototype chain for property 'name'. If it is found and |
2707 // has a setter, invoke it and set '*done' to true. If it is found and is | 2780 // has a setter, invoke it and set '*done' to true. If it is found and is |
2708 // read-only, reject and set '*done' to true. Otherwise, set '*done' to | 2781 // read-only, reject and set '*done' to true. Otherwise, set '*done' to |
2709 // false. Can throw and return an empty handle with '*done==true'. | 2782 // false. Can cause GC and can return a failure result with '*done==true'. |
2710 static Handle<Object> SetPropertyViaPrototypes( | 2783 MUST_USE_RESULT MaybeObject* SetPropertyViaPrototypes( |
2711 Handle<JSObject> object, | 2784 Name* name, |
2712 Handle<Name> name, | 2785 Object* value, |
2713 Handle<Object> value, | |
2714 PropertyAttributes attributes, | 2786 PropertyAttributes attributes, |
2715 StrictModeFlag strict_mode, | 2787 StrictModeFlag strict_mode, |
2716 bool* done); | 2788 bool* done); |
2717 static Handle<Object> SetPropertyPostInterceptor( | |
2718 Handle<JSObject> object, | |
2719 Handle<Name> name, | |
2720 Handle<Object> value, | |
2721 PropertyAttributes attributes, | |
2722 StrictModeFlag strict_mode); | |
2723 static Handle<Object> SetPropertyUsingTransition( | |
2724 Handle<JSObject> object, | |
2725 LookupResult* lookup, | |
2726 Handle<Name> name, | |
2727 Handle<Object> value, | |
2728 PropertyAttributes attributes); | |
2729 | |
2730 // Add a property to an object. | |
2731 static Handle<Object> AddProperty( | |
2732 Handle<JSObject> object, | |
2733 Handle<Name> name, | |
2734 Handle<Object> value, | |
2735 PropertyAttributes attributes, | |
2736 StrictModeFlag strict_mode, | |
2737 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, | |
2738 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, | |
2739 ValueType value_type = OPTIMAL_REPRESENTATION, | |
2740 StoreMode mode = ALLOW_AS_CONSTANT, | |
2741 TransitionFlag flag = INSERT_TRANSITION); | |
2742 | |
2743 // Add a constant function property to a fast-case object. | |
2744 // This leaves a CONSTANT_TRANSITION in the old map, and | |
2745 // if it is called on a second object with this map, a | |
2746 // normal property is added instead, with a map transition. | |
2747 // This avoids the creation of many maps with the same constant | |
2748 // function, all orphaned. | |
2749 static void AddConstantProperty(Handle<JSObject> object, | |
2750 Handle<Name> name, | |
2751 Handle<Object> constant, | |
2752 PropertyAttributes attributes, | |
2753 TransitionFlag flag); | |
2754 | |
2755 // Add a property to a fast-case object. | |
2756 static void AddFastProperty(Handle<JSObject> object, | |
2757 Handle<Name> name, | |
2758 Handle<Object> value, | |
2759 PropertyAttributes attributes, | |
2760 StoreFromKeyed store_mode, | |
2761 ValueType value_type, | |
2762 TransitionFlag flag); | |
2763 | |
2764 // Add a property to a fast-case object using a map transition to | |
2765 // new_map. | |
2766 static Handle<Object> AddFastPropertyUsingMap(Handle<JSObject> object, | |
2767 Handle<Map> new_map, | |
2768 Handle<Name> name, | |
2769 Handle<Object> value, | |
2770 int field_index, | |
2771 Representation representation); | |
2772 MUST_USE_RESULT MaybeObject* AddFastPropertyUsingMap( | |
2773 Map* new_map, | |
2774 Name* name, | |
2775 Object* value, | |
2776 int field_index, | |
2777 Representation representation); | |
2778 | |
2779 // Add a property to a slow-case object. | |
2780 static void AddSlowProperty(Handle<JSObject> object, | |
2781 Handle<Name> name, | |
2782 Handle<Object> value, | |
2783 PropertyAttributes attributes); | |
2784 | 2789 |
2785 static Handle<Object> DeleteProperty(Handle<JSObject> object, | 2790 static Handle<Object> DeleteProperty(Handle<JSObject> object, |
2786 Handle<Name> name, | 2791 Handle<Name> name, |
2787 DeleteMode mode); | 2792 DeleteMode mode); |
2788 static Handle<Object> DeletePropertyPostInterceptor(Handle<JSObject> object, | 2793 static Handle<Object> DeletePropertyPostInterceptor(Handle<JSObject> object, |
2789 Handle<Name> name, | 2794 Handle<Name> name, |
2790 DeleteMode mode); | 2795 DeleteMode mode); |
2791 static Handle<Object> DeletePropertyWithInterceptor(Handle<JSObject> object, | 2796 static Handle<Object> DeletePropertyWithInterceptor(Handle<JSObject> object, |
2792 Handle<Name> name); | 2797 Handle<Name> name); |
2793 | 2798 |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3163 // array. | 3168 // array. |
3164 inline void Append(Descriptor* desc, const WhitenessWitness&); | 3169 inline void Append(Descriptor* desc, const WhitenessWitness&); |
3165 inline void Append(Descriptor* desc); | 3170 inline void Append(Descriptor* desc); |
3166 | 3171 |
3167 // Transfer a complete descriptor from the src descriptor array to this | 3172 // Transfer a complete descriptor from the src descriptor array to this |
3168 // descriptor array. | 3173 // descriptor array. |
3169 void CopyFrom(int dst_index, | 3174 void CopyFrom(int dst_index, |
3170 DescriptorArray* src, | 3175 DescriptorArray* src, |
3171 int src_index, | 3176 int src_index, |
3172 const WhitenessWitness&); | 3177 const WhitenessWitness&); |
3173 static Handle<DescriptorArray> Merge(Handle<DescriptorArray> desc, | |
3174 int verbatim, | |
3175 int valid, | |
3176 int new_size, | |
3177 int modify_index, | |
3178 StoreMode store_mode, | |
3179 Handle<DescriptorArray> other); | |
3180 MUST_USE_RESULT MaybeObject* Merge(int verbatim, | 3178 MUST_USE_RESULT MaybeObject* Merge(int verbatim, |
3181 int valid, | 3179 int valid, |
3182 int new_size, | 3180 int new_size, |
3183 int modify_index, | 3181 int modify_index, |
3184 StoreMode store_mode, | 3182 StoreMode store_mode, |
3185 DescriptorArray* other); | 3183 DescriptorArray* other); |
3186 | 3184 |
3187 bool IsMoreGeneralThan(int verbatim, | 3185 bool IsMoreGeneralThan(int verbatim, |
3188 int valid, | 3186 int valid, |
3189 int new_size, | 3187 int new_size, |
(...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4806 | 4804 |
4807 static const char* Kind2String(Kind kind); | 4805 static const char* Kind2String(Kind kind); |
4808 | 4806 |
4809 // Types of stubs. | 4807 // Types of stubs. |
4810 enum StubType { | 4808 enum StubType { |
4811 NORMAL, | 4809 NORMAL, |
4812 FIELD, | 4810 FIELD, |
4813 CONSTANT, | 4811 CONSTANT, |
4814 CALLBACKS, | 4812 CALLBACKS, |
4815 INTERCEPTOR, | 4813 INTERCEPTOR, |
4816 TRANSITION, | 4814 MAP_TRANSITION, |
4817 NONEXISTENT | 4815 NONEXISTENT |
4818 }; | 4816 }; |
4819 | 4817 |
4820 enum StubHolder { | 4818 enum StubHolder { |
4821 OWN_STUB, | 4819 OWN_STUB, |
4822 PROTOTYPE_STUB | 4820 PROTOTYPE_STUB |
4823 }; | 4821 }; |
4824 | 4822 |
4825 typedef int ExtraICState; | 4823 typedef int ExtraICState; |
4826 | 4824 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5149 kAfterLastCodeAge, | 5147 kAfterLastCodeAge, |
5150 kLastCodeAge = kAfterLastCodeAge - 1, | 5148 kLastCodeAge = kAfterLastCodeAge - 1, |
5151 kCodeAgeCount = kAfterLastCodeAge - 1 | 5149 kCodeAgeCount = kAfterLastCodeAge - 1 |
5152 }; | 5150 }; |
5153 #undef DECLARE_CODE_AGE_ENUM | 5151 #undef DECLARE_CODE_AGE_ENUM |
5154 | 5152 |
5155 // Code aging. Indicates how many full GCs this code has survived without | 5153 // Code aging. Indicates how many full GCs this code has survived without |
5156 // being entered through the prologue. Used to determine when it is | 5154 // being entered through the prologue. Used to determine when it is |
5157 // relatively safe to flush this code object and replace it with the lazy | 5155 // relatively safe to flush this code object and replace it with the lazy |
5158 // compilation stub. | 5156 // compilation stub. |
5159 static void MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate); | 5157 static void MakeCodeAgeSequenceYoung(byte* sequence); |
5160 void MakeOlder(MarkingParity); | 5158 void MakeOlder(MarkingParity); |
5161 static bool IsYoungSequence(byte* sequence); | 5159 static bool IsYoungSequence(byte* sequence); |
5162 bool IsOld(); | 5160 bool IsOld(); |
5163 int GetAge(); | 5161 int GetAge(); |
5164 | 5162 |
5165 void PrintDeoptLocation(int bailout_id); | 5163 void PrintDeoptLocation(int bailout_id); |
5166 bool CanDeoptAt(Address pc); | 5164 bool CanDeoptAt(Address pc); |
5167 | 5165 |
5168 #ifdef VERIFY_HEAP | 5166 #ifdef VERIFY_HEAP |
5169 void VerifyEmbeddedMapsDependency(); | 5167 void VerifyEmbeddedMapsDependency(); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5295 | 5293 |
5296 private: | 5294 private: |
5297 friend class RelocIterator; | 5295 friend class RelocIterator; |
5298 | 5296 |
5299 // Code aging | 5297 // Code aging |
5300 byte* FindCodeAgeSequence(); | 5298 byte* FindCodeAgeSequence(); |
5301 static void GetCodeAgeAndParity(Code* code, Age* age, | 5299 static void GetCodeAgeAndParity(Code* code, Age* age, |
5302 MarkingParity* parity); | 5300 MarkingParity* parity); |
5303 static void GetCodeAgeAndParity(byte* sequence, Age* age, | 5301 static void GetCodeAgeAndParity(byte* sequence, Age* age, |
5304 MarkingParity* parity); | 5302 MarkingParity* parity); |
5305 static Code* GetCodeAgeStub(Isolate* isolate, Age age, MarkingParity parity); | 5303 static Code* GetCodeAgeStub(Age age, MarkingParity parity); |
5306 | 5304 |
5307 // Code aging -- platform-specific | 5305 // Code aging -- platform-specific |
5308 static void PatchPlatformCodeAge(Isolate* isolate, | 5306 static void PatchPlatformCodeAge(byte* sequence, Age age, |
5309 byte* sequence, Age age, | |
5310 MarkingParity parity); | 5307 MarkingParity parity); |
5311 | 5308 |
5312 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); | 5309 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); |
5313 }; | 5310 }; |
5314 | 5311 |
5315 | 5312 |
5316 class CompilationInfo; | 5313 class CompilationInfo; |
5317 | 5314 |
5318 // This class describes the layout of dependent codes array of a map. The | 5315 // This class describes the layout of dependent codes array of a map. The |
5319 // array is partitioned into several groups of dependent codes. Each group | 5316 // array is partitioned into several groups of dependent codes. Each group |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5612 | 5609 |
5613 bool InstancesNeedRewriting(Map* target, | 5610 bool InstancesNeedRewriting(Map* target, |
5614 int target_number_of_fields, | 5611 int target_number_of_fields, |
5615 int target_inobject, | 5612 int target_inobject, |
5616 int target_unused); | 5613 int target_unused); |
5617 static Handle<Map> GeneralizeRepresentation( | 5614 static Handle<Map> GeneralizeRepresentation( |
5618 Handle<Map> map, | 5615 Handle<Map> map, |
5619 int modify_index, | 5616 int modify_index, |
5620 Representation new_representation, | 5617 Representation new_representation, |
5621 StoreMode store_mode); | 5618 StoreMode store_mode); |
5622 static Handle<Map> CopyGeneralizeAllRepresentations( | 5619 MUST_USE_RESULT MaybeObject* GeneralizeRepresentation( |
5623 Handle<Map> map, | 5620 int modify_index, |
| 5621 Representation representation, |
| 5622 StoreMode store_mode); |
| 5623 MUST_USE_RESULT MaybeObject* CopyGeneralizeAllRepresentations( |
5624 int modify_index, | 5624 int modify_index, |
5625 StoreMode store_mode, | 5625 StoreMode store_mode, |
5626 PropertyAttributes attributes, | 5626 PropertyAttributes attributes, |
5627 const char* reason); | 5627 const char* reason); |
5628 | 5628 |
5629 void PrintGeneralization(FILE* file, | 5629 void PrintGeneralization(FILE* file, |
5630 const char* reason, | 5630 const char* reason, |
5631 int modify_index, | 5631 int modify_index, |
5632 int split, | 5632 int split, |
5633 int descriptors, | 5633 int descriptors, |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5793 | 5793 |
5794 MUST_USE_RESULT MaybeObject* RawCopy(int instance_size); | 5794 MUST_USE_RESULT MaybeObject* RawCopy(int instance_size); |
5795 MUST_USE_RESULT MaybeObject* CopyWithPreallocatedFieldDescriptors(); | 5795 MUST_USE_RESULT MaybeObject* CopyWithPreallocatedFieldDescriptors(); |
5796 static Handle<Map> CopyDropDescriptors(Handle<Map> map); | 5796 static Handle<Map> CopyDropDescriptors(Handle<Map> map); |
5797 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); | 5797 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); |
5798 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptors( | 5798 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptors( |
5799 DescriptorArray* descriptors, | 5799 DescriptorArray* descriptors, |
5800 TransitionFlag flag, | 5800 TransitionFlag flag, |
5801 Name* name = NULL, | 5801 Name* name = NULL, |
5802 SimpleTransitionFlag simple_flag = FULL_TRANSITION); | 5802 SimpleTransitionFlag simple_flag = FULL_TRANSITION); |
5803 static Handle<Map> CopyInstallDescriptors( | |
5804 Handle<Map> map, | |
5805 int new_descriptor, | |
5806 Handle<DescriptorArray> descriptors); | |
5807 MUST_USE_RESULT MaybeObject* CopyInstallDescriptors( | 5803 MUST_USE_RESULT MaybeObject* CopyInstallDescriptors( |
5808 int new_descriptor, | 5804 int new_descriptor, |
5809 DescriptorArray* descriptors); | 5805 DescriptorArray* descriptors); |
5810 MUST_USE_RESULT MaybeObject* ShareDescriptor(DescriptorArray* descriptors, | 5806 MUST_USE_RESULT MaybeObject* ShareDescriptor(DescriptorArray* descriptors, |
5811 Descriptor* descriptor); | 5807 Descriptor* descriptor); |
5812 MUST_USE_RESULT MaybeObject* CopyAddDescriptor(Descriptor* descriptor, | 5808 MUST_USE_RESULT MaybeObject* CopyAddDescriptor(Descriptor* descriptor, |
5813 TransitionFlag flag); | 5809 TransitionFlag flag); |
5814 MUST_USE_RESULT MaybeObject* CopyInsertDescriptor(Descriptor* descriptor, | 5810 MUST_USE_RESULT MaybeObject* CopyInsertDescriptor(Descriptor* descriptor, |
5815 TransitionFlag flag); | 5811 TransitionFlag flag); |
5816 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptor( | 5812 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptor( |
(...skipping 3198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9015 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 9011 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
9016 | 9012 |
9017 // [dependent_code]: dependent code that depends on the type of the global | 9013 // [dependent_code]: dependent code that depends on the type of the global |
9018 // property. | 9014 // property. |
9019 DECL_ACCESSORS(dependent_code, DependentCode) | 9015 DECL_ACCESSORS(dependent_code, DependentCode) |
9020 | 9016 |
9021 // Sets the value of the cell and updates the type field to be the union | 9017 // Sets the value of the cell and updates the type field to be the union |
9022 // of the cell's current type and the value's type. If the change causes | 9018 // of the cell's current type and the value's type. If the change causes |
9023 // a change of the type of the cell's contents, code dependent on the cell | 9019 // a change of the type of the cell's contents, code dependent on the cell |
9024 // will be deoptimized. | 9020 // will be deoptimized. |
9025 static void SetValueInferType(Handle<PropertyCell> cell, | |
9026 Handle<Object> value, | |
9027 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | |
9028 MUST_USE_RESULT MaybeObject* SetValueInferType( | 9021 MUST_USE_RESULT MaybeObject* SetValueInferType( |
9029 Object* value, | 9022 Object* value, |
9030 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 9023 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
9031 | 9024 |
9032 // Casting. | 9025 // Casting. |
9033 static inline PropertyCell* cast(Object* obj); | 9026 static inline PropertyCell* cast(Object* obj); |
9034 | 9027 |
9035 inline Address TypeAddress() { | 9028 inline Address TypeAddress() { |
9036 return address() + kTypeOffset; | 9029 return address() + kTypeOffset; |
9037 } | 9030 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9070 public: | 9063 public: |
9071 // [handler]: The handler property. | 9064 // [handler]: The handler property. |
9072 DECL_ACCESSORS(handler, Object) | 9065 DECL_ACCESSORS(handler, Object) |
9073 | 9066 |
9074 // [hash]: The hash code property (undefined if not initialized yet). | 9067 // [hash]: The hash code property (undefined if not initialized yet). |
9075 DECL_ACCESSORS(hash, Object) | 9068 DECL_ACCESSORS(hash, Object) |
9076 | 9069 |
9077 // Casting. | 9070 // Casting. |
9078 static inline JSProxy* cast(Object* obj); | 9071 static inline JSProxy* cast(Object* obj); |
9079 | 9072 |
| 9073 bool HasPropertyWithHandler(Name* name); |
| 9074 bool HasElementWithHandler(uint32_t index); |
| 9075 |
9080 MUST_USE_RESULT MaybeObject* GetPropertyWithHandler( | 9076 MUST_USE_RESULT MaybeObject* GetPropertyWithHandler( |
9081 Object* receiver, | 9077 Object* receiver, |
9082 Name* name); | 9078 Name* name); |
9083 MUST_USE_RESULT MaybeObject* GetElementWithHandler( | 9079 MUST_USE_RESULT MaybeObject* GetElementWithHandler( |
9084 Object* receiver, | 9080 Object* receiver, |
9085 uint32_t index); | 9081 uint32_t index); |
9086 | 9082 |
| 9083 MUST_USE_RESULT MaybeObject* SetPropertyWithHandler( |
| 9084 JSReceiver* receiver, |
| 9085 Name* name, |
| 9086 Object* value, |
| 9087 PropertyAttributes attributes, |
| 9088 StrictModeFlag strict_mode); |
| 9089 |
9087 // If the handler defines an accessor property with a setter, invoke it. | 9090 // If the handler defines an accessor property with a setter, invoke it. |
9088 // If it defines an accessor property without a setter, or a data property | 9091 // If it defines an accessor property without a setter, or a data property |
9089 // that is read-only, throw. In all these cases set '*done' to true, | 9092 // that is read-only, throw. In all these cases set '*done' to true, |
9090 // otherwise set it to false. | 9093 // otherwise set it to false. |
9091 MUST_USE_RESULT MaybeObject* SetPropertyViaPrototypesWithHandler( | 9094 MUST_USE_RESULT MaybeObject* SetPropertyViaPrototypesWithHandler( |
9092 JSReceiver* receiver, | 9095 JSReceiver* receiver, |
9093 Name* name, | 9096 Name* name, |
9094 Object* value, | 9097 Object* value, |
9095 PropertyAttributes attributes, | 9098 PropertyAttributes attributes, |
9096 StrictModeFlag strict_mode, | 9099 StrictModeFlag strict_mode, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9132 | 9135 |
9133 STATIC_CHECK(kPaddingSize >= 0); | 9136 STATIC_CHECK(kPaddingSize >= 0); |
9134 | 9137 |
9135 typedef FixedBodyDescriptor<kHandlerOffset, | 9138 typedef FixedBodyDescriptor<kHandlerOffset, |
9136 kPaddingOffset, | 9139 kPaddingOffset, |
9137 kSize> BodyDescriptor; | 9140 kSize> BodyDescriptor; |
9138 | 9141 |
9139 private: | 9142 private: |
9140 friend class JSReceiver; | 9143 friend class JSReceiver; |
9141 | 9144 |
9142 static Handle<Object> SetPropertyWithHandler(Handle<JSProxy> proxy, | |
9143 Handle<JSReceiver> receiver, | |
9144 Handle<Name> name, | |
9145 Handle<Object> value, | |
9146 PropertyAttributes attributes, | |
9147 StrictModeFlag strict_mode); | |
9148 static Handle<Object> SetElementWithHandler(Handle<JSProxy> proxy, | 9145 static Handle<Object> SetElementWithHandler(Handle<JSProxy> proxy, |
9149 Handle<JSReceiver> receiver, | 9146 Handle<JSReceiver> receiver, |
9150 uint32_t index, | 9147 uint32_t index, |
9151 Handle<Object> value, | 9148 Handle<Object> value, |
9152 StrictModeFlag strict_mode); | 9149 StrictModeFlag strict_mode); |
9153 | 9150 |
9154 static bool HasPropertyWithHandler(Handle<JSProxy> proxy, Handle<Name> name); | |
9155 static bool HasElementWithHandler(Handle<JSProxy> proxy, uint32_t index); | |
9156 | |
9157 static Handle<Object> DeletePropertyWithHandler(Handle<JSProxy> proxy, | 9151 static Handle<Object> DeletePropertyWithHandler(Handle<JSProxy> proxy, |
9158 Handle<Name> name, | 9152 Handle<Name> name, |
9159 DeleteMode mode); | 9153 DeleteMode mode); |
9160 static Handle<Object> DeleteElementWithHandler(Handle<JSProxy> proxy, | 9154 static Handle<Object> DeleteElementWithHandler(Handle<JSProxy> proxy, |
9161 uint32_t index, | 9155 uint32_t index, |
9162 DeleteMode mode); | 9156 DeleteMode mode); |
9163 | 9157 |
9164 MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); | 9158 MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); |
9165 static Handle<Object> GetIdentityHash(Handle<JSProxy> proxy, | 9159 static Handle<Object> GetIdentityHash(Handle<JSProxy> proxy, |
9166 CreationFlag flag); | 9160 CreationFlag flag); |
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10249 } else { | 10243 } else { |
10250 value &= ~(1 << bit_position); | 10244 value &= ~(1 << bit_position); |
10251 } | 10245 } |
10252 return value; | 10246 return value; |
10253 } | 10247 } |
10254 }; | 10248 }; |
10255 | 10249 |
10256 } } // namespace v8::internal | 10250 } } // namespace v8::internal |
10257 | 10251 |
10258 #endif // V8_OBJECTS_H_ | 10252 #endif // V8_OBJECTS_H_ |
OLD | NEW |