OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 | 1174 |
1175 // Log the code generation. If source information is available include | 1175 // Log the code generation. If source information is available include |
1176 // script name and line number. Check explicitly whether logging is | 1176 // script name and line number. Check explicitly whether logging is |
1177 // enabled as finding the line number is not free. | 1177 // enabled as finding the line number is not free. |
1178 if (info->isolate()->logger()->is_logging_code_events() || | 1178 if (info->isolate()->logger()->is_logging_code_events() || |
1179 info->isolate()->cpu_profiler()->is_profiling()) { | 1179 info->isolate()->cpu_profiler()->is_profiling()) { |
1180 Handle<Script> script = info->script(); | 1180 Handle<Script> script = info->script(); |
1181 Handle<Code> code = info->code(); | 1181 Handle<Code> code = info->code(); |
1182 if (*code == info->isolate()->builtins()->builtin(Builtins::kLazyCompile)) | 1182 if (*code == info->isolate()->builtins()->builtin(Builtins::kLazyCompile)) |
1183 return; | 1183 return; |
| 1184 Handle<String> script_name; |
1184 if (script->name()->IsString()) { | 1185 if (script->name()->IsString()) { |
| 1186 script_name = Handle<String>(String::cast(script->name())); |
| 1187 } else { |
| 1188 Handle<Object> name = GetScriptNameOrSourceURL(script); |
| 1189 if (!name.is_null() && name->IsString()) { |
| 1190 script_name = Handle<String>::cast(name); |
| 1191 } |
| 1192 } |
| 1193 if (!script_name.is_null()) { |
1185 int line_num = GetScriptLineNumber(script, shared->start_position()) + 1; | 1194 int line_num = GetScriptLineNumber(script, shared->start_position()) + 1; |
1186 USE(line_num); | 1195 USE(line_num); |
1187 PROFILE(info->isolate(), | 1196 PROFILE(info->isolate(), |
1188 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), | 1197 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), |
1189 *code, | 1198 *code, |
1190 *shared, | 1199 *shared, |
1191 info, | 1200 info, |
1192 String::cast(script->name()), | 1201 String::cast(*script_name), |
1193 line_num)); | 1202 line_num)); |
1194 } else { | 1203 } else { |
1195 PROFILE(info->isolate(), | 1204 PROFILE(info->isolate(), |
1196 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), | 1205 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), |
1197 *code, | 1206 *code, |
1198 *shared, | 1207 *shared, |
1199 info, | 1208 info, |
1200 shared->DebugName())); | 1209 shared->DebugName())); |
1201 } | 1210 } |
1202 } | 1211 } |
1203 | 1212 |
1204 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 1213 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
1205 Handle<Script>(info->script()), | 1214 Handle<Script>(info->script()), |
1206 Handle<Code>(info->code()), | 1215 Handle<Code>(info->code()), |
1207 info)); | 1216 info)); |
1208 } | 1217 } |
1209 | 1218 |
1210 } } // namespace v8::internal | 1219 } } // namespace v8::internal |
OLD | NEW |