5 #ifndef V8_OBJECTS_DICTIONARY_H_ 6 #define V8_OBJECTS_DICTIONARY_H_ 8 #include "src/base/export-template.h" 9 #include "src/globals.h" 10 #include "src/objects/hash-table.h" 11 #include "src/objects/property-array.h" 12 #include "src/objects/smi.h" 15 #include "src/objects/object-macros.h" 25 template <
typename Derived,
typename Shape>
30 typedef typename Shape::Key Key;
32 Object* ValueAt(
int entry) {
33 return this->
get(DerivedHashTable::EntryToIndex(entry) + 1);
37 void ValueAtPut(
int entry,
Object* value) {
38 this->
set(DerivedHashTable::EntryToIndex(entry) + 1, value);
43 return Shape::DetailsAt(Derived::cast(*
this), entry);
48 Shape::DetailsAtPut(isolate, Derived::cast(*
this), entry, value);
58 return DerivedHashTable::Shrink(isolate, dictionary);
61 int NumberOfEnumerableProperties();
67 void Print(std::ostream& os);
73 inline void ClearEntry(
Isolate* isolate,
int entry);
92 template <
typename Key>
95 static const bool kHasDetails =
true;
96 template <
typename Dictionary>
98 STATIC_ASSERT(Dictionary::kEntrySize == 3);
101 Dictionary::EntryToIndex(entry) + Dictionary::kEntryDetailsIndex)));
104 template <
typename Dictionary>
107 STATIC_ASSERT(Dictionary::kEntrySize == 3);
108 dict->set(Dictionary::EntryToIndex(entry) + Dictionary::kEntryDetailsIndex,
119 static inline RootIndex GetMapRootIndex();
120 static const int kPrefixSize = 2;
121 static const int kEntrySize = 3;
122 static const int kEntryValueIndex = 1;
123 static const bool kNeedsHoleCheck =
false;
126 template <
typename Derived,
typename Shape>
128 typedef typename Shape::Key Key;
131 static const int kNextEnumerationIndexIndex =
132 HashTableBase::kPrefixStartIndex;
133 static const int kObjectHashIndex = kNextEnumerationIndexIndex + 1;
134 static const int kEntryValueIndex = 1;
137 void SetNextEnumerationIndex(
int index) {
139 this->
set(kNextEnumerationIndexIndex, Smi::FromInt(index));
142 int NextEnumerationIndex() {
143 return Smi::ToInt(this->
get(kNextEnumerationIndexIndex));
146 void SetHash(
int hash) {
147 DCHECK(PropertyArray::HashField::is_valid(hash));
148 this->
set(kObjectHashIndex, Smi::FromInt(hash));
152 Object* hash_obj = this->
get(kObjectHashIndex);
153 int hash = Smi::ToInt(hash_obj);
154 DCHECK(PropertyArray::HashField::is_valid(hash));
160 Isolate* isolate,
int at_least_space_for,
161 PretenureFlag pretenure = NOT_TENURED,
162 MinimumCapacity capacity_option = USE_DEFAULT_MINIMUM_CAPACITY);
183 V8_WARN_UNUSED_RESULT
static Handle<Derived> AddNoUpdateNextEnumerationIndex(
199 static const int kEntryDetailsIndex = 2;
200 static const int kInitialCapacity = 2;
202 inline Name NameAt(
int entry);
203 inline void set_hash(
int hash);
204 inline int hash()
const;
215 static const int kEntrySize = 1;
217 template <
typename Dictionary>
220 template <
typename Dictionary>
227 static inline RootIndex GetMapRootIndex();
235 inline Object* ValueAt(
int entry);
239 inline Name NameAt(
int entry);
240 inline void ValueAtPut(
int entry,
Object* value);
258 static const int kPrefixSize = 1;
259 static const int kEntrySize = 3;
261 static inline RootIndex GetMapRootIndex();
266 static const bool kHasDetails =
false;
267 static const int kPrefixSize = 0;
268 static const int kEntrySize = 2;
270 template <
typename Dictionary>
275 template <
typename Dictionary>
281 static inline RootIndex GetMapRootIndex();
284 extern template class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE)
287 extern template class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE)
300 static const int kEntryValueIndex = 1;
307 extern template class EXPORT_TEMPLATE_DECLARE(
310 extern template class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE)
328 static const int kMaxNumberKeyIndex = kPrefixStartIndex;
333 bool HasComplexElements();
343 inline bool requires_slow_elements();
344 inline void set_requires_slow_elements();
351 static const int kEntryValueIndex = 1;
352 static const int kEntryDetailsIndex = 2;
355 static const int kRequiresSlowElementsMask = 1;
356 static const int kRequiresSlowElementsTagSize = 1;
357 static const uint32_t kRequiresSlowElementsLimit = (1 << 29) - 1;
361 static const uint32_t kPreferFastElementsSizeFactor = 3;
370 #include "src/objects/object-macros-undef.h" 372 #endif // V8_OBJECTS_DICTIONARY_H_