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

Unified Diff: src/serialize.h

Issue 974273002: Serializer: fix false negative in hashmap lookups. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 | src/serialize.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/serialize.h
diff --git a/src/serialize.h b/src/serialize.h
index 6817c7efe6922910025c604d36584af985c75cb5..06ed9fc4f257a7e8ee3892d6e5b1ced110935b06 100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -150,8 +150,8 @@ class AddressMapBase {
return static_cast<uint32_t>(reinterpret_cast<intptr_t>(entry->value));
}
- static HashMap::Entry* LookupEntry(HashMap* map, HeapObject* obj,
- bool insert) {
+ inline static HashMap::Entry* LookupEntry(HashMap* map, HeapObject* obj,
+ bool insert) {
return map->Lookup(Key(obj), Hash(obj), insert);
}
@@ -195,9 +195,9 @@ class PartialCacheIndexMap : public AddressMapBase {
// Lookup object in the map. Return its index if found, or create
// a new entry with new_index as value, and return kInvalidIndex.
int LookupOrInsert(HeapObject* obj, int new_index) {
- HashMap::Entry* entry = LookupEntry(&map_, obj, true);
- if (entry->value != NULL) return GetValue(entry);
- SetValue(entry, static_cast<uint32_t>(new_index));
+ HashMap::Entry* entry = LookupEntry(&map_, obj, false);
+ if (entry != NULL) return GetValue(entry);
+ SetValue(LookupEntry(&map_, obj, true), static_cast<uint32_t>(new_index));
return kInvalidIndex;
}
« no previous file with comments | « no previous file | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698