| 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
|
|
|