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 | 9 |
10 #include "src/assert-scope.h" | 10 #include "src/assert-scope.h" |
(...skipping 5731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5742 int target_inobject, int target_unused, | 5742 int target_inobject, int target_unused, |
5743 int* old_number_of_fields); | 5743 int* old_number_of_fields); |
5744 // TODO(ishell): moveit! | 5744 // TODO(ishell): moveit! |
5745 static Handle<Map> GeneralizeAllFieldRepresentations(Handle<Map> map); | 5745 static Handle<Map> GeneralizeAllFieldRepresentations(Handle<Map> map); |
5746 MUST_USE_RESULT static Handle<FieldType> GeneralizeFieldType( | 5746 MUST_USE_RESULT static Handle<FieldType> GeneralizeFieldType( |
5747 Representation rep1, Handle<FieldType> type1, Representation rep2, | 5747 Representation rep1, Handle<FieldType> type1, Representation rep2, |
5748 Handle<FieldType> type2, Isolate* isolate); | 5748 Handle<FieldType> type2, Isolate* isolate); |
5749 static void GeneralizeFieldType(Handle<Map> map, int modify_index, | 5749 static void GeneralizeFieldType(Handle<Map> map, int modify_index, |
5750 Representation new_representation, | 5750 Representation new_representation, |
5751 Handle<FieldType> new_field_type); | 5751 Handle<FieldType> new_field_type); |
5752 static Handle<Map> ReconfigureProperty(Handle<Map> map, int modify_index, | 5752 |
5753 PropertyKind new_kind, | 5753 static inline Handle<Map> ReconfigureProperty( |
5754 PropertyAttributes new_attributes, | 5754 Handle<Map> map, int modify_index, PropertyKind new_kind, |
5755 Representation new_representation, | 5755 PropertyAttributes new_attributes, Representation new_representation, |
5756 Handle<FieldType> new_field_type, | 5756 Handle<FieldType> new_field_type, StoreMode store_mode); |
5757 StoreMode store_mode); | 5757 |
5758 static Handle<Map> CopyGeneralizeAllRepresentations( | 5758 static inline Handle<Map> ReconfigureElementsKind( |
5759 Handle<Map> map, int modify_index, StoreMode store_mode, | 5759 Handle<Map> map, ElementsKind new_elements_kind); |
5760 PropertyKind kind, PropertyAttributes attributes, const char* reason); | |
5761 | 5760 |
5762 static Handle<Map> PrepareForDataProperty(Handle<Map> old_map, | 5761 static Handle<Map> PrepareForDataProperty(Handle<Map> old_map, |
5763 int descriptor_number, | 5762 int descriptor_number, |
5764 Handle<Object> value); | 5763 Handle<Object> value); |
5765 | 5764 |
5766 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode, | 5765 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode, |
5767 const char* reason); | 5766 const char* reason); |
5768 | 5767 |
5769 // Tells whether the map is used for JSObjects in dictionary mode (ie | 5768 // Tells whether the map is used for JSObjects in dictionary mode (ie |
5770 // normalized objects, ie objects for which HasFastProperties returns false). | 5769 // normalized objects, ie objects for which HasFastProperties returns false). |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5971 | 5970 |
5972 static inline int SlackForArraySize(int old_size, int size_limit); | 5971 static inline int SlackForArraySize(int old_size, int size_limit); |
5973 | 5972 |
5974 static void EnsureDescriptorSlack(Handle<Map> map, int slack); | 5973 static void EnsureDescriptorSlack(Handle<Map> map, int slack); |
5975 | 5974 |
5976 Code* LookupInCodeCache(Name* name, Code::Flags code); | 5975 Code* LookupInCodeCache(Name* name, Code::Flags code); |
5977 | 5976 |
5978 // Computes a hash value for this map, to be used in HashTables and such. | 5977 // Computes a hash value for this map, to be used in HashTables and such. |
5979 int Hash(); | 5978 int Hash(); |
5980 | 5979 |
5981 // Returns the map that this map transitions to if its elements_kind | |
5982 // is changed to |elements_kind|, or NULL if no such map is cached yet. | |
5983 // |safe_to_add_transitions| is set to false if adding transitions is not | |
5984 // allowed. | |
5985 Map* LookupElementsTransitionMap(ElementsKind elements_kind); | |
5986 | |
5987 // Returns the transitioned map for this map with the most generic | 5980 // Returns the transitioned map for this map with the most generic |
5988 // elements_kind that's found in |candidates|, or null handle if no match is | 5981 // elements_kind that's found in |candidates|, or |nullptr| if no match is |
5989 // found at all. | 5982 // found at all. |
5990 static Handle<Map> FindTransitionedMap(Handle<Map> map, | 5983 Map* FindElementsKindTransitionedMap(MapHandleList* candidates); |
5991 MapHandleList* candidates); | |
5992 | 5984 |
5993 inline bool CanTransition(); | 5985 inline bool CanTransition(); |
5994 | 5986 |
5995 inline bool IsBooleanMap(); | 5987 inline bool IsBooleanMap(); |
5996 inline bool IsPrimitiveMap(); | 5988 inline bool IsPrimitiveMap(); |
5997 inline bool IsJSReceiverMap(); | 5989 inline bool IsJSReceiverMap(); |
5998 inline bool IsJSObjectMap(); | 5990 inline bool IsJSObjectMap(); |
5999 inline bool IsJSArrayMap(); | 5991 inline bool IsJSArrayMap(); |
6000 inline bool IsJSFunctionMap(); | 5992 inline bool IsJSFunctionMap(); |
6001 inline bool IsStringMap(); | 5993 inline bool IsStringMap(); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6140 #if TRACE_MAPS | 6132 #if TRACE_MAPS |
6141 static void TraceTransition(const char* what, Map* from, Map* to, Name* name); | 6133 static void TraceTransition(const char* what, Map* from, Map* to, Name* name); |
6142 static void TraceAllTransitions(Map* map); | 6134 static void TraceAllTransitions(Map* map); |
6143 #endif | 6135 #endif |
6144 | 6136 |
6145 static inline Handle<Map> AddMissingTransitionsForTesting( | 6137 static inline Handle<Map> AddMissingTransitionsForTesting( |
6146 Handle<Map> split_map, Handle<DescriptorArray> descriptors, | 6138 Handle<Map> split_map, Handle<DescriptorArray> descriptors, |
6147 Handle<LayoutDescriptor> full_layout_descriptor); | 6139 Handle<LayoutDescriptor> full_layout_descriptor); |
6148 | 6140 |
6149 private: | 6141 private: |
| 6142 // Returns the map that this (root) map transitions to if its elements_kind |
| 6143 // is changed to |elements_kind|, or |nullptr| if no such map is cached yet. |
| 6144 Map* LookupElementsTransitionMap(ElementsKind elements_kind); |
| 6145 |
| 6146 // Tries to replay property transitions starting from this (root) map using |
| 6147 // the descriptor array of the |map|. The |root_map| is expected to have |
| 6148 // proper elements kind and therefore elements kinds transitions are not |
| 6149 // taken by this function. Returns |nullptr| if matching transition map is |
| 6150 // not found. |
| 6151 Map* TryReplayPropertyTransitions(Map* map); |
| 6152 |
6150 static void ConnectTransition(Handle<Map> parent, Handle<Map> child, | 6153 static void ConnectTransition(Handle<Map> parent, Handle<Map> child, |
6151 Handle<Name> name, SimpleTransitionFlag flag); | 6154 Handle<Name> name, SimpleTransitionFlag flag); |
6152 | 6155 |
6153 bool EquivalentToForTransition(Map* other); | 6156 bool EquivalentToForTransition(Map* other); |
6154 static Handle<Map> RawCopy(Handle<Map> map, int instance_size); | 6157 static Handle<Map> RawCopy(Handle<Map> map, int instance_size); |
6155 static Handle<Map> ShareDescriptor(Handle<Map> map, | 6158 static Handle<Map> ShareDescriptor(Handle<Map> map, |
6156 Handle<DescriptorArray> descriptors, | 6159 Handle<DescriptorArray> descriptors, |
6157 Descriptor* descriptor); | 6160 Descriptor* descriptor); |
6158 static Handle<Map> AddMissingTransitions( | 6161 static Handle<Map> AddMissingTransitions( |
6159 Handle<Map> map, Handle<DescriptorArray> descriptors, | 6162 Handle<Map> map, Handle<DescriptorArray> descriptors, |
(...skipping 16 matching lines...) Expand all Loading... |
6176 Descriptor* descriptor, | 6179 Descriptor* descriptor, |
6177 int index, | 6180 int index, |
6178 TransitionFlag flag); | 6181 TransitionFlag flag); |
6179 static MUST_USE_RESULT MaybeHandle<Map> TryReconfigureExistingProperty( | 6182 static MUST_USE_RESULT MaybeHandle<Map> TryReconfigureExistingProperty( |
6180 Handle<Map> map, int descriptor, PropertyKind kind, | 6183 Handle<Map> map, int descriptor, PropertyKind kind, |
6181 PropertyAttributes attributes, const char** reason); | 6184 PropertyAttributes attributes, const char** reason); |
6182 | 6185 |
6183 static Handle<Map> CopyNormalized(Handle<Map> map, | 6186 static Handle<Map> CopyNormalized(Handle<Map> map, |
6184 PropertyNormalizationMode mode); | 6187 PropertyNormalizationMode mode); |
6185 | 6188 |
| 6189 static Handle<Map> Reconfigure(Handle<Map> map, |
| 6190 ElementsKind new_elements_kind, |
| 6191 int modify_index, PropertyKind new_kind, |
| 6192 PropertyAttributes new_attributes, |
| 6193 Representation new_representation, |
| 6194 Handle<FieldType> new_field_type, |
| 6195 StoreMode store_mode); |
| 6196 |
| 6197 static Handle<Map> CopyGeneralizeAllRepresentations( |
| 6198 Handle<Map> map, ElementsKind elements_kind, int modify_index, |
| 6199 StoreMode store_mode, PropertyKind kind, PropertyAttributes attributes, |
| 6200 const char* reason); |
| 6201 |
6186 // Fires when the layout of an object with a leaf map changes. | 6202 // Fires when the layout of an object with a leaf map changes. |
6187 // This includes adding transitions to the leaf map or changing | 6203 // This includes adding transitions to the leaf map or changing |
6188 // the descriptor array. | 6204 // the descriptor array. |
6189 inline void NotifyLeafMapLayoutChange(); | 6205 inline void NotifyLeafMapLayoutChange(); |
6190 | 6206 |
6191 void DeprecateTransitionTree(); | 6207 void DeprecateTransitionTree(); |
6192 | 6208 |
6193 void ReplaceDescriptors(DescriptorArray* new_descriptors, | 6209 void ReplaceDescriptors(DescriptorArray* new_descriptors, |
6194 LayoutDescriptor* new_layout_descriptor); | 6210 LayoutDescriptor* new_layout_descriptor); |
6195 | 6211 |
(...skipping 4564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10760 } | 10776 } |
10761 return value; | 10777 return value; |
10762 } | 10778 } |
10763 }; | 10779 }; |
10764 | 10780 |
10765 | 10781 |
10766 } // NOLINT, false-positive due to second-order macros. | 10782 } // NOLINT, false-positive due to second-order macros. |
10767 } // NOLINT, false-positive due to second-order macros. | 10783 } // NOLINT, false-positive due to second-order macros. |
10768 | 10784 |
10769 #endif // V8_OBJECTS_H_ | 10785 #endif // V8_OBJECTS_H_ |
OLD | NEW |