| 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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1018     case Code::FUNCTION: return code->optimizable() ? "~" : ""; | 1018     case Code::FUNCTION: return code->optimizable() ? "~" : ""; | 
| 1019     case Code::OPTIMIZED_FUNCTION: return "*"; | 1019     case Code::OPTIMIZED_FUNCTION: return "*"; | 
| 1020     default: return ""; | 1020     default: return ""; | 
| 1021   } | 1021   } | 
| 1022 } | 1022 } | 
| 1023 | 1023 | 
| 1024 | 1024 | 
| 1025 void Logger::CodeCreateEvent(LogEventsAndTags tag, | 1025 void Logger::CodeCreateEvent(LogEventsAndTags tag, | 
| 1026                              Code* code, | 1026                              Code* code, | 
| 1027                              SharedFunctionInfo* shared, | 1027                              SharedFunctionInfo* shared, | 
|  | 1028                              CompilationInfo* info, | 
| 1028                              Name* name) { | 1029                              Name* name) { | 
| 1029   if (!is_logging_code_events()) return; | 1030   if (!is_logging_code_events()) return; | 
| 1030   if (FLAG_ll_prof || Serializer::enabled() || code_event_handler_ != NULL) { | 1031   if (FLAG_ll_prof || Serializer::enabled() || code_event_handler_ != NULL) { | 
| 1031     name_buffer_->Reset(); | 1032     name_buffer_->Reset(); | 
| 1032     name_buffer_->AppendBytes(kLogEventsNames[tag]); | 1033     name_buffer_->AppendBytes(kLogEventsNames[tag]); | 
| 1033     name_buffer_->AppendByte(':'); | 1034     name_buffer_->AppendByte(':'); | 
| 1034     name_buffer_->AppendBytes(ComputeMarker(code)); | 1035     name_buffer_->AppendBytes(ComputeMarker(code)); | 
| 1035     if (name->IsString()) { | 1036     if (name->IsString()) { | 
| 1036       name_buffer_->AppendString(String::cast(name)); | 1037       name_buffer_->AppendString(String::cast(name)); | 
| 1037     } else { | 1038     } else { | 
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1095   msg.WriteToLogFile(); | 1096   msg.WriteToLogFile(); | 
| 1096 } | 1097 } | 
| 1097 | 1098 | 
| 1098 | 1099 | 
| 1099 // Although, it is possible to extract source and line from | 1100 // Although, it is possible to extract source and line from | 
| 1100 // the SharedFunctionInfo object, we left it to caller | 1101 // the SharedFunctionInfo object, we left it to caller | 
| 1101 // to leave logging functions free from heap allocations. | 1102 // to leave logging functions free from heap allocations. | 
| 1102 void Logger::CodeCreateEvent(LogEventsAndTags tag, | 1103 void Logger::CodeCreateEvent(LogEventsAndTags tag, | 
| 1103                              Code* code, | 1104                              Code* code, | 
| 1104                              SharedFunctionInfo* shared, | 1105                              SharedFunctionInfo* shared, | 
|  | 1106                              CompilationInfo* info, | 
| 1105                              Name* source, int line) { | 1107                              Name* source, int line) { | 
| 1106   if (!is_logging_code_events()) return; | 1108   if (!is_logging_code_events()) return; | 
| 1107   if (FLAG_ll_prof || Serializer::enabled() || code_event_handler_ != NULL) { | 1109   if (FLAG_ll_prof || Serializer::enabled() || code_event_handler_ != NULL) { | 
| 1108     name_buffer_->Reset(); | 1110     name_buffer_->Reset(); | 
| 1109     name_buffer_->AppendBytes(kLogEventsNames[tag]); | 1111     name_buffer_->AppendBytes(kLogEventsNames[tag]); | 
| 1110     name_buffer_->AppendByte(':'); | 1112     name_buffer_->AppendByte(':'); | 
| 1111     name_buffer_->AppendBytes(ComputeMarker(code)); | 1113     name_buffer_->AppendBytes(ComputeMarker(code)); | 
| 1112     name_buffer_->AppendString(shared->DebugName()); | 1114     name_buffer_->AppendString(shared->DebugName()); | 
| 1113     name_buffer_->AppendByte(' '); | 1115     name_buffer_->AppendByte(' '); | 
| 1114     if (source->IsString()) { | 1116     if (source->IsString()) { | 
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1737   Handle<String> func_name(shared->DebugName()); | 1739   Handle<String> func_name(shared->DebugName()); | 
| 1738   if (shared->script()->IsScript()) { | 1740   if (shared->script()->IsScript()) { | 
| 1739     Handle<Script> script(Script::cast(shared->script())); | 1741     Handle<Script> script(Script::cast(shared->script())); | 
| 1740     if (script->name()->IsString()) { | 1742     if (script->name()->IsString()) { | 
| 1741       Handle<String> script_name(String::cast(script->name())); | 1743       Handle<String> script_name(String::cast(script->name())); | 
| 1742       int line_num = GetScriptLineNumber(script, shared->start_position()); | 1744       int line_num = GetScriptLineNumber(script, shared->start_position()); | 
| 1743       if (line_num > 0) { | 1745       if (line_num > 0) { | 
| 1744         PROFILE(isolate_, | 1746         PROFILE(isolate_, | 
| 1745                 CodeCreateEvent( | 1747                 CodeCreateEvent( | 
| 1746                     Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), | 1748                     Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), | 
| 1747                     *code, *shared, | 1749                     *code, *shared, NULL, | 
| 1748                     *script_name, line_num + 1)); | 1750                     *script_name, line_num + 1)); | 
| 1749       } else { | 1751       } else { | 
| 1750         // Can't distinguish eval and script here, so always use Script. | 1752         // Can't distinguish eval and script here, so always use Script. | 
| 1751         PROFILE(isolate_, | 1753         PROFILE(isolate_, | 
| 1752                 CodeCreateEvent( | 1754                 CodeCreateEvent( | 
| 1753                     Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), | 1755                     Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), | 
| 1754                     *code, *shared, *script_name)); | 1756                     *code, *shared, NULL, *script_name)); | 
| 1755       } | 1757       } | 
| 1756     } else { | 1758     } else { | 
| 1757       PROFILE(isolate_, | 1759       PROFILE(isolate_, | 
| 1758               CodeCreateEvent( | 1760               CodeCreateEvent( | 
| 1759                   Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), | 1761                   Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), | 
| 1760                   *code, *shared, *func_name)); | 1762                   *code, *shared, NULL, *func_name)); | 
| 1761     } | 1763     } | 
| 1762   } else if (shared->IsApiFunction()) { | 1764   } else if (shared->IsApiFunction()) { | 
| 1763     // API function. | 1765     // API function. | 
| 1764     FunctionTemplateInfo* fun_data = shared->get_api_func_data(); | 1766     FunctionTemplateInfo* fun_data = shared->get_api_func_data(); | 
| 1765     Object* raw_call_data = fun_data->call_code(); | 1767     Object* raw_call_data = fun_data->call_code(); | 
| 1766     if (!raw_call_data->IsUndefined()) { | 1768     if (!raw_call_data->IsUndefined()) { | 
| 1767       CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data); | 1769       CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data); | 
| 1768       Object* callback_obj = call_data->callback(); | 1770       Object* callback_obj = call_data->callback(); | 
| 1769       Address entry_point = v8::ToCData<Address>(callback_obj); | 1771       Address entry_point = v8::ToCData<Address>(callback_obj); | 
| 1770       PROFILE(isolate_, CallbackEvent(*func_name, entry_point)); | 1772       PROFILE(isolate_, CallbackEvent(*func_name, entry_point)); | 
| 1771     } | 1773     } | 
| 1772   } else { | 1774   } else { | 
| 1773     PROFILE(isolate_, | 1775     PROFILE(isolate_, | 
| 1774             CodeCreateEvent( | 1776             CodeCreateEvent( | 
| 1775                 Logger::LAZY_COMPILE_TAG, *code, *shared, *func_name)); | 1777                 Logger::LAZY_COMPILE_TAG, *code, *shared, NULL, *func_name)); | 
| 1776   } | 1778   } | 
| 1777 } | 1779 } | 
| 1778 | 1780 | 
| 1779 | 1781 | 
| 1780 void Logger::LogCompiledFunctions() { | 1782 void Logger::LogCompiledFunctions() { | 
| 1781   Heap* heap = isolate_->heap(); | 1783   Heap* heap = isolate_->heap(); | 
| 1782   heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, | 1784   heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, | 
| 1783                           "Logger::LogCompiledFunctions"); | 1785                           "Logger::LogCompiledFunctions"); | 
| 1784   HandleScope scope(isolate_); | 1786   HandleScope scope(isolate_); | 
| 1785   const int compiled_funcs_count = EnumerateCompiledFunctions(heap, NULL, NULL); | 1787   const int compiled_funcs_count = EnumerateCompiledFunctions(heap, NULL, NULL); | 
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1893     profiler_ = NULL; | 1895     profiler_ = NULL; | 
| 1894   } | 1896   } | 
| 1895 | 1897 | 
| 1896   delete ticker_; | 1898   delete ticker_; | 
| 1897   ticker_ = NULL; | 1899   ticker_ = NULL; | 
| 1898 | 1900 | 
| 1899   return log_->Close(); | 1901   return log_->Close(); | 
| 1900 } | 1902 } | 
| 1901 | 1903 | 
| 1902 } }  // namespace v8::internal | 1904 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|