5 #ifndef V8_OBJECTS_DESCRIPTOR_ARRAY_H_ 6 #define V8_OBJECTS_DESCRIPTOR_ARRAY_H_ 8 #include "src/objects.h" 9 #include "src/objects/fixed-array.h" 12 #include "src/objects/object-macros.h" 21 class MaybeObjectSlot;
32 static const int kKeysOffset = kValue1Offset;
33 static const int kIndicesOffset = kValue2Offset;
36 DISALLOW_IMPLICIT_CONSTRUCTORS(
EnumCache);
58 DECL_INT16_ACCESSORS(number_of_all_descriptors)
59 DECL_INT16_ACCESSORS(number_of_descriptors)
60 inline int16_t number_of_slack_descriptors()
const;
61 inline int number_of_entries()
const;
64 void ClearEnumCache();
72 inline Name GetKey(
int descriptor_number);
73 inline Object* GetStrongValue(
int descriptor_number);
74 inline void SetValue(
int descriptor_number,
Object* value);
77 inline int GetFieldIndex(
int descriptor_number);
78 inline FieldType GetFieldType(
int descriptor_number);
80 inline Name GetSortedKey(
int descriptor_number);
81 inline int GetSortedKeyIndex(
int descriptor_number);
82 inline void SetSortedKey(
int pointer,
int descriptor_number);
88 void Replace(
int descriptor_number,
Descriptor* descriptor);
92 void GeneralizeAllFields();
101 int enumeration_index,
int slack = 0);
105 PropertyAttributes attributes,
int slack = 0);
115 V8_INLINE
int Search(
Name name,
int number_of_own_descriptors);
116 V8_INLINE
int Search(
Name name,
Map map);
120 V8_INLINE
int SearchWithCache(
Isolate* isolate,
Name name,
Map map);
130 int nof_descriptors,
int slack);
135 static const int kNotFound = -1;
138 #define DESCRIPTOR_ARRAY_FIELDS(V) \ 139 V(kNumberOfAllDescriptorsOffset, kUInt16Size) \ 140 V(kNumberOfDescriptorsOffset, kUInt16Size) \ 141 V(kNumberOfMarkedDescriptorsOffset, kUInt16Size) \ 142 V(kFiller16BitsOffset, kUInt16Size) \ 143 V(kPointersStartOffset, 0) \ 144 V(kEnumCacheOffset, kTaggedSize) \ 147 DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
148 DESCRIPTOR_ARRAY_FIELDS)
149 #undef DESCRIPTOR_ARRAY_FIELDS 151 STATIC_ASSERT(IsAligned(kPointersStartOffset, kTaggedSize));
152 STATIC_ASSERT(IsAligned(kHeaderSize, kTaggedSize));
155 DECL_INT16_ACCESSORS(number_of_marked_descriptors)
156 static constexpr
int SizeFor(
int number_of_all_descriptors) {
157 return offset(number_of_all_descriptors * kEntrySize);
159 static constexpr
int OffsetOfDescriptorAt(
int descriptor) {
160 return offset(descriptor * kEntrySize);
163 inline ObjectSlot GetDescriptorSlot(
int descriptor);
171 static const int kEntryKeyIndex = 0;
172 static const int kEntryDetailsIndex = 1;
173 static const int kEntryValueIndex = 2;
174 static const int kEntrySize = 3;
177 void PrintDescriptors(std::ostream& os);
178 void PrintDescriptorDetails(std::ostream& os,
int descriptor,
179 PropertyDetails::PrintMode mode);
186 bool IsSortedNoDuplicates(
int valid_descriptors = -1);
192 static constexpr
int ToDetailsIndex(
int descriptor_number) {
193 return (descriptor_number * kEntrySize) + kEntryDetailsIndex;
197 static constexpr
int ToKeyIndex(
int descriptor_number) {
198 return (descriptor_number * kEntrySize) + kEntryKeyIndex;
201 static constexpr
int ToValueIndex(
int descriptor_number) {
202 return (descriptor_number * kEntrySize) + kEntryValueIndex;
206 DECL_INT16_ACCESSORS(filler16bits)
208 static constexpr
int offset(
int index) {
209 return kHeaderSize + index * kPointerSize;
211 inline int length()
const;
220 inline void SwapSortedKeys(
int first,
int second);
228 #include "src/objects/object-macros-undef.h" 230 #endif // V8_OBJECTS_DESCRIPTOR_ARRAY_H_