From 3835e915c4b20c1656815aaa69b4021b94abfc0e Mon Sep 17 00:00:00 2001 From: "mikhail.naganov@gmail.com" Date: Tue, 3 Feb 2009 10:52:02 +0000 Subject: [PATCH] Adding src_file_name:line_number into perf log entries for compiled JS functions. Thus, instead of the following profiler records: 1.5% 1.5% LazyCompile: we'll now have these: 1.5% 1.5% LazyCompile: richards.js:309 Basically, I translated two functions from messages.js into C++. In the next CL I will update messages.js to use added native functions. Review URL: http://codereview.chromium.org/19537 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1216 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/compiler.cc | 13 +++++++++- src/factory.cc | 1 + src/log.cc | 16 ++++++++++++ src/log.h | 2 ++ src/objects-inl.h | 1 + src/objects.cc | 55 ++++++++++++++++++++++++++++++++++++++++++ src/objects.h | 9 ++++++- tools/tickprocessor.py | 5 +++- 8 files changed, 99 insertions(+), 3 deletions(-) diff --git a/src/compiler.cc b/src/compiler.cc index 81be930fc5..94f4e845b1 100644 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -293,7 +293,18 @@ bool Compiler::CompileLazy(Handle shared, } // Generate the code, update the function info, and return the code. - LOG(CodeCreateEvent("LazyCompile", *code, *lit->name())); +#ifdef ENABLE_LOGGING_AND_PROFILING + if (script->name()->IsString()) { + int lineNum = script->GetLineNumber(start_position); + if (lineNum > 0) { + lineNum += script->line_offset()->value() + 1; + } + LOG(CodeCreateEvent("LazyCompile", *code, *lit->name(), + String::cast(script->name()), lineNum)); + } else { + LOG(CodeCreateEvent("LazyCompile", *code, *lit->name())); + } +#endif // Update the shared function info with the compiled code. shared->set_code(*code); diff --git a/src/factory.cc b/src/factory.cc index 52d3bad9fc..3eefa1faa0 100644 --- a/src/factory.cc +++ b/src/factory.cc @@ -160,6 +160,7 @@ Handle