Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index 7b0b92152931dc3da1e9036cc585b631de054c5c..5de9d960c79e9c96cdc3959f4d6a6a9e859283cf 100644 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -1181,7 +1181,16 @@ void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
Handle<Code> code = info->code(); |
if (*code == info->isolate()->builtins()->builtin(Builtins::kLazyCompile)) |
return; |
+ Handle<String> script_name; |
if (script->name()->IsString()) { |
+ script_name = Handle<String>(String::cast(script->name())); |
+ } else { |
+ Handle<Object> name = GetScriptNameOrSourceURL(script); |
+ if (!name.is_null() && name->IsString()) { |
+ script_name = Handle<String>::cast(name); |
+ } |
+ } |
+ if (!script_name.is_null()) { |
int line_num = GetScriptLineNumber(script, shared->start_position()) + 1; |
USE(line_num); |
PROFILE(info->isolate(), |
@@ -1189,7 +1198,7 @@ void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
*code, |
*shared, |
info, |
- String::cast(script->name()), |
+ String::cast(*script_name), |
line_num)); |
} else { |
PROFILE(info->isolate(), |