Chromium Code Reviews| 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 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1192 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( | 1192 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( |
| 1193 Isolate* isolate, | 1193 Isolate* isolate, |
| 1194 Handle<Object> object, | 1194 Handle<Object> object, |
| 1195 const char* key); | 1195 const char* key); |
| 1196 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( | 1196 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( |
| 1197 Handle<Object> object, Handle<Name> name); | 1197 Handle<Object> object, Handle<Name> name); |
| 1198 | 1198 |
| 1199 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithAccessor( | 1199 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithAccessor( |
| 1200 LookupIterator* it); | 1200 LookupIterator* it); |
| 1201 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithAccessor( | 1201 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithAccessor( |
| 1202 Handle<Object> receiver, Handle<Name> name, Handle<Object> value, | 1202 LookupIterator* it, Handle<Object> value, LanguageMode language_mode); |
| 1203 Handle<JSObject> holder, Handle<Object> structure, | |
| 1204 LanguageMode language_mode); | |
| 1205 | 1203 |
| 1206 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithDefinedGetter( | 1204 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithDefinedGetter( |
| 1207 Handle<Object> receiver, | 1205 Handle<Object> receiver, |
| 1208 Handle<JSReceiver> getter); | 1206 Handle<JSReceiver> getter); |
| 1209 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithDefinedSetter( | 1207 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithDefinedSetter( |
| 1210 Handle<Object> receiver, | 1208 Handle<Object> receiver, |
| 1211 Handle<JSReceiver> setter, | 1209 Handle<JSReceiver> setter, |
| 1212 Handle<Object> value); | 1210 Handle<Object> value); |
| 1213 | 1211 |
| 1214 MUST_USE_RESULT static inline MaybeHandle<Object> GetElement( | 1212 MUST_USE_RESULT static inline MaybeHandle<Object> GetElement( |
| 1215 Isolate* isolate, | 1213 Isolate* isolate, |
| 1216 Handle<Object> object, | 1214 Handle<Object> object, |
| 1217 uint32_t index); | 1215 uint32_t index); |
| 1218 | 1216 |
| 1219 MUST_USE_RESULT static MaybeHandle<Object> SetElementWithReceiver( | |
| 1220 Isolate* isolate, Handle<Object> object, Handle<Object> receiver, | |
| 1221 uint32_t index, Handle<Object> value, LanguageMode language_mode); | |
| 1222 | |
| 1223 static inline Handle<Object> GetPrototypeSkipHiddenPrototypes( | 1217 static inline Handle<Object> GetPrototypeSkipHiddenPrototypes( |
| 1224 Isolate* isolate, Handle<Object> receiver); | 1218 Isolate* isolate, Handle<Object> receiver); |
| 1225 | 1219 |
| 1226 // Returns the permanent hash code associated with this object. May return | 1220 // Returns the permanent hash code associated with this object. May return |
| 1227 // undefined if not yet created. | 1221 // undefined if not yet created. |
| 1228 Object* GetHash(); | 1222 Object* GetHash(); |
| 1229 | 1223 |
| 1230 // Returns undefined for JSObjects, but returns the hash code for simple | 1224 // Returns undefined for JSObjects, but returns the hash code for simple |
| 1231 // objects. This avoids a double lookup in the cases where we know we will | 1225 // objects. This avoids a double lookup in the cases where we know we will |
| 1232 // add the hash to the JSObject if it does not already exist. | 1226 // add the hash to the JSObject if it does not already exist. |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1646 DONT_ALLOW_DOUBLE_ELEMENTS, | 1640 DONT_ALLOW_DOUBLE_ELEMENTS, |
| 1647 ALLOW_COPIED_DOUBLE_ELEMENTS, | 1641 ALLOW_COPIED_DOUBLE_ELEMENTS, |
| 1648 ALLOW_CONVERTED_DOUBLE_ELEMENTS | 1642 ALLOW_CONVERTED_DOUBLE_ELEMENTS |
| 1649 }; | 1643 }; |
| 1650 | 1644 |
| 1651 | 1645 |
| 1652 // Indicates whether a property should be set or (re)defined. Setting of a | 1646 // Indicates whether a property should be set or (re)defined. Setting of a |
| 1653 // property causes attributes to remain unchanged, writability to be checked | 1647 // property causes attributes to remain unchanged, writability to be checked |
| 1654 // and callbacks to be called. Defining of a property causes attributes to | 1648 // and callbacks to be called. Defining of a property causes attributes to |
| 1655 // be updated and callbacks to be overridden. | 1649 // be updated and callbacks to be overridden. |
| 1656 enum SetPropertyMode { | 1650 enum SetPropertyMode { |
|
Igor Sheludko
2015/06/11 14:38:18
It looks like this enum is not used anymore.
| |
| 1657 SET_PROPERTY, | 1651 SET_PROPERTY, |
| 1658 DEFINE_PROPERTY | 1652 DEFINE_PROPERTY |
| 1659 }; | 1653 }; |
| 1660 | 1654 |
| 1661 | 1655 |
| 1662 // Indicator for one component of an AccessorPair. | 1656 // Indicator for one component of an AccessorPair. |
| 1663 enum AccessorComponent { | 1657 enum AccessorComponent { |
| 1664 ACCESSOR_GETTER, | 1658 ACCESSOR_GETTER, |
| 1665 ACCESSOR_SETTER | 1659 ACCESSOR_SETTER |
| 1666 }; | 1660 }; |
| 1667 | 1661 |
| 1668 | 1662 |
| 1669 // JSReceiver includes types on which properties can be defined, i.e., | 1663 // JSReceiver includes types on which properties can be defined, i.e., |
| 1670 // JSObject and JSProxy. | 1664 // JSObject and JSProxy. |
| 1671 class JSReceiver: public HeapObject { | 1665 class JSReceiver: public HeapObject { |
| 1672 public: | 1666 public: |
| 1673 DECLARE_CAST(JSReceiver) | 1667 DECLARE_CAST(JSReceiver) |
| 1674 | 1668 |
| 1675 MUST_USE_RESULT static MaybeHandle<Object> SetElement( | 1669 MUST_USE_RESULT static MaybeHandle<Object> SetElement( |
| 1676 Handle<JSReceiver> object, uint32_t index, Handle<Object> value, | 1670 Handle<JSReceiver> object, uint32_t index, Handle<Object> value, |
| 1677 PropertyAttributes attributes, LanguageMode language_mode); | 1671 LanguageMode language_mode); |
| 1678 | 1672 |
| 1679 // Implementation of [[HasProperty]], ECMA-262 5th edition, section 8.12.6. | 1673 // Implementation of [[HasProperty]], ECMA-262 5th edition, section 8.12.6. |
| 1680 MUST_USE_RESULT static inline Maybe<bool> HasProperty( | 1674 MUST_USE_RESULT static inline Maybe<bool> HasProperty( |
| 1681 Handle<JSReceiver> object, Handle<Name> name); | 1675 Handle<JSReceiver> object, Handle<Name> name); |
| 1682 MUST_USE_RESULT static inline Maybe<bool> HasOwnProperty(Handle<JSReceiver>, | 1676 MUST_USE_RESULT static inline Maybe<bool> HasOwnProperty(Handle<JSReceiver>, |
| 1683 Handle<Name> name); | 1677 Handle<Name> name); |
| 1684 MUST_USE_RESULT static inline Maybe<bool> HasElement( | 1678 MUST_USE_RESULT static inline Maybe<bool> HasElement( |
| 1685 Handle<JSReceiver> object, uint32_t index); | 1679 Handle<JSReceiver> object, uint32_t index); |
| 1686 MUST_USE_RESULT static inline Maybe<bool> HasOwnElement( | 1680 MUST_USE_RESULT static inline Maybe<bool> HasOwnElement( |
| 1687 Handle<JSReceiver> object, uint32_t index); | 1681 Handle<JSReceiver> object, uint32_t index); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1850 uint32_t limit); | 1844 uint32_t limit); |
| 1851 // As PrepareElementsForSort, but only on objects where elements is | 1845 // As PrepareElementsForSort, but only on objects where elements is |
| 1852 // a dictionary, and it will stay a dictionary. Collates undefined and | 1846 // a dictionary, and it will stay a dictionary. Collates undefined and |
| 1853 // unexisting elements below limit from position zero of the elements. | 1847 // unexisting elements below limit from position zero of the elements. |
| 1854 static Handle<Object> PrepareSlowElementsForSort(Handle<JSObject> object, | 1848 static Handle<Object> PrepareSlowElementsForSort(Handle<JSObject> object, |
| 1855 uint32_t limit); | 1849 uint32_t limit); |
| 1856 | 1850 |
| 1857 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithInterceptor( | 1851 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithInterceptor( |
| 1858 LookupIterator* it, Handle<Object> value); | 1852 LookupIterator* it, Handle<Object> value); |
| 1859 | 1853 |
| 1860 // SetLocalPropertyIgnoreAttributes converts callbacks to fields. We need to | |
| 1861 // grant an exemption to ExecutableAccessor callbacks in some cases. | |
| 1862 enum ExecutableAccessorInfoHandling { | |
| 1863 DEFAULT_HANDLING, | |
| 1864 DONT_FORCE_FIELD | |
| 1865 }; | |
| 1866 | |
| 1867 MUST_USE_RESULT static MaybeHandle<Object> SetOwnPropertyIgnoreAttributes( | 1854 MUST_USE_RESULT static MaybeHandle<Object> SetOwnPropertyIgnoreAttributes( |
| 1868 Handle<JSObject> object, Handle<Name> name, Handle<Object> value, | 1855 Handle<JSObject> object, Handle<Name> name, Handle<Object> value, |
| 1869 PropertyAttributes attributes, | 1856 PropertyAttributes attributes); |
| 1870 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING); | 1857 |
| 1858 MUST_USE_RESULT static MaybeHandle<Object> SetOwnElementIgnoreAttributes( | |
| 1859 Handle<JSObject> object, uint32_t index, Handle<Object> value, | |
| 1860 PropertyAttributes attributes); | |
| 1861 | |
| 1862 MUST_USE_RESULT static MaybeHandle<Object> ReconfigureAsDataProperty( | |
| 1863 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes); | |
| 1871 | 1864 |
| 1872 static void AddProperty(Handle<JSObject> object, Handle<Name> name, | 1865 static void AddProperty(Handle<JSObject> object, Handle<Name> name, |
| 1873 Handle<Object> value, PropertyAttributes attributes); | 1866 Handle<Object> value, PropertyAttributes attributes); |
| 1874 | 1867 |
| 1868 MUST_USE_RESULT static MaybeHandle<Object> AddDataElement( | |
| 1869 Handle<JSObject> receiver, uint32_t index, Handle<Object> value, | |
| 1870 PropertyAttributes attributes); | |
| 1871 | |
| 1875 // Extend the receiver with a single fast property appeared first in the | 1872 // Extend the receiver with a single fast property appeared first in the |
| 1876 // passed map. This also extends the property backing store if necessary. | 1873 // passed map. This also extends the property backing store if necessary. |
| 1877 static void AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map); | 1874 static void AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map); |
| 1878 | 1875 |
| 1879 // Migrates the given object to a map whose field representations are the | 1876 // Migrates the given object to a map whose field representations are the |
| 1880 // lowest upper bound of all known representations for that field. | 1877 // lowest upper bound of all known representations for that field. |
| 1881 static void MigrateInstance(Handle<JSObject> instance); | 1878 static void MigrateInstance(Handle<JSObject> instance); |
| 1882 | 1879 |
| 1883 // Migrates the given object only if the target map is already available, | 1880 // Migrates the given object only if the target map is already available, |
| 1884 // or returns false if such a map is not yet available. | 1881 // or returns false if such a map is not yet available. |
| 1885 static bool TryMigrateInstance(Handle<JSObject> instance); | 1882 static bool TryMigrateInstance(Handle<JSObject> instance); |
| 1886 | 1883 |
| 1887 // Sets the property value in a normalized object given (key, value, details). | 1884 // Sets the property value in a normalized object given (key, value, details). |
| 1888 // Handles the special representation of JS global objects. | 1885 // Handles the special representation of JS global objects. |
| 1889 static void SetNormalizedProperty(Handle<JSObject> object, Handle<Name> name, | 1886 static void SetNormalizedProperty(Handle<JSObject> object, Handle<Name> name, |
| 1890 Handle<Object> value, | 1887 Handle<Object> value, |
| 1891 PropertyDetails details); | 1888 PropertyDetails details); |
| 1889 static void SetDictionaryElement(Handle<JSObject> object, uint32_t index, | |
| 1890 Handle<Object> value, | |
| 1891 PropertyAttributes attributes); | |
| 1892 static void SetSloppyArgumentsElements(Handle<JSObject> object, | |
|
Igor Sheludko
2015/06/11 13:44:25
"SetSloppyArgumentsElement" to be consistent.
| |
| 1893 uint32_t index, Handle<Object> value, | |
| 1894 PropertyAttributes attributes); | |
| 1895 | |
| 1896 static void SetFastElement(Handle<JSObject> object, uint32_t index, | |
| 1897 Handle<Object> value); | |
| 1898 static void SetFastDoubleElement(Handle<JSObject> object, uint32_t index, | |
| 1899 Handle<Object> value); | |
| 1892 | 1900 |
| 1893 static void OptimizeAsPrototype(Handle<JSObject> object, | 1901 static void OptimizeAsPrototype(Handle<JSObject> object, |
| 1894 PrototypeOptimizationMode mode); | 1902 PrototypeOptimizationMode mode); |
| 1895 static void ReoptimizeIfPrototype(Handle<JSObject> object); | 1903 static void ReoptimizeIfPrototype(Handle<JSObject> object); |
| 1896 static void LazyRegisterPrototypeUser(Handle<Map> user, Isolate* isolate); | 1904 static void LazyRegisterPrototypeUser(Handle<Map> user, Isolate* isolate); |
| 1897 static bool RegisterPrototypeUserIfNotRegistered(Handle<JSObject> prototype, | 1905 static bool RegisterPrototypeUserIfNotRegistered(Handle<JSObject> prototype, |
| 1898 Handle<HeapObject> user, | 1906 Handle<HeapObject> user, |
| 1899 Isolate* isolate); | 1907 Isolate* isolate); |
| 1900 static bool UnregisterPrototypeUser(Handle<JSObject> prototype, | 1908 static bool UnregisterPrototypeUser(Handle<JSObject> prototype, |
| 1901 Handle<HeapObject> user); | 1909 Handle<HeapObject> user); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2004 // Computes the new capacity when expanding the elements of a JSObject. | 2012 // Computes the new capacity when expanding the elements of a JSObject. |
| 2005 static int NewElementsCapacity(int old_capacity) { | 2013 static int NewElementsCapacity(int old_capacity) { |
| 2006 // (old_capacity + 50%) + 16 | 2014 // (old_capacity + 50%) + 16 |
| 2007 return old_capacity + (old_capacity >> 1) + 16; | 2015 return old_capacity + (old_capacity >> 1) + 16; |
| 2008 } | 2016 } |
| 2009 | 2017 |
| 2010 // These methods do not perform access checks! | 2018 // These methods do not perform access checks! |
| 2011 MUST_USE_RESULT static MaybeHandle<AccessorPair> GetOwnElementAccessorPair( | 2019 MUST_USE_RESULT static MaybeHandle<AccessorPair> GetOwnElementAccessorPair( |
| 2012 Handle<JSObject> object, uint32_t index); | 2020 Handle<JSObject> object, uint32_t index); |
| 2013 | 2021 |
| 2014 MUST_USE_RESULT static MaybeHandle<Object> SetFastElement( | 2022 static void UpdateAllocationSite(Handle<JSObject> object, |
| 2015 Handle<JSObject> object, uint32_t index, Handle<Object> value, | 2023 ElementsKind to_kind); |
| 2016 LanguageMode language_mode, bool check_prototype); | |
| 2017 | |
| 2018 MUST_USE_RESULT static inline MaybeHandle<Object> SetOwnElement( | |
| 2019 Handle<JSObject> object, uint32_t index, Handle<Object> value, | |
| 2020 LanguageMode language_mode); | |
| 2021 | |
| 2022 MUST_USE_RESULT static MaybeHandle<Object> SetOwnElement( | |
| 2023 Handle<JSObject> object, uint32_t index, Handle<Object> value, | |
| 2024 PropertyAttributes attributes, LanguageMode language_mode); | |
| 2025 | |
| 2026 // Empty handle is returned if the element cannot be set to the given value. | |
| 2027 MUST_USE_RESULT static MaybeHandle<Object> SetElement( | |
| 2028 Handle<JSObject> object, uint32_t index, Handle<Object> value, | |
| 2029 PropertyAttributes attributes, LanguageMode language_mode, | |
| 2030 bool check_prototype = true, SetPropertyMode set_mode = SET_PROPERTY); | |
| 2031 | 2024 |
| 2032 enum SetFastElementsCapacitySmiMode { | 2025 enum SetFastElementsCapacitySmiMode { |
| 2033 kAllowSmiElements, | 2026 kAllowSmiElements, |
| 2034 kForceSmiElements, | 2027 kForceSmiElements, |
| 2035 kDontAllowSmiElements | 2028 kDontAllowSmiElements |
| 2036 }; | 2029 }; |
| 2037 | 2030 |
| 2038 static Handle<FixedArray> SetFastElementsCapacity( | 2031 static Handle<FixedArray> SetFastElementsCapacity( |
| 2039 Handle<JSObject> object, int capacity, | 2032 Handle<JSObject> object, int capacity, |
| 2040 SetFastElementsCapacitySmiMode smi_mode); | 2033 SetFastElementsCapacitySmiMode smi_mode); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2312 private: | 2305 private: |
| 2313 friend class DictionaryElementsAccessor; | 2306 friend class DictionaryElementsAccessor; |
| 2314 friend class JSReceiver; | 2307 friend class JSReceiver; |
| 2315 friend class Object; | 2308 friend class Object; |
| 2316 | 2309 |
| 2317 static void MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map); | 2310 static void MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map); |
| 2318 static void MigrateFastToSlow(Handle<JSObject> object, | 2311 static void MigrateFastToSlow(Handle<JSObject> object, |
| 2319 Handle<Map> new_map, | 2312 Handle<Map> new_map, |
| 2320 int expected_additional_properties); | 2313 int expected_additional_properties); |
| 2321 | 2314 |
| 2322 static void UpdateAllocationSite(Handle<JSObject> object, | |
| 2323 ElementsKind to_kind); | |
| 2324 | |
| 2325 // Used from Object::GetProperty(). | 2315 // Used from Object::GetProperty(). |
| 2326 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithFailedAccessCheck( | 2316 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithFailedAccessCheck( |
| 2327 LookupIterator* it); | 2317 LookupIterator* it); |
| 2328 | 2318 |
| 2329 MUST_USE_RESULT static MaybeHandle<Object> SetElementWithCallback( | |
| 2330 Handle<Object> object, Handle<Object> structure, uint32_t index, | |
| 2331 Handle<Object> value, Handle<JSObject> holder, | |
| 2332 LanguageMode language_mode); | |
| 2333 MUST_USE_RESULT static MaybeHandle<Object> SetElementWithInterceptor( | |
| 2334 Handle<JSObject> object, uint32_t index, Handle<Object> value, | |
| 2335 PropertyAttributes attributes, LanguageMode language_mode, | |
| 2336 bool check_prototype, SetPropertyMode set_mode); | |
| 2337 MUST_USE_RESULT static MaybeHandle<Object> SetElementWithoutInterceptor( | |
| 2338 Handle<JSObject> object, uint32_t index, Handle<Object> value, | |
| 2339 PropertyAttributes attributes, LanguageMode language_mode, | |
| 2340 bool check_prototype, SetPropertyMode set_mode); | |
| 2341 MUST_USE_RESULT | |
| 2342 static MaybeHandle<Object> SetElementWithCallbackSetterInPrototypes( | |
| 2343 Handle<JSObject> object, uint32_t index, Handle<Object> value, | |
| 2344 bool* found, LanguageMode language_mode); | |
| 2345 MUST_USE_RESULT static MaybeHandle<Object> SetDictionaryElement( | |
| 2346 Handle<JSObject> object, uint32_t index, Handle<Object> value, | |
| 2347 PropertyAttributes attributes, LanguageMode language_mode, | |
| 2348 bool check_prototype, SetPropertyMode set_mode = SET_PROPERTY); | |
| 2349 MUST_USE_RESULT static MaybeHandle<Object> SetFastDoubleElement( | |
| 2350 Handle<JSObject> object, uint32_t index, Handle<Object> value, | |
| 2351 LanguageMode language_mode, bool check_prototype = true); | |
| 2352 | |
| 2353 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithFailedAccessCheck( | 2319 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithFailedAccessCheck( |
| 2354 LookupIterator* it, Handle<Object> value, LanguageMode language_mode); | 2320 LookupIterator* it, Handle<Object> value, LanguageMode language_mode); |
| 2355 | 2321 |
| 2356 // Add a property to a slow-case object. | 2322 // Add a property to a slow-case object. |
| 2357 static void AddSlowProperty(Handle<JSObject> object, | 2323 static void AddSlowProperty(Handle<JSObject> object, |
| 2358 Handle<Name> name, | 2324 Handle<Name> name, |
| 2359 Handle<Object> value, | 2325 Handle<Object> value, |
| 2360 PropertyAttributes attributes); | 2326 PropertyAttributes attributes); |
| 2361 | 2327 |
| 2362 MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithInterceptor( | 2328 MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithInterceptor( |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2446 | 2412 |
| 2447 class FixedDoubleArray; | 2413 class FixedDoubleArray; |
| 2448 class IncrementalMarking; | 2414 class IncrementalMarking; |
| 2449 | 2415 |
| 2450 | 2416 |
| 2451 // FixedArray describes fixed-sized arrays with element type Object*. | 2417 // FixedArray describes fixed-sized arrays with element type Object*. |
| 2452 class FixedArray: public FixedArrayBase { | 2418 class FixedArray: public FixedArrayBase { |
| 2453 public: | 2419 public: |
| 2454 // Setter and getter for elements. | 2420 // Setter and getter for elements. |
| 2455 inline Object* get(int index) const; | 2421 inline Object* get(int index) const; |
| 2422 static Handle<Object> SetValue(Handle<JSObject> holder, | |
| 2423 Handle<FixedArray> array, uint32_t index, | |
| 2424 Handle<Object> value); | |
| 2456 static inline Handle<Object> get(Handle<FixedArray> array, int index); | 2425 static inline Handle<Object> get(Handle<FixedArray> array, int index); |
| 2457 // Setter that uses write barrier. | 2426 // Setter that uses write barrier. |
| 2458 inline void set(int index, Object* value); | 2427 inline void set(int index, Object* value); |
| 2459 inline bool is_the_hole(int index); | 2428 inline bool is_the_hole(int index); |
| 2460 | 2429 |
| 2461 // Setter that doesn't need write barrier. | 2430 // Setter that doesn't need write barrier. |
| 2462 inline void set(int index, Smi* value); | 2431 inline void set(int index, Smi* value); |
| 2463 // Setter with explicit barrier mode. | 2432 // Setter with explicit barrier mode. |
| 2464 inline void set(int index, Object* value, WriteBarrierMode mode); | 2433 inline void set(int index, Object* value, WriteBarrierMode mode); |
| 2465 | 2434 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2567 }; | 2536 }; |
| 2568 | 2537 |
| 2569 | 2538 |
| 2570 // FixedDoubleArray describes fixed-sized arrays with element type double. | 2539 // FixedDoubleArray describes fixed-sized arrays with element type double. |
| 2571 class FixedDoubleArray: public FixedArrayBase { | 2540 class FixedDoubleArray: public FixedArrayBase { |
| 2572 public: | 2541 public: |
| 2573 // Setter and getter for elements. | 2542 // Setter and getter for elements. |
| 2574 inline double get_scalar(int index); | 2543 inline double get_scalar(int index); |
| 2575 inline uint64_t get_representation(int index); | 2544 inline uint64_t get_representation(int index); |
| 2576 static inline Handle<Object> get(Handle<FixedDoubleArray> array, int index); | 2545 static inline Handle<Object> get(Handle<FixedDoubleArray> array, int index); |
| 2546 // This accessor has to get a Number as |value|. | |
| 2547 static Handle<Object> SetValue(Handle<JSObject> holder, | |
| 2548 Handle<FixedDoubleArray> array, uint32_t index, | |
| 2549 Handle<Object> value); | |
| 2577 inline void set(int index, double value); | 2550 inline void set(int index, double value); |
| 2578 inline void set_the_hole(int index); | 2551 inline void set_the_hole(int index); |
| 2579 | 2552 |
| 2580 // Checking for the hole. | 2553 // Checking for the hole. |
| 2581 inline bool is_the_hole(int index); | 2554 inline bool is_the_hole(int index); |
| 2582 | 2555 |
| 2583 // Garbage collection support. | 2556 // Garbage collection support. |
| 2584 inline static int SizeFor(int length) { | 2557 inline static int SizeFor(int length) { |
| 2585 return kHeaderSize + length * kDoubleSize; | 2558 return kHeaderSize + length * kDoubleSize; |
| 2586 } | 2559 } |
| (...skipping 3260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5847 Representation new_representation, | 5820 Representation new_representation, |
| 5848 Handle<HeapType> new_field_type, | 5821 Handle<HeapType> new_field_type, |
| 5849 StoreMode store_mode); | 5822 StoreMode store_mode); |
| 5850 static Handle<Map> CopyGeneralizeAllRepresentations( | 5823 static Handle<Map> CopyGeneralizeAllRepresentations( |
| 5851 Handle<Map> map, int modify_index, StoreMode store_mode, | 5824 Handle<Map> map, int modify_index, StoreMode store_mode, |
| 5852 PropertyKind kind, PropertyAttributes attributes, const char* reason); | 5825 PropertyKind kind, PropertyAttributes attributes, const char* reason); |
| 5853 | 5826 |
| 5854 static Handle<Map> PrepareForDataProperty(Handle<Map> old_map, | 5827 static Handle<Map> PrepareForDataProperty(Handle<Map> old_map, |
| 5855 int descriptor_number, | 5828 int descriptor_number, |
| 5856 Handle<Object> value); | 5829 Handle<Object> value); |
| 5830 static Handle<Map> PrepareForDataElement(Handle<Map> old_map, | |
| 5831 Handle<Object> value); | |
| 5857 | 5832 |
| 5858 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode, | 5833 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode, |
| 5859 const char* reason); | 5834 const char* reason); |
| 5860 | 5835 |
| 5861 // Returns the constructor name (the name (possibly, inferred name) of the | 5836 // Returns the constructor name (the name (possibly, inferred name) of the |
| 5862 // function that was used to instantiate the object). | 5837 // function that was used to instantiate the object). |
| 5863 String* constructor_name(); | 5838 String* constructor_name(); |
| 5864 | 5839 |
| 5865 // Tells whether the map is used for JSObjects in dictionary mode (ie | 5840 // Tells whether the map is used for JSObjects in dictionary mode (ie |
| 5866 // normalized objects, ie objects for which HasFastProperties returns false). | 5841 // normalized objects, ie objects for which HasFastProperties returns false). |
| (...skipping 3883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9750 | 9725 |
| 9751 STATIC_ASSERT(kPaddingSize >= 0); | 9726 STATIC_ASSERT(kPaddingSize >= 0); |
| 9752 | 9727 |
| 9753 typedef FixedBodyDescriptor<kHandlerOffset, | 9728 typedef FixedBodyDescriptor<kHandlerOffset, |
| 9754 kPaddingOffset, | 9729 kPaddingOffset, |
| 9755 kSize> BodyDescriptor; | 9730 kSize> BodyDescriptor; |
| 9756 | 9731 |
| 9757 private: | 9732 private: |
| 9758 friend class JSReceiver; | 9733 friend class JSReceiver; |
| 9759 | 9734 |
| 9760 MUST_USE_RESULT static inline MaybeHandle<Object> SetElementWithHandler( | |
| 9761 Handle<JSProxy> proxy, Handle<JSReceiver> receiver, uint32_t index, | |
| 9762 Handle<Object> value, LanguageMode language_mode); | |
| 9763 | |
| 9764 MUST_USE_RESULT static Maybe<bool> HasPropertyWithHandler( | 9735 MUST_USE_RESULT static Maybe<bool> HasPropertyWithHandler( |
| 9765 Handle<JSProxy> proxy, Handle<Name> name); | 9736 Handle<JSProxy> proxy, Handle<Name> name); |
| 9766 | 9737 |
| 9767 MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithHandler( | 9738 MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithHandler( |
| 9768 Handle<JSProxy> proxy, Handle<Name> name, LanguageMode language_mode); | 9739 Handle<JSProxy> proxy, Handle<Name> name, LanguageMode language_mode); |
| 9769 | 9740 |
| 9770 MUST_USE_RESULT Object* GetIdentityHash(); | 9741 MUST_USE_RESULT Object* GetIdentityHash(); |
| 9771 | 9742 |
| 9772 static Handle<Smi> GetOrCreateIdentityHash(Handle<JSProxy> proxy); | 9743 static Handle<Smi> GetOrCreateIdentityHash(Handle<JSProxy> proxy); |
| 9773 | 9744 |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10341 | 10312 |
| 10342 // Dispatched behavior. | 10313 // Dispatched behavior. |
| 10343 DECLARE_PRINTER(ExecutableAccessorInfo) | 10314 DECLARE_PRINTER(ExecutableAccessorInfo) |
| 10344 DECLARE_VERIFIER(ExecutableAccessorInfo) | 10315 DECLARE_VERIFIER(ExecutableAccessorInfo) |
| 10345 | 10316 |
| 10346 static const int kGetterOffset = AccessorInfo::kSize; | 10317 static const int kGetterOffset = AccessorInfo::kSize; |
| 10347 static const int kSetterOffset = kGetterOffset + kPointerSize; | 10318 static const int kSetterOffset = kGetterOffset + kPointerSize; |
| 10348 static const int kDataOffset = kSetterOffset + kPointerSize; | 10319 static const int kDataOffset = kSetterOffset + kPointerSize; |
| 10349 static const int kSize = kDataOffset + kPointerSize; | 10320 static const int kSize = kDataOffset + kPointerSize; |
| 10350 | 10321 |
| 10351 static inline void ClearSetter(Handle<ExecutableAccessorInfo> info); | 10322 static void ClearSetter(Handle<ExecutableAccessorInfo> info); |
| 10352 | 10323 |
| 10353 private: | 10324 private: |
| 10354 DISALLOW_IMPLICIT_CONSTRUCTORS(ExecutableAccessorInfo); | 10325 DISALLOW_IMPLICIT_CONSTRUCTORS(ExecutableAccessorInfo); |
| 10355 }; | 10326 }; |
| 10356 | 10327 |
| 10357 | 10328 |
| 10358 // Support for JavaScript accessors: A pair of a getter and a setter. Each | 10329 // Support for JavaScript accessors: A pair of a getter and a setter. Each |
| 10359 // accessor can either be | 10330 // accessor can either be |
| 10360 // * a pointer to a JavaScript function or proxy: a real accessor | 10331 // * a pointer to a JavaScript function or proxy: a real accessor |
| 10361 // * undefined: considered an accessor by the spec, too, strangely enough | 10332 // * undefined: considered an accessor by the spec, too, strangely enough |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10879 } else { | 10850 } else { |
| 10880 value &= ~(1 << bit_position); | 10851 value &= ~(1 << bit_position); |
| 10881 } | 10852 } |
| 10882 return value; | 10853 return value; |
| 10883 } | 10854 } |
| 10884 }; | 10855 }; |
| 10885 | 10856 |
| 10886 } } // namespace v8::internal | 10857 } } // namespace v8::internal |
| 10887 | 10858 |
| 10888 #endif // V8_OBJECTS_H_ | 10859 #endif // V8_OBJECTS_H_ |
| OLD | NEW |