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 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1488 }; | 1488 }; |
1489 | 1489 |
1490 inline Representation OptimalRepresentation( | 1490 inline Representation OptimalRepresentation( |
1491 ValueType type = OPTIMAL_REPRESENTATION) { | 1491 ValueType type = OPTIMAL_REPRESENTATION) { |
1492 if (!FLAG_track_fields) return Representation::Tagged(); | 1492 if (!FLAG_track_fields) return Representation::Tagged(); |
1493 if (type == FORCE_TAGGED) return Representation::Tagged(); | 1493 if (type == FORCE_TAGGED) return Representation::Tagged(); |
1494 if (IsSmi()) { | 1494 if (IsSmi()) { |
1495 return Representation::Smi(); | 1495 return Representation::Smi(); |
1496 } else if (FLAG_track_double_fields && IsHeapNumber()) { | 1496 } else if (FLAG_track_double_fields && IsHeapNumber()) { |
1497 return Representation::Double(); | 1497 return Representation::Double(); |
1498 } else if (FLAG_track_computed_fields && IsUninitialized()) { | 1498 } else if ((FLAG_track_computed_fields || |
1499 FLAG_track_heap_object_fields) && IsUninitialized()) { | |
Toon Verwaest
2014/03/21 14:33:37
Why did you add this flag? Which piece of code pas
Benedikt Meurer
2014/04/11 11:12:00
This was a hack to work-around the "missing chokep
| |
1499 return Representation::None(); | 1500 return Representation::None(); |
1500 } else if (FLAG_track_heap_object_fields) { | 1501 } else if (FLAG_track_heap_object_fields) { |
1501 ASSERT(IsHeapObject()); | 1502 ASSERT(IsHeapObject()); |
1502 return Representation::HeapObject(); | 1503 return Representation::HeapObject(); |
1503 } else { | 1504 } else { |
1504 return Representation::Tagged(); | 1505 return Representation::Tagged(); |
1505 } | 1506 } |
1506 } | 1507 } |
1507 | 1508 |
1508 inline bool FitsRepresentation(Representation representation) { | 1509 inline bool FitsRepresentation(Representation representation) { |
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2578 static void TransitionElementsKind(Handle<JSObject> object, | 2579 static void TransitionElementsKind(Handle<JSObject> object, |
2579 ElementsKind to_kind); | 2580 ElementsKind to_kind); |
2580 | 2581 |
2581 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); | 2582 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); |
2582 | 2583 |
2583 // TODO(mstarzinger): Both public because of ConvertAnsSetLocalProperty(). | 2584 // TODO(mstarzinger): Both public because of ConvertAnsSetLocalProperty(). |
2584 static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map); | 2585 static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map); |
2585 static void GeneralizeFieldRepresentation(Handle<JSObject> object, | 2586 static void GeneralizeFieldRepresentation(Handle<JSObject> object, |
2586 int modify_index, | 2587 int modify_index, |
2587 Representation new_representation, | 2588 Representation new_representation, |
2589 Handle<HeapType> new_field_type, | |
2588 StoreMode store_mode); | 2590 StoreMode store_mode); |
2589 | 2591 |
2590 // Convert the object to use the canonical dictionary | 2592 // Convert the object to use the canonical dictionary |
2591 // representation. If the object is expected to have additional properties | 2593 // representation. If the object is expected to have additional properties |
2592 // 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 |
2593 // an initial capacity for holding these properties. | 2595 // an initial capacity for holding these properties. |
2594 static void NormalizeProperties(Handle<JSObject> object, | 2596 static void NormalizeProperties(Handle<JSObject> object, |
2595 PropertyNormalizationMode mode, | 2597 PropertyNormalizationMode mode, |
2596 int expected_additional_properties); | 2598 int expected_additional_properties); |
2597 | 2599 |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3384 // Initialize or change the enum cache, | 3386 // Initialize or change the enum cache, |
3385 // using the supplied storage for the small "bridge". | 3387 // using the supplied storage for the small "bridge". |
3386 void SetEnumCache(FixedArray* bridge_storage, | 3388 void SetEnumCache(FixedArray* bridge_storage, |
3387 FixedArray* new_cache, | 3389 FixedArray* new_cache, |
3388 Object* new_index_cache); | 3390 Object* new_index_cache); |
3389 | 3391 |
3390 // Accessors for fetching instance descriptor at descriptor number. | 3392 // Accessors for fetching instance descriptor at descriptor number. |
3391 inline Name* GetKey(int descriptor_number); | 3393 inline Name* GetKey(int descriptor_number); |
3392 inline Object** GetKeySlot(int descriptor_number); | 3394 inline Object** GetKeySlot(int descriptor_number); |
3393 inline Object* GetValue(int descriptor_number); | 3395 inline Object* GetValue(int descriptor_number); |
3396 inline void SetValue(int descriptor_number, Object* value); | |
3394 inline Object** GetValueSlot(int descriptor_number); | 3397 inline Object** GetValueSlot(int descriptor_number); |
3395 inline Object** GetDescriptorStartSlot(int descriptor_number); | 3398 inline Object** GetDescriptorStartSlot(int descriptor_number); |
3396 inline Object** GetDescriptorEndSlot(int descriptor_number); | 3399 inline Object** GetDescriptorEndSlot(int descriptor_number); |
3397 inline PropertyDetails GetDetails(int descriptor_number); | 3400 inline PropertyDetails GetDetails(int descriptor_number); |
3398 inline PropertyType GetType(int descriptor_number); | 3401 inline PropertyType GetType(int descriptor_number); |
3399 inline int GetFieldIndex(int descriptor_number); | 3402 inline int GetFieldIndex(int descriptor_number); |
3403 HeapType* GetFieldType(int descriptor_number); | |
3400 inline Object* GetConstant(int descriptor_number); | 3404 inline Object* GetConstant(int descriptor_number); |
3401 inline Object* GetCallbacksObject(int descriptor_number); | 3405 inline Object* GetCallbacksObject(int descriptor_number); |
3402 inline AccessorDescriptor* GetCallbacks(int descriptor_number); | 3406 inline AccessorDescriptor* GetCallbacks(int descriptor_number); |
3403 | 3407 |
3404 inline Name* GetSortedKey(int descriptor_number); | 3408 inline Name* GetSortedKey(int descriptor_number); |
3405 inline int GetSortedKeyIndex(int descriptor_number); | 3409 inline int GetSortedKeyIndex(int descriptor_number); |
3406 inline void SetSortedKey(int pointer, int descriptor_number); | 3410 inline void SetSortedKey(int pointer, int descriptor_number); |
3407 inline void InitializeRepresentations(Representation representation); | |
3408 inline void SetRepresentation(int descriptor_number, | 3411 inline void SetRepresentation(int descriptor_number, |
3409 Representation representation); | 3412 Representation representation); |
3410 | 3413 |
3411 // Accessor for complete descriptor. | 3414 // Accessor for complete descriptor. |
3412 inline void Get(int descriptor_number, Descriptor* desc); | 3415 inline void Get(int descriptor_number, Descriptor* desc); |
3413 inline void Set(int descriptor_number, | 3416 inline void Set(int descriptor_number, |
3414 Descriptor* desc, | 3417 Descriptor* desc, |
3415 const WhitenessWitness&); | 3418 const WhitenessWitness&); |
3416 inline void Set(int descriptor_number, Descriptor* desc); | 3419 inline void Set(int descriptor_number, Descriptor* desc); |
3417 | 3420 |
(...skipping 2311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5729 // described by this map. The group is deoptimized whenever an object | 5732 // described by this map. The group is deoptimized whenever an object |
5730 // described by this map changes shape (and transitions to a new map), | 5733 // described by this map changes shape (and transitions to a new map), |
5731 // possibly invalidating the assumptions embedded in the code. | 5734 // possibly invalidating the assumptions embedded in the code. |
5732 kPrototypeCheckGroup, | 5735 kPrototypeCheckGroup, |
5733 // Group of code that depends on elements not being added to objects with | 5736 // Group of code that depends on elements not being added to objects with |
5734 // this map. | 5737 // this map. |
5735 kElementsCantBeAddedGroup, | 5738 kElementsCantBeAddedGroup, |
5736 // Group of code that depends on global property values in property cells | 5739 // Group of code that depends on global property values in property cells |
5737 // not being changed. | 5740 // not being changed. |
5738 kPropertyCellChangedGroup, | 5741 kPropertyCellChangedGroup, |
5742 // Group of code that omit run-time type checks for the field(s) introduced | |
5743 // by this map. | |
5744 kFieldTypeGroup, | |
5739 // Group of code that depends on tenuring information in AllocationSites | 5745 // Group of code that depends on tenuring information in AllocationSites |
5740 // not being changed. | 5746 // not being changed. |
5741 kAllocationSiteTenuringChangedGroup, | 5747 kAllocationSiteTenuringChangedGroup, |
5742 // Group of code that depends on element transition information in | 5748 // Group of code that depends on element transition information in |
5743 // AllocationSites not being changed. | 5749 // AllocationSites not being changed. |
5744 kAllocationSiteTransitionChangedGroup, | 5750 kAllocationSiteTransitionChangedGroup, |
5745 kGroupCount = kAllocationSiteTransitionChangedGroup + 1 | 5751 kGroupCount = kAllocationSiteTransitionChangedGroup + 1 |
5746 }; | 5752 }; |
5747 | 5753 |
5748 // Array for holding the index of the first code object of each group. | 5754 // Array for holding the index of the first code object of each group. |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6004 DECL_ACCESSORS(transitions, TransitionArray) | 6010 DECL_ACCESSORS(transitions, TransitionArray) |
6005 inline void ClearTransitions(Heap* heap, | 6011 inline void ClearTransitions(Heap* heap, |
6006 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 6012 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
6007 | 6013 |
6008 void DeprecateTransitionTree(); | 6014 void DeprecateTransitionTree(); |
6009 void DeprecateTarget(Name* key, DescriptorArray* new_descriptors); | 6015 void DeprecateTarget(Name* key, DescriptorArray* new_descriptors); |
6010 | 6016 |
6011 Map* FindRootMap(); | 6017 Map* FindRootMap(); |
6012 Map* FindUpdatedMap(int verbatim, int length, DescriptorArray* descriptors); | 6018 Map* FindUpdatedMap(int verbatim, int length, DescriptorArray* descriptors); |
6013 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); | 6019 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); |
6020 Map* FindFieldOwner(int descriptor); | |
6021 | |
6022 void UpdateDescriptor(int descriptor_number, Descriptor* desc); | |
6023 void UpdateFieldType(int descriptor, HeapType* field_type); | |
6014 | 6024 |
6015 inline int GetInObjectPropertyOffset(int index); | 6025 inline int GetInObjectPropertyOffset(int index); |
6016 | 6026 |
6017 int NumberOfFields(); | 6027 int NumberOfFields(); |
6018 | 6028 |
6019 bool InstancesNeedRewriting(Map* target, | 6029 bool InstancesNeedRewriting(Map* target, |
6020 int target_number_of_fields, | 6030 int target_number_of_fields, |
6021 int target_inobject, | 6031 int target_inobject, |
6022 int target_unused); | 6032 int target_unused); |
6023 static Handle<Map> GeneralizeAllFieldRepresentations( | 6033 static Handle<Map> GeneralizeAllFieldRepresentations(Handle<Map> map); |
6024 Handle<Map> map, | |
6025 Representation new_representation); | |
6026 static Handle<Map> GeneralizeRepresentation( | 6034 static Handle<Map> GeneralizeRepresentation( |
6027 Handle<Map> map, | 6035 Handle<Map> map, |
6028 int modify_index, | 6036 int modify_index, |
6029 Representation new_representation, | 6037 Representation new_representation, |
6038 Handle<HeapType> new_field_type, | |
6030 StoreMode store_mode); | 6039 StoreMode store_mode); |
6031 static Handle<Map> CopyGeneralizeAllRepresentations( | 6040 static Handle<Map> CopyGeneralizeAllRepresentations( |
6032 Handle<Map> map, | 6041 Handle<Map> map, |
6033 int modify_index, | 6042 int modify_index, |
6034 StoreMode store_mode, | 6043 StoreMode store_mode, |
6035 PropertyAttributes attributes, | 6044 PropertyAttributes attributes, |
6036 const char* reason); | 6045 const char* reason); |
6037 | 6046 |
6038 void PrintGeneralization(FILE* file, | 6047 void PrintGeneralization(FILE* file, |
6039 const char* reason, | 6048 const char* reason, |
(...skipping 4752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10792 } else { | 10801 } else { |
10793 value &= ~(1 << bit_position); | 10802 value &= ~(1 << bit_position); |
10794 } | 10803 } |
10795 return value; | 10804 return value; |
10796 } | 10805 } |
10797 }; | 10806 }; |
10798 | 10807 |
10799 } } // namespace v8::internal | 10808 } } // namespace v8::internal |
10800 | 10809 |
10801 #endif // V8_OBJECTS_H_ | 10810 #endif // V8_OBJECTS_H_ |
OLD | NEW |