Skip to content

Commit d11d1b1

Browse files
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. [email protected] Review URL: https://codereview.chromium.org/22897021 Patch from Daniel Kurka <[email protected]>. git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@16307 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
1 parent 6e375c3 commit d11d1b1

8 files changed

+450
-14
lines changed

src/compiler.cc

+6-2
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,8 @@ void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag,
12091209
if (*code == info->isolate()->builtins()->builtin(Builtins::kLazyCompile))
12101210
return;
12111211
int line_num = GetScriptLineNumber(script, shared->start_position()) + 1;
1212+
int column_num =
1213+
GetScriptColumnNumber(script, shared->start_position()) + 1;
12121214
USE(line_num);
12131215
if (script->name()->IsString()) {
12141216
PROFILE(info->isolate(),
@@ -1217,15 +1219,17 @@ void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag,
12171219
*shared,
12181220
info,
12191221
String::cast(script->name()),
1220-
line_num));
1222+
line_num,
1223+
column_num));
12211224
} else {
12221225
PROFILE(info->isolate(),
12231226
CodeCreateEvent(Logger::ToNativeByScript(tag, *script),
12241227
*code,
12251228
*shared,
12261229
info,
12271230
info->isolate()->heap()->empty_string(),
1228-
line_num));
1231+
line_num,
1232+
column_num));
12291233
}
12301234
}
12311235

src/log.cc

+6-4
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag,
12331233
Code* code,
12341234
SharedFunctionInfo* shared,
12351235
CompilationInfo* info,
1236-
Name* source, int line) {
1236+
Name* source, int line, int column) {
12371237
PROFILER_LOG(CodeCreateEvent(tag, code, shared, info, source, line));
12381238

12391239
if (!is_logging_code_events()) return;
@@ -1252,7 +1252,7 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag,
12521252
} else {
12531253
msg.AppendSymbolName(Symbol::cast(source));
12541254
}
1255-
msg.Append(":%d\",", line);
1255+
msg.Append(":%d:%d\",", line, column);
12561256
msg.AppendAddress(shared->address());
12571257
msg.Append(",%s", ComputeMarker(code));
12581258
msg.Append('\n');
@@ -1712,14 +1712,16 @@ void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared,
17121712
if (shared->script()->IsScript()) {
17131713
Handle<Script> script(Script::cast(shared->script()));
17141714
int line_num = GetScriptLineNumber(script, shared->start_position()) + 1;
1715+
int column_num =
1716+
GetScriptColumnNumber(script, shared->start_position()) + 1;
17151717
if (script->name()->IsString()) {
17161718
Handle<String> script_name(String::cast(script->name()));
17171719
if (line_num > 0) {
17181720
PROFILE(isolate_,
17191721
CodeCreateEvent(
17201722
Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script),
17211723
*code, *shared, NULL,
1722-
*script_name, line_num));
1724+
*script_name, line_num, column_num));
17231725
} else {
17241726
// Can't distinguish eval and script here, so always use Script.
17251727
PROFILE(isolate_,
@@ -1732,7 +1734,7 @@ void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared,
17321734
CodeCreateEvent(
17331735
Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script),
17341736
*code, *shared, NULL,
1735-
isolate_->heap()->empty_string(), line_num));
1737+
isolate_->heap()->empty_string(), line_num, column_num));
17361738
}
17371739
} else if (shared->IsApiFunction()) {
17381740
// API function.

src/log.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ class Logger {
248248
Code* code,
249249
SharedFunctionInfo* shared,
250250
CompilationInfo* info,
251-
Name* source, int line);
251+
Name* source, int line, int column);
252252
void CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count);
253253
void CodeMovingGCEvent();
254254
// Emits a code create event for a RegExp.

0 commit comments

Comments
 (0)