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

Side by Side Diff: src/objects.h

Issue 1636013002: Replace HeapType with a non-templated FieldType class. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix tracing of generalizations Created 4 years, 10 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
« src/ic/ic.cc ('K') | « src/lookup.cc ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 class Cell; 833 class Cell;
834 class ConsString; 834 class ConsString;
835 class ElementsAccessor; 835 class ElementsAccessor;
836 class FixedArrayBase; 836 class FixedArrayBase;
837 class FunctionLiteral; 837 class FunctionLiteral;
838 class JSGlobalObject; 838 class JSGlobalObject;
839 class KeyAccumulator; 839 class KeyAccumulator;
840 class LayoutDescriptor; 840 class LayoutDescriptor;
841 class LiteralsArray; 841 class LiteralsArray;
842 class LookupIterator; 842 class LookupIterator;
843 class FieldType;
843 class ObjectHashTable; 844 class ObjectHashTable;
844 class ObjectVisitor; 845 class ObjectVisitor;
845 class PropertyCell; 846 class PropertyCell;
846 class PropertyDescriptor; 847 class PropertyDescriptor;
847 class SafepointEntry; 848 class SafepointEntry;
848 class SharedFunctionInfo; 849 class SharedFunctionInfo;
849 class StringStream; 850 class StringStream;
850 class TypeFeedbackInfo; 851 class TypeFeedbackInfo;
851 class TypeFeedbackVector; 852 class TypeFeedbackVector;
852 class WeakCell; 853 class WeakCell;
853 class TransitionArray; 854 class TransitionArray;
854 855
855 // We cannot just say "class HeapType;" if it is created from a template... =8-?
856 template<class> class TypeImpl;
857 struct HeapTypeConfig;
858 typedef TypeImpl<HeapTypeConfig> HeapType;
859
860 856
861 // A template-ized version of the IsXXX functions. 857 // A template-ized version of the IsXXX functions.
862 template <class C> inline bool Is(Object* obj); 858 template <class C> inline bool Is(Object* obj);
863 859
864 #ifdef VERIFY_HEAP 860 #ifdef VERIFY_HEAP
865 #define DECLARE_VERIFIER(Name) void Name##Verify(); 861 #define DECLARE_VERIFIER(Name) void Name##Verify();
866 #else 862 #else
867 #define DECLARE_VERIFIER(Name) 863 #define DECLARE_VERIFIER(Name)
868 #endif 864 #endif
869 865
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 1087
1092 inline bool FitsRepresentation(Representation representation); 1088 inline bool FitsRepresentation(Representation representation);
1093 1089
1094 // Checks whether two valid primitive encodings of a property name resolve to 1090 // Checks whether two valid primitive encodings of a property name resolve to
1095 // the same logical property. E.g., the smi 1, the string "1" and the double 1091 // the same logical property. E.g., the smi 1, the string "1" and the double
1096 // 1 all refer to the same property, so this helper will return true. 1092 // 1 all refer to the same property, so this helper will return true.
1097 inline bool KeyEquals(Object* other); 1093 inline bool KeyEquals(Object* other);
1098 1094
1099 inline bool FilterKey(PropertyFilter filter); 1095 inline bool FilterKey(PropertyFilter filter);
1100 1096
1101 Handle<HeapType> OptimalType(Isolate* isolate, Representation representation); 1097 Handle<FieldType> OptimalType(Isolate* isolate,
1098 Representation representation);
1102 1099
1103 inline static Handle<Object> NewStorageFor(Isolate* isolate, 1100 inline static Handle<Object> NewStorageFor(Isolate* isolate,
1104 Handle<Object> object, 1101 Handle<Object> object,
1105 Representation representation); 1102 Representation representation);
1106 1103
1107 inline static Handle<Object> WrapForRead(Isolate* isolate, 1104 inline static Handle<Object> WrapForRead(Isolate* isolate,
1108 Handle<Object> object, 1105 Handle<Object> object,
1109 Representation representation); 1106 Representation representation);
1110 1107
1111 // Returns true if the object is of the correct type to be used as a 1108 // Returns true if the object is of the correct type to be used as a
(...skipping 1798 matching lines...) Expand 10 before | Expand all | Expand 10 after
2910 inline Object** GetKeySlot(int descriptor_number); 2907 inline Object** GetKeySlot(int descriptor_number);
2911 inline Object* GetValue(int descriptor_number); 2908 inline Object* GetValue(int descriptor_number);
2912 inline void SetValue(int descriptor_number, Object* value); 2909 inline void SetValue(int descriptor_number, Object* value);
2913 inline Object** GetValueSlot(int descriptor_number); 2910 inline Object** GetValueSlot(int descriptor_number);
2914 static inline int GetValueOffset(int descriptor_number); 2911 static inline int GetValueOffset(int descriptor_number);
2915 inline Object** GetDescriptorStartSlot(int descriptor_number); 2912 inline Object** GetDescriptorStartSlot(int descriptor_number);
2916 inline Object** GetDescriptorEndSlot(int descriptor_number); 2913 inline Object** GetDescriptorEndSlot(int descriptor_number);
2917 inline PropertyDetails GetDetails(int descriptor_number); 2914 inline PropertyDetails GetDetails(int descriptor_number);
2918 inline PropertyType GetType(int descriptor_number); 2915 inline PropertyType GetType(int descriptor_number);
2919 inline int GetFieldIndex(int descriptor_number); 2916 inline int GetFieldIndex(int descriptor_number);
2920 inline HeapType* GetFieldType(int descriptor_number); 2917 inline FieldType* GetFieldType(int descriptor_number);
2921 inline Object* GetConstant(int descriptor_number); 2918 inline Object* GetConstant(int descriptor_number);
2922 inline Object* GetCallbacksObject(int descriptor_number); 2919 inline Object* GetCallbacksObject(int descriptor_number);
2923 inline AccessorDescriptor* GetCallbacks(int descriptor_number); 2920 inline AccessorDescriptor* GetCallbacks(int descriptor_number);
2924 2921
2925 inline Name* GetSortedKey(int descriptor_number); 2922 inline Name* GetSortedKey(int descriptor_number);
2926 inline int GetSortedKeyIndex(int descriptor_number); 2923 inline int GetSortedKeyIndex(int descriptor_number);
2927 inline void SetSortedKey(int pointer, int descriptor_number); 2924 inline void SetSortedKey(int pointer, int descriptor_number);
2928 inline void SetRepresentation(int descriptor_number, 2925 inline void SetRepresentation(int descriptor_number,
2929 Representation representation); 2926 Representation representation);
2930 2927
(...skipping 2770 matching lines...) Expand 10 before | Expand all | Expand 10 after
5701 inline int GetInObjectPropertyOffset(int index); 5698 inline int GetInObjectPropertyOffset(int index);
5702 5699
5703 int NumberOfFields(); 5700 int NumberOfFields();
5704 5701
5705 // TODO(ishell): candidate with JSObject::MigrateToMap(). 5702 // TODO(ishell): candidate with JSObject::MigrateToMap().
5706 bool InstancesNeedRewriting(Map* target, int target_number_of_fields, 5703 bool InstancesNeedRewriting(Map* target, int target_number_of_fields,
5707 int target_inobject, int target_unused, 5704 int target_inobject, int target_unused,
5708 int* old_number_of_fields); 5705 int* old_number_of_fields);
5709 // TODO(ishell): moveit! 5706 // TODO(ishell): moveit!
5710 static Handle<Map> GeneralizeAllFieldRepresentations(Handle<Map> map); 5707 static Handle<Map> GeneralizeAllFieldRepresentations(Handle<Map> map);
5711 MUST_USE_RESULT static Handle<HeapType> GeneralizeFieldType( 5708 MUST_USE_RESULT static Handle<FieldType> GeneralizeFieldType(
5712 Representation rep1, Handle<HeapType> type1, Representation rep2, 5709 Representation rep1, Handle<FieldType> type1, Representation rep2,
5713 Handle<HeapType> type2, Isolate* isolate); 5710 Handle<FieldType> type2, Isolate* isolate);
5714 static void GeneralizeFieldType(Handle<Map> map, int modify_index, 5711 static void GeneralizeFieldType(Handle<Map> map, int modify_index,
5715 Representation new_representation, 5712 Representation new_representation,
5716 Handle<HeapType> new_field_type); 5713 Handle<FieldType> new_field_type);
5717 static Handle<Map> ReconfigureProperty(Handle<Map> map, int modify_index, 5714 static Handle<Map> ReconfigureProperty(Handle<Map> map, int modify_index,
5718 PropertyKind new_kind, 5715 PropertyKind new_kind,
5719 PropertyAttributes new_attributes, 5716 PropertyAttributes new_attributes,
5720 Representation new_representation, 5717 Representation new_representation,
5721 Handle<HeapType> new_field_type, 5718 Handle<FieldType> new_field_type,
5722 StoreMode store_mode); 5719 StoreMode store_mode);
5723 static Handle<Map> CopyGeneralizeAllRepresentations( 5720 static Handle<Map> CopyGeneralizeAllRepresentations(
5724 Handle<Map> map, int modify_index, StoreMode store_mode, 5721 Handle<Map> map, int modify_index, StoreMode store_mode,
5725 PropertyKind kind, PropertyAttributes attributes, const char* reason); 5722 PropertyKind kind, PropertyAttributes attributes, const char* reason);
5726 5723
5727 static Handle<Map> PrepareForDataProperty(Handle<Map> old_map, 5724 static Handle<Map> PrepareForDataProperty(Handle<Map> old_map,
5728 int descriptor_number, 5725 int descriptor_number,
5729 Handle<Object> value); 5726 Handle<Object> value);
5730 5727
5731 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode, 5728 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode,
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
5833 static inline Handle<Map> CopyInitialMap(Handle<Map> map); 5830 static inline Handle<Map> CopyInitialMap(Handle<Map> map);
5834 static Handle<Map> CopyInitialMap(Handle<Map> map, int instance_size, 5831 static Handle<Map> CopyInitialMap(Handle<Map> map, int instance_size,
5835 int in_object_properties, 5832 int in_object_properties,
5836 int unused_property_fields); 5833 int unused_property_fields);
5837 static Handle<Map> CopyDropDescriptors(Handle<Map> map); 5834 static Handle<Map> CopyDropDescriptors(Handle<Map> map);
5838 static Handle<Map> CopyInsertDescriptor(Handle<Map> map, 5835 static Handle<Map> CopyInsertDescriptor(Handle<Map> map,
5839 Descriptor* descriptor, 5836 Descriptor* descriptor,
5840 TransitionFlag flag); 5837 TransitionFlag flag);
5841 5838
5842 MUST_USE_RESULT static MaybeHandle<Map> CopyWithField( 5839 MUST_USE_RESULT static MaybeHandle<Map> CopyWithField(
5843 Handle<Map> map, 5840 Handle<Map> map, Handle<Name> name, Handle<FieldType> type,
5844 Handle<Name> name, 5841 PropertyAttributes attributes, Representation representation,
5845 Handle<HeapType> type,
5846 PropertyAttributes attributes,
5847 Representation representation,
5848 TransitionFlag flag); 5842 TransitionFlag flag);
5849 5843
5850 MUST_USE_RESULT static MaybeHandle<Map> CopyWithConstant( 5844 MUST_USE_RESULT static MaybeHandle<Map> CopyWithConstant(
5851 Handle<Map> map, 5845 Handle<Map> map,
5852 Handle<Name> name, 5846 Handle<Name> name,
5853 Handle<Object> constant, 5847 Handle<Object> constant,
5854 PropertyAttributes attributes, 5848 PropertyAttributes attributes,
5855 TransitionFlag flag); 5849 TransitionFlag flag);
5856 5850
5857 // Returns a new map with all transitions dropped from the given map and 5851 // Returns a new map with all transitions dropped from the given map and
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
6171 6165
6172 // Update field type of the given descriptor to new representation and new 6166 // Update field type of the given descriptor to new representation and new
6173 // type. The type must be prepared for storing in descriptor array: 6167 // type. The type must be prepared for storing in descriptor array:
6174 // it must be either a simple type or a map wrapped in a weak cell. 6168 // it must be either a simple type or a map wrapped in a weak cell.
6175 void UpdateFieldType(int descriptor_number, Handle<Name> name, 6169 void UpdateFieldType(int descriptor_number, Handle<Name> name,
6176 Representation new_representation, 6170 Representation new_representation,
6177 Handle<Object> new_wrapped_type); 6171 Handle<Object> new_wrapped_type);
6178 6172
6179 void PrintReconfiguration(FILE* file, int modify_index, PropertyKind kind, 6173 void PrintReconfiguration(FILE* file, int modify_index, PropertyKind kind,
6180 PropertyAttributes attributes); 6174 PropertyAttributes attributes);
6181 void PrintGeneralization(FILE* file, 6175 void PrintGeneralization(FILE* file, const char* reason, int modify_index,
6182 const char* reason, 6176 int split, int descriptors, bool constant_to_field,
6183 int modify_index,
6184 int split,
6185 int descriptors,
6186 bool constant_to_field,
6187 Representation old_representation, 6177 Representation old_representation,
6188 Representation new_representation, 6178 Representation new_representation,
6189 HeapType* old_field_type, 6179 MaybeHandle<FieldType> old_field_type,
6190 HeapType* new_field_type); 6180 MaybeHandle<Object> old_value,
6181 MaybeHandle<FieldType> new_field_type,
6182 MaybeHandle<Object> new_value);
6191 6183
6192 static const int kFastPropertiesSoftLimit = 12; 6184 static const int kFastPropertiesSoftLimit = 12;
6193 static const int kMaxFastProperties = 128; 6185 static const int kMaxFastProperties = 128;
6194 6186
6195 DISALLOW_IMPLICIT_CONSTRUCTORS(Map); 6187 DISALLOW_IMPLICIT_CONSTRUCTORS(Map);
6196 }; 6188 };
6197 6189
6198 6190
6199 // An abstract superclass, a marker class really, for simple structure classes. 6191 // An abstract superclass, a marker class really, for simple structure classes.
6200 // It doesn't carry much functionality but allows struct classes to be 6192 // It doesn't carry much functionality but allows struct classes to be
(...skipping 4585 matching lines...) Expand 10 before | Expand all | Expand 10 after
10786 } 10778 }
10787 return value; 10779 return value;
10788 } 10780 }
10789 }; 10781 };
10790 10782
10791 10783
10792 } // NOLINT, false-positive due to second-order macros. 10784 } // NOLINT, false-positive due to second-order macros.
10793 } // NOLINT, false-positive due to second-order macros. 10785 } // NOLINT, false-positive due to second-order macros.
10794 10786
10795 #endif // V8_OBJECTS_H_ 10787 #endif // V8_OBJECTS_H_
OLDNEW
« src/ic/ic.cc ('K') | « src/lookup.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698