| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
| 6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 | 1114 |
| 1115 // Converts this to a Smi if possible. | 1115 // Converts this to a Smi if possible. |
| 1116 static MUST_USE_RESULT inline MaybeHandle<Smi> ToSmi(Isolate* isolate, | 1116 static MUST_USE_RESULT inline MaybeHandle<Smi> ToSmi(Isolate* isolate, |
| 1117 Handle<Object> object); | 1117 Handle<Object> object); |
| 1118 | 1118 |
| 1119 MUST_USE_RESULT static MaybeHandle<Object> GetProperty(LookupIterator* it); | 1119 MUST_USE_RESULT static MaybeHandle<Object> GetProperty(LookupIterator* it); |
| 1120 | 1120 |
| 1121 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5. | 1121 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5. |
| 1122 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( | 1122 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( |
| 1123 Handle<Object> object, Handle<Name> key, Handle<Object> value, | 1123 Handle<Object> object, Handle<Name> key, Handle<Object> value, |
| 1124 StrictMode strict_mode, | 1124 LanguageMode language_mode, |
| 1125 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); | 1125 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); |
| 1126 | 1126 |
| 1127 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( | 1127 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( |
| 1128 LookupIterator* it, Handle<Object> value, StrictMode strict_mode, | 1128 LookupIterator* it, Handle<Object> value, LanguageMode language_mode, |
| 1129 StoreFromKeyed store_mode, | 1129 StoreFromKeyed store_mode, |
| 1130 StorePropertyMode data_store_mode = NORMAL_PROPERTY); | 1130 StorePropertyMode data_store_mode = NORMAL_PROPERTY); |
| 1131 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyProperty( | 1131 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyProperty( |
| 1132 LookupIterator* it, Handle<Object> value, StrictMode strict_mode); | 1132 LookupIterator* it, Handle<Object> value, LanguageMode language_mode); |
| 1133 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyElement( | 1133 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyElement( |
| 1134 Isolate* isolate, Handle<Object> receiver, uint32_t index, | 1134 Isolate* isolate, Handle<Object> receiver, uint32_t index, |
| 1135 Handle<Object> value, StrictMode strict_mode); | 1135 Handle<Object> value, LanguageMode language_mode); |
| 1136 MUST_USE_RESULT static MaybeHandle<Object> SetDataProperty( | 1136 MUST_USE_RESULT static MaybeHandle<Object> SetDataProperty( |
| 1137 LookupIterator* it, Handle<Object> value); | 1137 LookupIterator* it, Handle<Object> value); |
| 1138 MUST_USE_RESULT static MaybeHandle<Object> AddDataProperty( | 1138 MUST_USE_RESULT static MaybeHandle<Object> AddDataProperty( |
| 1139 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, | 1139 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, |
| 1140 StrictMode strict_mode, StoreFromKeyed store_mode); | 1140 LanguageMode language_mode, StoreFromKeyed store_mode); |
| 1141 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( | 1141 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( |
| 1142 Handle<Object> object, | 1142 Handle<Object> object, |
| 1143 Handle<Name> key); | 1143 Handle<Name> key); |
| 1144 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( | 1144 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( |
| 1145 Isolate* isolate, | 1145 Isolate* isolate, |
| 1146 Handle<Object> object, | 1146 Handle<Object> object, |
| 1147 const char* key); | 1147 const char* key); |
| 1148 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( | 1148 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( |
| 1149 Handle<Object> object, | 1149 Handle<Object> object, |
| 1150 Handle<Name> key); | 1150 Handle<Name> key); |
| 1151 | 1151 |
| 1152 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithAccessor( | 1152 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithAccessor( |
| 1153 Handle<Object> receiver, | 1153 Handle<Object> receiver, |
| 1154 Handle<Name> name, | 1154 Handle<Name> name, |
| 1155 Handle<JSObject> holder, | 1155 Handle<JSObject> holder, |
| 1156 Handle<Object> structure); | 1156 Handle<Object> structure); |
| 1157 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithAccessor( | 1157 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithAccessor( |
| 1158 Handle<Object> receiver, Handle<Name> name, Handle<Object> value, | 1158 Handle<Object> receiver, Handle<Name> name, Handle<Object> value, |
| 1159 Handle<JSObject> holder, Handle<Object> structure, | 1159 Handle<JSObject> holder, Handle<Object> structure, |
| 1160 StrictMode strict_mode); | 1160 LanguageMode language_mode); |
| 1161 | 1161 |
| 1162 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithDefinedGetter( | 1162 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithDefinedGetter( |
| 1163 Handle<Object> receiver, | 1163 Handle<Object> receiver, |
| 1164 Handle<JSReceiver> getter); | 1164 Handle<JSReceiver> getter); |
| 1165 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithDefinedSetter( | 1165 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithDefinedSetter( |
| 1166 Handle<Object> receiver, | 1166 Handle<Object> receiver, |
| 1167 Handle<JSReceiver> setter, | 1167 Handle<JSReceiver> setter, |
| 1168 Handle<Object> value); | 1168 Handle<Object> value); |
| 1169 | 1169 |
| 1170 MUST_USE_RESULT static inline MaybeHandle<Object> GetElement( | 1170 MUST_USE_RESULT static inline MaybeHandle<Object> GetElement( |
| 1171 Isolate* isolate, | 1171 Isolate* isolate, |
| 1172 Handle<Object> object, | 1172 Handle<Object> object, |
| 1173 uint32_t index); | 1173 uint32_t index); |
| 1174 | 1174 |
| 1175 MUST_USE_RESULT static MaybeHandle<Object> GetElementWithReceiver( | 1175 MUST_USE_RESULT static MaybeHandle<Object> GetElementWithReceiver( |
| 1176 Isolate* isolate, | 1176 Isolate* isolate, |
| 1177 Handle<Object> object, | 1177 Handle<Object> object, |
| 1178 Handle<Object> receiver, | 1178 Handle<Object> receiver, |
| 1179 uint32_t index); | 1179 uint32_t index); |
| 1180 | 1180 |
| 1181 MUST_USE_RESULT static MaybeHandle<Object> SetElementWithReceiver( | 1181 MUST_USE_RESULT static MaybeHandle<Object> SetElementWithReceiver( |
| 1182 Isolate* isolate, Handle<Object> object, Handle<Object> receiver, | 1182 Isolate* isolate, Handle<Object> object, Handle<Object> receiver, |
| 1183 uint32_t index, Handle<Object> value, StrictMode strict_mode); | 1183 uint32_t index, Handle<Object> value, LanguageMode language_mode); |
| 1184 | 1184 |
| 1185 static inline Handle<Object> GetPrototypeSkipHiddenPrototypes( | 1185 static inline Handle<Object> GetPrototypeSkipHiddenPrototypes( |
| 1186 Isolate* isolate, Handle<Object> receiver); | 1186 Isolate* isolate, Handle<Object> receiver); |
| 1187 | 1187 |
| 1188 // Returns the permanent hash code associated with this object. May return | 1188 // Returns the permanent hash code associated with this object. May return |
| 1189 // undefined if not yet created. | 1189 // undefined if not yet created. |
| 1190 Object* GetHash(); | 1190 Object* GetHash(); |
| 1191 | 1191 |
| 1192 // Returns the permanent hash code associated with this object depending on | 1192 // Returns the permanent hash code associated with this object depending on |
| 1193 // the actual object type. May create and store a hash code if needed and none | 1193 // the actual object type. May create and store a hash code if needed and none |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1585 }; | 1585 }; |
| 1586 | 1586 |
| 1587 | 1587 |
| 1588 // JSReceiver includes types on which properties can be defined, i.e., | 1588 // JSReceiver includes types on which properties can be defined, i.e., |
| 1589 // JSObject and JSProxy. | 1589 // JSObject and JSProxy. |
| 1590 class JSReceiver: public HeapObject { | 1590 class JSReceiver: public HeapObject { |
| 1591 public: | 1591 public: |
| 1592 DECLARE_CAST(JSReceiver) | 1592 DECLARE_CAST(JSReceiver) |
| 1593 | 1593 |
| 1594 MUST_USE_RESULT static MaybeHandle<Object> SetElement( | 1594 MUST_USE_RESULT static MaybeHandle<Object> SetElement( |
| 1595 Handle<JSReceiver> object, | 1595 Handle<JSReceiver> object, uint32_t index, Handle<Object> value, |
| 1596 uint32_t index, | 1596 PropertyAttributes attributes, LanguageMode language_mode); |
| 1597 Handle<Object> value, | |
| 1598 PropertyAttributes attributes, | |
| 1599 StrictMode strict_mode); | |
| 1600 | 1597 |
| 1601 // Implementation of [[HasProperty]], ECMA-262 5th edition, section 8.12.6. | 1598 // Implementation of [[HasProperty]], ECMA-262 5th edition, section 8.12.6. |
| 1602 MUST_USE_RESULT static inline Maybe<bool> HasProperty( | 1599 MUST_USE_RESULT static inline Maybe<bool> HasProperty( |
| 1603 Handle<JSReceiver> object, Handle<Name> name); | 1600 Handle<JSReceiver> object, Handle<Name> name); |
| 1604 MUST_USE_RESULT static inline Maybe<bool> HasOwnProperty(Handle<JSReceiver>, | 1601 MUST_USE_RESULT static inline Maybe<bool> HasOwnProperty(Handle<JSReceiver>, |
| 1605 Handle<Name> name); | 1602 Handle<Name> name); |
| 1606 MUST_USE_RESULT static inline Maybe<bool> HasElement( | 1603 MUST_USE_RESULT static inline Maybe<bool> HasElement( |
| 1607 Handle<JSReceiver> object, uint32_t index); | 1604 Handle<JSReceiver> object, uint32_t index); |
| 1608 MUST_USE_RESULT static inline Maybe<bool> HasOwnElement( | 1605 MUST_USE_RESULT static inline Maybe<bool> HasOwnElement( |
| 1609 Handle<JSReceiver> object, uint32_t index); | 1606 Handle<JSReceiver> object, uint32_t index); |
| 1610 | 1607 |
| 1611 // Implementation of [[Delete]], ECMA-262 5th edition, section 8.12.7. | 1608 // Implementation of [[Delete]], ECMA-262 5th edition, section 8.12.7. |
| 1612 MUST_USE_RESULT static MaybeHandle<Object> DeleteProperty( | 1609 MUST_USE_RESULT static MaybeHandle<Object> DeleteProperty( |
| 1613 Handle<JSReceiver> object, Handle<Name> name, | 1610 Handle<JSReceiver> object, Handle<Name> name, |
| 1614 StrictMode strict_mode = SLOPPY); | 1611 LanguageMode language_mode = SLOPPY); |
| 1615 MUST_USE_RESULT static MaybeHandle<Object> DeleteElement( | 1612 MUST_USE_RESULT static MaybeHandle<Object> DeleteElement( |
| 1616 Handle<JSReceiver> object, uint32_t index, | 1613 Handle<JSReceiver> object, uint32_t index, |
| 1617 StrictMode strict_mode = SLOPPY); | 1614 LanguageMode language_mode = SLOPPY); |
| 1618 | 1615 |
| 1619 // Tests for the fast common case for property enumeration. | 1616 // Tests for the fast common case for property enumeration. |
| 1620 bool IsSimpleEnum(); | 1617 bool IsSimpleEnum(); |
| 1621 | 1618 |
| 1622 // Returns the class name ([[Class]] property in the specification). | 1619 // Returns the class name ([[Class]] property in the specification). |
| 1623 String* class_name(); | 1620 String* class_name(); |
| 1624 | 1621 |
| 1625 // Returns the constructor name (the name (possibly, inferred name) of the | 1622 // Returns the constructor name (the name (possibly, inferred name) of the |
| 1626 // function that was used to instantiate the object). | 1623 // function that was used to instantiate the object). |
| 1627 String* constructor_name(); | 1624 String* constructor_name(); |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1925 static int NewElementsCapacity(int old_capacity) { | 1922 static int NewElementsCapacity(int old_capacity) { |
| 1926 // (old_capacity + 50%) + 16 | 1923 // (old_capacity + 50%) + 16 |
| 1927 return old_capacity + (old_capacity >> 1) + 16; | 1924 return old_capacity + (old_capacity >> 1) + 16; |
| 1928 } | 1925 } |
| 1929 | 1926 |
| 1930 // These methods do not perform access checks! | 1927 // These methods do not perform access checks! |
| 1931 MUST_USE_RESULT static MaybeHandle<AccessorPair> GetOwnElementAccessorPair( | 1928 MUST_USE_RESULT static MaybeHandle<AccessorPair> GetOwnElementAccessorPair( |
| 1932 Handle<JSObject> object, uint32_t index); | 1929 Handle<JSObject> object, uint32_t index); |
| 1933 | 1930 |
| 1934 MUST_USE_RESULT static MaybeHandle<Object> SetFastElement( | 1931 MUST_USE_RESULT static MaybeHandle<Object> SetFastElement( |
| 1935 Handle<JSObject> object, | 1932 Handle<JSObject> object, uint32_t index, Handle<Object> value, |
| 1936 uint32_t index, | 1933 LanguageMode language_mode, bool check_prototype); |
| 1937 Handle<Object> value, | |
| 1938 StrictMode strict_mode, | |
| 1939 bool check_prototype); | |
| 1940 | 1934 |
| 1941 MUST_USE_RESULT static MaybeHandle<Object> SetOwnElement( | 1935 MUST_USE_RESULT static MaybeHandle<Object> SetOwnElement( |
| 1942 Handle<JSObject> object, | 1936 Handle<JSObject> object, uint32_t index, Handle<Object> value, |
| 1943 uint32_t index, | 1937 LanguageMode language_mode); |
| 1944 Handle<Object> value, | |
| 1945 StrictMode strict_mode); | |
| 1946 | 1938 |
| 1947 // Empty handle is returned if the element cannot be set to the given value. | 1939 // Empty handle is returned if the element cannot be set to the given value. |
| 1948 MUST_USE_RESULT static MaybeHandle<Object> SetElement( | 1940 MUST_USE_RESULT static MaybeHandle<Object> SetElement( |
| 1949 Handle<JSObject> object, | 1941 Handle<JSObject> object, uint32_t index, Handle<Object> value, |
| 1950 uint32_t index, | 1942 PropertyAttributes attributes, LanguageMode language_mode, |
| 1951 Handle<Object> value, | 1943 bool check_prototype = true, SetPropertyMode set_mode = SET_PROPERTY); |
| 1952 PropertyAttributes attributes, | |
| 1953 StrictMode strict_mode, | |
| 1954 bool check_prototype = true, | |
| 1955 SetPropertyMode set_mode = SET_PROPERTY); | |
| 1956 | 1944 |
| 1957 // Returns the index'th element. | 1945 // Returns the index'th element. |
| 1958 // The undefined object if index is out of bounds. | 1946 // The undefined object if index is out of bounds. |
| 1959 MUST_USE_RESULT static MaybeHandle<Object> GetElementWithInterceptor( | 1947 MUST_USE_RESULT static MaybeHandle<Object> GetElementWithInterceptor( |
| 1960 Handle<JSObject> object, | 1948 Handle<JSObject> object, |
| 1961 Handle<Object> receiver, | 1949 Handle<Object> receiver, |
| 1962 uint32_t index); | 1950 uint32_t index); |
| 1963 | 1951 |
| 1964 enum SetFastElementsCapacitySmiMode { | 1952 enum SetFastElementsCapacitySmiMode { |
| 1965 kAllowSmiElements, | 1953 kAllowSmiElements, |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2277 Handle<Object> receiver, | 2265 Handle<Object> receiver, |
| 2278 uint32_t index); | 2266 uint32_t index); |
| 2279 | 2267 |
| 2280 MUST_USE_RESULT static Maybe<PropertyAttributes> | 2268 MUST_USE_RESULT static Maybe<PropertyAttributes> |
| 2281 GetElementAttributeWithoutInterceptor(Handle<JSObject> object, | 2269 GetElementAttributeWithoutInterceptor(Handle<JSObject> object, |
| 2282 Handle<JSReceiver> receiver, | 2270 Handle<JSReceiver> receiver, |
| 2283 uint32_t index, | 2271 uint32_t index, |
| 2284 bool continue_search); | 2272 bool continue_search); |
| 2285 MUST_USE_RESULT static MaybeHandle<Object> SetElementWithCallback( | 2273 MUST_USE_RESULT static MaybeHandle<Object> SetElementWithCallback( |
| 2286 Handle<Object> object, Handle<Object> structure, uint32_t index, | 2274 Handle<Object> object, Handle<Object> structure, uint32_t index, |
| 2287 Handle<Object> value, Handle<JSObject> holder, StrictMode strict_mode); | 2275 Handle<Object> value, Handle<JSObject> holder, |
| 2276 LanguageMode language_mode); |
| 2288 MUST_USE_RESULT static MaybeHandle<Object> SetElementWithInterceptor( | 2277 MUST_USE_RESULT static MaybeHandle<Object> SetElementWithInterceptor( |
| 2289 Handle<JSObject> object, | 2278 Handle<JSObject> object, uint32_t index, Handle<Object> value, |
| 2290 uint32_t index, | 2279 PropertyAttributes attributes, LanguageMode language_mode, |
| 2291 Handle<Object> value, | 2280 bool check_prototype, SetPropertyMode set_mode); |
| 2292 PropertyAttributes attributes, | |
| 2293 StrictMode strict_mode, | |
| 2294 bool check_prototype, | |
| 2295 SetPropertyMode set_mode); | |
| 2296 MUST_USE_RESULT static MaybeHandle<Object> SetElementWithoutInterceptor( | 2281 MUST_USE_RESULT static MaybeHandle<Object> SetElementWithoutInterceptor( |
| 2297 Handle<JSObject> object, | 2282 Handle<JSObject> object, uint32_t index, Handle<Object> value, |
| 2298 uint32_t index, | 2283 PropertyAttributes attributes, LanguageMode language_mode, |
| 2299 Handle<Object> value, | 2284 bool check_prototype, SetPropertyMode set_mode); |
| 2300 PropertyAttributes attributes, | |
| 2301 StrictMode strict_mode, | |
| 2302 bool check_prototype, | |
| 2303 SetPropertyMode set_mode); | |
| 2304 MUST_USE_RESULT | 2285 MUST_USE_RESULT |
| 2305 static MaybeHandle<Object> SetElementWithCallbackSetterInPrototypes( | 2286 static MaybeHandle<Object> SetElementWithCallbackSetterInPrototypes( |
| 2306 Handle<JSObject> object, | 2287 Handle<JSObject> object, uint32_t index, Handle<Object> value, |
| 2307 uint32_t index, | 2288 bool* found, LanguageMode language_mode); |
| 2308 Handle<Object> value, | |
| 2309 bool* found, | |
| 2310 StrictMode strict_mode); | |
| 2311 MUST_USE_RESULT static MaybeHandle<Object> SetDictionaryElement( | 2289 MUST_USE_RESULT static MaybeHandle<Object> SetDictionaryElement( |
| 2312 Handle<JSObject> object, | 2290 Handle<JSObject> object, uint32_t index, Handle<Object> value, |
| 2313 uint32_t index, | 2291 PropertyAttributes attributes, LanguageMode language_mode, |
| 2314 Handle<Object> value, | 2292 bool check_prototype, SetPropertyMode set_mode = SET_PROPERTY); |
| 2315 PropertyAttributes attributes, | |
| 2316 StrictMode strict_mode, | |
| 2317 bool check_prototype, | |
| 2318 SetPropertyMode set_mode = SET_PROPERTY); | |
| 2319 MUST_USE_RESULT static MaybeHandle<Object> SetFastDoubleElement( | 2293 MUST_USE_RESULT static MaybeHandle<Object> SetFastDoubleElement( |
| 2320 Handle<JSObject> object, | 2294 Handle<JSObject> object, uint32_t index, Handle<Object> value, |
| 2321 uint32_t index, | 2295 LanguageMode language_mode, bool check_prototype = true); |
| 2322 Handle<Object> value, | |
| 2323 StrictMode strict_mode, | |
| 2324 bool check_prototype = true); | |
| 2325 | 2296 |
| 2326 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithFailedAccessCheck( | 2297 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithFailedAccessCheck( |
| 2327 LookupIterator* it, Handle<Object> value, StrictMode strict_mode); | 2298 LookupIterator* it, Handle<Object> value, LanguageMode language_mode); |
| 2328 | 2299 |
| 2329 // Add a property to a slow-case object. | 2300 // Add a property to a slow-case object. |
| 2330 static void AddSlowProperty(Handle<JSObject> object, | 2301 static void AddSlowProperty(Handle<JSObject> object, |
| 2331 Handle<Name> name, | 2302 Handle<Name> name, |
| 2332 Handle<Object> value, | 2303 Handle<Object> value, |
| 2333 PropertyAttributes attributes); | 2304 PropertyAttributes attributes); |
| 2334 | 2305 |
| 2335 MUST_USE_RESULT static MaybeHandle<Object> DeleteProperty( | 2306 MUST_USE_RESULT static MaybeHandle<Object> DeleteProperty( |
| 2336 Handle<JSObject> object, Handle<Name> name, StrictMode strict_mode); | 2307 Handle<JSObject> object, Handle<Name> name, LanguageMode language_mode); |
| 2337 MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithInterceptor( | 2308 MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithInterceptor( |
| 2338 Handle<JSObject> holder, Handle<JSObject> receiver, Handle<Name> name); | 2309 Handle<JSObject> holder, Handle<JSObject> receiver, Handle<Name> name); |
| 2339 | 2310 |
| 2340 // Deletes an existing named property in a normalized object. | 2311 // Deletes an existing named property in a normalized object. |
| 2341 static void DeleteNormalizedProperty(Handle<JSObject> object, | 2312 static void DeleteNormalizedProperty(Handle<JSObject> object, |
| 2342 Handle<Name> name); | 2313 Handle<Name> name); |
| 2343 | 2314 |
| 2344 MUST_USE_RESULT static MaybeHandle<Object> DeleteElement( | 2315 MUST_USE_RESULT static MaybeHandle<Object> DeleteElement( |
| 2345 Handle<JSObject> object, uint32_t index, StrictMode strict_mode); | 2316 Handle<JSObject> object, uint32_t index, LanguageMode language_mode); |
| 2346 MUST_USE_RESULT static MaybeHandle<Object> DeleteElementWithInterceptor( | 2317 MUST_USE_RESULT static MaybeHandle<Object> DeleteElementWithInterceptor( |
| 2347 Handle<JSObject> object, | 2318 Handle<JSObject> object, |
| 2348 uint32_t index); | 2319 uint32_t index); |
| 2349 | 2320 |
| 2350 bool ReferencesObjectFromElements(FixedArray* elements, | 2321 bool ReferencesObjectFromElements(FixedArray* elements, |
| 2351 ElementsKind kind, | 2322 ElementsKind kind, |
| 2352 Object* object); | 2323 Object* object); |
| 2353 | 2324 |
| 2354 // Returns true if most of the elements backing storage is used. | 2325 // Returns true if most of the elements backing storage is used. |
| 2355 bool HasDenseElements(); | 2326 bool HasDenseElements(); |
| (...skipping 1796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4152 class ScopeInfo : public FixedArray { | 4123 class ScopeInfo : public FixedArray { |
| 4153 public: | 4124 public: |
| 4154 DECLARE_CAST(ScopeInfo) | 4125 DECLARE_CAST(ScopeInfo) |
| 4155 | 4126 |
| 4156 // Return the type of this scope. | 4127 // Return the type of this scope. |
| 4157 ScopeType scope_type(); | 4128 ScopeType scope_type(); |
| 4158 | 4129 |
| 4159 // Does this scope call eval? | 4130 // Does this scope call eval? |
| 4160 bool CallsEval(); | 4131 bool CallsEval(); |
| 4161 | 4132 |
| 4162 // Return the strict mode of this scope. | 4133 // Return the language mode of this scope. |
| 4163 StrictMode strict_mode(); | 4134 LanguageMode language_mode(); |
| 4164 | 4135 |
| 4165 // Does this scope make a sloppy eval call? | 4136 // Does this scope make a sloppy eval call? |
| 4166 bool CallsSloppyEval() { return CallsEval() && strict_mode() == SLOPPY; } | 4137 bool CallsSloppyEval() { return CallsEval() && is_sloppy(language_mode()); } |
| 4167 | 4138 |
| 4168 // Return the total number of locals allocated on the stack and in the | 4139 // Return the total number of locals allocated on the stack and in the |
| 4169 // context. This includes the parameters that are allocated in the context. | 4140 // context. This includes the parameters that are allocated in the context. |
| 4170 int LocalCount(); | 4141 int LocalCount(); |
| 4171 | 4142 |
| 4172 // Return the number of stack slots for code. This number consists of two | 4143 // Return the number of stack slots for code. This number consists of two |
| 4173 // parts: | 4144 // parts: |
| 4174 // 1. One stack slot per stack allocated local. | 4145 // 1. One stack slot per stack allocated local. |
| 4175 // 2. One stack slot for the function name if it is stack allocated. | 4146 // 2. One stack slot for the function name if it is stack allocated. |
| 4176 int StackSlotCount(); | 4147 int StackSlotCount(); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4343 enum FunctionVariableInfo { | 4314 enum FunctionVariableInfo { |
| 4344 NONE, // No function name present. | 4315 NONE, // No function name present. |
| 4345 STACK, // Function | 4316 STACK, // Function |
| 4346 CONTEXT, | 4317 CONTEXT, |
| 4347 UNUSED | 4318 UNUSED |
| 4348 }; | 4319 }; |
| 4349 | 4320 |
| 4350 // Properties of scopes. | 4321 // Properties of scopes. |
| 4351 class ScopeTypeField : public BitField<ScopeType, 0, 4> {}; | 4322 class ScopeTypeField : public BitField<ScopeType, 0, 4> {}; |
| 4352 class CallsEvalField : public BitField<bool, 4, 1> {}; | 4323 class CallsEvalField : public BitField<bool, 4, 1> {}; |
| 4353 class StrictModeField : public BitField<StrictMode, 5, 1> {}; | 4324 STATIC_ASSERT(LANGUAGE_END == 2); |
| 4325 class LanguageModeField : public BitField<LanguageMode, 5, 1> {}; |
| 4354 class FunctionVariableField : public BitField<FunctionVariableInfo, 6, 2> {}; | 4326 class FunctionVariableField : public BitField<FunctionVariableInfo, 6, 2> {}; |
| 4355 class FunctionVariableMode : public BitField<VariableMode, 8, 3> {}; | 4327 class FunctionVariableMode : public BitField<VariableMode, 8, 3> {}; |
| 4356 class AsmModuleField : public BitField<bool, 11, 1> {}; | 4328 class AsmModuleField : public BitField<bool, 11, 1> {}; |
| 4357 class AsmFunctionField : public BitField<bool, 12, 1> {}; | 4329 class AsmFunctionField : public BitField<bool, 12, 1> {}; |
| 4358 | 4330 |
| 4359 // BitFields representing the encoded information for context locals in the | 4331 // BitFields representing the encoded information for context locals in the |
| 4360 // ContextLocalInfoEntries part. | 4332 // ContextLocalInfoEntries part. |
| 4361 class ContextLocalMode: public BitField<VariableMode, 0, 3> {}; | 4333 class ContextLocalMode: public BitField<VariableMode, 0, 3> {}; |
| 4362 class ContextLocalInitFlag: public BitField<InitializationFlag, 3, 1> {}; | 4334 class ContextLocalInitFlag: public BitField<InitializationFlag, 3, 1> {}; |
| 4363 class ContextLocalMaybeAssignedFlag | 4335 class ContextLocalMaybeAssignedFlag |
| (...skipping 2539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6903 // iteration by the debugger). | 6875 // iteration by the debugger). |
| 6904 DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation_without_context) | 6876 DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation_without_context) |
| 6905 | 6877 |
| 6906 // Indicates whether optimizations have been disabled for this | 6878 // Indicates whether optimizations have been disabled for this |
| 6907 // shared function info. If a function is repeatedly optimized or if | 6879 // shared function info. If a function is repeatedly optimized or if |
| 6908 // we cannot optimize the function we disable optimization to avoid | 6880 // we cannot optimize the function we disable optimization to avoid |
| 6909 // spending time attempting to optimize it again. | 6881 // spending time attempting to optimize it again. |
| 6910 DECL_BOOLEAN_ACCESSORS(optimization_disabled) | 6882 DECL_BOOLEAN_ACCESSORS(optimization_disabled) |
| 6911 | 6883 |
| 6912 // Indicates the language mode. | 6884 // Indicates the language mode. |
| 6913 inline StrictMode strict_mode(); | 6885 inline LanguageMode language_mode(); |
| 6914 inline void set_strict_mode(StrictMode strict_mode); | 6886 inline void set_language_mode(LanguageMode language_mode); |
| 6915 | 6887 |
| 6916 // False if the function definitely does not allocate an arguments object. | 6888 // False if the function definitely does not allocate an arguments object. |
| 6917 DECL_BOOLEAN_ACCESSORS(uses_arguments) | 6889 DECL_BOOLEAN_ACCESSORS(uses_arguments) |
| 6918 | 6890 |
| 6919 // Indicates that this function uses a super property. | 6891 // Indicates that this function uses a super property. |
| 6920 // This is needed to set up the [[HomeObject]] on the function instance. | 6892 // This is needed to set up the [[HomeObject]] on the function instance. |
| 6921 DECL_BOOLEAN_ACCESSORS(uses_super_property) | 6893 DECL_BOOLEAN_ACCESSORS(uses_super_property) |
| 6922 | 6894 |
| 6923 // Indicates that this function uses the super constructor. | 6895 // Indicates that this function uses the super constructor. |
| 6924 DECL_BOOLEAN_ACCESSORS(uses_super_constructor_call) | 6896 DECL_BOOLEAN_ACCESSORS(uses_super_constructor_call) |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7215 kDontFlush, | 7187 kDontFlush, |
| 7216 kIsArrow, | 7188 kIsArrow, |
| 7217 kIsGenerator, | 7189 kIsGenerator, |
| 7218 kIsConciseMethod, | 7190 kIsConciseMethod, |
| 7219 kIsDefaultConstructor, | 7191 kIsDefaultConstructor, |
| 7220 kIsSubclassConstructor, | 7192 kIsSubclassConstructor, |
| 7221 kIsAsmFunction, | 7193 kIsAsmFunction, |
| 7222 kDeserialized, | 7194 kDeserialized, |
| 7223 kCompilerHintsCount // Pseudo entry | 7195 kCompilerHintsCount // Pseudo entry |
| 7224 }; | 7196 }; |
| 7197 // Add hints for other modes when they're added. |
| 7198 STATIC_ASSERT(LANGUAGE_END == 2); |
| 7225 | 7199 |
| 7226 class FunctionKindBits : public BitField<FunctionKind, kIsArrow, 5> {}; | 7200 class FunctionKindBits : public BitField<FunctionKind, kIsArrow, 5> {}; |
| 7227 | 7201 |
| 7228 class DeoptCountBits : public BitField<int, 0, 4> {}; | 7202 class DeoptCountBits : public BitField<int, 0, 4> {}; |
| 7229 class OptReenableTriesBits : public BitField<int, 4, 18> {}; | 7203 class OptReenableTriesBits : public BitField<int, 4, 18> {}; |
| 7230 class ICAgeBits : public BitField<int, 22, 8> {}; | 7204 class ICAgeBits : public BitField<int, 22, 8> {}; |
| 7231 | 7205 |
| 7232 class OptCountBits : public BitField<int, 0, 22> {}; | 7206 class OptCountBits : public BitField<int, 0, 22> {}; |
| 7233 class DisabledOptimizationReasonBits : public BitField<int, 22, 8> {}; | 7207 class DisabledOptimizationReasonBits : public BitField<int, 22, 8> {}; |
| 7234 | 7208 |
| (...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8074 // recompilation stub, or to "old" code. This avoids memory leaks due to | 8048 // recompilation stub, or to "old" code. This avoids memory leaks due to |
| 8075 // premature caching of scripts and eval strings that are never needed later. | 8049 // premature caching of scripts and eval strings that are never needed later. |
| 8076 class CompilationCacheTable: public HashTable<CompilationCacheTable, | 8050 class CompilationCacheTable: public HashTable<CompilationCacheTable, |
| 8077 CompilationCacheShape, | 8051 CompilationCacheShape, |
| 8078 HashTableKey*> { | 8052 HashTableKey*> { |
| 8079 public: | 8053 public: |
| 8080 // Find cached value for a string key, otherwise return null. | 8054 // Find cached value for a string key, otherwise return null. |
| 8081 Handle<Object> Lookup(Handle<String> src, Handle<Context> context); | 8055 Handle<Object> Lookup(Handle<String> src, Handle<Context> context); |
| 8082 Handle<Object> LookupEval(Handle<String> src, | 8056 Handle<Object> LookupEval(Handle<String> src, |
| 8083 Handle<SharedFunctionInfo> shared, | 8057 Handle<SharedFunctionInfo> shared, |
| 8084 StrictMode strict_mode, int scope_position); | 8058 LanguageMode language_mode, int scope_position); |
| 8085 Handle<Object> LookupRegExp(Handle<String> source, JSRegExp::Flags flags); | 8059 Handle<Object> LookupRegExp(Handle<String> source, JSRegExp::Flags flags); |
| 8086 static Handle<CompilationCacheTable> Put( | 8060 static Handle<CompilationCacheTable> Put( |
| 8087 Handle<CompilationCacheTable> cache, Handle<String> src, | 8061 Handle<CompilationCacheTable> cache, Handle<String> src, |
| 8088 Handle<Context> context, Handle<Object> value); | 8062 Handle<Context> context, Handle<Object> value); |
| 8089 static Handle<CompilationCacheTable> PutEval( | 8063 static Handle<CompilationCacheTable> PutEval( |
| 8090 Handle<CompilationCacheTable> cache, Handle<String> src, | 8064 Handle<CompilationCacheTable> cache, Handle<String> src, |
| 8091 Handle<SharedFunctionInfo> context, Handle<SharedFunctionInfo> value, | 8065 Handle<SharedFunctionInfo> context, Handle<SharedFunctionInfo> value, |
| 8092 int scope_position); | 8066 int scope_position); |
| 8093 static Handle<CompilationCacheTable> PutRegExp( | 8067 static Handle<CompilationCacheTable> PutRegExp( |
| 8094 Handle<CompilationCacheTable> cache, Handle<String> src, | 8068 Handle<CompilationCacheTable> cache, Handle<String> src, |
| (...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9813 Handle<Object> receiver, | 9787 Handle<Object> receiver, |
| 9814 uint32_t index); | 9788 uint32_t index); |
| 9815 | 9789 |
| 9816 // If the handler defines an accessor property with a setter, invoke it. | 9790 // If the handler defines an accessor property with a setter, invoke it. |
| 9817 // If it defines an accessor property without a setter, or a data property | 9791 // If it defines an accessor property without a setter, or a data property |
| 9818 // that is read-only, throw. In all these cases set '*done' to true, | 9792 // that is read-only, throw. In all these cases set '*done' to true, |
| 9819 // otherwise set it to false. | 9793 // otherwise set it to false. |
| 9820 MUST_USE_RESULT | 9794 MUST_USE_RESULT |
| 9821 static MaybeHandle<Object> SetPropertyViaPrototypesWithHandler( | 9795 static MaybeHandle<Object> SetPropertyViaPrototypesWithHandler( |
| 9822 Handle<JSProxy> proxy, Handle<Object> receiver, Handle<Name> name, | 9796 Handle<JSProxy> proxy, Handle<Object> receiver, Handle<Name> name, |
| 9823 Handle<Object> value, StrictMode strict_mode, bool* done); | 9797 Handle<Object> value, LanguageMode language_mode, bool* done); |
| 9824 | 9798 |
| 9825 MUST_USE_RESULT static Maybe<PropertyAttributes> | 9799 MUST_USE_RESULT static Maybe<PropertyAttributes> |
| 9826 GetPropertyAttributesWithHandler(Handle<JSProxy> proxy, | 9800 GetPropertyAttributesWithHandler(Handle<JSProxy> proxy, |
| 9827 Handle<Object> receiver, | 9801 Handle<Object> receiver, |
| 9828 Handle<Name> name); | 9802 Handle<Name> name); |
| 9829 MUST_USE_RESULT static Maybe<PropertyAttributes> | 9803 MUST_USE_RESULT static Maybe<PropertyAttributes> |
| 9830 GetElementAttributeWithHandler(Handle<JSProxy> proxy, | 9804 GetElementAttributeWithHandler(Handle<JSProxy> proxy, |
| 9831 Handle<JSReceiver> receiver, | 9805 Handle<JSReceiver> receiver, |
| 9832 uint32_t index); | 9806 uint32_t index); |
| 9833 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithHandler( | 9807 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithHandler( |
| 9834 Handle<JSProxy> proxy, Handle<Object> receiver, Handle<Name> name, | 9808 Handle<JSProxy> proxy, Handle<Object> receiver, Handle<Name> name, |
| 9835 Handle<Object> value, StrictMode strict_mode); | 9809 Handle<Object> value, LanguageMode language_mode); |
| 9836 | 9810 |
| 9837 // Turn the proxy into an (empty) JSObject. | 9811 // Turn the proxy into an (empty) JSObject. |
| 9838 static void Fix(Handle<JSProxy> proxy); | 9812 static void Fix(Handle<JSProxy> proxy); |
| 9839 | 9813 |
| 9840 // Initializes the body after the handler slot. | 9814 // Initializes the body after the handler slot. |
| 9841 inline void InitializeBody(int object_size, Object* value); | 9815 inline void InitializeBody(int object_size, Object* value); |
| 9842 | 9816 |
| 9843 // Invoke a trap by name. If the trap does not exist on this's handler, | 9817 // Invoke a trap by name. If the trap does not exist on this's handler, |
| 9844 // but derived_trap is non-NULL, invoke that instead. May cause GC. | 9818 // but derived_trap is non-NULL, invoke that instead. May cause GC. |
| 9845 MUST_USE_RESULT static MaybeHandle<Object> CallTrap( | 9819 MUST_USE_RESULT static MaybeHandle<Object> CallTrap( |
| (...skipping 20 matching lines...) Expand all Loading... |
| 9866 STATIC_ASSERT(kPaddingSize >= 0); | 9840 STATIC_ASSERT(kPaddingSize >= 0); |
| 9867 | 9841 |
| 9868 typedef FixedBodyDescriptor<kHandlerOffset, | 9842 typedef FixedBodyDescriptor<kHandlerOffset, |
| 9869 kPaddingOffset, | 9843 kPaddingOffset, |
| 9870 kSize> BodyDescriptor; | 9844 kSize> BodyDescriptor; |
| 9871 | 9845 |
| 9872 private: | 9846 private: |
| 9873 friend class JSReceiver; | 9847 friend class JSReceiver; |
| 9874 | 9848 |
| 9875 MUST_USE_RESULT static inline MaybeHandle<Object> SetElementWithHandler( | 9849 MUST_USE_RESULT static inline MaybeHandle<Object> SetElementWithHandler( |
| 9876 Handle<JSProxy> proxy, | 9850 Handle<JSProxy> proxy, Handle<JSReceiver> receiver, uint32_t index, |
| 9877 Handle<JSReceiver> receiver, | 9851 Handle<Object> value, LanguageMode language_mode); |
| 9878 uint32_t index, | |
| 9879 Handle<Object> value, | |
| 9880 StrictMode strict_mode); | |
| 9881 | 9852 |
| 9882 MUST_USE_RESULT static Maybe<bool> HasPropertyWithHandler( | 9853 MUST_USE_RESULT static Maybe<bool> HasPropertyWithHandler( |
| 9883 Handle<JSProxy> proxy, Handle<Name> name); | 9854 Handle<JSProxy> proxy, Handle<Name> name); |
| 9884 MUST_USE_RESULT static inline Maybe<bool> HasElementWithHandler( | 9855 MUST_USE_RESULT static inline Maybe<bool> HasElementWithHandler( |
| 9885 Handle<JSProxy> proxy, uint32_t index); | 9856 Handle<JSProxy> proxy, uint32_t index); |
| 9886 | 9857 |
| 9887 MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithHandler( | 9858 MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithHandler( |
| 9888 Handle<JSProxy> proxy, Handle<Name> name, StrictMode strict_mode); | 9859 Handle<JSProxy> proxy, Handle<Name> name, LanguageMode language_mode); |
| 9889 MUST_USE_RESULT static MaybeHandle<Object> DeleteElementWithHandler( | 9860 MUST_USE_RESULT static MaybeHandle<Object> DeleteElementWithHandler( |
| 9890 Handle<JSProxy> proxy, uint32_t index, StrictMode strict_mode); | 9861 Handle<JSProxy> proxy, uint32_t index, LanguageMode language_mode); |
| 9891 | 9862 |
| 9892 MUST_USE_RESULT Object* GetIdentityHash(); | 9863 MUST_USE_RESULT Object* GetIdentityHash(); |
| 9893 | 9864 |
| 9894 static Handle<Smi> GetOrCreateIdentityHash(Handle<JSProxy> proxy); | 9865 static Handle<Smi> GetOrCreateIdentityHash(Handle<JSProxy> proxy); |
| 9895 | 9866 |
| 9896 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); | 9867 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); |
| 9897 }; | 9868 }; |
| 9898 | 9869 |
| 9899 | 9870 |
| 9900 class JSFunctionProxy: public JSProxy { | 9871 class JSFunctionProxy: public JSProxy { |
| (...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10978 } else { | 10949 } else { |
| 10979 value &= ~(1 << bit_position); | 10950 value &= ~(1 << bit_position); |
| 10980 } | 10951 } |
| 10981 return value; | 10952 return value; |
| 10982 } | 10953 } |
| 10983 }; | 10954 }; |
| 10984 | 10955 |
| 10985 } } // namespace v8::internal | 10956 } } // namespace v8::internal |
| 10986 | 10957 |
| 10987 #endif // V8_OBJECTS_H_ | 10958 #endif // V8_OBJECTS_H_ |
| OLD | NEW |