Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: src/compiler.cc

Issue 39179: Adding support for reporting addresses of JIT compiled code to OProfile (Closed)
Patch Set: Fixes according to Kasper's comments Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/SConscript ('k') | src/flag-definitions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 89917d8edfd5471909acfd3391394f7c4ae65c0d..c82fa093c8bf280f77dec9234ec2811b9f9afd25 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -35,6 +35,7 @@
#include "scopes.h"
#include "rewriter.h"
#include "usage-analyzer.h"
+#include "oprofile-agent.h"
namespace v8 { namespace internal {
@@ -123,16 +124,20 @@ static Handle<JSFunction> MakeFunction(bool is_global,
return Handle<JSFunction>::null();
}
-#ifdef ENABLE_LOGGING_AND_PROFILING
+#if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT
// Log the code generation for the script. Check explicit whether logging is
// to avoid allocating when not required.
- if (Logger::is_enabled()) {
+ if (Logger::is_enabled() || OProfileAgent::is_enabled()) {
if (script->name()->IsString()) {
SmartPointer<char> data =
String::cast(script->name())->ToCString(DISALLOW_NULLS);
LOG(CodeCreateEvent(is_eval ? "Eval" : "Script", *code, *data));
+ OProfileAgent::CreateNativeCodeRegion(*data, code->address(),
+ code->ExecutableSize());
} else {
LOG(CodeCreateEvent(is_eval ? "Eval" : "Script", *code, ""));
+ OProfileAgent::CreateNativeCodeRegion(is_eval ? "Eval" : "Script",
+ code->address(), code->ExecutableSize());
}
}
#endif
@@ -306,11 +311,11 @@ bool Compiler::CompileLazy(Handle<SharedFunctionInfo> shared,
return false;
}
-#ifdef ENABLE_LOGGING_AND_PROFILING
+#if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT
// Log the code generation. If source information is available include script
// name and line number. Check explicit whether logging is enabled as finding
// the line number is not for free.
- if (Logger::is_enabled()) {
+ if (Logger::is_enabled() || OProfileAgent::is_enabled()) {
if (script->name()->IsString()) {
int line_num = script->GetLineNumber(start_position);
if (line_num > 0) {
@@ -318,8 +323,14 @@ bool Compiler::CompileLazy(Handle<SharedFunctionInfo> shared,
}
LOG(CodeCreateEvent("LazyCompile", *code, *lit->name(),
String::cast(script->name()), line_num));
+ OProfileAgent::CreateNativeCodeRegion(*lit->name(),
+ String::cast(script->name()),
+ line_num, code->address(),
+ code->ExecutableSize());
} else {
LOG(CodeCreateEvent("LazyCompile", *code, *lit->name()));
+ OProfileAgent::CreateNativeCodeRegion(*lit->name(), code->address(),
+ code->ExecutableSize());
}
}
#endif
« no previous file with comments | « src/SConscript ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698