Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index ced82cb2bedb0167c7a92ad8bd51b982a7a6c17e..969d3b4191eb8c21ad1e05b4eb269918f62c8b6a 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -2591,8 +2591,8 @@ int BinarySearch(T* array, Name* name, int low, int high, int valid_entries, |
template <SearchMode search_mode, typename T> |
int LinearSearch(T* array, Name* name, int len, int valid_entries, |
int* out_insertion_index) { |
- uint32_t hash = name->Hash(); |
if (search_mode == ALL_ENTRIES) { |
+ uint32_t hash = name->Hash(); |
for (int number = 0; number < len; number++) { |
int sorted_index = array->GetSortedKeyIndex(number); |
Name* entry = array->GetKey(sorted_index); |
@@ -2609,9 +2609,7 @@ int LinearSearch(T* array, Name* name, int len, int valid_entries, |
DCHECK(len >= valid_entries); |
DCHECK_NULL(out_insertion_index); // Not supported here. |
for (int number = 0; number < valid_entries; number++) { |
- Name* entry = array->GetKey(number); |
- uint32_t current_hash = entry->Hash(); |
- if (current_hash == hash && entry->Equals(name)) return number; |
+ if (array->GetKey(number)->Equals(name)) return number; |
} |
return T::kNotFound; |
} |