Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1380)

Side by Side Diff: src/objects.h

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

Powered by Google App Engine
This is Rietveld 408576698