From 29abaf4aad7bc736f9f8fb6225b86748efccfcf4 Mon Sep 17 00:00:00 2001 From: "loislo@chromium.org" Date: Wed, 12 Jun 2013 08:27:24 +0000 Subject: [PATCH] DevTools: CPUProfiler: provide url for scripts that have sourceURL property. BUG=none TEST=SourceURLSupportForNewFunctions, LogExistingFunctionSourceURLCheck R=jkummerow@chromium.org, yurys@chromium.org Review URL: https://codereview.chromium.org/16035027 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15074 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/compiler.cc | 11 ++++- src/handles.cc | 3 ++ src/log.cc | 12 ++++- test/cctest/test-cpu-profiler.cc | 76 ++++++++++++++++++++++++++++++++ 4 files changed, 99 insertions(+), 3 deletions(-) diff --git a/src/compiler.cc b/src/compiler.cc index 5fc107f943..b1f823466c 100644 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -1141,7 +1141,16 @@ void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, Handle code = info->code(); if (*code == info->isolate()->builtins()->builtin(Builtins::kLazyCompile)) return; + Handle script_name; if (script->name()->IsString()) { + script_name = Handle(String::cast(script->name())); + } else { + Handle name = GetScriptNameOrSourceURL(script); + if (!name.is_null() && name->IsString()) { + script_name = Handle::cast(name); + } + } + if (!script_name.is_null()) { int line_num = GetScriptLineNumber(script, shared->start_position()) + 1; USE(line_num); PROFILE(info->isolate(), @@ -1149,7 +1158,7 @@ void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, *code, *shared, info, - String::cast(script->name()), + String::cast(*script_name), line_num)); } else { PROFILE(info->isolate(), diff --git a/src/handles.cc b/src/handles.cc index 81828d98cc..658bb2a2a2 100644 --- a/src/handles.cc +++ b/src/handles.cc @@ -599,6 +599,9 @@ v8::Handle GetKeysForIndexedInterceptor(Handle receiver, Handle GetScriptNameOrSourceURL(Handle