From 5be7020308b416596cb567ed3c4403b5510d8993 Mon Sep 17 00:00:00 2001 From: "alph@chromium.org" Date: Tue, 5 Aug 2014 07:31:17 +0000 Subject: [PATCH] Make CPU profiler function names match ones from StackFrame iterator. R=yangguo@chromium.org, yurys@chromium.org Review URL: https://codereview.chromium.org/417253003 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22845 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/cpu-profiler.cc | 24 ++++++++++-------------- src/cpu-profiler.h | 13 +++++-------- src/isolate.cc | 5 +---- 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/src/cpu-profiler.cc b/src/cpu-profiler.cc index 3b14fb6..68a565c 100644 --- a/src/cpu-profiler.cc +++ b/src/cpu-profiler.cc @@ -222,16 +222,16 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, } -void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, - Code* code, +void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code, SharedFunctionInfo* shared, - CompilationInfo* info, - Name* name) { + CompilationInfo* info, Name* script_name) { if (FilterOutCodeCreateEvent(tag)) return; CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; rec->start = code->address(); - rec->entry = profiles_->NewCodeEntry(tag, profiles_->GetFunctionName(name)); + rec->entry = profiles_->NewCodeEntry( + tag, profiles_->GetFunctionName(shared->DebugName()), + CodeEntry::kEmptyNamePrefix, profiles_->GetName(script_name)); if (info) { rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges()); } @@ -248,21 +248,17 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, } -void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, - Code* code, +void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code, SharedFunctionInfo* shared, - CompilationInfo* info, - Name* source, int line, int column) { + CompilationInfo* info, Name* script_name, + int line, int column) { if (FilterOutCodeCreateEvent(tag)) return; CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; rec->start = code->address(); rec->entry = profiles_->NewCodeEntry( - tag, - profiles_->GetFunctionName(shared->DebugName()), - CodeEntry::kEmptyNamePrefix, - profiles_->GetName(source), - line, + tag, profiles_->GetFunctionName(shared->DebugName()), + CodeEntry::kEmptyNamePrefix, profiles_->GetName(script_name), line, column); if (info) { rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges()); diff --git a/src/cpu-profiler.h b/src/cpu-profiler.h index d666255..c1e75a1 100644 --- a/src/cpu-profiler.h +++ b/src/cpu-profiler.h @@ -221,16 +221,13 @@ class CpuProfiler : public CodeEventListener { Code* code, const char* comment); virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code, Name* name); - virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, - Code* code, + virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code, SharedFunctionInfo* shared, - CompilationInfo* info, - Name* name); - virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, - Code* code, + CompilationInfo* info, Name* script_name); + virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code, SharedFunctionInfo* shared, - CompilationInfo* info, - Name* source, int line, int column); + CompilationInfo* info, Name* script_name, + int line, int column); virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code, int args_count); virtual void CodeMovingGCEvent() {} diff --git a/src/isolate.cc b/src/isolate.cc index 69a62f9..cc01f57 100644 --- a/src/isolate.cc +++ b/src/isolate.cc @@ -523,10 +523,7 @@ Handle Isolate::CaptureCurrentStackTrace( } if (options & StackTrace::kFunctionName) { - Handle fun_name(fun->shared()->name(), this); - if (!fun_name->BooleanValue()) { - fun_name = Handle(fun->shared()->inferred_name(), this); - } + Handle fun_name(fun->shared()->DebugName(), this); JSObject::AddProperty(stack_frame, function_key, fun_name, NONE); } -- 2.7.4