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

Unified Diff: test/cctest/test-heap-profiler.cc

Issue 1074943002: Split TemplateHashMapImpl::Lookup into two methods (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix arm (and ppc) builds Created 5 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
« test/cctest/test-api.cc ('K') | « test/cctest/test-hashmap.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-heap-profiler.cc
diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc
index d00532f48d0d1f04127125a9010b34c92c5f9062..54052ef560eb44b19fdaec6a8ca4c529f13d7a66 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -74,10 +74,9 @@ class NamedEntriesDetector {
for (int i = 0; i < children.length(); ++i) {
if (children[i]->type() == i::HeapGraphEdge::kShortcut) continue;
i::HeapEntry* child = children[i]->to();
- i::HashMap::Entry* entry = visited.Lookup(
+ i::HashMap::Entry* entry = visited.LookupOrInsert(
reinterpret_cast<void*>(child),
- static_cast<uint32_t>(reinterpret_cast<uintptr_t>(child)),
- true);
+ static_cast<uint32_t>(reinterpret_cast<uintptr_t>(child)));
if (entry->value)
continue;
entry->value = reinterpret_cast<void*>(1);
@@ -146,10 +145,9 @@ static bool ValidateSnapshot(const v8::HeapSnapshot* snapshot, int depth = 3) {
i::HashMap visited(AddressesMatch);
i::List<i::HeapGraphEdge>& edges = heap_snapshot->edges();
for (int i = 0; i < edges.length(); ++i) {
- i::HashMap::Entry* entry = visited.Lookup(
+ i::HashMap::Entry* entry = visited.LookupOrInsert(
reinterpret_cast<void*>(edges[i].to()),
- static_cast<uint32_t>(reinterpret_cast<uintptr_t>(edges[i].to())),
- true);
+ static_cast<uint32_t>(reinterpret_cast<uintptr_t>(edges[i].to())));
uint32_t ref_count = static_cast<uint32_t>(
reinterpret_cast<uintptr_t>(entry->value));
entry->value = reinterpret_cast<void*>(ref_count + 1);
@@ -159,8 +157,7 @@ static bool ValidateSnapshot(const v8::HeapSnapshot* snapshot, int depth = 3) {
for (int i = 0; i < entries.length(); ++i) {
i::HashMap::Entry* entry = visited.Lookup(
reinterpret_cast<void*>(&entries[i]),
- static_cast<uint32_t>(reinterpret_cast<uintptr_t>(&entries[i])),
- false);
+ static_cast<uint32_t>(reinterpret_cast<uintptr_t>(&entries[i])));
if (!entry && entries[i].id() != 1) {
entries[i].Print("entry with no retainer", "", depth, 0);
++unretained_entries_count;
« test/cctest/test-api.cc ('K') | « test/cctest/test-hashmap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698