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

Unified Diff: src/snapshot/serialize.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
Index: src/snapshot/serialize.cc
diff --git a/src/snapshot/serialize.cc b/src/snapshot/serialize.cc
index 2179c8de6b881c2c8bf87f71fa6d7350aac6cae9..a81a0f387723e96004fe79eb8fab3b2a6aeff4be 100644
--- a/src/snapshot/serialize.cc
+++ b/src/snapshot/serialize.cc
@@ -339,8 +339,8 @@ ExternalReferenceEncoder::ExternalReferenceEncoder(Isolate* isolate) {
Address addr = table->address(i);
if (addr == ExternalReferenceTable::NotAvailable()) continue;
// We expect no duplicate external references entries in the table.
- DCHECK_NULL(map_->Lookup(addr, Hash(addr), false));
- map_->Lookup(addr, Hash(addr), true)->value = reinterpret_cast<void*>(i);
+ DCHECK_NULL(map_->Lookup(addr, Hash(addr)));
+ map_->LookupOrInsert(addr, Hash(addr))->value = reinterpret_cast<void*>(i);
}
isolate->set_external_reference_map(map_);
}
@@ -349,7 +349,7 @@ ExternalReferenceEncoder::ExternalReferenceEncoder(Isolate* isolate) {
uint32_t ExternalReferenceEncoder::Encode(Address address) const {
DCHECK_NOT_NULL(address);
HashMap::Entry* entry =
- const_cast<HashMap*>(map_)->Lookup(address, Hash(address), false);
+ const_cast<HashMap*>(map_)->Lookup(address, Hash(address));
DCHECK_NOT_NULL(entry);
return static_cast<uint32_t>(reinterpret_cast<intptr_t>(entry->value));
}
@@ -358,7 +358,7 @@ uint32_t ExternalReferenceEncoder::Encode(Address address) const {
const char* ExternalReferenceEncoder::NameOfAddress(Isolate* isolate,
Address address) const {
HashMap::Entry* entry =
- const_cast<HashMap*>(map_)->Lookup(address, Hash(address), false);
+ const_cast<HashMap*>(map_)->Lookup(address, Hash(address));
if (entry == NULL) return "<unknown>";
uint32_t i = static_cast<uint32_t>(reinterpret_cast<intptr_t>(entry->value));
return ExternalReferenceTable::instance(isolate)->name(i);
@@ -472,13 +472,12 @@ class CodeAddressMap: public CodeEventLogger {
}
HashMap::Entry* FindOrCreateEntry(Address code_address) {
- return impl_.Lookup(code_address, ComputePointerHash(code_address), true);
+ return impl_.LookupOrInsert(code_address,
+ ComputePointerHash(code_address));
}
HashMap::Entry* FindEntry(Address code_address) {
- return impl_.Lookup(code_address,
- ComputePointerHash(code_address),
- false);
+ return impl_.Lookup(code_address, ComputePointerHash(code_address));
}
void RemoveEntry(HashMap::Entry* entry) {

Powered by Google App Engine
This is Rietveld 408576698