From 43bf8f97549c87c9842a155be70590db225d3da7 Mon Sep 17 00:00:00 2001 From: "jkummerow@chromium.org" Date: Fri, 23 Aug 2013 17:20:54 +0000 Subject: [PATCH] Add source map support to tick processor. Added a console parameter for source map to the tick processor. The tickprocesspor reads in the source maps and uses it to output the original filename, line number and column in the profile. Modified d8 to output column numbers into the log, since this is needed to do source mapping. R=jkummerow@chromium.org Review URL: https://codereview.chromium.org/22897021 Patch from Daniel Kurka . git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16307 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/compiler.cc | 8 +- src/log.cc | 10 +- src/log.h | 2 +- tools/SourceMap.js | 371 +++++++++++++++++++++++++++++++++++++++ tools/linux-tick-processor | 1 + tools/tickprocessor-driver.js | 20 ++- tools/tickprocessor.js | 50 +++++- tools/windows-tick-processor.bat | 2 +- 8 files changed, 450 insertions(+), 14 deletions(-) create mode 100644 tools/SourceMap.js diff --git a/src/compiler.cc b/src/compiler.cc index 19f7054..c14234f 100644 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -1209,6 +1209,8 @@ void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, if (*code == info->isolate()->builtins()->builtin(Builtins::kLazyCompile)) return; int line_num = GetScriptLineNumber(script, shared->start_position()) + 1; + int column_num = + GetScriptColumnNumber(script, shared->start_position()) + 1; USE(line_num); if (script->name()->IsString()) { PROFILE(info->isolate(), @@ -1217,7 +1219,8 @@ void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, *shared, info, String::cast(script->name()), - line_num)); + line_num, + column_num)); } else { PROFILE(info->isolate(), CodeCreateEvent(Logger::ToNativeByScript(tag, *script), @@ -1225,7 +1228,8 @@ void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, *shared, info, info->isolate()->heap()->empty_string(), - line_num)); + line_num, + column_num)); } } diff --git a/src/log.cc b/src/log.cc index e93a760..1ddfd42 100644 --- a/src/log.cc +++ b/src/log.cc @@ -1233,7 +1233,7 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, SharedFunctionInfo* shared, CompilationInfo* info, - Name* source, int line) { + Name* source, int line, int column) { PROFILER_LOG(CodeCreateEvent(tag, code, shared, info, source, line)); if (!is_logging_code_events()) return; @@ -1252,7 +1252,7 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, } else { msg.AppendSymbolName(Symbol::cast(source)); } - msg.Append(":%d\",", line); + msg.Append(":%d:%d\",", line, column); msg.AppendAddress(shared->address()); msg.Append(",%s", ComputeMarker(code)); msg.Append('\n'); @@ -1712,6 +1712,8 @@ void Logger::LogExistingFunction(Handle shared, if (shared->script()->IsScript()) { Handle