Commit 494388da authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[objects] Remove unnecessary loop in LookupKey

Change-Id: Iee3a65c6df143a41b45b610a10a19ec28ad5c268
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2565513Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71518}
parent 277f4dc2
......@@ -464,8 +464,6 @@ Handle<String> StringTable::LookupKey(LocalIsolate* isolate,
// allocation if another write also did an allocation. This assumes that
// writes are rarer than reads.
Handle<String> new_string;
while (true) {
// Load the current string table data, in case another thread updates the
// data while we're reading.
const Data* data = data_.load(std::memory_order_acquire);
......@@ -486,7 +484,7 @@ Handle<String> StringTable::LookupKey(LocalIsolate* isolate,
// allocated value on insertion retries. If another thread concurrently
// allocates the same string, the insert will fail, the lookup above will
// succeed, and this string will be discarded.
if (new_string.is_null()) new_string = key->AsHandle(isolate);
Handle<String> new_string = key->AsHandle(isolate);
{
base::MutexGuard table_write_guard(&write_mutex_);
......@@ -495,8 +493,7 @@ Handle<String> StringTable::LookupKey(LocalIsolate* isolate,
// Check one last time if the key is present in the table, in case it was
// added after the check.
InternalIndex entry =
data->FindEntryOrInsertionEntry(isolate, key, key->hash());
entry = data->FindEntryOrInsertionEntry(isolate, key, key->hash());
Object element = data->Get(isolate, entry);
if (element == empty_element()) {
......@@ -516,7 +513,6 @@ Handle<String> StringTable::LookupKey(LocalIsolate* isolate,
return handle(String::cast(element), isolate);
}
}
}
}
template Handle<String> StringTable::LookupKey(Isolate* isolate,
......
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