OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 if (obj->IsCode()) LogCodeObject(obj); | 1721 if (obj->IsCode()) LogCodeObject(obj); |
1722 } | 1722 } |
1723 } | 1723 } |
1724 | 1724 |
1725 | 1725 |
1726 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, | 1726 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, |
1727 Handle<Code> code) { | 1727 Handle<Code> code) { |
1728 Handle<String> func_name(shared->DebugName()); | 1728 Handle<String> func_name(shared->DebugName()); |
1729 if (shared->script()->IsScript()) { | 1729 if (shared->script()->IsScript()) { |
1730 Handle<Script> script(Script::cast(shared->script())); | 1730 Handle<Script> script(Script::cast(shared->script())); |
| 1731 Handle<String> script_name; |
1731 if (script->name()->IsString()) { | 1732 if (script->name()->IsString()) { |
1732 Handle<String> script_name(String::cast(script->name())); | 1733 script_name = Handle<String>(String::cast(script->name())); |
| 1734 } else { |
| 1735 Handle<Object> name = GetScriptNameOrSourceURL(script); |
| 1736 if (!name.is_null() && name->IsString()) { |
| 1737 script_name = Handle<String>::cast(name); |
| 1738 } |
| 1739 } |
| 1740 if (!script_name.is_null()) { |
1733 int line_num = GetScriptLineNumber(script, shared->start_position()); | 1741 int line_num = GetScriptLineNumber(script, shared->start_position()); |
1734 if (line_num > 0) { | 1742 if (line_num > -1) { |
1735 PROFILE(isolate_, | 1743 PROFILE(isolate_, |
1736 CodeCreateEvent( | 1744 CodeCreateEvent( |
1737 Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), | 1745 Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), |
1738 *code, *shared, NULL, | 1746 *code, *shared, NULL, |
1739 *script_name, line_num + 1)); | 1747 *script_name, line_num + 1)); |
1740 } else { | 1748 } else { |
1741 // Can't distinguish eval and script here, so always use Script. | 1749 // Can't distinguish eval and script here, so always use Script. |
1742 PROFILE(isolate_, | 1750 PROFILE(isolate_, |
1743 CodeCreateEvent( | 1751 CodeCreateEvent( |
1744 Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), | 1752 Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1884 profiler_ = NULL; | 1892 profiler_ = NULL; |
1885 } | 1893 } |
1886 | 1894 |
1887 delete ticker_; | 1895 delete ticker_; |
1888 ticker_ = NULL; | 1896 ticker_ = NULL; |
1889 | 1897 |
1890 return log_->Close(); | 1898 return log_->Close(); |
1891 } | 1899 } |
1892 | 1900 |
1893 } } // namespace v8::internal | 1901 } } // namespace v8::internal |
OLD | NEW |