Commit c383fc20 authored by verwaest's avatar verwaest Committed by Commit bot

[runtime] Don't compute the hash for linear search in descriptor array

I replaced the hidden string with hidden_properties_symbol, so we don't
need the extra hash-check anymore. This is slightly faster anyway.

BUG=

Review URL: https://codereview.chromium.org/1707653003

Cr-Commit-Position: refs/heads/master@{#34086}
parent 56e08dfa
...@@ -2591,8 +2591,8 @@ int BinarySearch(T* array, Name* name, int low, int high, int valid_entries, ...@@ -2591,8 +2591,8 @@ int BinarySearch(T* array, Name* name, int low, int high, int valid_entries,
template <SearchMode search_mode, typename T> template <SearchMode search_mode, typename T>
int LinearSearch(T* array, Name* name, int len, int valid_entries, int LinearSearch(T* array, Name* name, int len, int valid_entries,
int* out_insertion_index) { int* out_insertion_index) {
uint32_t hash = name->Hash();
if (search_mode == ALL_ENTRIES) { if (search_mode == ALL_ENTRIES) {
uint32_t hash = name->Hash();
for (int number = 0; number < len; number++) { for (int number = 0; number < len; number++) {
int sorted_index = array->GetSortedKeyIndex(number); int sorted_index = array->GetSortedKeyIndex(number);
Name* entry = array->GetKey(sorted_index); Name* entry = array->GetKey(sorted_index);
...@@ -2609,9 +2609,7 @@ int LinearSearch(T* array, Name* name, int len, int valid_entries, ...@@ -2609,9 +2609,7 @@ int LinearSearch(T* array, Name* name, int len, int valid_entries,
DCHECK(len >= valid_entries); DCHECK(len >= valid_entries);
DCHECK_NULL(out_insertion_index); // Not supported here. DCHECK_NULL(out_insertion_index); // Not supported here.
for (int number = 0; number < valid_entries; number++) { for (int number = 0; number < valid_entries; number++) {
Name* entry = array->GetKey(number); if (array->GetKey(number)->Equals(name)) return number;
uint32_t current_hash = entry->Hash();
if (current_hash == hash && entry->Equals(name)) return number;
} }
return T::kNotFound; return T::kNotFound;
} }
......
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