Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(681)

Unified Diff: src/objects-inl.h

Issue 1707653003: [runtime] Don't compute the hash for linear search in descriptor array (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698