| 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 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1843 }; | 1843 }; |
| 1844 | 1844 |
| 1845 enum class GetKeysConversion { kKeepNumbers, kConvertToString }; | 1845 enum class GetKeysConversion { kKeepNumbers, kConvertToString }; |
| 1846 | 1846 |
| 1847 enum class KeyCollectionMode { | 1847 enum class KeyCollectionMode { |
| 1848 kOwnOnly = static_cast<int>(v8::KeyCollectionMode::kOwnOnly), | 1848 kOwnOnly = static_cast<int>(v8::KeyCollectionMode::kOwnOnly), |
| 1849 kIncludePrototypes = | 1849 kIncludePrototypes = |
| 1850 static_cast<int>(v8::KeyCollectionMode::kIncludePrototypes) | 1850 static_cast<int>(v8::KeyCollectionMode::kIncludePrototypes) |
| 1851 }; | 1851 }; |
| 1852 | 1852 |
| 1853 enum class AllocationSiteUpdateMode { kUpdate, kCheckOnly }; |
| 1854 |
| 1853 // JSReceiver includes types on which properties can be defined, i.e., | 1855 // JSReceiver includes types on which properties can be defined, i.e., |
| 1854 // JSObject and JSProxy. | 1856 // JSObject and JSProxy. |
| 1855 class JSReceiver: public HeapObject { | 1857 class JSReceiver: public HeapObject { |
| 1856 public: | 1858 public: |
| 1857 // [properties]: Backing storage for properties. | 1859 // [properties]: Backing storage for properties. |
| 1858 // properties is a FixedArray in the fast case and a Dictionary in the | 1860 // properties is a FixedArray in the fast case and a Dictionary in the |
| 1859 // slow case. | 1861 // slow case. |
| 1860 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties. | 1862 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties. |
| 1861 inline void initialize_properties(); | 1863 inline void initialize_properties(); |
| 1862 inline bool HasFastProperties(); | 1864 inline bool HasFastProperties(); |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2293 // an access at key? | 2295 // an access at key? |
| 2294 bool WouldConvertToSlowElements(uint32_t index); | 2296 bool WouldConvertToSlowElements(uint32_t index); |
| 2295 | 2297 |
| 2296 // Computes the new capacity when expanding the elements of a JSObject. | 2298 // Computes the new capacity when expanding the elements of a JSObject. |
| 2297 static uint32_t NewElementsCapacity(uint32_t old_capacity) { | 2299 static uint32_t NewElementsCapacity(uint32_t old_capacity) { |
| 2298 // (old_capacity + 50%) + 16 | 2300 // (old_capacity + 50%) + 16 |
| 2299 return old_capacity + (old_capacity >> 1) + 16; | 2301 return old_capacity + (old_capacity >> 1) + 16; |
| 2300 } | 2302 } |
| 2301 | 2303 |
| 2302 // These methods do not perform access checks! | 2304 // These methods do not perform access checks! |
| 2303 static void UpdateAllocationSite(Handle<JSObject> object, | 2305 template <AllocationSiteUpdateMode update_or_check = |
| 2306 AllocationSiteUpdateMode::kUpdate> |
| 2307 static bool UpdateAllocationSite(Handle<JSObject> object, |
| 2304 ElementsKind to_kind); | 2308 ElementsKind to_kind); |
| 2305 | 2309 |
| 2306 // Lookup interceptors are used for handling properties controlled by host | 2310 // Lookup interceptors are used for handling properties controlled by host |
| 2307 // objects. | 2311 // objects. |
| 2308 inline bool HasNamedInterceptor(); | 2312 inline bool HasNamedInterceptor(); |
| 2309 inline bool HasIndexedInterceptor(); | 2313 inline bool HasIndexedInterceptor(); |
| 2310 | 2314 |
| 2311 // Support functions for v8 api (needed for correct interceptor behavior). | 2315 // Support functions for v8 api (needed for correct interceptor behavior). |
| 2312 MUST_USE_RESULT static Maybe<bool> HasRealNamedProperty( | 2316 MUST_USE_RESULT static Maybe<bool> HasRealNamedProperty( |
| 2313 Handle<JSObject> object, Handle<Name> name); | 2317 Handle<JSObject> object, Handle<Name> name); |
| (...skipping 6341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8655 inline bool DigestPretenuringFeedback(bool maximum_size_scavenge); | 8659 inline bool DigestPretenuringFeedback(bool maximum_size_scavenge); |
| 8656 | 8660 |
| 8657 inline ElementsKind GetElementsKind(); | 8661 inline ElementsKind GetElementsKind(); |
| 8658 inline void SetElementsKind(ElementsKind kind); | 8662 inline void SetElementsKind(ElementsKind kind); |
| 8659 | 8663 |
| 8660 inline bool CanInlineCall(); | 8664 inline bool CanInlineCall(); |
| 8661 inline void SetDoNotInlineCall(); | 8665 inline void SetDoNotInlineCall(); |
| 8662 | 8666 |
| 8663 inline bool SitePointsToLiteral(); | 8667 inline bool SitePointsToLiteral(); |
| 8664 | 8668 |
| 8665 static void DigestTransitionFeedback(Handle<AllocationSite> site, | 8669 template <AllocationSiteUpdateMode update_or_check = |
| 8670 AllocationSiteUpdateMode::kUpdate> |
| 8671 static bool DigestTransitionFeedback(Handle<AllocationSite> site, |
| 8666 ElementsKind to_kind); | 8672 ElementsKind to_kind); |
| 8667 | 8673 |
| 8668 DECLARE_PRINTER(AllocationSite) | 8674 DECLARE_PRINTER(AllocationSite) |
| 8669 DECLARE_VERIFIER(AllocationSite) | 8675 DECLARE_VERIFIER(AllocationSite) |
| 8670 | 8676 |
| 8671 DECLARE_CAST(AllocationSite) | 8677 DECLARE_CAST(AllocationSite) |
| 8672 static inline AllocationSiteMode GetMode( | 8678 static inline AllocationSiteMode GetMode( |
| 8673 ElementsKind boilerplate_elements_kind); | 8679 ElementsKind boilerplate_elements_kind); |
| 8674 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | 8680 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); |
| 8675 static inline bool CanTrack(InstanceType type); | 8681 static inline bool CanTrack(InstanceType type); |
| (...skipping 2497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11173 } | 11179 } |
| 11174 return value; | 11180 return value; |
| 11175 } | 11181 } |
| 11176 }; | 11182 }; |
| 11177 | 11183 |
| 11178 | 11184 |
| 11179 } // NOLINT, false-positive due to second-order macros. | 11185 } // NOLINT, false-positive due to second-order macros. |
| 11180 } // NOLINT, false-positive due to second-order macros. | 11186 } // NOLINT, false-positive due to second-order macros. |
| 11181 | 11187 |
| 11182 #endif // V8_OBJECTS_H_ | 11188 #endif // V8_OBJECTS_H_ |
| OLD | NEW |