| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 Script* script, | 428 Script* script, |
| 429 const char* name, | 429 const char* name, |
| 430 size_t name_len) { | 430 size_t name_len) { |
| 431 JitCodeEvent event; | 431 JitCodeEvent event; |
| 432 memset(&event, 0, sizeof(event)); | 432 memset(&event, 0, sizeof(event)); |
| 433 event.type = JitCodeEvent::CODE_ADDED; | 433 event.type = JitCodeEvent::CODE_ADDED; |
| 434 event.code_start = code->instruction_start(); | 434 event.code_start = code->instruction_start(); |
| 435 event.code_len = code->instruction_size(); | 435 event.code_len = code->instruction_size(); |
| 436 Handle<Script> script_handle = | 436 Handle<Script> script_handle = |
| 437 script != NULL ? Handle<Script>(script) : Handle<Script>(); | 437 script != NULL ? Handle<Script>(script) : Handle<Script>(); |
| 438 event.script = v8::Handle<v8::Script>(ToApi<v8::Script>(script_handle)); | 438 event.script = ToApiHandle<v8::Script>(script_handle); |
| 439 event.name.str = name; | 439 event.name.str = name; |
| 440 event.name.len = name_len; | 440 event.name.len = name_len; |
| 441 | 441 |
| 442 code_event_handler_(&event); | 442 code_event_handler_(&event); |
| 443 } | 443 } |
| 444 | 444 |
| 445 | 445 |
| 446 void Logger::IssueCodeMovedEvent(Address from, Address to) { | 446 void Logger::IssueCodeMovedEvent(Address from, Address to) { |
| 447 Code* from_code = Code::cast(HeapObject::FromAddress(from)); | 447 Code* from_code = Code::cast(HeapObject::FromAddress(from)); |
| 448 | 448 |
| (...skipping 1272 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; | |
| 1732 if (script->name()->IsString()) { | 1731 if (script->name()->IsString()) { |
| 1733 script_name = Handle<String>(String::cast(script->name())); | 1732 Handle<String> script_name(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()) { | |
| 1741 int line_num = GetScriptLineNumber(script, shared->start_position()); | 1733 int line_num = GetScriptLineNumber(script, shared->start_position()); |
| 1742 if (line_num > -1) { | 1734 if (line_num > 0) { |
| 1743 PROFILE(isolate_, | 1735 PROFILE(isolate_, |
| 1744 CodeCreateEvent( | 1736 CodeCreateEvent( |
| 1745 Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), | 1737 Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), |
| 1746 *code, *shared, NULL, | 1738 *code, *shared, NULL, |
| 1747 *script_name, line_num + 1)); | 1739 *script_name, line_num + 1)); |
| 1748 } else { | 1740 } else { |
| 1749 // Can't distinguish eval and script here, so always use Script. | 1741 // Can't distinguish eval and script here, so always use Script. |
| 1750 PROFILE(isolate_, | 1742 PROFILE(isolate_, |
| 1751 CodeCreateEvent( | 1743 CodeCreateEvent( |
| 1752 Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), | 1744 Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1892 profiler_ = NULL; | 1884 profiler_ = NULL; |
| 1893 } | 1885 } |
| 1894 | 1886 |
| 1895 delete ticker_; | 1887 delete ticker_; |
| 1896 ticker_ = NULL; | 1888 ticker_ = NULL; |
| 1897 | 1889 |
| 1898 return log_->Close(); | 1890 return log_->Close(); |
| 1899 } | 1891 } |
| 1900 | 1892 |
| 1901 } } // namespace v8::internal | 1893 } } // namespace v8::internal |
| OLD | NEW |