| Index: src/objects.h
|
| ===================================================================
|
| --- src/objects.h (revision 3533)
|
| +++ src/objects.h (working copy)
|
| @@ -1886,6 +1886,11 @@
|
| return Smi::cast(get(kNumberOfElementsIndex))->value();
|
| }
|
|
|
| + // Returns the number of deleted elements in the hash table.
|
| + int NumberOfDeletedElements() {
|
| + return Smi::cast(get(kNumberOfDeletedElementsIndex))->value();
|
| + }
|
| +
|
| // Returns the capacity of the hash table.
|
| int Capacity() {
|
| return Smi::cast(get(kCapacityIndex))->value();
|
| @@ -1897,8 +1902,14 @@
|
|
|
| // ElementRemoved should be called whenever an element is removed from
|
| // a hash table.
|
| - void ElementRemoved() { SetNumberOfElements(NumberOfElements() - 1); }
|
| - void ElementsRemoved(int n) { SetNumberOfElements(NumberOfElements() - n); }
|
| + void ElementRemoved() {
|
| + SetNumberOfElements(NumberOfElements() - 1);
|
| + SetNumberOfDeletedElements(NumberOfDeletedElements() + 1);
|
| + }
|
| + void ElementsRemoved(int n) {
|
| + SetNumberOfElements(NumberOfElements() - n);
|
| + SetNumberOfDeletedElements(NumberOfDeletedElements() + n);
|
| + }
|
|
|
| // Returns a new HashTable object. Might return Failure.
|
| static Object* Allocate(int at_least_space_for);
|
| @@ -1925,12 +1936,13 @@
|
| }
|
|
|
| static const int kNumberOfElementsIndex = 0;
|
| - static const int kCapacityIndex = 1;
|
| - static const int kPrefixStartIndex = 2;
|
| - static const int kElementsStartIndex =
|
| + static const int kNumberOfDeletedElementsIndex = 1;
|
| + static const int kCapacityIndex = 2;
|
| + static const int kPrefixStartIndex = 3;
|
| + static const int kElementsStartIndex =
|
| kPrefixStartIndex + Shape::kPrefixSize;
|
| - static const int kEntrySize = Shape::kEntrySize;
|
| - static const int kElementsStartOffset =
|
| + static const int kEntrySize = Shape::kEntrySize;
|
| + static const int kElementsStartOffset =
|
| kHeaderSize + kElementsStartIndex * kPointerSize;
|
|
|
| // Constant used for denoting a absent entry.
|
| @@ -1955,6 +1967,11 @@
|
| fast_set(this, kNumberOfElementsIndex, Smi::FromInt(nof));
|
| }
|
|
|
| + // Update the number of deleted elements in the hash table.
|
| + void SetNumberOfDeletedElements(int nod) {
|
| + fast_set(this, kNumberOfDeletedElementsIndex, Smi::FromInt(nod));
|
| + }
|
| +
|
| // Sets the capacity of the hash table.
|
| void SetCapacity(int capacity) {
|
| // To scale a computed hash code to fit within the hash table, we
|
|
|