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

Unified Diff: src/base/hashmap.h

Issue 2101383002: [heap] Reland uncommit unused large object page memory. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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/base/platform/platform.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/base/hashmap.h
diff --git a/src/base/hashmap.h b/src/base/hashmap.h
index efb5dc8baaafd7bdb0f036bca43347f1322aa42d..36755f62c3a051bf4bbe23d2a0515434594a0faf 100644
--- a/src/base/hashmap.h
+++ b/src/base/hashmap.h
@@ -61,6 +61,9 @@ class TemplateHashMapImpl {
Entry* LookupOrInsert(void* key, uint32_t hash,
AllocationPolicy allocator = AllocationPolicy());
+ Entry* InsertNew(void* key, uint32_t hash,
+ AllocationPolicy allocator = AllocationPolicy());
+
// Removes the entry with matching key.
// It returns the value of the deleted entry
// or null if there is no value for such key.
@@ -134,6 +137,17 @@ TemplateHashMapImpl<AllocationPolicy>::LookupOrInsert(
return p;
}
+ return InsertNew(key, hash, allocator);
+}
+
+template <class AllocationPolicy>
+typename TemplateHashMapImpl<AllocationPolicy>::Entry*
+TemplateHashMapImpl<AllocationPolicy>::InsertNew(void* key, uint32_t hash,
+ AllocationPolicy allocator) {
+ // Find a matching entry.
+ Entry* p = Probe(key, hash);
+ DCHECK(p->key == NULL);
+
// No entry found; insert one.
p->key = key;
p->value = NULL;
« no previous file with comments | « no previous file | src/base/platform/platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698