Commit 3c0f8918 authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

Revert "[OrderedHashSet] Remove extra entry lookup"

This reverts commit 64c12860.

Reason for revert: the number of buckets can be changed later, so we can't cache the value

Original change's description:
> [OrderedHashSet] Remove extra entry lookup
> 
> Bug: v8:5717
> Change-Id: I999ea81f745a25a1f3a539e50594e597e64f5287
> Reviewed-on: https://chromium-review.googlesource.com/481044
> Reviewed-by: Adam Klein <adamk@chromium.org>
> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#44705}

TBR=adamk@chromium.org,cbruni@chromium.org,gsathya@chromium.org,v8-reviews@googlegroups.com
# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Iade35c0041e943f6dedb24844b07034f56ff1150
Reviewed-on: https://chromium-review.googlesource.com/483904
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44761}
parent ba4fb637
......@@ -18868,8 +18868,7 @@ 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 previous_entry = table->HashToEntry(hash);
int entry = previous_entry;
int entry = table->HashToEntry(hash);
// Walk the chain of the bucket and try finding the key.
while (entry != kNotFound) {
Object* candidate_key = table->KeyAt(entry);
......@@ -18881,6 +18880,7 @@ 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