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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1642 }; | 1636 }; |
1643 | 1637 |
1644 | 1638 |
1645 enum EnsureElementsMode { | 1639 enum EnsureElementsMode { |
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 | |
1653 // property causes attributes to remain unchanged, writability to be checked | |
1654 // and callbacks to be called. Defining of a property causes attributes to | |
1655 // be updated and callbacks to be overridden. | |
1656 enum SetPropertyMode { | |
1657 SET_PROPERTY, | |
1658 DEFINE_PROPERTY | |
1659 }; | |
1660 | |
1661 | |
1662 // Indicator for one component of an AccessorPair. | 1646 // Indicator for one component of an AccessorPair. |
1663 enum AccessorComponent { | 1647 enum AccessorComponent { |
1664 ACCESSOR_GETTER, | 1648 ACCESSOR_GETTER, |
1665 ACCESSOR_SETTER | 1649 ACCESSOR_SETTER |
1666 }; | 1650 }; |
1667 | 1651 |
1668 | 1652 |
1669 // JSReceiver includes types on which properties can be defined, i.e., | 1653 // JSReceiver includes types on which properties can be defined, i.e., |
1670 // JSObject and JSProxy. | 1654 // JSObject and JSProxy. |
1671 class JSReceiver: public HeapObject { | 1655 class JSReceiver: public HeapObject { |
1672 public: | 1656 public: |
1673 DECLARE_CAST(JSReceiver) | 1657 DECLARE_CAST(JSReceiver) |
1674 | 1658 |
1675 MUST_USE_RESULT static MaybeHandle<Object> SetElement( | 1659 MUST_USE_RESULT static MaybeHandle<Object> SetElement( |
1676 Handle<JSReceiver> object, uint32_t index, Handle<Object> value, | 1660 Handle<JSReceiver> object, uint32_t index, Handle<Object> value, |
1677 PropertyAttributes attributes, LanguageMode language_mode); | 1661 LanguageMode language_mode); |
1678 | 1662 |
1679 // Implementation of [[HasProperty]], ECMA-262 5th edition, section 8.12.6. | 1663 // Implementation of [[HasProperty]], ECMA-262 5th edition, section 8.12.6. |
1680 MUST_USE_RESULT static inline Maybe<bool> HasProperty( | 1664 MUST_USE_RESULT static inline Maybe<bool> HasProperty( |
1681 Handle<JSReceiver> object, Handle<Name> name); | 1665 Handle<JSReceiver> object, Handle<Name> name); |
1682 MUST_USE_RESULT static inline Maybe<bool> HasOwnProperty(Handle<JSReceiver>, | 1666 MUST_USE_RESULT static inline Maybe<bool> HasOwnProperty(Handle<JSReceiver>, |
1683 Handle<Name> name); | 1667 Handle<Name> name); |
1684 MUST_USE_RESULT static inline Maybe<bool> HasElement( | 1668 MUST_USE_RESULT static inline Maybe<bool> HasElement( |
1685 Handle<JSReceiver> object, uint32_t index); | 1669 Handle<JSReceiver> object, uint32_t index); |
1686 MUST_USE_RESULT static inline Maybe<bool> HasOwnElement( | 1670 MUST_USE_RESULT static inline Maybe<bool> HasOwnElement( |
1687 Handle<JSReceiver> object, uint32_t index); | 1671 Handle<JSReceiver> object, uint32_t index); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1850 uint32_t limit); | 1834 uint32_t limit); |
1851 // As PrepareElementsForSort, but only on objects where elements is | 1835 // As PrepareElementsForSort, but only on objects where elements is |
1852 // a dictionary, and it will stay a dictionary. Collates undefined and | 1836 // a dictionary, and it will stay a dictionary. Collates undefined and |
1853 // unexisting elements below limit from position zero of the elements. | 1837 // unexisting elements below limit from position zero of the elements. |
1854 static Handle<Object> PrepareSlowElementsForSort(Handle<JSObject> object, | 1838 static Handle<Object> PrepareSlowElementsForSort(Handle<JSObject> object, |
1855 uint32_t limit); | 1839 uint32_t limit); |
1856 | 1840 |
1857 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithInterceptor( | 1841 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithInterceptor( |
1858 LookupIterator* it, Handle<Object> value); | 1842 LookupIterator* it, Handle<Object> value); |
1859 | 1843 |
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( | 1844 MUST_USE_RESULT static MaybeHandle<Object> SetOwnPropertyIgnoreAttributes( |
1868 Handle<JSObject> object, Handle<Name> name, Handle<Object> value, | 1845 Handle<JSObject> object, Handle<Name> name, Handle<Object> value, |
1869 PropertyAttributes attributes, | 1846 PropertyAttributes attributes); |
1870 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING); | 1847 |
| 1848 MUST_USE_RESULT static MaybeHandle<Object> SetOwnElementIgnoreAttributes( |
| 1849 Handle<JSObject> object, uint32_t index, Handle<Object> value, |
| 1850 PropertyAttributes attributes); |
| 1851 |
| 1852 MUST_USE_RESULT static MaybeHandle<Object> ReconfigureAsDataProperty( |
| 1853 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes); |
1871 | 1854 |
1872 static void AddProperty(Handle<JSObject> object, Handle<Name> name, | 1855 static void AddProperty(Handle<JSObject> object, Handle<Name> name, |
1873 Handle<Object> value, PropertyAttributes attributes); | 1856 Handle<Object> value, PropertyAttributes attributes); |
1874 | 1857 |
| 1858 MUST_USE_RESULT static MaybeHandle<Object> AddDataElement( |
| 1859 Handle<JSObject> receiver, uint32_t index, Handle<Object> value, |
| 1860 PropertyAttributes attributes); |
| 1861 |
1875 // Extend the receiver with a single fast property appeared first in the | 1862 // Extend the receiver with a single fast property appeared first in the |
1876 // passed map. This also extends the property backing store if necessary. | 1863 // passed map. This also extends the property backing store if necessary. |
1877 static void AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map); | 1864 static void AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map); |
1878 | 1865 |
1879 // Migrates the given object to a map whose field representations are the | 1866 // Migrates the given object to a map whose field representations are the |
1880 // lowest upper bound of all known representations for that field. | 1867 // lowest upper bound of all known representations for that field. |
1881 static void MigrateInstance(Handle<JSObject> instance); | 1868 static void MigrateInstance(Handle<JSObject> instance); |
1882 | 1869 |
1883 // Migrates the given object only if the target map is already available, | 1870 // Migrates the given object only if the target map is already available, |
1884 // or returns false if such a map is not yet available. | 1871 // or returns false if such a map is not yet available. |
1885 static bool TryMigrateInstance(Handle<JSObject> instance); | 1872 static bool TryMigrateInstance(Handle<JSObject> instance); |
1886 | 1873 |
1887 // Sets the property value in a normalized object given (key, value, details). | 1874 // Sets the property value in a normalized object given (key, value, details). |
1888 // Handles the special representation of JS global objects. | 1875 // Handles the special representation of JS global objects. |
1889 static void SetNormalizedProperty(Handle<JSObject> object, Handle<Name> name, | 1876 static void SetNormalizedProperty(Handle<JSObject> object, Handle<Name> name, |
1890 Handle<Object> value, | 1877 Handle<Object> value, |
1891 PropertyDetails details); | 1878 PropertyDetails details); |
| 1879 static void SetDictionaryElement(Handle<JSObject> object, uint32_t index, |
| 1880 Handle<Object> value, |
| 1881 PropertyAttributes attributes); |
| 1882 static void SetSloppyArgumentsElement(Handle<JSObject> object, uint32_t index, |
| 1883 Handle<Object> value, |
| 1884 PropertyAttributes attributes); |
| 1885 |
| 1886 static void SetFastElement(Handle<JSObject> object, uint32_t index, |
| 1887 Handle<Object> value); |
| 1888 static void SetFastDoubleElement(Handle<JSObject> object, uint32_t index, |
| 1889 Handle<Object> value); |
1892 | 1890 |
1893 static void OptimizeAsPrototype(Handle<JSObject> object, | 1891 static void OptimizeAsPrototype(Handle<JSObject> object, |
1894 PrototypeOptimizationMode mode); | 1892 PrototypeOptimizationMode mode); |
1895 static void ReoptimizeIfPrototype(Handle<JSObject> object); | 1893 static void ReoptimizeIfPrototype(Handle<JSObject> object); |
1896 static void LazyRegisterPrototypeUser(Handle<Map> user, Isolate* isolate); | 1894 static void LazyRegisterPrototypeUser(Handle<Map> user, Isolate* isolate); |
1897 static bool RegisterPrototypeUserIfNotRegistered(Handle<JSObject> prototype, | 1895 static bool RegisterPrototypeUserIfNotRegistered(Handle<JSObject> prototype, |
1898 Handle<HeapObject> user, | 1896 Handle<HeapObject> user, |
1899 Isolate* isolate); | 1897 Isolate* isolate); |
1900 static bool UnregisterPrototypeUser(Handle<JSObject> prototype, | 1898 static bool UnregisterPrototypeUser(Handle<JSObject> prototype, |
1901 Handle<HeapObject> user); | 1899 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. | 2002 // Computes the new capacity when expanding the elements of a JSObject. |
2005 static int NewElementsCapacity(int old_capacity) { | 2003 static int NewElementsCapacity(int old_capacity) { |
2006 // (old_capacity + 50%) + 16 | 2004 // (old_capacity + 50%) + 16 |
2007 return old_capacity + (old_capacity >> 1) + 16; | 2005 return old_capacity + (old_capacity >> 1) + 16; |
2008 } | 2006 } |
2009 | 2007 |
2010 // These methods do not perform access checks! | 2008 // These methods do not perform access checks! |
2011 MUST_USE_RESULT static MaybeHandle<AccessorPair> GetOwnElementAccessorPair( | 2009 MUST_USE_RESULT static MaybeHandle<AccessorPair> GetOwnElementAccessorPair( |
2012 Handle<JSObject> object, uint32_t index); | 2010 Handle<JSObject> object, uint32_t index); |
2013 | 2011 |
2014 MUST_USE_RESULT static MaybeHandle<Object> SetFastElement( | 2012 static void UpdateAllocationSite(Handle<JSObject> object, |
2015 Handle<JSObject> object, uint32_t index, Handle<Object> value, | 2013 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 | 2014 |
2032 enum SetFastElementsCapacitySmiMode { | 2015 enum SetFastElementsCapacitySmiMode { |
2033 kAllowSmiElements, | 2016 kAllowSmiElements, |
2034 kForceSmiElements, | 2017 kForceSmiElements, |
2035 kDontAllowSmiElements | 2018 kDontAllowSmiElements |
2036 }; | 2019 }; |
2037 | 2020 |
2038 static Handle<FixedArray> SetFastElementsCapacity( | 2021 static Handle<FixedArray> SetFastElementsCapacity( |
2039 Handle<JSObject> object, int capacity, | 2022 Handle<JSObject> object, int capacity, |
2040 SetFastElementsCapacitySmiMode smi_mode); | 2023 SetFastElementsCapacitySmiMode smi_mode); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2312 private: | 2295 private: |
2313 friend class DictionaryElementsAccessor; | 2296 friend class DictionaryElementsAccessor; |
2314 friend class JSReceiver; | 2297 friend class JSReceiver; |
2315 friend class Object; | 2298 friend class Object; |
2316 | 2299 |
2317 static void MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map); | 2300 static void MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map); |
2318 static void MigrateFastToSlow(Handle<JSObject> object, | 2301 static void MigrateFastToSlow(Handle<JSObject> object, |
2319 Handle<Map> new_map, | 2302 Handle<Map> new_map, |
2320 int expected_additional_properties); | 2303 int expected_additional_properties); |
2321 | 2304 |
2322 static void UpdateAllocationSite(Handle<JSObject> object, | |
2323 ElementsKind to_kind); | |
2324 | |
2325 // Used from Object::GetProperty(). | 2305 // Used from Object::GetProperty(). |
2326 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithFailedAccessCheck( | 2306 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithFailedAccessCheck( |
2327 LookupIterator* it); | 2307 LookupIterator* it); |
2328 | 2308 |
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( | 2309 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithFailedAccessCheck( |
2354 LookupIterator* it, Handle<Object> value, LanguageMode language_mode); | 2310 LookupIterator* it, Handle<Object> value, LanguageMode language_mode); |
2355 | 2311 |
2356 // Add a property to a slow-case object. | 2312 // Add a property to a slow-case object. |
2357 static void AddSlowProperty(Handle<JSObject> object, | 2313 static void AddSlowProperty(Handle<JSObject> object, |
2358 Handle<Name> name, | 2314 Handle<Name> name, |
2359 Handle<Object> value, | 2315 Handle<Object> value, |
2360 PropertyAttributes attributes); | 2316 PropertyAttributes attributes); |
2361 | 2317 |
2362 MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithInterceptor( | 2318 MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithInterceptor( |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2446 | 2402 |
2447 class FixedDoubleArray; | 2403 class FixedDoubleArray; |
2448 class IncrementalMarking; | 2404 class IncrementalMarking; |
2449 | 2405 |
2450 | 2406 |
2451 // FixedArray describes fixed-sized arrays with element type Object*. | 2407 // FixedArray describes fixed-sized arrays with element type Object*. |
2452 class FixedArray: public FixedArrayBase { | 2408 class FixedArray: public FixedArrayBase { |
2453 public: | 2409 public: |
2454 // Setter and getter for elements. | 2410 // Setter and getter for elements. |
2455 inline Object* get(int index) const; | 2411 inline Object* get(int index) const; |
| 2412 static Handle<Object> SetValue(Handle<JSObject> holder, |
| 2413 Handle<FixedArray> array, uint32_t index, |
| 2414 Handle<Object> value); |
2456 static inline Handle<Object> get(Handle<FixedArray> array, int index); | 2415 static inline Handle<Object> get(Handle<FixedArray> array, int index); |
2457 // Setter that uses write barrier. | 2416 // Setter that uses write barrier. |
2458 inline void set(int index, Object* value); | 2417 inline void set(int index, Object* value); |
2459 inline bool is_the_hole(int index); | 2418 inline bool is_the_hole(int index); |
2460 | 2419 |
2461 // Setter that doesn't need write barrier. | 2420 // Setter that doesn't need write barrier. |
2462 inline void set(int index, Smi* value); | 2421 inline void set(int index, Smi* value); |
2463 // Setter with explicit barrier mode. | 2422 // Setter with explicit barrier mode. |
2464 inline void set(int index, Object* value, WriteBarrierMode mode); | 2423 inline void set(int index, Object* value, WriteBarrierMode mode); |
2465 | 2424 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2567 }; | 2526 }; |
2568 | 2527 |
2569 | 2528 |
2570 // FixedDoubleArray describes fixed-sized arrays with element type double. | 2529 // FixedDoubleArray describes fixed-sized arrays with element type double. |
2571 class FixedDoubleArray: public FixedArrayBase { | 2530 class FixedDoubleArray: public FixedArrayBase { |
2572 public: | 2531 public: |
2573 // Setter and getter for elements. | 2532 // Setter and getter for elements. |
2574 inline double get_scalar(int index); | 2533 inline double get_scalar(int index); |
2575 inline uint64_t get_representation(int index); | 2534 inline uint64_t get_representation(int index); |
2576 static inline Handle<Object> get(Handle<FixedDoubleArray> array, int index); | 2535 static inline Handle<Object> get(Handle<FixedDoubleArray> array, int index); |
| 2536 // This accessor has to get a Number as |value|. |
| 2537 static Handle<Object> SetValue(Handle<JSObject> holder, |
| 2538 Handle<FixedDoubleArray> array, uint32_t index, |
| 2539 Handle<Object> value); |
2577 inline void set(int index, double value); | 2540 inline void set(int index, double value); |
2578 inline void set_the_hole(int index); | 2541 inline void set_the_hole(int index); |
2579 | 2542 |
2580 // Checking for the hole. | 2543 // Checking for the hole. |
2581 inline bool is_the_hole(int index); | 2544 inline bool is_the_hole(int index); |
2582 | 2545 |
2583 // Garbage collection support. | 2546 // Garbage collection support. |
2584 inline static int SizeFor(int length) { | 2547 inline static int SizeFor(int length) { |
2585 return kHeaderSize + length * kDoubleSize; | 2548 return kHeaderSize + length * kDoubleSize; |
2586 } | 2549 } |
(...skipping 3260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5847 Representation new_representation, | 5810 Representation new_representation, |
5848 Handle<HeapType> new_field_type, | 5811 Handle<HeapType> new_field_type, |
5849 StoreMode store_mode); | 5812 StoreMode store_mode); |
5850 static Handle<Map> CopyGeneralizeAllRepresentations( | 5813 static Handle<Map> CopyGeneralizeAllRepresentations( |
5851 Handle<Map> map, int modify_index, StoreMode store_mode, | 5814 Handle<Map> map, int modify_index, StoreMode store_mode, |
5852 PropertyKind kind, PropertyAttributes attributes, const char* reason); | 5815 PropertyKind kind, PropertyAttributes attributes, const char* reason); |
5853 | 5816 |
5854 static Handle<Map> PrepareForDataProperty(Handle<Map> old_map, | 5817 static Handle<Map> PrepareForDataProperty(Handle<Map> old_map, |
5855 int descriptor_number, | 5818 int descriptor_number, |
5856 Handle<Object> value); | 5819 Handle<Object> value); |
| 5820 static Handle<Map> PrepareForDataElement(Handle<Map> old_map, |
| 5821 Handle<Object> value); |
5857 | 5822 |
5858 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode, | 5823 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode, |
5859 const char* reason); | 5824 const char* reason); |
5860 | 5825 |
5861 // Returns the constructor name (the name (possibly, inferred name) of the | 5826 // Returns the constructor name (the name (possibly, inferred name) of the |
5862 // function that was used to instantiate the object). | 5827 // function that was used to instantiate the object). |
5863 String* constructor_name(); | 5828 String* constructor_name(); |
5864 | 5829 |
5865 // Tells whether the map is used for JSObjects in dictionary mode (ie | 5830 // Tells whether the map is used for JSObjects in dictionary mode (ie |
5866 // normalized objects, ie objects for which HasFastProperties returns false). | 5831 // normalized objects, ie objects for which HasFastProperties returns false). |
(...skipping 3883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9750 | 9715 |
9751 STATIC_ASSERT(kPaddingSize >= 0); | 9716 STATIC_ASSERT(kPaddingSize >= 0); |
9752 | 9717 |
9753 typedef FixedBodyDescriptor<kHandlerOffset, | 9718 typedef FixedBodyDescriptor<kHandlerOffset, |
9754 kPaddingOffset, | 9719 kPaddingOffset, |
9755 kSize> BodyDescriptor; | 9720 kSize> BodyDescriptor; |
9756 | 9721 |
9757 private: | 9722 private: |
9758 friend class JSReceiver; | 9723 friend class JSReceiver; |
9759 | 9724 |
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( | 9725 MUST_USE_RESULT static Maybe<bool> HasPropertyWithHandler( |
9765 Handle<JSProxy> proxy, Handle<Name> name); | 9726 Handle<JSProxy> proxy, Handle<Name> name); |
9766 | 9727 |
9767 MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithHandler( | 9728 MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithHandler( |
9768 Handle<JSProxy> proxy, Handle<Name> name, LanguageMode language_mode); | 9729 Handle<JSProxy> proxy, Handle<Name> name, LanguageMode language_mode); |
9769 | 9730 |
9770 MUST_USE_RESULT Object* GetIdentityHash(); | 9731 MUST_USE_RESULT Object* GetIdentityHash(); |
9771 | 9732 |
9772 static Handle<Smi> GetOrCreateIdentityHash(Handle<JSProxy> proxy); | 9733 static Handle<Smi> GetOrCreateIdentityHash(Handle<JSProxy> proxy); |
9773 | 9734 |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10341 | 10302 |
10342 // Dispatched behavior. | 10303 // Dispatched behavior. |
10343 DECLARE_PRINTER(ExecutableAccessorInfo) | 10304 DECLARE_PRINTER(ExecutableAccessorInfo) |
10344 DECLARE_VERIFIER(ExecutableAccessorInfo) | 10305 DECLARE_VERIFIER(ExecutableAccessorInfo) |
10345 | 10306 |
10346 static const int kGetterOffset = AccessorInfo::kSize; | 10307 static const int kGetterOffset = AccessorInfo::kSize; |
10347 static const int kSetterOffset = kGetterOffset + kPointerSize; | 10308 static const int kSetterOffset = kGetterOffset + kPointerSize; |
10348 static const int kDataOffset = kSetterOffset + kPointerSize; | 10309 static const int kDataOffset = kSetterOffset + kPointerSize; |
10349 static const int kSize = kDataOffset + kPointerSize; | 10310 static const int kSize = kDataOffset + kPointerSize; |
10350 | 10311 |
10351 static inline void ClearSetter(Handle<ExecutableAccessorInfo> info); | 10312 static void ClearSetter(Handle<ExecutableAccessorInfo> info); |
10352 | 10313 |
10353 private: | 10314 private: |
10354 DISALLOW_IMPLICIT_CONSTRUCTORS(ExecutableAccessorInfo); | 10315 DISALLOW_IMPLICIT_CONSTRUCTORS(ExecutableAccessorInfo); |
10355 }; | 10316 }; |
10356 | 10317 |
10357 | 10318 |
10358 // Support for JavaScript accessors: A pair of a getter and a setter. Each | 10319 // Support for JavaScript accessors: A pair of a getter and a setter. Each |
10359 // accessor can either be | 10320 // accessor can either be |
10360 // * a pointer to a JavaScript function or proxy: a real accessor | 10321 // * a pointer to a JavaScript function or proxy: a real accessor |
10361 // * undefined: considered an accessor by the spec, too, strangely enough | 10322 // * 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 { | 10840 } else { |
10880 value &= ~(1 << bit_position); | 10841 value &= ~(1 << bit_position); |
10881 } | 10842 } |
10882 return value; | 10843 return value; |
10883 } | 10844 } |
10884 }; | 10845 }; |
10885 | 10846 |
10886 } } // namespace v8::internal | 10847 } } // namespace v8::internal |
10887 | 10848 |
10888 #endif // V8_OBJECTS_H_ | 10849 #endif // V8_OBJECTS_H_ |
OLD | NEW |