[cleanup] Remove GetFunctionName from StringsStorage
This distinction doesn't matter, they aren't treated any differently to other strings. Change-Id: I524a0a1c4089284af97aa507afc5bd5985fe6631 Reviewed-on: https://chromium-review.googlesource.com/1071628 Reviewed-by: Camillo Bruni <cbruni@chromium.org> Commit-Queue: Peter Marshall <petermarshall@chromium.org> Cr-Commit-Position: refs/heads/master@{#53329}
This commit is contained in:
parent
71e4c57319
commit
170418b212
@ -249,7 +249,7 @@ unsigned AllocationTracker::AddFunctionInfo(SharedFunctionInfo* shared,
|
||||
reinterpret_cast<void*>(id), SnapshotObjectIdHash(id));
|
||||
if (entry->value == nullptr) {
|
||||
FunctionInfo* info = new FunctionInfo();
|
||||
info->name = names_->GetFunctionName(shared->DebugName());
|
||||
info->name = names_->GetName(shared->DebugName());
|
||||
info->function_id = id;
|
||||
if (shared->script()->IsScript()) {
|
||||
Script* script = Script::cast(shared->script());
|
||||
|
@ -37,10 +37,10 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
|
||||
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
|
||||
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
|
||||
rec->start = code->address();
|
||||
rec->entry = NewCodeEntry(
|
||||
tag, GetFunctionName(name), CodeEntry::kEmptyResourceName,
|
||||
CpuProfileNode::kNoLineNumberInfo, CpuProfileNode::kNoColumnNumberInfo,
|
||||
nullptr, code->InstructionStart());
|
||||
rec->entry = NewCodeEntry(tag, GetName(name), CodeEntry::kEmptyResourceName,
|
||||
CpuProfileNode::kNoLineNumberInfo,
|
||||
CpuProfileNode::kNoColumnNumberInfo, nullptr,
|
||||
code->InstructionStart());
|
||||
RecordInliningInfo(rec->entry, code);
|
||||
rec->size = code->ExecutableSize();
|
||||
DispatchCodeEvent(evt_rec);
|
||||
@ -51,10 +51,10 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
|
||||
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
|
||||
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
|
||||
rec->start = code->address();
|
||||
rec->entry = NewCodeEntry(
|
||||
tag, GetFunctionName(name), CodeEntry::kEmptyResourceName,
|
||||
CpuProfileNode::kNoLineNumberInfo, CpuProfileNode::kNoColumnNumberInfo,
|
||||
nullptr, code->InstructionStart());
|
||||
rec->entry = NewCodeEntry(tag, GetName(name), CodeEntry::kEmptyResourceName,
|
||||
CpuProfileNode::kNoLineNumberInfo,
|
||||
CpuProfileNode::kNoColumnNumberInfo, nullptr,
|
||||
code->InstructionStart());
|
||||
RecordInliningInfo(rec->entry, code);
|
||||
rec->size = code->ExecutableSize();
|
||||
DispatchCodeEvent(evt_rec);
|
||||
@ -67,7 +67,7 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
|
||||
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
|
||||
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
|
||||
rec->start = code->address();
|
||||
rec->entry = NewCodeEntry(tag, GetFunctionName(shared->DebugName()),
|
||||
rec->entry = NewCodeEntry(tag, GetName(shared->DebugName()),
|
||||
GetName(InferScriptName(script_name, shared)),
|
||||
CpuProfileNode::kNoLineNumberInfo,
|
||||
CpuProfileNode::kNoColumnNumberInfo, nullptr,
|
||||
@ -102,7 +102,7 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
|
||||
}
|
||||
}
|
||||
rec->entry =
|
||||
NewCodeEntry(tag, GetFunctionName(shared->DebugName()),
|
||||
NewCodeEntry(tag, GetName(shared->DebugName()),
|
||||
GetName(InferScriptName(script_name, shared)), line, column,
|
||||
std::move(line_table), abstract_code->InstructionStart());
|
||||
RecordInliningInfo(rec->entry, abstract_code);
|
||||
@ -119,7 +119,7 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
|
||||
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
|
||||
rec->start = code->instruction_start();
|
||||
rec->entry = NewCodeEntry(
|
||||
tag, GetFunctionName(name.start()), CodeEntry::kWasmResourceNamePrefix,
|
||||
tag, GetName(name.start()), CodeEntry::kWasmResourceNamePrefix,
|
||||
CpuProfileNode::kNoLineNumberInfo, CpuProfileNode::kNoColumnNumberInfo,
|
||||
nullptr, code->instruction_start());
|
||||
rec->size = code->instructions().length();
|
||||
@ -237,7 +237,7 @@ void ProfilerListener::RecordInliningInfo(CodeEntry* entry,
|
||||
: CodeEntry::kEmptyResourceName;
|
||||
|
||||
CodeEntry* inline_entry =
|
||||
new CodeEntry(entry->tag(), GetFunctionName(shared_info->DebugName()),
|
||||
new CodeEntry(entry->tag(), GetName(shared_info->DebugName()),
|
||||
resource_name, CpuProfileNode::kNoLineNumberInfo,
|
||||
CpuProfileNode::kNoColumnNumberInfo, nullptr,
|
||||
code->InstructionStart());
|
||||
|
@ -67,15 +67,12 @@ class ProfilerListener : public CodeEventListener {
|
||||
const char* GetName(int args_count) {
|
||||
return function_and_resource_names_.GetName(args_count);
|
||||
}
|
||||
const char* GetName(const char* name) {
|
||||
return function_and_resource_names_.GetCopy(name);
|
||||
}
|
||||
const char* GetConsName(const char* prefix, Name* name) {
|
||||
return function_and_resource_names_.GetConsName(prefix, name);
|
||||
}
|
||||
const char* GetFunctionName(Name* name) {
|
||||
return function_and_resource_names_.GetFunctionName(name);
|
||||
}
|
||||
const char* GetFunctionName(const char* name) {
|
||||
return function_and_resource_names_.GetFunctionName(name);
|
||||
}
|
||||
|
||||
private:
|
||||
void RecordInliningInfo(CodeEntry* entry, AbstractCode* abstract_code);
|
||||
|
@ -203,7 +203,7 @@ SamplingHeapProfiler::AllocationNode* SamplingHeapProfiler::AddStack() {
|
||||
// the first element in the list.
|
||||
for (auto it = stack.rbegin(); it != stack.rend(); ++it) {
|
||||
SharedFunctionInfo* shared = *it;
|
||||
const char* name = this->names()->GetFunctionName(shared->DebugName());
|
||||
const char* name = this->names()->GetName(shared->DebugName());
|
||||
int script_id = v8::UnboundScript::kNoScriptId;
|
||||
if (shared->script()->IsScript()) {
|
||||
Script* script = Script::cast(shared->script());
|
||||
|
@ -107,14 +107,6 @@ const char* StringsStorage::GetConsName(const char* prefix, Name* name) {
|
||||
return "";
|
||||
}
|
||||
|
||||
const char* StringsStorage::GetFunctionName(Name* name) {
|
||||
return GetName(name);
|
||||
}
|
||||
|
||||
const char* StringsStorage::GetFunctionName(const char* name) {
|
||||
return GetCopy(name);
|
||||
}
|
||||
|
||||
base::HashMap::Entry* StringsStorage::GetEntry(const char* str, int len) {
|
||||
uint32_t hash = StringHasher::HashSequentialString(str, len, hash_seed_);
|
||||
return names_.LookupOrInsert(const_cast<char*>(str), hash);
|
||||
|
@ -35,10 +35,6 @@ class V8_EXPORT_PRIVATE StringsStorage {
|
||||
// Appends string resulting from name to prefix, then returns the stored
|
||||
// result.
|
||||
const char* GetConsName(const char* prefix, Name* name);
|
||||
// Does exactly the same thing as GetName(Name* name).
|
||||
const char* GetFunctionName(Name* name);
|
||||
// Does exactly the same thing as GetCopy(const char* name).
|
||||
const char* GetFunctionName(const char* name);
|
||||
|
||||
private:
|
||||
static bool StringsMatch(void* key1, void* key2);
|
||||
|
@ -80,28 +80,6 @@ TEST_F(StringsStorageWithIsolate, GetNameFromInt) {
|
||||
CHECK(StringEq(str_negative_int, stored_str));
|
||||
}
|
||||
|
||||
TEST_F(StringsStorageWithIsolate, GetFunctionNameFromString) {
|
||||
StringsStorage storage(isolate()->heap()->HashSeed());
|
||||
|
||||
Handle<String> str = isolate()->factory()->NewStringFromAsciiChecked("xy");
|
||||
const char* stored_str = storage.GetFunctionName(*str);
|
||||
CHECK(StringEq("xy", stored_str));
|
||||
|
||||
// Check that GetName and GetFunctionName use the same storage.
|
||||
const char* stored_str_twice = storage.GetName(*str);
|
||||
CHECK_EQ(stored_str, stored_str_twice);
|
||||
}
|
||||
|
||||
TEST_F(StringsStorageWithIsolate, GetFunctionNameFromCString) {
|
||||
StringsStorage storage(isolate()->heap()->HashSeed());
|
||||
|
||||
const char* xy = "xy";
|
||||
const char* stored_str = storage.GetFunctionName("xy");
|
||||
CHECK(StringEq("xy", stored_str));
|
||||
// Check that the string is copied.
|
||||
CHECK_NE(xy, stored_str);
|
||||
}
|
||||
|
||||
TEST_F(StringsStorageWithIsolate, Format) {
|
||||
StringsStorage storage(isolate()->heap()->HashSeed());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user