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

Unified Diff: src/compiler.cc

Issue 575004: Apply r3795 to bleeding_edge. (Closed)
Patch Set: Created 10 years, 11 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/compiler.h ('k') | no next file » | 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 c5609e3a2338271173c912523b8ef98440acc52f..29a48a0e57b8aa8f3aff514e5bcf3b2e46e1b1b0 100755
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -385,29 +385,12 @@ bool Compiler::CompileLazy(CompilationInfo* info) {
}
#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_logging() || OProfileAgent::is_enabled()) {
- Handle<String> func_name(name->length() > 0 ?
- *name : shared->inferred_name());
- Handle<Script> script = info->script();
- if (script->name()->IsString()) {
- int line_num = GetScriptLineNumber(script, start_position) + 1;
- LOG(CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *func_name,
- String::cast(script->name()), line_num));
- OProfileAgent::CreateNativeCodeRegion(*func_name,
- String::cast(script->name()),
- line_num,
- code->instruction_start(),
- code->instruction_size());
- } else {
- LOG(CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *func_name));
- OProfileAgent::CreateNativeCodeRegion(*func_name,
- code->instruction_start(),
- code->instruction_size());
- }
- }
+ LogCodeCreateEvent(Logger::LAZY_COMPILE_TAG,
+ name,
+ Handle<String>(shared->inferred_name()),
+ start_position,
+ info->script(),
+ code);
#endif
// Update the shared function info with the compiled code.
@@ -494,12 +477,14 @@ Handle<JSFunction> Compiler::BuildBoilerplate(FunctionLiteral* literal,
}
// Function compilation complete.
- LOG(CodeCreateEvent(Logger::FUNCTION_TAG, *code, *literal->name()));
-#ifdef ENABLE_OPROFILE_AGENT
- OProfileAgent::CreateNativeCodeRegion(*literal->name(),
- code->instruction_start(),
- code->instruction_size());
+#if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT
+ LogCodeCreateEvent(Logger::FUNCTION_TAG,
+ literal->name(),
+ literal->inferred_name(),
+ literal->start_position(),
+ script,
+ code);
#endif
}
@@ -547,4 +532,35 @@ void Compiler::SetFunctionInfo(Handle<JSFunction> fun,
}
+#if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT
+void Compiler::LogCodeCreateEvent(Logger::LogEventsAndTags tag,
+ Handle<String> name,
+ Handle<String> inferred_name,
+ int start_position,
+ Handle<Script> script,
+ Handle<Code> code) {
+ // Log the code generation. If source information is available
+ // include script name and line number. Check explicitly whether
+ // logging is enabled as finding the line number is not free.
+ if (Logger::is_logging() || OProfileAgent::is_enabled()) {
+ Handle<String> func_name(name->length() > 0 ? *name : *inferred_name);
+ if (script->name()->IsString()) {
+ int line_num = GetScriptLineNumber(script, start_position) + 1;
+ LOG(CodeCreateEvent(tag, *code, *func_name,
+ String::cast(script->name()), line_num));
+ OProfileAgent::CreateNativeCodeRegion(*func_name,
+ String::cast(script->name()),
+ line_num,
+ code->instruction_start(),
+ code->instruction_size());
+ } else {
+ LOG(CodeCreateEvent(tag, *code, *func_name));
+ OProfileAgent::CreateNativeCodeRegion(*func_name,
+ code->instruction_start(),
+ code->instruction_size());
+ }
+ }
+}
+#endif
+
} } // namespace v8::internal
« no previous file with comments | « src/compiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698