| Index: src/objects.h
|
| diff --git a/src/objects.h b/src/objects.h
|
| index f1bc09bc14e9fabfc5e5e3c7c0046aed5fb304bf..886cda870943ae0de25d59b52b24db4515366260 100644
|
| --- a/src/objects.h
|
| +++ b/src/objects.h
|
| @@ -3489,6 +3489,9 @@ class HashTableBase : public FixedArray {
|
| // Constant used for denoting a absent entry.
|
| static const int kNotFound = -1;
|
|
|
| + // Minimum capacity for newly created hash tables.
|
| + static const int kMinCapacity = 4;
|
| +
|
| protected:
|
| // Update the number of elements in the hash table.
|
| inline void SetNumberOfElements(int nof);
|
| @@ -3566,8 +3569,11 @@ class HashTable : public HashTableBase {
|
| static const int kEntryKeyIndex = 0;
|
| static const int kElementsStartOffset =
|
| kHeaderSize + kElementsStartIndex * kPointerSize;
|
| - static const int kCapacityOffset =
|
| - kHeaderSize + kCapacityIndex * kPointerSize;
|
| + // Maximal capacity of HashTable. Based on maximal length of underlying
|
| + // FixedArray. Staying below kMaxCapacity also ensures that EntryToIndex
|
| + // cannot overflow.
|
| + static const int kMaxCapacity =
|
| + (FixedArray::kMaxLength - kElementsStartIndex) / kEntrySize;
|
|
|
| // Returns the index for an entry (of the key)
|
| static inline int EntryToIndex(int entry) {
|
| @@ -3604,12 +3610,6 @@ class HashTable : public HashTableBase {
|
| set(kCapacityIndex, Smi::FromInt(capacity));
|
| }
|
|
|
| - // Maximal capacity of HashTable. Based on maximal length of underlying
|
| - // FixedArray. Staying below kMaxCapacity also ensures that EntryToIndex
|
| - // cannot overflow.
|
| - static const int kMaxCapacity =
|
| - (FixedArray::kMaxLength - kElementsStartOffset) / kEntrySize;
|
| -
|
| private:
|
| // Returns _expected_ if one of entries given by the first _probe_ probes is
|
| // equal to _expected_. Otherwise, returns the entry given by the probe
|
| @@ -3838,6 +3838,13 @@ class Dictionary: public HashTable<Derived, Shape, Key> {
|
| static Handle<FixedArray> BuildIterationIndicesArray(
|
| Handle<Derived> dictionary);
|
|
|
| + // Generate new enumeration indices to avoid enumeration index overflow.
|
| + // Returns iteration indices array for the |dictionary|.
|
| + static Handle<FixedArray> GenerateNewEnumerationIndices(
|
| + Handle<Derived> dictionary);
|
| + static const int kMaxNumberKeyIndex = DerivedHashTable::kPrefixStartIndex;
|
| + static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1;
|
| +
|
| protected:
|
| // Generic at put operation.
|
| MUST_USE_RESULT static Handle<Derived> AtPut(
|
| @@ -3848,13 +3855,6 @@ class Dictionary: public HashTable<Derived, Shape, Key> {
|
| // Add entry to dictionary. Returns entry value.
|
| static int AddEntry(Handle<Derived> dictionary, Key key, Handle<Object> value,
|
| PropertyDetails details, uint32_t hash);
|
| -
|
| - // Generate new enumeration indices to avoid enumeration index overflow.
|
| - // Returns iteration indices array for the |dictionary|.
|
| - static Handle<FixedArray> GenerateNewEnumerationIndices(
|
| - Handle<Derived> dictionary);
|
| - static const int kMaxNumberKeyIndex = DerivedHashTable::kPrefixStartIndex;
|
| - static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1;
|
| };
|
|
|
|
|
| @@ -3926,6 +3926,7 @@ class NameDictionary
|
|
|
| static const int kEntryValueIndex = 1;
|
| static const int kEntryDetailsIndex = 2;
|
| + static const int kInitialCapacity = 2;
|
| };
|
|
|
|
|
|
|