| Index: src/objects.h
|
| diff --git a/src/objects.h b/src/objects.h
|
| index 45748500939bbd7ee82cdec3b3bb621dcd5c6303..8ec6236c5cd251333b66400cbec36ba5616073ee 100644
|
| --- a/src/objects.h
|
| +++ b/src/objects.h
|
| @@ -3879,7 +3879,7 @@ class OrderedHashTable: public FixedArray {
|
| static Handle<Derived> Shrink(Handle<Derived> table);
|
|
|
| // Returns a new empty OrderedHashTable and records the clearing so that
|
| - // exisiting iterators can be updated.
|
| + // existing iterators can be updated.
|
| static Handle<Derived> Clear(Handle<Derived> table);
|
|
|
| // Returns a true if the OrderedHashTable contains the key
|
| @@ -3893,6 +3893,8 @@ class OrderedHashTable: public FixedArray {
|
| return Smi::cast(get(kNumberOfDeletedElementsIndex))->value();
|
| }
|
|
|
| + // Returns the number of contiguous entries in the data table, starting at 0,
|
| + // that either are real entries or have been deleted.
|
| int UsedCapacity() { return NumberOfElements() + NumberOfDeletedElements(); }
|
|
|
| int NumberOfBuckets() {
|
| @@ -3924,7 +3926,11 @@ class OrderedHashTable: public FixedArray {
|
| return Smi::cast(next_entry)->value();
|
| }
|
|
|
| - Object* KeyAt(int entry) { return get(EntryToIndex(entry)); }
|
| + // use KeyAt(i)->IsTheHole() to determine if this is a deleted entry.
|
| + Object* KeyAt(int entry) {
|
| + DCHECK_LT(entry, this->UsedCapacity());
|
| + return get(EntryToIndex(entry));
|
| + }
|
|
|
| bool IsObsolete() {
|
| return !get(kNextTableIndex)->IsSmi();
|
| @@ -3985,6 +3991,7 @@ class OrderedHashTable: public FixedArray {
|
| set(kNumberOfDeletedElementsIndex, Smi::FromInt(num));
|
| }
|
|
|
| + // Returns the number elements that can fit into the allocated buffer.
|
| int Capacity() {
|
| return NumberOfBuckets() * kLoadFactor;
|
| }
|
|
|