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

Unified Diff: src/snapshot/serializer-common.cc

Issue 2498163003: Revert of [serializer] print use count of external references. (Closed)
Patch Set: Created 4 years, 1 month 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 | « src/snapshot/serializer-common.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot/serializer-common.cc
diff --git a/src/snapshot/serializer-common.cc b/src/snapshot/serializer-common.cc
index f18879341931465f456bf36095ac0d84262d0375..d42c3061e6f5fd3596617161a81e64bb0b372a91 100644
--- a/src/snapshot/serializer-common.cc
+++ b/src/snapshot/serializer-common.cc
@@ -8,21 +8,25 @@
#include "src/ic/stub-cache.h"
#include "src/list-inl.h"
+#if defined(DEBUG) && defined(V8_OS_LINUX) && !defined(V8_OS_ANDROID)
+#define SYMBOLIZE_FUNCTION
+#include <execinfo.h>
+#endif // DEBUG && V8_OS_LINUX && !V8_OS_ANDROID
+
namespace v8 {
namespace internal {
ExternalReferenceEncoder::ExternalReferenceEncoder(Isolate* isolate) {
map_ = isolate->external_reference_map();
-#ifdef DEBUG
- table_ = ExternalReferenceTable::instance(isolate);
-#endif // DEBUG
if (map_ != nullptr) return;
map_ = new AddressToIndexHashMap();
ExternalReferenceTable* table = ExternalReferenceTable::instance(isolate);
for (uint32_t i = 0; i < table->size(); ++i) {
Address addr = table->address(i);
- DCHECK(map_->Get(addr).IsNothing() ||
- strncmp(table->name(i), "Redirect to ", 12) == 0);
+ // We expect no duplicate external references entries in the table.
+ // AccessorRefTable getter may have duplicates, indicated by an empty string
+ // as name.
+ DCHECK(table->name(i)[0] == '\0' || map_->Get(addr).IsNothing());
map_->Set(addr, i);
DCHECK(map_->Get(addr).IsJust());
}
@@ -32,14 +36,13 @@
uint32_t ExternalReferenceEncoder::Encode(Address address) const {
Maybe<uint32_t> maybe_index = map_->Get(address);
if (maybe_index.IsNothing()) {
- void* addr = address;
- v8::base::OS::PrintError("Unknown external reference %p.\n", addr);
- v8::base::OS::PrintError("%s", ExternalReferenceTable::ResolveSymbol(addr));
+ void* function_addr = address;
+ v8::base::OS::PrintError("Unknown external reference %p.\n", function_addr);
+#ifdef SYMBOLIZE_FUNCTION
+ v8::base::OS::PrintError("%s\n", backtrace_symbols(&function_addr, 1)[0]);
+#endif // SYMBOLIZE_FUNCTION
v8::base::OS::Abort();
}
-#ifdef DEBUG
- table_->increment_count(maybe_index.FromJust());
-#endif // DEBUG
return maybe_index.FromJust();
}
« no previous file with comments | « src/snapshot/serializer-common.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698