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 | |
1514 inline MaybeObject* AllocateNewStorageFor(Heap* heap, | 1512 inline MaybeObject* AllocateNewStorageFor(Heap* heap, |
1515 Representation representation); | 1513 Representation representation); |
1516 | 1514 |
1517 // Returns true if the object is of the correct type to be used as a | 1515 // Returns true if the object is of the correct type to be used as a |
1518 // implementation of a JSObject's elements. | 1516 // implementation of a JSObject's elements. |
1519 inline bool HasValidElements(); | 1517 inline bool HasValidElements(); |
1520 | 1518 |
1521 inline bool HasSpecificClassOf(String* name); | 1519 inline bool HasSpecificClassOf(String* name); |
1522 | 1520 |
1523 MUST_USE_RESULT MaybeObject* ToObject(Isolate* isolate); // ECMA-262 9.9. | 1521 MUST_USE_RESULT MaybeObject* ToObject(Isolate* isolate); // ECMA-262 9.9. |
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2575 ElementsKind elements_kind); | 2573 ElementsKind elements_kind); |
2576 | 2574 |
2577 static void TransitionElementsKind(Handle<JSObject> object, | 2575 static void TransitionElementsKind(Handle<JSObject> object, |
2578 ElementsKind to_kind); | 2576 ElementsKind to_kind); |
2579 | 2577 |
2580 // TODO(mstarzinger): Both public because of ConvertAnsSetLocalProperty(). | 2578 // TODO(mstarzinger): Both public because of ConvertAnsSetLocalProperty(). |
2581 static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map); | 2579 static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map); |
2582 static void GeneralizeFieldRepresentation(Handle<JSObject> object, | 2580 static void GeneralizeFieldRepresentation(Handle<JSObject> object, |
2583 int modify_index, | 2581 int modify_index, |
2584 Representation new_representation, | 2582 Representation new_representation, |
2585 Handle<HeapType> new_field_type, | |
2586 StoreMode store_mode); | 2583 StoreMode store_mode); |
2587 | 2584 |
2588 // Convert the object to use the canonical dictionary | 2585 // Convert the object to use the canonical dictionary |
2589 // representation. If the object is expected to have additional properties | 2586 // representation. If the object is expected to have additional properties |
2590 // added this number can be indicated to have the backing store allocated to | 2587 // added this number can be indicated to have the backing store allocated to |
2591 // an initial capacity for holding these properties. | 2588 // an initial capacity for holding these properties. |
2592 static void NormalizeProperties(Handle<JSObject> object, | 2589 static void NormalizeProperties(Handle<JSObject> object, |
2593 PropertyNormalizationMode mode, | 2590 PropertyNormalizationMode mode, |
2594 int expected_additional_properties); | 2591 int expected_additional_properties); |
2595 | 2592 |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3401 // Initialize or change the enum cache, | 3398 // Initialize or change the enum cache, |
3402 // using the supplied storage for the small "bridge". | 3399 // using the supplied storage for the small "bridge". |
3403 void SetEnumCache(FixedArray* bridge_storage, | 3400 void SetEnumCache(FixedArray* bridge_storage, |
3404 FixedArray* new_cache, | 3401 FixedArray* new_cache, |
3405 Object* new_index_cache); | 3402 Object* new_index_cache); |
3406 | 3403 |
3407 // Accessors for fetching instance descriptor at descriptor number. | 3404 // Accessors for fetching instance descriptor at descriptor number. |
3408 inline Name* GetKey(int descriptor_number); | 3405 inline Name* GetKey(int descriptor_number); |
3409 inline Object** GetKeySlot(int descriptor_number); | 3406 inline Object** GetKeySlot(int descriptor_number); |
3410 inline Object* GetValue(int descriptor_number); | 3407 inline Object* GetValue(int descriptor_number); |
3411 inline void SetValue(int descriptor_number, Object* value); | |
3412 inline Object** GetValueSlot(int descriptor_number); | 3408 inline Object** GetValueSlot(int descriptor_number); |
3413 inline Object** GetDescriptorStartSlot(int descriptor_number); | 3409 inline Object** GetDescriptorStartSlot(int descriptor_number); |
3414 inline Object** GetDescriptorEndSlot(int descriptor_number); | 3410 inline Object** GetDescriptorEndSlot(int descriptor_number); |
3415 inline PropertyDetails GetDetails(int descriptor_number); | 3411 inline PropertyDetails GetDetails(int descriptor_number); |
3416 inline PropertyType GetType(int descriptor_number); | 3412 inline PropertyType GetType(int descriptor_number); |
3417 inline int GetFieldIndex(int descriptor_number); | 3413 inline int GetFieldIndex(int descriptor_number); |
3418 inline HeapType* GetFieldType(int descriptor_number); | |
3419 inline Object* GetConstant(int descriptor_number); | 3414 inline Object* GetConstant(int descriptor_number); |
3420 inline Object* GetCallbacksObject(int descriptor_number); | 3415 inline Object* GetCallbacksObject(int descriptor_number); |
3421 inline AccessorDescriptor* GetCallbacks(int descriptor_number); | 3416 inline AccessorDescriptor* GetCallbacks(int descriptor_number); |
3422 | 3417 |
3423 inline Name* GetSortedKey(int descriptor_number); | 3418 inline Name* GetSortedKey(int descriptor_number); |
3424 inline int GetSortedKeyIndex(int descriptor_number); | 3419 inline int GetSortedKeyIndex(int descriptor_number); |
3425 inline void SetSortedKey(int pointer, int descriptor_number); | 3420 inline void SetSortedKey(int pointer, int descriptor_number); |
| 3421 inline void InitializeRepresentations(Representation representation); |
3426 inline void SetRepresentation(int descriptor_number, | 3422 inline void SetRepresentation(int descriptor_number, |
3427 Representation representation); | 3423 Representation representation); |
3428 | 3424 |
3429 // Accessor for complete descriptor. | 3425 // Accessor for complete descriptor. |
3430 inline void Get(int descriptor_number, Descriptor* desc); | 3426 inline void Get(int descriptor_number, Descriptor* desc); |
3431 inline void Set(int descriptor_number, Descriptor* desc); | 3427 inline void Set(int descriptor_number, Descriptor* desc); |
3432 void Replace(int descriptor_number, Descriptor* descriptor); | 3428 void Replace(int descriptor_number, Descriptor* descriptor); |
3433 | 3429 |
3434 // Append automatically sets the enumeration index. This should only be used | 3430 // 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 | 3431 // to add descriptors in bulk at the end, followed by sorting the descriptor |
(...skipping 2511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5947 // described by this map. The group is deoptimized whenever an object | 5943 // described by this map. The group is deoptimized whenever an object |
5948 // described by this map changes shape (and transitions to a new map), | 5944 // described by this map changes shape (and transitions to a new map), |
5949 // possibly invalidating the assumptions embedded in the code. | 5945 // possibly invalidating the assumptions embedded in the code. |
5950 kPrototypeCheckGroup, | 5946 kPrototypeCheckGroup, |
5951 // Group of code that depends on elements not being added to objects with | 5947 // Group of code that depends on elements not being added to objects with |
5952 // this map. | 5948 // this map. |
5953 kElementsCantBeAddedGroup, | 5949 kElementsCantBeAddedGroup, |
5954 // Group of code that depends on global property values in property cells | 5950 // Group of code that depends on global property values in property cells |
5955 // not being changed. | 5951 // not being changed. |
5956 kPropertyCellChangedGroup, | 5952 kPropertyCellChangedGroup, |
5957 // Group of code that omit run-time type checks for the field(s) introduced | |
5958 // by this map. | |
5959 kFieldTypeGroup, | |
5960 // Group of code that depends on tenuring information in AllocationSites | 5953 // Group of code that depends on tenuring information in AllocationSites |
5961 // not being changed. | 5954 // not being changed. |
5962 kAllocationSiteTenuringChangedGroup, | 5955 kAllocationSiteTenuringChangedGroup, |
5963 // Group of code that depends on element transition information in | 5956 // Group of code that depends on element transition information in |
5964 // AllocationSites not being changed. | 5957 // AllocationSites not being changed. |
5965 kAllocationSiteTransitionChangedGroup, | 5958 kAllocationSiteTransitionChangedGroup, |
5966 kGroupCount = kAllocationSiteTransitionChangedGroup + 1 | 5959 kGroupCount = kAllocationSiteTransitionChangedGroup + 1 |
5967 }; | 5960 }; |
5968 | 5961 |
5969 // Array for holding the index of the first code object of each group. | 5962 // 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... |
6220 DECL_ACCESSORS(transitions, TransitionArray) | 6213 DECL_ACCESSORS(transitions, TransitionArray) |
6221 inline void ClearTransitions(Heap* heap, | 6214 inline void ClearTransitions(Heap* heap, |
6222 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 6215 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
6223 | 6216 |
6224 void DeprecateTransitionTree(); | 6217 void DeprecateTransitionTree(); |
6225 void DeprecateTarget(Name* key, DescriptorArray* new_descriptors); | 6218 void DeprecateTarget(Name* key, DescriptorArray* new_descriptors); |
6226 | 6219 |
6227 Map* FindRootMap(); | 6220 Map* FindRootMap(); |
6228 Map* FindUpdatedMap(int verbatim, int length, DescriptorArray* descriptors); | 6221 Map* FindUpdatedMap(int verbatim, int length, DescriptorArray* descriptors); |
6229 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); | 6222 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); |
6230 Map* FindFieldOwner(int descriptor); | |
6231 | |
6232 void UpdateDescriptor(int descriptor_number, Descriptor* desc); | |
6233 | 6223 |
6234 inline int GetInObjectPropertyOffset(int index); | 6224 inline int GetInObjectPropertyOffset(int index); |
6235 | 6225 |
6236 int NumberOfFields(); | 6226 int NumberOfFields(); |
6237 | 6227 |
6238 bool InstancesNeedRewriting(Map* target, | 6228 bool InstancesNeedRewriting(Map* target, |
6239 int target_number_of_fields, | 6229 int target_number_of_fields, |
6240 int target_inobject, | 6230 int target_inobject, |
6241 int target_unused); | 6231 int target_unused); |
6242 static Handle<Map> GeneralizeAllFieldRepresentations(Handle<Map> map); | 6232 static Handle<Map> GeneralizeAllFieldRepresentations( |
6243 static Handle<HeapType> GeneralizeFieldType(Handle<HeapType> old_field_type, | 6233 Handle<Map> map, |
6244 Handle<HeapType> new_field_type, | 6234 Representation new_representation); |
6245 Isolate* isolate) | |
6246 V8_WARN_UNUSED_RESULT; | |
6247 static void GeneralizeFieldType(Handle<Map> map, | |
6248 int modify_index, | |
6249 Handle<HeapType> new_field_type); | |
6250 static Handle<Map> GeneralizeRepresentation( | 6235 static Handle<Map> GeneralizeRepresentation( |
6251 Handle<Map> map, | 6236 Handle<Map> map, |
6252 int modify_index, | 6237 int modify_index, |
6253 Representation new_representation, | 6238 Representation new_representation, |
6254 Handle<HeapType> new_field_type, | |
6255 StoreMode store_mode); | 6239 StoreMode store_mode); |
6256 static Handle<Map> CopyGeneralizeAllRepresentations( | 6240 static Handle<Map> CopyGeneralizeAllRepresentations( |
6257 Handle<Map> map, | 6241 Handle<Map> map, |
6258 int modify_index, | 6242 int modify_index, |
6259 StoreMode store_mode, | 6243 StoreMode store_mode, |
6260 PropertyAttributes attributes, | 6244 PropertyAttributes attributes, |
6261 const char* reason); | 6245 const char* reason); |
6262 | 6246 |
6263 void PrintGeneralization(FILE* file, | 6247 void PrintGeneralization(FILE* file, |
6264 const char* reason, | 6248 const char* reason, |
6265 int modify_index, | 6249 int modify_index, |
6266 int split, | 6250 int split, |
6267 int descriptors, | 6251 int descriptors, |
6268 bool constant_to_field, | 6252 bool constant_to_field, |
6269 Representation old_representation, | 6253 Representation old_representation, |
6270 Representation new_representation, | 6254 Representation new_representation); |
6271 HeapType* old_field_type, | |
6272 HeapType* new_field_type); | |
6273 | 6255 |
6274 // Returns the constructor name (the name (possibly, inferred name) of the | 6256 // Returns the constructor name (the name (possibly, inferred name) of the |
6275 // function that was used to instantiate the object). | 6257 // function that was used to instantiate the object). |
6276 String* constructor_name(); | 6258 String* constructor_name(); |
6277 | 6259 |
6278 // Tells whether the map is attached to SharedFunctionInfo | 6260 // Tells whether the map is attached to SharedFunctionInfo |
6279 // (for inobject slack tracking). | 6261 // (for inobject slack tracking). |
6280 inline void set_attached_to_shared_function_info(bool value); | 6262 inline void set_attached_to_shared_function_info(bool value); |
6281 | 6263 |
6282 inline bool attached_to_shared_function_info(); | 6264 inline bool attached_to_shared_function_info(); |
(...skipping 4757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11040 } else { | 11022 } else { |
11041 value &= ~(1 << bit_position); | 11023 value &= ~(1 << bit_position); |
11042 } | 11024 } |
11043 return value; | 11025 return value; |
11044 } | 11026 } |
11045 }; | 11027 }; |
11046 | 11028 |
11047 } } // namespace v8::internal | 11029 } } // namespace v8::internal |
11048 | 11030 |
11049 #endif // V8_OBJECTS_H_ | 11031 #endif // V8_OBJECTS_H_ |
OLD | NEW |