| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1502 } else if (FLAG_track_fields && representation.IsSmi()) { | 1502 } else if (FLAG_track_fields && representation.IsSmi()) { |
| 1503 return IsSmi(); | 1503 return IsSmi(); |
| 1504 } else if (FLAG_track_double_fields && representation.IsDouble()) { | 1504 } else if (FLAG_track_double_fields && representation.IsDouble()) { |
| 1505 return IsNumber(); | 1505 return IsNumber(); |
| 1506 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 1506 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { |
| 1507 return IsHeapObject(); | 1507 return IsHeapObject(); |
| 1508 } | 1508 } |
| 1509 return true; | 1509 return true; |
| 1510 } | 1510 } |
| 1511 | 1511 |
| 1512 Handle<HeapType> OptimalType(Isolate* isolate, Representation representation); |
| 1513 |
| 1512 inline MaybeObject* AllocateNewStorageFor(Heap* heap, | 1514 inline MaybeObject* AllocateNewStorageFor(Heap* heap, |
| 1513 Representation representation); | 1515 Representation representation); |
| 1514 | 1516 |
| 1515 // Returns true if the object is of the correct type to be used as a | 1517 // Returns true if the object is of the correct type to be used as a |
| 1516 // implementation of a JSObject's elements. | 1518 // implementation of a JSObject's elements. |
| 1517 inline bool HasValidElements(); | 1519 inline bool HasValidElements(); |
| 1518 | 1520 |
| 1519 inline bool HasSpecificClassOf(String* name); | 1521 inline bool HasSpecificClassOf(String* name); |
| 1520 | 1522 |
| 1521 MUST_USE_RESULT MaybeObject* ToObject(Isolate* isolate); // ECMA-262 9.9. | 1523 MUST_USE_RESULT MaybeObject* ToObject(Isolate* isolate); // ECMA-262 9.9. |
| (...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2577 ElementsKind elements_kind); | 2579 ElementsKind elements_kind); |
| 2578 | 2580 |
| 2579 static void TransitionElementsKind(Handle<JSObject> object, | 2581 static void TransitionElementsKind(Handle<JSObject> object, |
| 2580 ElementsKind to_kind); | 2582 ElementsKind to_kind); |
| 2581 | 2583 |
| 2582 // TODO(mstarzinger): Both public because of ConvertAnsSetLocalProperty(). | 2584 // TODO(mstarzinger): Both public because of ConvertAnsSetLocalProperty(). |
| 2583 static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map); | 2585 static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map); |
| 2584 static void GeneralizeFieldRepresentation(Handle<JSObject> object, | 2586 static void GeneralizeFieldRepresentation(Handle<JSObject> object, |
| 2585 int modify_index, | 2587 int modify_index, |
| 2586 Representation new_representation, | 2588 Representation new_representation, |
| 2589 Handle<HeapType> new_field_type, |
| 2587 StoreMode store_mode); | 2590 StoreMode store_mode); |
| 2588 | 2591 |
| 2589 // Convert the object to use the canonical dictionary | 2592 // Convert the object to use the canonical dictionary |
| 2590 // representation. If the object is expected to have additional properties | 2593 // representation. If the object is expected to have additional properties |
| 2591 // added this number can be indicated to have the backing store allocated to | 2594 // added this number can be indicated to have the backing store allocated to |
| 2592 // an initial capacity for holding these properties. | 2595 // an initial capacity for holding these properties. |
| 2593 static void NormalizeProperties(Handle<JSObject> object, | 2596 static void NormalizeProperties(Handle<JSObject> object, |
| 2594 PropertyNormalizationMode mode, | 2597 PropertyNormalizationMode mode, |
| 2595 int expected_additional_properties); | 2598 int expected_additional_properties); |
| 2596 | 2599 |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3402 // Initialize or change the enum cache, | 3405 // Initialize or change the enum cache, |
| 3403 // using the supplied storage for the small "bridge". | 3406 // using the supplied storage for the small "bridge". |
| 3404 void SetEnumCache(FixedArray* bridge_storage, | 3407 void SetEnumCache(FixedArray* bridge_storage, |
| 3405 FixedArray* new_cache, | 3408 FixedArray* new_cache, |
| 3406 Object* new_index_cache); | 3409 Object* new_index_cache); |
| 3407 | 3410 |
| 3408 // Accessors for fetching instance descriptor at descriptor number. | 3411 // Accessors for fetching instance descriptor at descriptor number. |
| 3409 inline Name* GetKey(int descriptor_number); | 3412 inline Name* GetKey(int descriptor_number); |
| 3410 inline Object** GetKeySlot(int descriptor_number); | 3413 inline Object** GetKeySlot(int descriptor_number); |
| 3411 inline Object* GetValue(int descriptor_number); | 3414 inline Object* GetValue(int descriptor_number); |
| 3415 inline void SetValue(int descriptor_number, Object* value); |
| 3412 inline Object** GetValueSlot(int descriptor_number); | 3416 inline Object** GetValueSlot(int descriptor_number); |
| 3413 inline Object** GetDescriptorStartSlot(int descriptor_number); | 3417 inline Object** GetDescriptorStartSlot(int descriptor_number); |
| 3414 inline Object** GetDescriptorEndSlot(int descriptor_number); | 3418 inline Object** GetDescriptorEndSlot(int descriptor_number); |
| 3415 inline PropertyDetails GetDetails(int descriptor_number); | 3419 inline PropertyDetails GetDetails(int descriptor_number); |
| 3416 inline PropertyType GetType(int descriptor_number); | 3420 inline PropertyType GetType(int descriptor_number); |
| 3417 inline int GetFieldIndex(int descriptor_number); | 3421 inline int GetFieldIndex(int descriptor_number); |
| 3422 inline HeapType* GetFieldType(int descriptor_number); |
| 3418 inline Object* GetConstant(int descriptor_number); | 3423 inline Object* GetConstant(int descriptor_number); |
| 3419 inline Object* GetCallbacksObject(int descriptor_number); | 3424 inline Object* GetCallbacksObject(int descriptor_number); |
| 3420 inline AccessorDescriptor* GetCallbacks(int descriptor_number); | 3425 inline AccessorDescriptor* GetCallbacks(int descriptor_number); |
| 3421 | 3426 |
| 3422 inline Name* GetSortedKey(int descriptor_number); | 3427 inline Name* GetSortedKey(int descriptor_number); |
| 3423 inline int GetSortedKeyIndex(int descriptor_number); | 3428 inline int GetSortedKeyIndex(int descriptor_number); |
| 3424 inline void SetSortedKey(int pointer, int descriptor_number); | 3429 inline void SetSortedKey(int pointer, int descriptor_number); |
| 3425 inline void InitializeRepresentations(Representation representation); | |
| 3426 inline void SetRepresentation(int descriptor_number, | 3430 inline void SetRepresentation(int descriptor_number, |
| 3427 Representation representation); | 3431 Representation representation); |
| 3428 | 3432 |
| 3429 // Accessor for complete descriptor. | 3433 // Accessor for complete descriptor. |
| 3430 inline void Get(int descriptor_number, Descriptor* desc); | 3434 inline void Get(int descriptor_number, Descriptor* desc); |
| 3431 inline void Set(int descriptor_number, Descriptor* desc); | 3435 inline void Set(int descriptor_number, Descriptor* desc); |
| 3432 void Replace(int descriptor_number, Descriptor* descriptor); | 3436 void Replace(int descriptor_number, Descriptor* descriptor); |
| 3433 | 3437 |
| 3434 // Append automatically sets the enumeration index. This should only be used | 3438 // Append automatically sets the enumeration index. This should only be used |
| 3435 // to add descriptors in bulk at the end, followed by sorting the descriptor | 3439 // to add descriptors in bulk at the end, followed by sorting the descriptor |
| (...skipping 2540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5976 // described by this map. The group is deoptimized whenever an object | 5980 // described by this map. The group is deoptimized whenever an object |
| 5977 // described by this map changes shape (and transitions to a new map), | 5981 // described by this map changes shape (and transitions to a new map), |
| 5978 // possibly invalidating the assumptions embedded in the code. | 5982 // possibly invalidating the assumptions embedded in the code. |
| 5979 kPrototypeCheckGroup, | 5983 kPrototypeCheckGroup, |
| 5980 // Group of code that depends on elements not being added to objects with | 5984 // Group of code that depends on elements not being added to objects with |
| 5981 // this map. | 5985 // this map. |
| 5982 kElementsCantBeAddedGroup, | 5986 kElementsCantBeAddedGroup, |
| 5983 // Group of code that depends on global property values in property cells | 5987 // Group of code that depends on global property values in property cells |
| 5984 // not being changed. | 5988 // not being changed. |
| 5985 kPropertyCellChangedGroup, | 5989 kPropertyCellChangedGroup, |
| 5990 // Group of code that omit run-time type checks for the field(s) introduced |
| 5991 // by this map. |
| 5992 kFieldTypeGroup, |
| 5986 // Group of code that depends on tenuring information in AllocationSites | 5993 // Group of code that depends on tenuring information in AllocationSites |
| 5987 // not being changed. | 5994 // not being changed. |
| 5988 kAllocationSiteTenuringChangedGroup, | 5995 kAllocationSiteTenuringChangedGroup, |
| 5989 // Group of code that depends on element transition information in | 5996 // Group of code that depends on element transition information in |
| 5990 // AllocationSites not being changed. | 5997 // AllocationSites not being changed. |
| 5991 kAllocationSiteTransitionChangedGroup, | 5998 kAllocationSiteTransitionChangedGroup, |
| 5992 kGroupCount = kAllocationSiteTransitionChangedGroup + 1 | 5999 kGroupCount = kAllocationSiteTransitionChangedGroup + 1 |
| 5993 }; | 6000 }; |
| 5994 | 6001 |
| 5995 // Array for holding the index of the first code object of each group. | 6002 // Array for holding the index of the first code object of each group. |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6238 inline Map* elements_transition_map(); | 6245 inline Map* elements_transition_map(); |
| 6239 static Handle<TransitionArray> SetElementsTransitionMap( | 6246 static Handle<TransitionArray> SetElementsTransitionMap( |
| 6240 Handle<Map> map, Handle<Map> transitioned_map); | 6247 Handle<Map> map, Handle<Map> transitioned_map); |
| 6241 inline Map* GetTransition(int transition_index); | 6248 inline Map* GetTransition(int transition_index); |
| 6242 inline int SearchTransition(Name* name); | 6249 inline int SearchTransition(Name* name); |
| 6243 inline FixedArrayBase* GetInitialElements(); | 6250 inline FixedArrayBase* GetInitialElements(); |
| 6244 | 6251 |
| 6245 DECL_ACCESSORS(transitions, TransitionArray) | 6252 DECL_ACCESSORS(transitions, TransitionArray) |
| 6246 | 6253 |
| 6247 Map* FindRootMap(); | 6254 Map* FindRootMap(); |
| 6255 Map* FindFieldOwner(int descriptor); |
| 6248 | 6256 |
| 6249 inline int GetInObjectPropertyOffset(int index); | 6257 inline int GetInObjectPropertyOffset(int index); |
| 6250 | 6258 |
| 6251 int NumberOfFields(); | 6259 int NumberOfFields(); |
| 6252 | 6260 |
| 6253 bool InstancesNeedRewriting(Map* target, | 6261 bool InstancesNeedRewriting(Map* target, |
| 6254 int target_number_of_fields, | 6262 int target_number_of_fields, |
| 6255 int target_inobject, | 6263 int target_inobject, |
| 6256 int target_unused); | 6264 int target_unused); |
| 6257 static Handle<Map> GeneralizeAllFieldRepresentations( | 6265 static Handle<Map> GeneralizeAllFieldRepresentations(Handle<Map> map); |
| 6258 Handle<Map> map, | 6266 static Handle<HeapType> GeneralizeFieldType(Handle<HeapType> old_field_type, |
| 6259 Representation new_representation); | 6267 Handle<HeapType> new_field_type, |
| 6268 Isolate* isolate) |
| 6269 V8_WARN_UNUSED_RESULT; |
| 6270 static void GeneralizeFieldType(Handle<Map> map, |
| 6271 int modify_index, |
| 6272 Handle<HeapType> new_field_type); |
| 6260 static Handle<Map> GeneralizeRepresentation( | 6273 static Handle<Map> GeneralizeRepresentation( |
| 6261 Handle<Map> map, | 6274 Handle<Map> map, |
| 6262 int modify_index, | 6275 int modify_index, |
| 6263 Representation new_representation, | 6276 Representation new_representation, |
| 6277 Handle<HeapType> new_field_type, |
| 6264 StoreMode store_mode); | 6278 StoreMode store_mode); |
| 6265 static Handle<Map> CopyGeneralizeAllRepresentations( | 6279 static Handle<Map> CopyGeneralizeAllRepresentations( |
| 6266 Handle<Map> map, | 6280 Handle<Map> map, |
| 6267 int modify_index, | 6281 int modify_index, |
| 6268 StoreMode store_mode, | 6282 StoreMode store_mode, |
| 6269 PropertyAttributes attributes, | 6283 PropertyAttributes attributes, |
| 6270 const char* reason); | 6284 const char* reason); |
| 6271 | 6285 |
| 6272 // Returns the constructor name (the name (possibly, inferred name) of the | 6286 // Returns the constructor name (the name (possibly, inferred name) of the |
| 6273 // function that was used to instantiate the object). | 6287 // function that was used to instantiate the object). |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6705 // heap verification is turned on. | 6719 // heap verification is turned on. |
| 6706 void ZapPrototypeTransitions(); | 6720 void ZapPrototypeTransitions(); |
| 6707 void ZapTransitions(); | 6721 void ZapTransitions(); |
| 6708 | 6722 |
| 6709 void DeprecateTransitionTree(); | 6723 void DeprecateTransitionTree(); |
| 6710 void DeprecateTarget(Name* key, DescriptorArray* new_descriptors); | 6724 void DeprecateTarget(Name* key, DescriptorArray* new_descriptors); |
| 6711 | 6725 |
| 6712 Map* FindUpdatedMap(int verbatim, int length, DescriptorArray* descriptors); | 6726 Map* FindUpdatedMap(int verbatim, int length, DescriptorArray* descriptors); |
| 6713 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); | 6727 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); |
| 6714 | 6728 |
| 6729 void UpdateDescriptor(int descriptor_number, Descriptor* desc); |
| 6730 |
| 6715 void PrintGeneralization(FILE* file, | 6731 void PrintGeneralization(FILE* file, |
| 6716 const char* reason, | 6732 const char* reason, |
| 6717 int modify_index, | 6733 int modify_index, |
| 6718 int split, | 6734 int split, |
| 6719 int descriptors, | 6735 int descriptors, |
| 6720 bool constant_to_field, | 6736 bool constant_to_field, |
| 6721 Representation old_representation, | 6737 Representation old_representation, |
| 6722 Representation new_representation); | 6738 Representation new_representation, |
| 6739 HeapType* old_field_type, |
| 6740 HeapType* new_field_type); |
| 6723 | 6741 |
| 6724 static inline void SetPrototypeTransitions( | 6742 static inline void SetPrototypeTransitions( |
| 6725 Handle<Map> map, | 6743 Handle<Map> map, |
| 6726 Handle<FixedArray> prototype_transitions); | 6744 Handle<FixedArray> prototype_transitions); |
| 6727 | 6745 |
| 6728 static Handle<Map> GetPrototypeTransition(Handle<Map> map, | 6746 static Handle<Map> GetPrototypeTransition(Handle<Map> map, |
| 6729 Handle<Object> prototype); | 6747 Handle<Object> prototype); |
| 6730 static Handle<Map> PutPrototypeTransition(Handle<Map> map, | 6748 static Handle<Map> PutPrototypeTransition(Handle<Map> map, |
| 6731 Handle<Object> prototype, | 6749 Handle<Object> prototype, |
| 6732 Handle<Map> target_map); | 6750 Handle<Map> target_map); |
| (...skipping 4324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11057 } else { | 11075 } else { |
| 11058 value &= ~(1 << bit_position); | 11076 value &= ~(1 << bit_position); |
| 11059 } | 11077 } |
| 11060 return value; | 11078 return value; |
| 11061 } | 11079 } |
| 11062 }; | 11080 }; |
| 11063 | 11081 |
| 11064 } } // namespace v8::internal | 11082 } } // namespace v8::internal |
| 11065 | 11083 |
| 11066 #endif // V8_OBJECTS_H_ | 11084 #endif // V8_OBJECTS_H_ |
| OLD | NEW |