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 5880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5891 int* old_number_of_fields); | 5891 int* old_number_of_fields); |
5892 // TODO(ishell): moveit! | 5892 // TODO(ishell): moveit! |
5893 static Handle<Map> GeneralizeAllFieldRepresentations(Handle<Map> map); | 5893 static Handle<Map> GeneralizeAllFieldRepresentations(Handle<Map> map); |
5894 MUST_USE_RESULT static Handle<HeapType> GeneralizeFieldType( | 5894 MUST_USE_RESULT static Handle<HeapType> GeneralizeFieldType( |
5895 Handle<HeapType> type1, | 5895 Handle<HeapType> type1, |
5896 Handle<HeapType> type2, | 5896 Handle<HeapType> type2, |
5897 Isolate* isolate); | 5897 Isolate* isolate); |
5898 static void GeneralizeFieldType(Handle<Map> map, int modify_index, | 5898 static void GeneralizeFieldType(Handle<Map> map, int modify_index, |
5899 Representation new_representation, | 5899 Representation new_representation, |
5900 Handle<HeapType> new_field_type); | 5900 Handle<HeapType> new_field_type); |
5901 static Handle<Map> GeneralizeRepresentation( | 5901 static Handle<Map> ReconfigureProperty(Handle<Map> map, int modify_index, |
5902 Handle<Map> map, | 5902 PropertyKind new_kind, |
5903 int modify_index, | 5903 PropertyAttributes new_attributes, |
5904 Representation new_representation, | 5904 Representation new_representation, |
5905 Handle<HeapType> new_field_type, | 5905 Handle<HeapType> new_field_type, |
5906 StoreMode store_mode); | 5906 StoreMode store_mode); |
5907 static Handle<Map> CopyGeneralizeAllRepresentations( | 5907 static Handle<Map> CopyGeneralizeAllRepresentations( |
5908 Handle<Map> map, | 5908 Handle<Map> map, int modify_index, StoreMode store_mode, |
5909 int modify_index, | 5909 PropertyKind kind, PropertyAttributes attributes, const char* reason); |
5910 StoreMode store_mode, | |
5911 PropertyAttributes attributes, | |
5912 const char* reason); | |
5913 static Handle<Map> CopyGeneralizeAllRepresentations( | |
5914 Handle<Map> map, | |
5915 int modify_index, | |
5916 StoreMode store_mode, | |
5917 const char* reason); | |
5918 | 5910 |
5919 static Handle<Map> PrepareForDataProperty(Handle<Map> old_map, | 5911 static Handle<Map> PrepareForDataProperty(Handle<Map> old_map, |
5920 int descriptor_number, | 5912 int descriptor_number, |
5921 Handle<Object> value); | 5913 Handle<Object> value); |
5922 | 5914 |
5923 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode, | 5915 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode, |
5924 const char* reason); | 5916 const char* reason); |
5925 | 5917 |
5926 // Returns the constructor name (the name (possibly, inferred name) of the | 5918 // Returns the constructor name (the name (possibly, inferred name) of the |
5927 // function that was used to instantiate the object). | 5919 // function that was used to instantiate the object). |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6135 // dictionaries. | 6127 // dictionaries. |
6136 inline bool TooManyFastProperties(StoreFromKeyed store_mode); | 6128 inline bool TooManyFastProperties(StoreFromKeyed store_mode); |
6137 static Handle<Map> TransitionToDataProperty(Handle<Map> map, | 6129 static Handle<Map> TransitionToDataProperty(Handle<Map> map, |
6138 Handle<Name> name, | 6130 Handle<Name> name, |
6139 Handle<Object> value, | 6131 Handle<Object> value, |
6140 PropertyAttributes attributes, | 6132 PropertyAttributes attributes, |
6141 StoreFromKeyed store_mode); | 6133 StoreFromKeyed store_mode); |
6142 static Handle<Map> TransitionToAccessorProperty( | 6134 static Handle<Map> TransitionToAccessorProperty( |
6143 Handle<Map> map, Handle<Name> name, AccessorComponent component, | 6135 Handle<Map> map, Handle<Name> name, AccessorComponent component, |
6144 Handle<Object> accessor, PropertyAttributes attributes); | 6136 Handle<Object> accessor, PropertyAttributes attributes); |
6145 static Handle<Map> ReconfigureDataProperty(Handle<Map> map, int descriptor, | 6137 static Handle<Map> ReconfigureExistingProperty(Handle<Map> map, |
6146 PropertyAttributes attributes); | 6138 int descriptor, |
| 6139 PropertyKind kind, |
| 6140 PropertyAttributes attributes); |
6147 | 6141 |
6148 inline void AppendDescriptor(Descriptor* desc); | 6142 inline void AppendDescriptor(Descriptor* desc); |
6149 | 6143 |
6150 // Returns a copy of the map, prepared for inserting into the transition | 6144 // Returns a copy of the map, prepared for inserting into the transition |
6151 // tree (if the |map| owns descriptors then the new one will share | 6145 // tree (if the |map| owns descriptors then the new one will share |
6152 // descriptors with |map|). | 6146 // descriptors with |map|). |
6153 static Handle<Map> CopyForTransition(Handle<Map> map, const char* reason); | 6147 static Handle<Map> CopyForTransition(Handle<Map> map, const char* reason); |
6154 | 6148 |
6155 // Returns a copy of the map, with all transitions dropped from the | 6149 // Returns a copy of the map, with all transitions dropped from the |
6156 // instance descriptors. | 6150 // instance descriptors. |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6421 Handle<Map> map, Handle<DescriptorArray> descriptors, | 6415 Handle<Map> map, Handle<DescriptorArray> descriptors, |
6422 Handle<LayoutDescriptor> layout_descriptor, TransitionFlag flag, | 6416 Handle<LayoutDescriptor> layout_descriptor, TransitionFlag flag, |
6423 MaybeHandle<Name> maybe_name, const char* reason, | 6417 MaybeHandle<Name> maybe_name, const char* reason, |
6424 SimpleTransitionFlag simple_flag); | 6418 SimpleTransitionFlag simple_flag); |
6425 | 6419 |
6426 static Handle<Map> CopyReplaceDescriptor(Handle<Map> map, | 6420 static Handle<Map> CopyReplaceDescriptor(Handle<Map> map, |
6427 Handle<DescriptorArray> descriptors, | 6421 Handle<DescriptorArray> descriptors, |
6428 Descriptor* descriptor, | 6422 Descriptor* descriptor, |
6429 int index, | 6423 int index, |
6430 TransitionFlag flag); | 6424 TransitionFlag flag); |
| 6425 static MUST_USE_RESULT MaybeHandle<Map> TryReconfigureExistingProperty( |
| 6426 Handle<Map> map, int descriptor, PropertyKind kind, |
| 6427 PropertyAttributes attributes, const char** reason); |
6431 | 6428 |
6432 static Handle<Map> CopyNormalized(Handle<Map> map, | 6429 static Handle<Map> CopyNormalized(Handle<Map> map, |
6433 PropertyNormalizationMode mode); | 6430 PropertyNormalizationMode mode); |
6434 | 6431 |
6435 // Fires when the layout of an object with a leaf map changes. | 6432 // Fires when the layout of an object with a leaf map changes. |
6436 // This includes adding transitions to the leaf map or changing | 6433 // This includes adding transitions to the leaf map or changing |
6437 // the descriptor array. | 6434 // the descriptor array. |
6438 inline void NotifyLeafMapLayoutChange(); | 6435 inline void NotifyLeafMapLayoutChange(); |
6439 | 6436 |
6440 static Handle<Map> TransitionElementsToSlow(Handle<Map> object, | 6437 static Handle<Map> TransitionElementsToSlow(Handle<Map> object, |
(...skipping 13 matching lines...) Expand all Loading... |
6454 PropertyAttributes attributes, | 6451 PropertyAttributes attributes, |
6455 DescriptorArray* new_descriptors, | 6452 DescriptorArray* new_descriptors, |
6456 LayoutDescriptor* new_layout_descriptor); | 6453 LayoutDescriptor* new_layout_descriptor); |
6457 | 6454 |
6458 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); | 6455 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); |
6459 | 6456 |
6460 void UpdateFieldType(int descriptor_number, Handle<Name> name, | 6457 void UpdateFieldType(int descriptor_number, Handle<Name> name, |
6461 Representation new_representation, | 6458 Representation new_representation, |
6462 Handle<HeapType> new_type); | 6459 Handle<HeapType> new_type); |
6463 | 6460 |
| 6461 void PrintReconfiguration(FILE* file, int modify_index, PropertyKind kind, |
| 6462 PropertyAttributes attributes); |
6464 void PrintGeneralization(FILE* file, | 6463 void PrintGeneralization(FILE* file, |
6465 const char* reason, | 6464 const char* reason, |
6466 int modify_index, | 6465 int modify_index, |
6467 int split, | 6466 int split, |
6468 int descriptors, | 6467 int descriptors, |
6469 bool constant_to_field, | 6468 bool constant_to_field, |
6470 Representation old_representation, | 6469 Representation old_representation, |
6471 Representation new_representation, | 6470 Representation new_representation, |
6472 HeapType* old_field_type, | 6471 HeapType* old_field_type, |
6473 HeapType* new_field_type); | 6472 HeapType* new_field_type); |
6474 | 6473 |
| 6474 #ifdef OBJECT_PRINT |
| 6475 void PrintPrototypeTransitions(std::ostream& os); // NOLINT |
| 6476 #endif |
| 6477 |
6475 static inline void SetPrototypeTransitions( | 6478 static inline void SetPrototypeTransitions( |
6476 Handle<Map> map, | 6479 Handle<Map> map, |
6477 Handle<FixedArray> prototype_transitions); | 6480 Handle<FixedArray> prototype_transitions); |
6478 | 6481 |
6479 static Handle<Map> GetPrototypeTransition(Handle<Map> map, | 6482 static Handle<Map> GetPrototypeTransition(Handle<Map> map, |
6480 Handle<Object> prototype); | 6483 Handle<Object> prototype); |
6481 static Handle<Map> PutPrototypeTransition(Handle<Map> map, | 6484 static Handle<Map> PutPrototypeTransition(Handle<Map> map, |
6482 Handle<Object> prototype, | 6485 Handle<Object> prototype, |
6483 Handle<Map> target_map); | 6486 Handle<Map> target_map); |
6484 | 6487 |
(...skipping 4003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10488 | 10491 |
10489 // Note: Returns undefined instead in case of a hole. | 10492 // Note: Returns undefined instead in case of a hole. |
10490 Object* GetComponent(AccessorComponent component); | 10493 Object* GetComponent(AccessorComponent component); |
10491 | 10494 |
10492 // Set both components, skipping arguments which are a JavaScript null. | 10495 // Set both components, skipping arguments which are a JavaScript null. |
10493 void SetComponents(Object* getter, Object* setter) { | 10496 void SetComponents(Object* getter, Object* setter) { |
10494 if (!getter->IsNull()) set_getter(getter); | 10497 if (!getter->IsNull()) set_getter(getter); |
10495 if (!setter->IsNull()) set_setter(setter); | 10498 if (!setter->IsNull()) set_setter(setter); |
10496 } | 10499 } |
10497 | 10500 |
| 10501 bool Equals(AccessorPair* pair) { |
| 10502 return (this == pair) || pair->Equals(getter(), setter()); |
| 10503 } |
| 10504 |
| 10505 bool Equals(Object* getter_value, Object* setter_value) { |
| 10506 return (getter() == getter_value) && (setter() == setter_value); |
| 10507 } |
| 10508 |
10498 bool ContainsAccessor() { | 10509 bool ContainsAccessor() { |
10499 return IsJSAccessor(getter()) || IsJSAccessor(setter()); | 10510 return IsJSAccessor(getter()) || IsJSAccessor(setter()); |
10500 } | 10511 } |
10501 | 10512 |
10502 // Dispatched behavior. | 10513 // Dispatched behavior. |
10503 DECLARE_PRINTER(AccessorPair) | 10514 DECLARE_PRINTER(AccessorPair) |
10504 DECLARE_VERIFIER(AccessorPair) | 10515 DECLARE_VERIFIER(AccessorPair) |
10505 | 10516 |
10506 static const int kGetterOffset = HeapObject::kHeaderSize; | 10517 static const int kGetterOffset = HeapObject::kHeaderSize; |
10507 static const int kSetterOffset = kGetterOffset + kPointerSize; | 10518 static const int kSetterOffset = kGetterOffset + kPointerSize; |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10965 } else { | 10976 } else { |
10966 value &= ~(1 << bit_position); | 10977 value &= ~(1 << bit_position); |
10967 } | 10978 } |
10968 return value; | 10979 return value; |
10969 } | 10980 } |
10970 }; | 10981 }; |
10971 | 10982 |
10972 } } // namespace v8::internal | 10983 } } // namespace v8::internal |
10973 | 10984 |
10974 #endif // V8_OBJECTS_H_ | 10985 #endif // V8_OBJECTS_H_ |
OLD | NEW |