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

Side by Side Diff: src/log.cc

Issue 18058008: CPUProfiler: Improve line numbers support in profiler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: cosmetic changes Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after
1652 if (obj->IsCode()) LogCodeObject(obj); 1652 if (obj->IsCode()) LogCodeObject(obj);
1653 } 1653 }
1654 } 1654 }
1655 1655
1656 1656
1657 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, 1657 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared,
1658 Handle<Code> code) { 1658 Handle<Code> code) {
1659 Handle<String> func_name(shared->DebugName()); 1659 Handle<String> func_name(shared->DebugName());
1660 if (shared->script()->IsScript()) { 1660 if (shared->script()->IsScript()) {
1661 Handle<Script> script(Script::cast(shared->script())); 1661 Handle<Script> script(Script::cast(shared->script()));
1662 int line_num = GetScriptLineNumber(script, shared->start_position()) + 1;
1662 if (script->name()->IsString()) { 1663 if (script->name()->IsString()) {
1663 Handle<String> script_name(String::cast(script->name())); 1664 Handle<String> script_name(String::cast(script->name()));
1664 int line_num = GetScriptLineNumber(script, shared->start_position());
1665 if (line_num > 0) { 1665 if (line_num > 0) {
1666 PROFILE(isolate_, 1666 PROFILE(isolate_,
1667 CodeCreateEvent( 1667 CodeCreateEvent(
1668 Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), 1668 Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script),
1669 *code, *shared, NULL, 1669 *code, *shared, NULL,
1670 *script_name, line_num + 1)); 1670 *script_name, line_num));
1671 } else { 1671 } else {
1672 // Can't distinguish eval and script here, so always use Script. 1672 // Can't distinguish eval and script here, so always use Script.
1673 PROFILE(isolate_, 1673 PROFILE(isolate_,
1674 CodeCreateEvent( 1674 CodeCreateEvent(
1675 Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), 1675 Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script),
1676 *code, *shared, NULL, *script_name)); 1676 *code, *shared, NULL, *script_name));
1677 } 1677 }
1678 } else { 1678 } else {
1679 PROFILE(isolate_, 1679 PROFILE(isolate_,
1680 CodeCreateEvent( 1680 CodeCreateEvent(
1681 Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), 1681 Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script),
1682 *code, *shared, NULL, *func_name)); 1682 *code, *shared, NULL,
1683 isolate_->heap()->empty_string(), line_num));
1683 } 1684 }
1684 } else if (shared->IsApiFunction()) { 1685 } else if (shared->IsApiFunction()) {
1685 // API function. 1686 // API function.
1686 FunctionTemplateInfo* fun_data = shared->get_api_func_data(); 1687 FunctionTemplateInfo* fun_data = shared->get_api_func_data();
1687 Object* raw_call_data = fun_data->call_code(); 1688 Object* raw_call_data = fun_data->call_code();
1688 if (!raw_call_data->IsUndefined()) { 1689 if (!raw_call_data->IsUndefined()) {
1689 CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data); 1690 CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data);
1690 Object* callback_obj = call_data->callback(); 1691 Object* callback_obj = call_data->callback();
1691 Address entry_point = v8::ToCData<Address>(callback_obj); 1692 Address entry_point = v8::ToCData<Address>(callback_obj);
1692 PROFILE(isolate_, CallbackEvent(*func_name, entry_point)); 1693 PROFILE(isolate_, CallbackEvent(*func_name, entry_point));
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1815 profiler_ = NULL; 1816 profiler_ = NULL;
1816 } 1817 }
1817 1818
1818 delete ticker_; 1819 delete ticker_;
1819 ticker_ = NULL; 1820 ticker_ = NULL;
1820 1821
1821 return log_->Close(); 1822 return log_->Close();
1822 } 1823 }
1823 1824
1824 } } // namespace v8::internal 1825 } } // namespace v8::internal
OLDNEW
« src/compiler.cc ('K') | « src/cpu-profiler-inl.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698