| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1835 }; | 1835 }; |
| 1836 | 1836 |
| 1837 enum class GetKeysConversion { kKeepNumbers, kConvertToString }; | 1837 enum class GetKeysConversion { kKeepNumbers, kConvertToString }; |
| 1838 | 1838 |
| 1839 enum class KeyCollectionMode { | 1839 enum class KeyCollectionMode { |
| 1840 kOwnOnly = static_cast<int>(v8::KeyCollectionMode::kOwnOnly), | 1840 kOwnOnly = static_cast<int>(v8::KeyCollectionMode::kOwnOnly), |
| 1841 kIncludePrototypes = | 1841 kIncludePrototypes = |
| 1842 static_cast<int>(v8::KeyCollectionMode::kIncludePrototypes) | 1842 static_cast<int>(v8::KeyCollectionMode::kIncludePrototypes) |
| 1843 }; | 1843 }; |
| 1844 | 1844 |
| 1845 enum class AllocationSiteUpdateMode { kUpdate, kCheckOnly }; |
| 1846 |
| 1845 // JSReceiver includes types on which properties can be defined, i.e., | 1847 // JSReceiver includes types on which properties can be defined, i.e., |
| 1846 // JSObject and JSProxy. | 1848 // JSObject and JSProxy. |
| 1847 class JSReceiver: public HeapObject { | 1849 class JSReceiver: public HeapObject { |
| 1848 public: | 1850 public: |
| 1849 // [properties]: Backing storage for properties. | 1851 // [properties]: Backing storage for properties. |
| 1850 // properties is a FixedArray in the fast case and a Dictionary in the | 1852 // properties is a FixedArray in the fast case and a Dictionary in the |
| 1851 // slow case. | 1853 // slow case. |
| 1852 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties. | 1854 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties. |
| 1853 inline void initialize_properties(); | 1855 inline void initialize_properties(); |
| 1854 inline bool HasFastProperties(); | 1856 inline bool HasFastProperties(); |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2285 // an access at key? | 2287 // an access at key? |
| 2286 bool WouldConvertToSlowElements(uint32_t index); | 2288 bool WouldConvertToSlowElements(uint32_t index); |
| 2287 | 2289 |
| 2288 // Computes the new capacity when expanding the elements of a JSObject. | 2290 // Computes the new capacity when expanding the elements of a JSObject. |
| 2289 static uint32_t NewElementsCapacity(uint32_t old_capacity) { | 2291 static uint32_t NewElementsCapacity(uint32_t old_capacity) { |
| 2290 // (old_capacity + 50%) + 16 | 2292 // (old_capacity + 50%) + 16 |
| 2291 return old_capacity + (old_capacity >> 1) + 16; | 2293 return old_capacity + (old_capacity >> 1) + 16; |
| 2292 } | 2294 } |
| 2293 | 2295 |
| 2294 // These methods do not perform access checks! | 2296 // These methods do not perform access checks! |
| 2295 static void UpdateAllocationSite(Handle<JSObject> object, | 2297 template <AllocationSiteUpdateMode update_or_check = |
| 2298 AllocationSiteUpdateMode::kUpdate> |
| 2299 static bool UpdateAllocationSite(Handle<JSObject> object, |
| 2296 ElementsKind to_kind); | 2300 ElementsKind to_kind); |
| 2297 | 2301 |
| 2298 // Lookup interceptors are used for handling properties controlled by host | 2302 // Lookup interceptors are used for handling properties controlled by host |
| 2299 // objects. | 2303 // objects. |
| 2300 inline bool HasNamedInterceptor(); | 2304 inline bool HasNamedInterceptor(); |
| 2301 inline bool HasIndexedInterceptor(); | 2305 inline bool HasIndexedInterceptor(); |
| 2302 | 2306 |
| 2303 // Support functions for v8 api (needed for correct interceptor behavior). | 2307 // Support functions for v8 api (needed for correct interceptor behavior). |
| 2304 MUST_USE_RESULT static Maybe<bool> HasRealNamedProperty( | 2308 MUST_USE_RESULT static Maybe<bool> HasRealNamedProperty( |
| 2305 Handle<JSObject> object, Handle<Name> name); | 2309 Handle<JSObject> object, Handle<Name> name); |
| (...skipping 6343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8649 inline bool DigestPretenuringFeedback(bool maximum_size_scavenge); | 8653 inline bool DigestPretenuringFeedback(bool maximum_size_scavenge); |
| 8650 | 8654 |
| 8651 inline ElementsKind GetElementsKind(); | 8655 inline ElementsKind GetElementsKind(); |
| 8652 inline void SetElementsKind(ElementsKind kind); | 8656 inline void SetElementsKind(ElementsKind kind); |
| 8653 | 8657 |
| 8654 inline bool CanInlineCall(); | 8658 inline bool CanInlineCall(); |
| 8655 inline void SetDoNotInlineCall(); | 8659 inline void SetDoNotInlineCall(); |
| 8656 | 8660 |
| 8657 inline bool SitePointsToLiteral(); | 8661 inline bool SitePointsToLiteral(); |
| 8658 | 8662 |
| 8659 static void DigestTransitionFeedback(Handle<AllocationSite> site, | 8663 template <AllocationSiteUpdateMode update_or_check = |
| 8664 AllocationSiteUpdateMode::kUpdate> |
| 8665 static bool DigestTransitionFeedback(Handle<AllocationSite> site, |
| 8660 ElementsKind to_kind); | 8666 ElementsKind to_kind); |
| 8661 | 8667 |
| 8662 DECLARE_PRINTER(AllocationSite) | 8668 DECLARE_PRINTER(AllocationSite) |
| 8663 DECLARE_VERIFIER(AllocationSite) | 8669 DECLARE_VERIFIER(AllocationSite) |
| 8664 | 8670 |
| 8665 DECLARE_CAST(AllocationSite) | 8671 DECLARE_CAST(AllocationSite) |
| 8666 static inline AllocationSiteMode GetMode( | 8672 static inline AllocationSiteMode GetMode( |
| 8667 ElementsKind boilerplate_elements_kind); | 8673 ElementsKind boilerplate_elements_kind); |
| 8668 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | 8674 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); |
| 8669 static inline bool CanTrack(InstanceType type); | 8675 static inline bool CanTrack(InstanceType type); |
| (...skipping 2495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11165 } | 11171 } |
| 11166 return value; | 11172 return value; |
| 11167 } | 11173 } |
| 11168 }; | 11174 }; |
| 11169 | 11175 |
| 11170 | 11176 |
| 11171 } // NOLINT, false-positive due to second-order macros. | 11177 } // NOLINT, false-positive due to second-order macros. |
| 11172 } // NOLINT, false-positive due to second-order macros. | 11178 } // NOLINT, false-positive due to second-order macros. |
| 11173 | 11179 |
| 11174 #endif // V8_OBJECTS_H_ | 11180 #endif // V8_OBJECTS_H_ |
| OLD | NEW |