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 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2590 ElementsKind elements_kind); | 2592 ElementsKind elements_kind); |
2591 | 2593 |
2592 static void TransitionElementsKind(Handle<JSObject> object, | 2594 static void TransitionElementsKind(Handle<JSObject> object, |
2593 ElementsKind to_kind); | 2595 ElementsKind to_kind); |
2594 | 2596 |
2595 // TODO(mstarzinger): Both public because of ConvertAnsSetLocalProperty(). | 2597 // TODO(mstarzinger): Both public because of ConvertAnsSetLocalProperty(). |
2596 static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map); | 2598 static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map); |
2597 static void GeneralizeFieldRepresentation(Handle<JSObject> object, | 2599 static void GeneralizeFieldRepresentation(Handle<JSObject> object, |
2598 int modify_index, | 2600 int modify_index, |
2599 Representation new_representation, | 2601 Representation new_representation, |
| 2602 Handle<HeapType> new_field_type, |
2600 StoreMode store_mode); | 2603 StoreMode store_mode); |
2601 | 2604 |
2602 // Convert the object to use the canonical dictionary | 2605 // Convert the object to use the canonical dictionary |
2603 // representation. If the object is expected to have additional properties | 2606 // representation. If the object is expected to have additional properties |
2604 // added this number can be indicated to have the backing store allocated to | 2607 // added this number can be indicated to have the backing store allocated to |
2605 // an initial capacity for holding these properties. | 2608 // an initial capacity for holding these properties. |
2606 static void NormalizeProperties(Handle<JSObject> object, | 2609 static void NormalizeProperties(Handle<JSObject> object, |
2607 PropertyNormalizationMode mode, | 2610 PropertyNormalizationMode mode, |
2608 int expected_additional_properties); | 2611 int expected_additional_properties); |
2609 | 2612 |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3429 // Initialize or change the enum cache, | 3432 // Initialize or change the enum cache, |
3430 // using the supplied storage for the small "bridge". | 3433 // using the supplied storage for the small "bridge". |
3431 void SetEnumCache(FixedArray* bridge_storage, | 3434 void SetEnumCache(FixedArray* bridge_storage, |
3432 FixedArray* new_cache, | 3435 FixedArray* new_cache, |
3433 Object* new_index_cache); | 3436 Object* new_index_cache); |
3434 | 3437 |
3435 // Accessors for fetching instance descriptor at descriptor number. | 3438 // Accessors for fetching instance descriptor at descriptor number. |
3436 inline Name* GetKey(int descriptor_number); | 3439 inline Name* GetKey(int descriptor_number); |
3437 inline Object** GetKeySlot(int descriptor_number); | 3440 inline Object** GetKeySlot(int descriptor_number); |
3438 inline Object* GetValue(int descriptor_number); | 3441 inline Object* GetValue(int descriptor_number); |
| 3442 inline void SetValue(int descriptor_number, Object* value); |
3439 inline Object** GetValueSlot(int descriptor_number); | 3443 inline Object** GetValueSlot(int descriptor_number); |
3440 inline Object** GetDescriptorStartSlot(int descriptor_number); | 3444 inline Object** GetDescriptorStartSlot(int descriptor_number); |
3441 inline Object** GetDescriptorEndSlot(int descriptor_number); | 3445 inline Object** GetDescriptorEndSlot(int descriptor_number); |
3442 inline PropertyDetails GetDetails(int descriptor_number); | 3446 inline PropertyDetails GetDetails(int descriptor_number); |
3443 inline PropertyType GetType(int descriptor_number); | 3447 inline PropertyType GetType(int descriptor_number); |
3444 inline int GetFieldIndex(int descriptor_number); | 3448 inline int GetFieldIndex(int descriptor_number); |
| 3449 inline HeapType* GetFieldType(int descriptor_number); |
3445 inline Object* GetConstant(int descriptor_number); | 3450 inline Object* GetConstant(int descriptor_number); |
3446 inline Object* GetCallbacksObject(int descriptor_number); | 3451 inline Object* GetCallbacksObject(int descriptor_number); |
3447 inline AccessorDescriptor* GetCallbacks(int descriptor_number); | 3452 inline AccessorDescriptor* GetCallbacks(int descriptor_number); |
3448 | 3453 |
3449 inline Name* GetSortedKey(int descriptor_number); | 3454 inline Name* GetSortedKey(int descriptor_number); |
3450 inline int GetSortedKeyIndex(int descriptor_number); | 3455 inline int GetSortedKeyIndex(int descriptor_number); |
3451 inline void SetSortedKey(int pointer, int descriptor_number); | 3456 inline void SetSortedKey(int pointer, int descriptor_number); |
3452 inline void InitializeRepresentations(Representation representation); | |
3453 inline void SetRepresentation(int descriptor_number, | 3457 inline void SetRepresentation(int descriptor_number, |
3454 Representation representation); | 3458 Representation representation); |
3455 | 3459 |
3456 // Accessor for complete descriptor. | 3460 // Accessor for complete descriptor. |
3457 inline void Get(int descriptor_number, Descriptor* desc); | 3461 inline void Get(int descriptor_number, Descriptor* desc); |
3458 inline void Set(int descriptor_number, | 3462 inline void Set(int descriptor_number, |
3459 Descriptor* desc, | 3463 Descriptor* desc, |
3460 const WhitenessWitness&); | 3464 const WhitenessWitness&); |
3461 void Replace(int descriptor_number, Descriptor* descriptor); | 3465 void Replace(int descriptor_number, Descriptor* descriptor); |
3462 | 3466 |
(...skipping 2498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5961 // described by this map. The group is deoptimized whenever an object | 5965 // described by this map. The group is deoptimized whenever an object |
5962 // described by this map changes shape (and transitions to a new map), | 5966 // described by this map changes shape (and transitions to a new map), |
5963 // possibly invalidating the assumptions embedded in the code. | 5967 // possibly invalidating the assumptions embedded in the code. |
5964 kPrototypeCheckGroup, | 5968 kPrototypeCheckGroup, |
5965 // Group of code that depends on elements not being added to objects with | 5969 // Group of code that depends on elements not being added to objects with |
5966 // this map. | 5970 // this map. |
5967 kElementsCantBeAddedGroup, | 5971 kElementsCantBeAddedGroup, |
5968 // Group of code that depends on global property values in property cells | 5972 // Group of code that depends on global property values in property cells |
5969 // not being changed. | 5973 // not being changed. |
5970 kPropertyCellChangedGroup, | 5974 kPropertyCellChangedGroup, |
| 5975 // Group of code that omit run-time type checks for the field(s) introduced |
| 5976 // by this map. |
| 5977 kFieldTypeGroup, |
5971 // Group of code that depends on tenuring information in AllocationSites | 5978 // Group of code that depends on tenuring information in AllocationSites |
5972 // not being changed. | 5979 // not being changed. |
5973 kAllocationSiteTenuringChangedGroup, | 5980 kAllocationSiteTenuringChangedGroup, |
5974 // Group of code that depends on element transition information in | 5981 // Group of code that depends on element transition information in |
5975 // AllocationSites not being changed. | 5982 // AllocationSites not being changed. |
5976 kAllocationSiteTransitionChangedGroup, | 5983 kAllocationSiteTransitionChangedGroup, |
5977 kGroupCount = kAllocationSiteTransitionChangedGroup + 1 | 5984 kGroupCount = kAllocationSiteTransitionChangedGroup + 1 |
5978 }; | 5985 }; |
5979 | 5986 |
5980 // Array for holding the index of the first code object of each group. | 5987 // Array for holding the index of the first code object of each group. |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6231 DECL_ACCESSORS(transitions, TransitionArray) | 6238 DECL_ACCESSORS(transitions, TransitionArray) |
6232 inline void ClearTransitions(Heap* heap, | 6239 inline void ClearTransitions(Heap* heap, |
6233 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 6240 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
6234 | 6241 |
6235 void DeprecateTransitionTree(); | 6242 void DeprecateTransitionTree(); |
6236 void DeprecateTarget(Name* key, DescriptorArray* new_descriptors); | 6243 void DeprecateTarget(Name* key, DescriptorArray* new_descriptors); |
6237 | 6244 |
6238 Map* FindRootMap(); | 6245 Map* FindRootMap(); |
6239 Map* FindUpdatedMap(int verbatim, int length, DescriptorArray* descriptors); | 6246 Map* FindUpdatedMap(int verbatim, int length, DescriptorArray* descriptors); |
6240 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); | 6247 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); |
| 6248 Map* FindFieldOwner(int descriptor); |
| 6249 |
| 6250 void UpdateDescriptor(int descriptor_number, Descriptor* desc); |
6241 | 6251 |
6242 inline int GetInObjectPropertyOffset(int index); | 6252 inline int GetInObjectPropertyOffset(int index); |
6243 | 6253 |
6244 int NumberOfFields(); | 6254 int NumberOfFields(); |
6245 | 6255 |
6246 bool InstancesNeedRewriting(Map* target, | 6256 bool InstancesNeedRewriting(Map* target, |
6247 int target_number_of_fields, | 6257 int target_number_of_fields, |
6248 int target_inobject, | 6258 int target_inobject, |
6249 int target_unused); | 6259 int target_unused); |
6250 static Handle<Map> GeneralizeAllFieldRepresentations( | 6260 static Handle<Map> GeneralizeAllFieldRepresentations(Handle<Map> map); |
6251 Handle<Map> map, | 6261 static void GeneralizeFieldType(Handle<Map> map, |
6252 Representation new_representation); | 6262 int modify_index, |
| 6263 Handle<HeapType> new_field_type); |
6253 static Handle<Map> GeneralizeRepresentation( | 6264 static Handle<Map> GeneralizeRepresentation( |
6254 Handle<Map> map, | 6265 Handle<Map> map, |
6255 int modify_index, | 6266 int modify_index, |
6256 Representation new_representation, | 6267 Representation new_representation, |
| 6268 Handle<HeapType> new_field_type, |
6257 StoreMode store_mode); | 6269 StoreMode store_mode); |
6258 static Handle<Map> CopyGeneralizeAllRepresentations( | 6270 static Handle<Map> CopyGeneralizeAllRepresentations( |
6259 Handle<Map> map, | 6271 Handle<Map> map, |
6260 int modify_index, | 6272 int modify_index, |
6261 StoreMode store_mode, | 6273 StoreMode store_mode, |
6262 PropertyAttributes attributes, | 6274 PropertyAttributes attributes, |
6263 const char* reason); | 6275 const char* reason); |
6264 | 6276 |
6265 void PrintGeneralization(FILE* file, | 6277 void PrintGeneralization(FILE* file, |
6266 const char* reason, | 6278 const char* reason, |
6267 int modify_index, | 6279 int modify_index, |
6268 int split, | 6280 int split, |
6269 int descriptors, | 6281 int descriptors, |
6270 bool constant_to_field, | 6282 bool constant_to_field, |
6271 Representation old_representation, | 6283 Representation old_representation, |
6272 Representation new_representation); | 6284 Representation new_representation, |
| 6285 HeapType* old_field_type, |
| 6286 HeapType* new_field_type); |
6273 | 6287 |
6274 // Returns the constructor name (the name (possibly, inferred name) of the | 6288 // Returns the constructor name (the name (possibly, inferred name) of the |
6275 // function that was used to instantiate the object). | 6289 // function that was used to instantiate the object). |
6276 String* constructor_name(); | 6290 String* constructor_name(); |
6277 | 6291 |
6278 // Tells whether the map is attached to SharedFunctionInfo | 6292 // Tells whether the map is attached to SharedFunctionInfo |
6279 // (for inobject slack tracking). | 6293 // (for inobject slack tracking). |
6280 inline void set_attached_to_shared_function_info(bool value); | 6294 inline void set_attached_to_shared_function_info(bool value); |
6281 | 6295 |
6282 inline bool attached_to_shared_function_info(); | 6296 inline bool attached_to_shared_function_info(); |
(...skipping 4765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11048 } else { | 11062 } else { |
11049 value &= ~(1 << bit_position); | 11063 value &= ~(1 << bit_position); |
11050 } | 11064 } |
11051 return value; | 11065 return value; |
11052 } | 11066 } |
11053 }; | 11067 }; |
11054 | 11068 |
11055 } } // namespace v8::internal | 11069 } } // namespace v8::internal |
11056 | 11070 |
11057 #endif // V8_OBJECTS_H_ | 11071 #endif // V8_OBJECTS_H_ |
OLD | NEW |