| 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 5871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5882 int* old_number_of_fields); | 5882 int* old_number_of_fields); |
| 5883 // TODO(ishell): moveit! | 5883 // TODO(ishell): moveit! |
| 5884 static Handle<Map> GeneralizeAllFieldRepresentations(Handle<Map> map); | 5884 static Handle<Map> GeneralizeAllFieldRepresentations(Handle<Map> map); |
| 5885 MUST_USE_RESULT static Handle<HeapType> GeneralizeFieldType( | 5885 MUST_USE_RESULT static Handle<HeapType> GeneralizeFieldType( |
| 5886 Handle<HeapType> type1, | 5886 Handle<HeapType> type1, |
| 5887 Handle<HeapType> type2, | 5887 Handle<HeapType> type2, |
| 5888 Isolate* isolate); | 5888 Isolate* isolate); |
| 5889 static void GeneralizeFieldType(Handle<Map> map, int modify_index, | 5889 static void GeneralizeFieldType(Handle<Map> map, int modify_index, |
| 5890 Representation new_representation, | 5890 Representation new_representation, |
| 5891 Handle<HeapType> new_field_type); | 5891 Handle<HeapType> new_field_type); |
| 5892 static Handle<Map> GeneralizeRepresentation( | 5892 static Handle<Map> ReconfigureProperty(Handle<Map> map, int modify_index, |
| 5893 Handle<Map> map, | 5893 PropertyKind new_kind, |
| 5894 int modify_index, | 5894 PropertyAttributes new_attributes, |
| 5895 Representation new_representation, | 5895 Representation new_representation, |
| 5896 Handle<HeapType> new_field_type, | 5896 Handle<HeapType> new_field_type, |
| 5897 StoreMode store_mode); | 5897 StoreMode store_mode); |
| 5898 static Handle<Map> CopyGeneralizeAllRepresentations( | 5898 static Handle<Map> CopyGeneralizeAllRepresentations( |
| 5899 Handle<Map> map, | 5899 Handle<Map> map, int modify_index, StoreMode store_mode, |
| 5900 int modify_index, | 5900 PropertyKind kind, PropertyAttributes attributes, const char* reason); |
| 5901 StoreMode store_mode, | |
| 5902 PropertyAttributes attributes, | |
| 5903 const char* reason); | |
| 5904 static Handle<Map> CopyGeneralizeAllRepresentations( | |
| 5905 Handle<Map> map, | |
| 5906 int modify_index, | |
| 5907 StoreMode store_mode, | |
| 5908 const char* reason); | |
| 5909 | 5901 |
| 5910 static Handle<Map> PrepareForDataProperty(Handle<Map> old_map, | 5902 static Handle<Map> PrepareForDataProperty(Handle<Map> old_map, |
| 5911 int descriptor_number, | 5903 int descriptor_number, |
| 5912 Handle<Object> value); | 5904 Handle<Object> value); |
| 5913 | 5905 |
| 5914 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode, | 5906 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode, |
| 5915 const char* reason); | 5907 const char* reason); |
| 5916 | 5908 |
| 5917 // Returns the constructor name (the name (possibly, inferred name) of the | 5909 // Returns the constructor name (the name (possibly, inferred name) of the |
| 5918 // function that was used to instantiate the object). | 5910 // function that was used to instantiate the object). |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6121 // dictionaries. | 6113 // dictionaries. |
| 6122 inline bool TooManyFastProperties(StoreFromKeyed store_mode); | 6114 inline bool TooManyFastProperties(StoreFromKeyed store_mode); |
| 6123 static Handle<Map> TransitionToDataProperty(Handle<Map> map, | 6115 static Handle<Map> TransitionToDataProperty(Handle<Map> map, |
| 6124 Handle<Name> name, | 6116 Handle<Name> name, |
| 6125 Handle<Object> value, | 6117 Handle<Object> value, |
| 6126 PropertyAttributes attributes, | 6118 PropertyAttributes attributes, |
| 6127 StoreFromKeyed store_mode); | 6119 StoreFromKeyed store_mode); |
| 6128 static Handle<Map> TransitionToAccessorProperty( | 6120 static Handle<Map> TransitionToAccessorProperty( |
| 6129 Handle<Map> map, Handle<Name> name, AccessorComponent component, | 6121 Handle<Map> map, Handle<Name> name, AccessorComponent component, |
| 6130 Handle<Object> accessor, PropertyAttributes attributes); | 6122 Handle<Object> accessor, PropertyAttributes attributes); |
| 6131 static Handle<Map> ReconfigureDataProperty(Handle<Map> map, int descriptor, | 6123 static Handle<Map> ReconfigureExistingProperty(Handle<Map> map, |
| 6132 PropertyAttributes attributes); | 6124 int descriptor, |
| 6125 PropertyKind kind, |
| 6126 PropertyAttributes attributes); |
| 6133 | 6127 |
| 6134 inline void AppendDescriptor(Descriptor* desc); | 6128 inline void AppendDescriptor(Descriptor* desc); |
| 6135 | 6129 |
| 6136 // Returns a copy of the map, prepared for inserting into the transition | 6130 // Returns a copy of the map, prepared for inserting into the transition |
| 6137 // tree (if the |map| owns descriptors then the new one will share | 6131 // tree (if the |map| owns descriptors then the new one will share |
| 6138 // descriptors with |map|). | 6132 // descriptors with |map|). |
| 6139 static Handle<Map> CopyForTransition(Handle<Map> map, const char* reason); | 6133 static Handle<Map> CopyForTransition(Handle<Map> map, const char* reason); |
| 6140 | 6134 |
| 6141 // Returns a copy of the map, with all transitions dropped from the | 6135 // Returns a copy of the map, with all transitions dropped from the |
| 6142 // instance descriptors. | 6136 // instance descriptors. |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6407 Handle<Map> map, Handle<DescriptorArray> descriptors, | 6401 Handle<Map> map, Handle<DescriptorArray> descriptors, |
| 6408 Handle<LayoutDescriptor> layout_descriptor, TransitionFlag flag, | 6402 Handle<LayoutDescriptor> layout_descriptor, TransitionFlag flag, |
| 6409 MaybeHandle<Name> maybe_name, const char* reason, | 6403 MaybeHandle<Name> maybe_name, const char* reason, |
| 6410 SimpleTransitionFlag simple_flag); | 6404 SimpleTransitionFlag simple_flag); |
| 6411 | 6405 |
| 6412 static Handle<Map> CopyReplaceDescriptor(Handle<Map> map, | 6406 static Handle<Map> CopyReplaceDescriptor(Handle<Map> map, |
| 6413 Handle<DescriptorArray> descriptors, | 6407 Handle<DescriptorArray> descriptors, |
| 6414 Descriptor* descriptor, | 6408 Descriptor* descriptor, |
| 6415 int index, | 6409 int index, |
| 6416 TransitionFlag flag); | 6410 TransitionFlag flag); |
| 6411 static MUST_USE_RESULT MaybeHandle<Map> TryReconfigureExistingProperty( |
| 6412 Handle<Map> map, int descriptor, PropertyKind kind, |
| 6413 PropertyAttributes attributes, const char** reason); |
| 6417 | 6414 |
| 6418 static Handle<Map> CopyNormalized(Handle<Map> map, | 6415 static Handle<Map> CopyNormalized(Handle<Map> map, |
| 6419 PropertyNormalizationMode mode); | 6416 PropertyNormalizationMode mode); |
| 6420 | 6417 |
| 6421 // Fires when the layout of an object with a leaf map changes. | 6418 // Fires when the layout of an object with a leaf map changes. |
| 6422 // This includes adding transitions to the leaf map or changing | 6419 // This includes adding transitions to the leaf map or changing |
| 6423 // the descriptor array. | 6420 // the descriptor array. |
| 6424 inline void NotifyLeafMapLayoutChange(); | 6421 inline void NotifyLeafMapLayoutChange(); |
| 6425 | 6422 |
| 6426 static Handle<Map> TransitionElementsToSlow(Handle<Map> object, | 6423 static Handle<Map> TransitionElementsToSlow(Handle<Map> object, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 6440 PropertyAttributes attributes, | 6437 PropertyAttributes attributes, |
| 6441 DescriptorArray* new_descriptors, | 6438 DescriptorArray* new_descriptors, |
| 6442 LayoutDescriptor* new_layout_descriptor); | 6439 LayoutDescriptor* new_layout_descriptor); |
| 6443 | 6440 |
| 6444 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); | 6441 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); |
| 6445 | 6442 |
| 6446 void UpdateFieldType(int descriptor_number, Handle<Name> name, | 6443 void UpdateFieldType(int descriptor_number, Handle<Name> name, |
| 6447 Representation new_representation, | 6444 Representation new_representation, |
| 6448 Handle<HeapType> new_type); | 6445 Handle<HeapType> new_type); |
| 6449 | 6446 |
| 6447 void PrintReconfiguration(FILE* file, int modify_index, PropertyKind kind, |
| 6448 PropertyAttributes attributes); |
| 6450 void PrintGeneralization(FILE* file, | 6449 void PrintGeneralization(FILE* file, |
| 6451 const char* reason, | 6450 const char* reason, |
| 6452 int modify_index, | 6451 int modify_index, |
| 6453 int split, | 6452 int split, |
| 6454 int descriptors, | 6453 int descriptors, |
| 6455 bool constant_to_field, | 6454 bool constant_to_field, |
| 6456 Representation old_representation, | 6455 Representation old_representation, |
| 6457 Representation new_representation, | 6456 Representation new_representation, |
| 6458 HeapType* old_field_type, | 6457 HeapType* old_field_type, |
| 6459 HeapType* new_field_type); | 6458 HeapType* new_field_type); |
| (...skipping 4039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10499 | 10498 |
| 10500 // Note: Returns undefined instead in case of a hole. | 10499 // Note: Returns undefined instead in case of a hole. |
| 10501 Object* GetComponent(AccessorComponent component); | 10500 Object* GetComponent(AccessorComponent component); |
| 10502 | 10501 |
| 10503 // Set both components, skipping arguments which are a JavaScript null. | 10502 // Set both components, skipping arguments which are a JavaScript null. |
| 10504 void SetComponents(Object* getter, Object* setter) { | 10503 void SetComponents(Object* getter, Object* setter) { |
| 10505 if (!getter->IsNull()) set_getter(getter); | 10504 if (!getter->IsNull()) set_getter(getter); |
| 10506 if (!setter->IsNull()) set_setter(setter); | 10505 if (!setter->IsNull()) set_setter(setter); |
| 10507 } | 10506 } |
| 10508 | 10507 |
| 10508 bool Equals(AccessorPair* pair) { |
| 10509 return (this == pair) || pair->Equals(getter(), setter()); |
| 10510 } |
| 10511 |
| 10512 bool Equals(Object* getter_value, Object* setter_value) { |
| 10513 return (getter() == getter_value) && (setter() == setter_value); |
| 10514 } |
| 10515 |
| 10509 bool ContainsAccessor() { | 10516 bool ContainsAccessor() { |
| 10510 return IsJSAccessor(getter()) || IsJSAccessor(setter()); | 10517 return IsJSAccessor(getter()) || IsJSAccessor(setter()); |
| 10511 } | 10518 } |
| 10512 | 10519 |
| 10513 // Dispatched behavior. | 10520 // Dispatched behavior. |
| 10514 DECLARE_PRINTER(AccessorPair) | 10521 DECLARE_PRINTER(AccessorPair) |
| 10515 DECLARE_VERIFIER(AccessorPair) | 10522 DECLARE_VERIFIER(AccessorPair) |
| 10516 | 10523 |
| 10517 static const int kGetterOffset = HeapObject::kHeaderSize; | 10524 static const int kGetterOffset = HeapObject::kHeaderSize; |
| 10518 static const int kSetterOffset = kGetterOffset + kPointerSize; | 10525 static const int kSetterOffset = kGetterOffset + kPointerSize; |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10978 } else { | 10985 } else { |
| 10979 value &= ~(1 << bit_position); | 10986 value &= ~(1 << bit_position); |
| 10980 } | 10987 } |
| 10981 return value; | 10988 return value; |
| 10982 } | 10989 } |
| 10983 }; | 10990 }; |
| 10984 | 10991 |
| 10985 } } // namespace v8::internal | 10992 } } // namespace v8::internal |
| 10986 | 10993 |
| 10987 #endif // V8_OBJECTS_H_ | 10994 #endif // V8_OBJECTS_H_ |
| OLD | NEW |