Revert of [serializer] print use count of external references. (patchset #2 id:20001 of https://codereview.chromium.org/2495213003/ )

Reason for revert:
Breaks https://build.chromium.org/p/client.v8/builders/V8%20Linux%20-%20vtunejit/builds/14690 compile

Original issue's description:
> [serializer] print use count of external references.
>
> R=peria@chromium.org, vogelheim@chromium.org
> BUG=chromium:617892
> NOPRESUBMIT=true

TBR=peria@chromium.org,vogelheim@chromium.org,yangguo@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:617892

Review-Url: https://codereview.chromium.org/2498163003
Cr-Commit-Position: refs/heads/master@{#40980}
This commit is contained in:
machenbach 2016-11-14 23:42:55 -08:00 committed by Commit bot
parent e56bd9c332
commit 42d8a1d89b
6 changed files with 22 additions and 79 deletions

View File

@ -559,10 +559,6 @@ StartupData SnapshotCreator::CreateBlob(
}
data->contexts_.Clear();
#ifdef DEBUG
i::ExternalReferenceTable::instance(isolate)->ResetCount();
#endif // DEBUG
i::StartupSerializer startup_serializer(isolate, function_code_handling);
startup_serializer.SerializeStrongReferences();
@ -576,13 +572,6 @@ StartupData SnapshotCreator::CreateBlob(
}
startup_serializer.SerializeWeakReferencesAndDeferred();
#ifdef DEBUG
if (i::FLAG_external_reference_stats) {
i::ExternalReferenceTable::instance(isolate)->PrintCount();
}
#endif // DEBUG
i::SnapshotData startup_snapshot(&startup_serializer);
StartupData result =
i::Snapshot::CreateSnapshotBlob(&startup_snapshot, &context_snapshots);

View File

@ -11,11 +11,6 @@
#include "src/deoptimizer.h"
#include "src/ic/stub-cache.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 {
@ -48,28 +43,6 @@ ExternalReferenceTable::ExternalReferenceTable(Isolate* isolate) {
AddApiReferences(isolate);
}
#ifdef DEBUG
void ExternalReferenceTable::ResetCount() {
for (ExternalReferenceEntry& entry : refs_) entry.count = 0;
}
void ExternalReferenceTable::PrintCount() {
for (int i = 0; i < refs_.length(); i++) {
v8::base::OS::Print("index=%5d count=%5d %-60s\n", i, refs_[i].count,
refs_[i].name);
}
}
#endif // DEBUG
// static
const char* ExternalReferenceTable::ResolveSymbol(void* address) {
#ifdef SYMBOLIZE_FUNCTION
return backtrace_symbols(&address, 1)[0];
#else
return "<unresolved>";
#endif // SYMBOLIZE_FUNCTION
}
void ExternalReferenceTable::AddReferences(Isolate* isolate) {
// Miscellaneous
Add(ExternalReference::roots_array_start(isolate).address(),
@ -363,24 +336,22 @@ void ExternalReferenceTable::AddAccessors(Isolate* isolate) {
};
static const AccessorRefTable getters[] = {
#define ACCESSOR_INFO_DECLARATION(name) \
{ FUNCTION_ADDR(&Accessors::name##Getter), \
"Redirect to Accessors::" #name "Getter"},
ACCESSOR_INFO_LIST(ACCESSOR_INFO_DECLARATION)
#define ACCESSOR_INFO_DECLARATION(name) \
{FUNCTION_ADDR(&Accessors::name##Getter), "Accessors::" #name "Getter"},
ACCESSOR_INFO_LIST(ACCESSOR_INFO_DECLARATION)
#undef ACCESSOR_INFO_DECLARATION
};
static const AccessorRefTable setters[] = {
#define ACCESSOR_SETTER_DECLARATION(name) \
{ FUNCTION_ADDR(&Accessors::name), "Accessors::" #name},
ACCESSOR_SETTER_LIST(ACCESSOR_SETTER_DECLARATION)
{FUNCTION_ADDR(&Accessors::name), "Accessors::" #name},
ACCESSOR_SETTER_LIST(ACCESSOR_SETTER_DECLARATION)
#undef ACCESSOR_INFO_DECLARATION
};
for (unsigned i = 0; i < arraysize(getters); ++i) {
const char* name = getters[i].name + 12; // Skip "Redirect to " prefix.
Add(getters[i].address, name);
Add(getters[i].address, getters[i].name);
Add(AccessorInfo::redirect(isolate, getters[i].address, ACCESSOR_GETTER),
getters[i].name);
"");
}
for (unsigned i = 0; i < arraysize(setters); ++i) {
@ -441,8 +412,7 @@ void ExternalReferenceTable::AddApiReferences(Isolate* isolate) {
intptr_t* api_external_references = isolate->api_external_references();
if (api_external_references != nullptr) {
while (*api_external_references != 0) {
Address address = reinterpret_cast<Address>(*api_external_references);
Add(address, ResolveSymbol(address));
Add(reinterpret_cast<Address>(*api_external_references), "<embedder>");
api_external_references++;
}
}

View File

@ -23,24 +23,12 @@ class ExternalReferenceTable {
Address address(uint32_t i) { return refs_[i].address; }
const char* name(uint32_t i) { return refs_[i].name; }
#ifdef DEBUG
void increment_count(uint32_t i) { refs_[i].count++; }
int count(uint32_t i) { return refs_[i].count; }
void ResetCount();
void PrintCount();
#endif // DEBUG
static const char* ResolveSymbol(void* address);
static const int kDeoptTableSerializeEntryCount = 64;
private:
struct ExternalReferenceEntry {
Address address;
const char* name;
#ifdef DEBUG
int count;
#endif // DEBUG
};
explicit ExternalReferenceTable(Isolate* isolate);

View File

@ -627,10 +627,6 @@ DEFINE_BOOL(serialize_toplevel, true, "enable caching of toplevel scripts")
DEFINE_BOOL(serialize_eager, false, "compile eagerly when caching scripts")
DEFINE_BOOL(serialize_age_code, false, "pre age code in the code cache")
DEFINE_BOOL(trace_serializer, false, "print code serializer trace")
#ifdef DEBUG
DEFINE_BOOL(external_reference_stats, false,
"print statistics on external references used during serialization")
#endif // DEBUG
// compiler.cc
DEFINE_INT(min_preparse_length, 1024,

View File

@ -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 @@ ExternalReferenceEncoder::ExternalReferenceEncoder(Isolate* isolate) {
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();
}

View File

@ -24,9 +24,6 @@ class ExternalReferenceEncoder {
private:
AddressToIndexHashMap* map_;
#ifdef DEBUG
ExternalReferenceTable* table_;
#endif // DEBUG
DISALLOW_COPY_AND_ASSIGN(ExternalReferenceEncoder);
};