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

Unified Diff: src/hashmap.h

Issue 10031032: I'd like to add addr field into EntryInfo struct. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: style errors were fixed Created 8 years, 8 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/profile-generator.h » ('j') | src/profile-generator.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hashmap.h
diff --git a/src/hashmap.h b/src/hashmap.h
index 5aeb8951ed38f0237df5b7d3d75621667514007d..ef6bb85801f4c8ff27f300bc23561c8ebf2161d8 100644
--- a/src/hashmap.h
+++ b/src/hashmap.h
@@ -63,7 +63,7 @@ class TemplateHashMapImpl {
Entry* Lookup(void* key, uint32_t hash, bool insert);
// Removes the entry with matching key.
mnaganov (inactive) 2012/04/10 21:12:04 Please update the comment.
- void Remove(void* key, uint32_t hash);
+ void* Remove(void* key, uint32_t hash);
// Empties the hash map (occupancy() == 0).
void Clear();
@@ -146,14 +146,15 @@ typename TemplateHashMapImpl<P>::Entry* TemplateHashMapImpl<P>::Lookup(
template<class P>
-void TemplateHashMapImpl<P>::Remove(void* key, uint32_t hash) {
+void* TemplateHashMapImpl<P>::Remove(void* key, uint32_t hash) {
// Lookup the entry for the key to remove.
Entry* p = Probe(key, hash);
if (p->key == NULL) {
// Key not found nothing to remove.
- return;
+ return NULL;
}
+ void* value = p->value;
// To remove an entry we need to ensure that it does not create an empty
// entry that will cause the search for another entry to stop too soon. If all
// the entries between the entry to remove and the next empty slot have their
@@ -202,6 +203,7 @@ void TemplateHashMapImpl<P>::Remove(void* key, uint32_t hash) {
// Clear the entry which is allowed to en emptied.
p->key = NULL;
occupancy_--;
+ return value;
}
« no previous file with comments | « no previous file | src/profile-generator.h » ('j') | src/profile-generator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698