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 3177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3188 inline int GetSortedKeyIndex(int descriptor_number); | 3188 inline int GetSortedKeyIndex(int descriptor_number); |
3189 inline void SetSortedKey(int pointer, int descriptor_number); | 3189 inline void SetSortedKey(int pointer, int descriptor_number); |
3190 | 3190 |
3191 // Accessor for complete descriptor. | 3191 // Accessor for complete descriptor. |
3192 inline void Get(int descriptor_number, Descriptor* desc); | 3192 inline void Get(int descriptor_number, Descriptor* desc); |
3193 inline void Set(int descriptor_number, Descriptor* desc); | 3193 inline void Set(int descriptor_number, Descriptor* desc); |
3194 inline void Set(int descriptor_number, Name* key, Object* value, | 3194 inline void Set(int descriptor_number, Name* key, Object* value, |
3195 PropertyDetails details); | 3195 PropertyDetails details); |
3196 void Replace(int descriptor_number, Descriptor* descriptor); | 3196 void Replace(int descriptor_number, Descriptor* descriptor); |
3197 | 3197 |
3198 // Generalizes representation and field type of all field descriptors. | 3198 // Generalizes constness, representation and field type of all field |
| 3199 // descriptors. |
3199 void GeneralizeAllFields(); | 3200 void GeneralizeAllFields(); |
3200 | 3201 |
3201 // Append automatically sets the enumeration index. This should only be used | 3202 // Append automatically sets the enumeration index. This should only be used |
3202 // to add descriptors in bulk at the end, followed by sorting the descriptor | 3203 // to add descriptors in bulk at the end, followed by sorting the descriptor |
3203 // array. | 3204 // array. |
3204 inline void Append(Descriptor* desc); | 3205 inline void Append(Descriptor* desc); |
3205 | 3206 |
3206 static Handle<DescriptorArray> CopyUpTo(Handle<DescriptorArray> desc, | 3207 static Handle<DescriptorArray> CopyUpTo(Handle<DescriptorArray> desc, |
3207 int enumeration_index, | 3208 int enumeration_index, |
3208 int slack = 0); | 3209 int slack = 0); |
(...skipping 2725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5934 bool InstancesNeedRewriting(Map* target); | 5935 bool InstancesNeedRewriting(Map* target); |
5935 bool InstancesNeedRewriting(Map* target, int target_number_of_fields, | 5936 bool InstancesNeedRewriting(Map* target, int target_number_of_fields, |
5936 int target_inobject, int target_unused, | 5937 int target_inobject, int target_unused, |
5937 int* old_number_of_fields); | 5938 int* old_number_of_fields); |
5938 // TODO(ishell): moveit! | 5939 // TODO(ishell): moveit! |
5939 static Handle<Map> GeneralizeAllFields(Handle<Map> map); | 5940 static Handle<Map> GeneralizeAllFields(Handle<Map> map); |
5940 MUST_USE_RESULT static Handle<FieldType> GeneralizeFieldType( | 5941 MUST_USE_RESULT static Handle<FieldType> GeneralizeFieldType( |
5941 Representation rep1, Handle<FieldType> type1, Representation rep2, | 5942 Representation rep1, Handle<FieldType> type1, Representation rep2, |
5942 Handle<FieldType> type2, Isolate* isolate); | 5943 Handle<FieldType> type2, Isolate* isolate); |
5943 static void GeneralizeField(Handle<Map> map, int modify_index, | 5944 static void GeneralizeField(Handle<Map> map, int modify_index, |
| 5945 PropertyConstness new_constness, |
5944 Representation new_representation, | 5946 Representation new_representation, |
5945 Handle<FieldType> new_field_type); | 5947 Handle<FieldType> new_field_type); |
5946 | 5948 |
5947 static Handle<Map> ReconfigureProperty(Handle<Map> map, int modify_index, | 5949 static Handle<Map> ReconfigureProperty(Handle<Map> map, int modify_index, |
5948 PropertyKind new_kind, | 5950 PropertyKind new_kind, |
5949 PropertyAttributes new_attributes, | 5951 PropertyAttributes new_attributes, |
5950 Representation new_representation, | 5952 Representation new_representation, |
5951 Handle<FieldType> new_field_type); | 5953 Handle<FieldType> new_field_type); |
5952 | 5954 |
5953 static Handle<Map> ReconfigureElementsKind(Handle<Map> map, | 5955 static Handle<Map> ReconfigureElementsKind(Handle<Map> map, |
5954 ElementsKind new_elements_kind); | 5956 ElementsKind new_elements_kind); |
5955 | 5957 |
5956 static Handle<Map> PrepareForDataProperty(Handle<Map> old_map, | 5958 static Handle<Map> PrepareForDataProperty(Handle<Map> old_map, |
5957 int descriptor_number, | 5959 int descriptor_number, |
| 5960 PropertyConstness constness, |
5958 Handle<Object> value); | 5961 Handle<Object> value); |
5959 | 5962 |
5960 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode, | 5963 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode, |
5961 const char* reason); | 5964 const char* reason); |
5962 | 5965 |
5963 // Tells whether the map is used for JSObjects in dictionary mode (ie | 5966 // Tells whether the map is used for JSObjects in dictionary mode (ie |
5964 // normalized objects, ie objects for which HasFastProperties returns false). | 5967 // normalized objects, ie objects for which HasFastProperties returns false). |
5965 // A map can never be used for both dictionary mode and fast mode JSObjects. | 5968 // A map can never be used for both dictionary mode and fast mode JSObjects. |
5966 // False by default and for HeapObjects that are not JSObjects. | 5969 // False by default and for HeapObjects that are not JSObjects. |
5967 inline void set_dictionary_map(bool value); | 5970 inline void set_dictionary_map(bool value); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6072 static Handle<Map> CopyDropDescriptors(Handle<Map> map); | 6075 static Handle<Map> CopyDropDescriptors(Handle<Map> map); |
6073 static Handle<Map> CopyInsertDescriptor(Handle<Map> map, | 6076 static Handle<Map> CopyInsertDescriptor(Handle<Map> map, |
6074 Descriptor* descriptor, | 6077 Descriptor* descriptor, |
6075 TransitionFlag flag); | 6078 TransitionFlag flag); |
6076 | 6079 |
6077 static Handle<Object> WrapFieldType(Handle<FieldType> type); | 6080 static Handle<Object> WrapFieldType(Handle<FieldType> type); |
6078 static FieldType* UnwrapFieldType(Object* wrapped_type); | 6081 static FieldType* UnwrapFieldType(Object* wrapped_type); |
6079 | 6082 |
6080 MUST_USE_RESULT static MaybeHandle<Map> CopyWithField( | 6083 MUST_USE_RESULT static MaybeHandle<Map> CopyWithField( |
6081 Handle<Map> map, Handle<Name> name, Handle<FieldType> type, | 6084 Handle<Map> map, Handle<Name> name, Handle<FieldType> type, |
6082 PropertyAttributes attributes, Representation representation, | 6085 PropertyAttributes attributes, PropertyConstness constness, |
6083 TransitionFlag flag); | 6086 Representation representation, TransitionFlag flag); |
6084 | 6087 |
6085 MUST_USE_RESULT static MaybeHandle<Map> CopyWithConstant( | 6088 MUST_USE_RESULT static MaybeHandle<Map> CopyWithConstant( |
6086 Handle<Map> map, | 6089 Handle<Map> map, |
6087 Handle<Name> name, | 6090 Handle<Name> name, |
6088 Handle<Object> constant, | 6091 Handle<Object> constant, |
6089 PropertyAttributes attributes, | 6092 PropertyAttributes attributes, |
6090 TransitionFlag flag); | 6093 TransitionFlag flag); |
6091 | 6094 |
6092 // Returns a new map with all transitions dropped from the given map and | 6095 // Returns a new map with all transitions dropped from the given map and |
6093 // the ElementsKind set. | 6096 // the ElementsKind set. |
(...skipping 20 matching lines...) Expand all Loading... |
6114 | 6117 |
6115 | 6118 |
6116 // Maximal number of fast properties. Used to restrict the number of map | 6119 // Maximal number of fast properties. Used to restrict the number of map |
6117 // transitions to avoid an explosion in the number of maps for objects used as | 6120 // transitions to avoid an explosion in the number of maps for objects used as |
6118 // dictionaries. | 6121 // dictionaries. |
6119 inline bool TooManyFastProperties(StoreFromKeyed store_mode); | 6122 inline bool TooManyFastProperties(StoreFromKeyed store_mode); |
6120 static Handle<Map> TransitionToDataProperty(Handle<Map> map, | 6123 static Handle<Map> TransitionToDataProperty(Handle<Map> map, |
6121 Handle<Name> name, | 6124 Handle<Name> name, |
6122 Handle<Object> value, | 6125 Handle<Object> value, |
6123 PropertyAttributes attributes, | 6126 PropertyAttributes attributes, |
| 6127 PropertyConstness constness, |
6124 StoreFromKeyed store_mode); | 6128 StoreFromKeyed store_mode); |
6125 static Handle<Map> TransitionToAccessorProperty( | 6129 static Handle<Map> TransitionToAccessorProperty( |
6126 Isolate* isolate, Handle<Map> map, Handle<Name> name, int descriptor, | 6130 Isolate* isolate, Handle<Map> map, Handle<Name> name, int descriptor, |
6127 Handle<Object> getter, Handle<Object> setter, | 6131 Handle<Object> getter, Handle<Object> setter, |
6128 PropertyAttributes attributes); | 6132 PropertyAttributes attributes); |
6129 static Handle<Map> ReconfigureExistingProperty(Handle<Map> map, | 6133 static Handle<Map> ReconfigureExistingProperty(Handle<Map> map, |
6130 int descriptor, | 6134 int descriptor, |
6131 PropertyKind kind, | 6135 PropertyKind kind, |
6132 PropertyAttributes attributes); | 6136 PropertyAttributes attributes); |
6133 | 6137 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6405 void DeprecateTransitionTree(); | 6409 void DeprecateTransitionTree(); |
6406 | 6410 |
6407 void ReplaceDescriptors(DescriptorArray* new_descriptors, | 6411 void ReplaceDescriptors(DescriptorArray* new_descriptors, |
6408 LayoutDescriptor* new_layout_descriptor); | 6412 LayoutDescriptor* new_layout_descriptor); |
6409 | 6413 |
6410 | 6414 |
6411 // Update field type of the given descriptor to new representation and new | 6415 // Update field type of the given descriptor to new representation and new |
6412 // type. The type must be prepared for storing in descriptor array: | 6416 // type. The type must be prepared for storing in descriptor array: |
6413 // it must be either a simple type or a map wrapped in a weak cell. | 6417 // it must be either a simple type or a map wrapped in a weak cell. |
6414 void UpdateFieldType(int descriptor_number, Handle<Name> name, | 6418 void UpdateFieldType(int descriptor_number, Handle<Name> name, |
| 6419 PropertyConstness new_constness, |
6415 Representation new_representation, | 6420 Representation new_representation, |
6416 Handle<Object> new_wrapped_type); | 6421 Handle<Object> new_wrapped_type); |
6417 | 6422 |
6418 // TODO(ishell): Move to MapUpdater. | 6423 // TODO(ishell): Move to MapUpdater. |
6419 void PrintReconfiguration(FILE* file, int modify_index, PropertyKind kind, | 6424 void PrintReconfiguration(FILE* file, int modify_index, PropertyKind kind, |
6420 PropertyAttributes attributes); | 6425 PropertyAttributes attributes); |
6421 // TODO(ishell): Move to MapUpdater. | 6426 // TODO(ishell): Move to MapUpdater. |
6422 void PrintGeneralization(FILE* file, const char* reason, int modify_index, | 6427 void PrintGeneralization(FILE* file, const char* reason, int modify_index, |
6423 int split, int descriptors, bool constant_to_field, | 6428 int split, int descriptors, bool constant_to_field, |
6424 Representation old_representation, | 6429 Representation old_representation, |
(...skipping 5206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11631 } | 11636 } |
11632 }; | 11637 }; |
11633 | 11638 |
11634 | 11639 |
11635 } // NOLINT, false-positive due to second-order macros. | 11640 } // NOLINT, false-positive due to second-order macros. |
11636 } // NOLINT, false-positive due to second-order macros. | 11641 } // NOLINT, false-positive due to second-order macros. |
11637 | 11642 |
11638 #include "src/objects/object-macros-undef.h" | 11643 #include "src/objects/object-macros-undef.h" |
11639 | 11644 |
11640 #endif // V8_OBJECTS_H_ | 11645 #endif // V8_OBJECTS_H_ |
OLD | NEW |