Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index f4522db01d9e2fadba75d3e0dc9c4ffe315e1877..f65a2e7fb587175eb273d10c11801c036e58efb6 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -16140,14 +16140,12 @@ Handle<Derived> OrderedHashTable<Derived, Iterator, entrysize>::Rehash( |
template<class Derived, class Iterator, int entrysize> |
int OrderedHashTable<Derived, Iterator, entrysize>::FindEntry( |
- Handle<Object> key) { |
+ Handle<Object> key, int hash) { |
ASSERT(!IsObsolete()); |
DisallowHeapAllocation no_gc; |
ASSERT(!key->IsTheHole()); |
- Object* hash = key->GetHash(); |
- if (hash->IsUndefined()) return kNotFound; |
- for (int entry = HashToEntry(Smi::cast(hash)->value()); |
+ for (int entry = HashToEntry(hash); |
entry != kNotFound; |
entry = ChainAt(entry)) { |
Object* candidate = KeyAt(entry); |
@@ -16159,6 +16157,16 @@ int OrderedHashTable<Derived, Iterator, entrysize>::FindEntry( |
template<class Derived, class Iterator, int entrysize> |
+int OrderedHashTable<Derived, Iterator, entrysize>::FindEntry( |
+ Handle<Object> key) { |
+ DisallowHeapAllocation no_gc; |
+ Object* hash = key->GetHash(); |
+ if (!hash->IsSmi()) return kNotFound; |
+ return FindEntry(key, Smi::cast(hash)->value()); |
+} |
+ |
+ |
+template<class Derived, class Iterator, int entrysize> |
int OrderedHashTable<Derived, Iterator, entrysize>::AddEntry(int hash) { |
ASSERT(!IsObsolete()); |
@@ -16208,6 +16216,9 @@ OrderedHashTable<OrderedHashSet, JSSetIterator, 1>::Remove( |
template int |
OrderedHashTable<OrderedHashSet, JSSetIterator, 1>::FindEntry( |
+ Handle<Object> key, int hash); |
+template int |
+OrderedHashTable<OrderedHashSet, JSSetIterator, 1>::FindEntry( |
Handle<Object> key); |
template int |
@@ -16239,6 +16250,9 @@ OrderedHashTable<OrderedHashMap, JSMapIterator, 2>::Remove( |
template int |
OrderedHashTable<OrderedHashMap, JSMapIterator, 2>::FindEntry( |
+ Handle<Object> key, int hash); |
+template int |
+OrderedHashTable<OrderedHashMap, JSMapIterator, 2>::FindEntry( |
Handle<Object> key); |
template int |
@@ -16255,12 +16269,12 @@ bool OrderedHashSet::Contains(Handle<Object> key) { |
Handle<OrderedHashSet> OrderedHashSet::Add(Handle<OrderedHashSet> table, |
Handle<Object> key) { |
- if (table->FindEntry(key) != kNotFound) return table; |
+ int hash = GetOrCreateHash(table->GetIsolate(), key)->value(); |
+ if (table->FindEntry(key, hash) != kNotFound) return table; |
table = EnsureGrowable(table); |
- Handle<Smi> hash = GetOrCreateHash(table->GetIsolate(), key); |
- int index = table->AddEntry(hash->value()); |
+ int index = table->AddEntry(hash); |
table->set(index, *key); |
return table; |
} |
@@ -16279,7 +16293,8 @@ Handle<OrderedHashMap> OrderedHashMap::Put(Handle<OrderedHashMap> table, |
Handle<Object> value) { |
ASSERT(!key->IsTheHole()); |
- int entry = table->FindEntry(key); |
+ int hash = GetOrCreateHash(table->GetIsolate(), key)->value(); |
+ int entry = table->FindEntry(key, hash); |
if (entry != kNotFound) { |
table->set(table->EntryToIndex(entry) + kValueOffset, *value); |
@@ -16288,8 +16303,7 @@ Handle<OrderedHashMap> OrderedHashMap::Put(Handle<OrderedHashMap> table, |
table = EnsureGrowable(table); |
- Handle<Smi> hash = GetOrCreateHash(table->GetIsolate(), key); |
- int index = table->AddEntry(hash->value()); |
+ int index = table->AddEntry(hash); |
table->set(index, *key); |
table->set(index + kValueOffset, *value); |
return table; |