Commit 6a6e907a authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[log] Canonicalize printing of object addresses

This avoids having occurrences of both 0x000012345678 and
0x12345678 in the log.

Change-Id: Id3603993362d1dd327aad567ef3448d00ce3a8fd
Reviewed-on: https://chromium-review.googlesource.com/c/1491514Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59910}
parent f70bb59b
......@@ -1623,7 +1623,7 @@ void Logger::ICEvent(const char* type, bool keyed, Map map, Object key,
Address pc = isolate_->GetAbstractPC(&line, &column);
msg << type << kNext << reinterpret_cast<void*>(pc) << kNext << line << kNext
<< column << kNext << old_state << kNext << new_state << kNext
<< reinterpret_cast<void*>(map.ptr()) << kNext;
<< AsHex::Address(map.ptr()) << kNext;
if (key->IsSmi()) {
msg << Smi::ToInt(key);
} else if (key->IsNumber()) {
......@@ -1652,10 +1652,9 @@ void Logger::MapEvent(const char* type, Map from, Map to, const char* reason,
}
Log::MessageBuilder msg(log_);
msg << "map" << kNext << type << kNext << timer_.Elapsed().InMicroseconds()
<< kNext << reinterpret_cast<void*>(from.ptr()) << kNext
<< reinterpret_cast<void*>(to.ptr()) << kNext
<< reinterpret_cast<void*>(pc) << kNext << line << kNext << column
<< kNext << reason << kNext;
<< kNext << AsHex::Address(from.ptr()) << kNext
<< AsHex::Address(to.ptr()) << kNext << AsHex::Address(pc) << kNext
<< line << kNext << column << kNext << reason << kNext;
if (!name_or_sfi.is_null()) {
if (name_or_sfi->IsName()) {
......@@ -1676,7 +1675,7 @@ void Logger::MapCreate(Map map) {
DisallowHeapAllocation no_gc;
Log::MessageBuilder msg(log_);
msg << "map-create" << kNext << timer_.Elapsed().InMicroseconds() << kNext
<< reinterpret_cast<void*>(map.ptr());
<< AsHex::Address(map.ptr());
msg.WriteToLogFile();
}
......@@ -1685,7 +1684,7 @@ void Logger::MapDetails(Map map) {
DisallowHeapAllocation no_gc;
Log::MessageBuilder msg(log_);
msg << "map-details" << kNext << timer_.Elapsed().InMicroseconds() << kNext
<< reinterpret_cast<void*>(map.ptr()) << kNext;
<< AsHex::Address(map.ptr()) << kNext;
if (FLAG_trace_maps_details) {
std::ostringstream buffer;
map->PrintMapDetails(buffer);
......
......@@ -1841,7 +1841,7 @@ void Smi::SmiPrint(std::ostream& os) const { // NOLINT
void HeapObject::HeapObjectShortPrint(std::ostream& os) { // NOLINT
os << AsHex(this->ptr(), kSystemPointerHexDigits, true) << " ";
os << AsHex::Address(this->ptr()) << " ";
if (IsString()) {
HeapStringAllocator allocator;
......
......@@ -121,6 +121,10 @@ struct AsHex {
uint64_t value;
uint8_t min_width;
bool with_prefix;
static AsHex Address(Address a) {
return AsHex(a, kSystemPointerHexDigits, true);
}
};
// Output the given value as hex, separated in individual bytes.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment