Commit 64c12860 authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

[OrderedHashSet] Remove extra entry lookup

Bug: v8:5717
Change-Id: I999ea81f745a25a1f3a539e50594e597e64f5287
Reviewed-on: https://chromium-review.googlesource.com/481044Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44705}
parent 66155c72
......@@ -18870,7 +18870,8 @@ bool OrderedHashTable<Derived, entrysize>::HasKey(Handle<Derived> table,
Handle<OrderedHashSet> OrderedHashSet::Add(Handle<OrderedHashSet> table,
Handle<Object> key) {
int hash = Object::GetOrCreateHash(table->GetIsolate(), key)->value();
int entry = table->HashToEntry(hash);
int previous_entry = table->HashToEntry(hash);
int entry = previous_entry;
// Walk the chain of the bucket and try finding the key.
while (entry != kNotFound) {
Object* candidate_key = table->KeyAt(entry);
......@@ -18882,7 +18883,6 @@ Handle<OrderedHashSet> OrderedHashSet::Add(Handle<OrderedHashSet> table,
table = OrderedHashSet::EnsureGrowable(table);
// Read the existing bucket values.
int bucket = table->HashToBucket(hash);
int previous_entry = table->HashToEntry(hash);
int nof = table->NumberOfElements();
// Insert a new entry at the end,
int new_entry = nof + table->NumberOfDeletedElements();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment