Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 | 152 |
| 153 // Avoid collecting traces while doing GC. | 153 // Avoid collecting traces while doing GC. |
| 154 if (sample->state == GC) return; | 154 if (sample->state == GC) return; |
| 155 | 155 |
| 156 const Address js_entry_sp = Top::js_entry_sp(Top::GetCurrentThread()); | 156 const Address js_entry_sp = Top::js_entry_sp(Top::GetCurrentThread()); |
| 157 if (js_entry_sp == 0) { | 157 if (js_entry_sp == 0) { |
| 158 // Not executing JS now. | 158 // Not executing JS now. |
| 159 return; | 159 return; |
| 160 } | 160 } |
| 161 | 161 |
| 162 const Address function_address = | 162 // Sample potential return address value for frameless invocation of |
| 163 sample->fp + JavaScriptFrameConstants::kFunctionOffset; | 163 // stubs (we'll figure out later, if this value makes sense). |
| 164 if (SafeStackFrameIterator::IsWithinBounds(sample->sp, js_entry_sp, | 164 sample->function = Memory::Address_at(sample->sp); |
|
Vitaly Repeshko
2011/02/22 15:11:19
We should rename the "function" field in TickSampl
mnaganov (inactive)
2011/02/22 16:18:22
Renamed it to "tos" -- it's shorter.
| |
| 165 function_address)) { | |
| 166 Object* object = Memory::Object_at(function_address); | |
| 167 if (object->IsHeapObject()) { | |
| 168 sample->function = HeapObject::cast(object)->address(); | |
| 169 } | |
| 170 } | |
| 171 | 165 |
| 172 int i = 0; | 166 int i = 0; |
| 173 const Address callback = Top::external_callback(); | 167 const Address callback = Top::external_callback(); |
| 174 // Surprisingly, PC can point _exactly_ to callback start, with good | 168 // Surprisingly, PC can point _exactly_ to callback start, with good |
| 175 // probability, and this will result in reporting fake nested | 169 // probability, and this will result in reporting fake nested |
| 176 // callback call. | 170 // callback call. |
| 177 if (callback != NULL && callback != sample->pc) { | 171 if (callback != NULL && callback != sample->pc) { |
| 178 sample->stack[i++] = callback; | 172 sample->stack[i++] = callback; |
| 179 } | 173 } |
| 180 | 174 |
| 181 SafeStackTraceFrameIterator it(sample->fp, sample->sp, | 175 SafeStackTraceFrameIterator it(sample->fp, sample->sp, |
| 182 sample->sp, js_entry_sp); | 176 sample->sp, js_entry_sp); |
| 183 while (!it.done() && i < TickSample::kMaxFramesCount) { | 177 while (!it.done() && i < TickSample::kMaxFramesCount) { |
| 184 Object* object = it.frame()->function_slot_object(); | 178 sample->stack[i++] = it.frame()->pc(); |
| 185 if (object->IsHeapObject()) { | |
| 186 sample->stack[i++] = HeapObject::cast(object)->address(); | |
| 187 } | |
| 188 it.Advance(); | 179 it.Advance(); |
| 189 } | 180 } |
| 190 sample->frames_count = i; | 181 sample->frames_count = i; |
| 191 } | 182 } |
| 192 | 183 |
| 193 | 184 |
| 194 // | 185 // |
| 195 // Ticker used to provide ticks to the profiler and the sliding state | 186 // Ticker used to provide ticks to the profiler and the sliding state |
| 196 // window. | 187 // window. |
| 197 // | 188 // |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 703 void Logger::SetterCallbackEvent(String* name, Address entry_point) { | 694 void Logger::SetterCallbackEvent(String* name, Address entry_point) { |
| 704 #ifdef ENABLE_LOGGING_AND_PROFILING | 695 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 705 if (!Log::IsEnabled() || !FLAG_log_code) return; | 696 if (!Log::IsEnabled() || !FLAG_log_code) return; |
| 706 SmartPointer<char> str = | 697 SmartPointer<char> str = |
| 707 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 698 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 708 CallbackEventInternal("set ", *str, entry_point); | 699 CallbackEventInternal("set ", *str, entry_point); |
| 709 #endif | 700 #endif |
| 710 } | 701 } |
| 711 | 702 |
| 712 | 703 |
| 713 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 714 static const char* ComputeMarker(Code* code) { | |
| 715 switch (code->kind()) { | |
| 716 case Code::FUNCTION: return code->optimizable() ? "~" : ""; | |
| 717 case Code::OPTIMIZED_FUNCTION: return "*"; | |
| 718 default: return ""; | |
| 719 } | |
| 720 } | |
| 721 #endif | |
| 722 | |
| 723 | |
| 724 void Logger::CodeCreateEvent(LogEventsAndTags tag, | 704 void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| 725 Code* code, | 705 Code* code, |
| 726 const char* comment) { | 706 const char* comment) { |
| 727 #ifdef ENABLE_LOGGING_AND_PROFILING | 707 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 728 if (!Log::IsEnabled() || !FLAG_log_code) return; | 708 if (!Log::IsEnabled() || !FLAG_log_code) return; |
| 729 LogMessageBuilder msg; | 709 LogMessageBuilder msg; |
| 730 msg.Append("%s,%s,", | 710 msg.Append("%s,%s,", |
| 731 kLogEventsNames[CODE_CREATION_EVENT], | 711 kLogEventsNames[CODE_CREATION_EVENT], |
| 732 kLogEventsNames[tag]); | 712 kLogEventsNames[tag]); |
| 733 msg.AppendAddress(code->address()); | 713 msg.AppendAddress(code->address()); |
| 734 msg.Append(",%d,\"%s", code->ExecutableSize(), ComputeMarker(code)); | 714 msg.Append(",%d,\"", code->ExecutableSize()); |
| 735 for (const char* p = comment; *p != '\0'; p++) { | 715 for (const char* p = comment; *p != '\0'; p++) { |
| 736 if (*p == '"') { | 716 if (*p == '"') { |
| 737 msg.Append('\\'); | 717 msg.Append('\\'); |
| 738 } | 718 } |
| 739 msg.Append(*p); | 719 msg.Append(*p); |
| 740 } | 720 } |
| 741 msg.Append('"'); | 721 msg.Append('"'); |
| 742 LowLevelCodeCreateEvent(code, &msg); | 722 LowLevelCodeCreateEvent(code, &msg); |
| 743 msg.Append('\n'); | 723 msg.Append('\n'); |
| 744 msg.WriteToLogFile(); | 724 msg.WriteToLogFile(); |
| 745 #endif | 725 #endif |
| 746 } | 726 } |
| 747 | 727 |
| 748 | 728 |
| 749 void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, String* name) { | 729 void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| 730 Code* code, | |
| 731 String* name) { | |
| 732 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 733 if (name != NULL) { | |
| 734 SmartPointer<char> str = | |
| 735 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | |
| 736 CodeCreateEvent(tag, code, *str); | |
| 737 } else { | |
| 738 CodeCreateEvent(tag, code, ""); | |
| 739 } | |
| 740 #endif | |
| 741 } | |
| 742 | |
| 743 | |
| 744 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 745 // ComputeMarker must only be used when SharedFunctionInfo is known. | |
| 746 static const char* ComputeMarker(Code* code) { | |
| 747 switch (code->kind()) { | |
| 748 case Code::FUNCTION: return code->optimizable() ? "~" : ""; | |
| 749 case Code::OPTIMIZED_FUNCTION: return "*"; | |
| 750 default: return ""; | |
| 751 } | |
| 752 } | |
| 753 #endif | |
| 754 | |
| 755 | |
| 756 void Logger::CodeCreateEvent(LogEventsAndTags tag, | |
| 757 Code* code, | |
| 758 SharedFunctionInfo *shared, | |
| 759 String* name) { | |
| 750 #ifdef ENABLE_LOGGING_AND_PROFILING | 760 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 751 if (!Log::IsEnabled() || !FLAG_log_code) return; | 761 if (!Log::IsEnabled() || !FLAG_log_code) return; |
| 762 if (code == Builtins::builtin(Builtins::LazyCompile)) return; | |
|
Vitaly Repeshko
2011/02/22 15:11:19
Can we make the caller do this check for us? (I th
mnaganov (inactive)
2011/02/22 16:18:22
Good idea. BTW, I forgot to add a similar check to
| |
| 752 LogMessageBuilder msg; | 763 LogMessageBuilder msg; |
| 753 SmartPointer<char> str = | 764 SmartPointer<char> str = |
| 754 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 765 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 755 msg.Append("%s,%s,", | 766 msg.Append("%s,%s,", |
| 756 kLogEventsNames[CODE_CREATION_EVENT], | 767 kLogEventsNames[CODE_CREATION_EVENT], |
| 757 kLogEventsNames[tag]); | 768 kLogEventsNames[tag]); |
| 758 msg.AppendAddress(code->address()); | 769 msg.AppendAddress(code->address()); |
| 759 msg.Append(",%d,\"%s%s\"", code->ExecutableSize(), ComputeMarker(code), *str); | 770 msg.Append(",%d,\"%s\",", code->ExecutableSize(), *str); |
| 771 msg.AppendAddress(shared->address()); | |
| 772 msg.Append(",%s", ComputeMarker(code)); | |
| 760 LowLevelCodeCreateEvent(code, &msg); | 773 LowLevelCodeCreateEvent(code, &msg); |
| 761 msg.Append('\n'); | 774 msg.Append('\n'); |
| 762 msg.WriteToLogFile(); | 775 msg.WriteToLogFile(); |
| 763 #endif | 776 #endif |
| 764 } | 777 } |
| 765 | 778 |
| 766 | 779 |
| 780 // Although, it is possible to extract source and line from | |
| 781 // the SharedFunctionInfo object, we left it to caller | |
| 782 // to leave logging functions free from heap allocations. | |
| 767 void Logger::CodeCreateEvent(LogEventsAndTags tag, | 783 void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| 768 Code* code, String* name, | 784 Code* code, |
| 785 SharedFunctionInfo *shared, | |
|
Vitaly Repeshko
2011/02/22 15:11:19
Same nit.
mnaganov (inactive)
2011/02/22 16:18:22
Done.
| |
| 769 String* source, int line) { | 786 String* source, int line) { |
| 770 #ifdef ENABLE_LOGGING_AND_PROFILING | 787 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 771 if (!Log::IsEnabled() || !FLAG_log_code) return; | 788 if (!Log::IsEnabled() || !FLAG_log_code) return; |
| 789 if (code == Builtins::builtin(Builtins::LazyCompile)) return; | |
| 772 LogMessageBuilder msg; | 790 LogMessageBuilder msg; |
| 773 SmartPointer<char> str = | 791 SmartPointer<char> name = |
| 774 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 792 shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 775 SmartPointer<char> sourcestr = | 793 SmartPointer<char> sourcestr = |
| 776 source->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 794 source->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 777 msg.Append("%s,%s,", | 795 msg.Append("%s,%s,", |
| 778 kLogEventsNames[CODE_CREATION_EVENT], | 796 kLogEventsNames[CODE_CREATION_EVENT], |
| 779 kLogEventsNames[tag]); | 797 kLogEventsNames[tag]); |
| 780 msg.AppendAddress(code->address()); | 798 msg.AppendAddress(code->address()); |
| 781 msg.Append(",%d,\"%s%s %s:%d\"", | 799 msg.Append(",%d,\"%s %s:%d\",", |
| 782 code->ExecutableSize(), | 800 code->ExecutableSize(), |
| 783 ComputeMarker(code), | 801 *name, |
| 784 *str, | |
| 785 *sourcestr, | 802 *sourcestr, |
| 786 line); | 803 line); |
| 804 msg.AppendAddress(shared->address()); | |
| 805 msg.Append(",%s", ComputeMarker(code)); | |
| 787 LowLevelCodeCreateEvent(code, &msg); | 806 LowLevelCodeCreateEvent(code, &msg); |
| 788 msg.Append('\n'); | 807 msg.Append('\n'); |
| 789 msg.WriteToLogFile(); | 808 msg.WriteToLogFile(); |
| 790 #endif | 809 #endif |
| 791 } | 810 } |
| 792 | 811 |
| 793 | 812 |
| 794 void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count) { | 813 void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count) { |
| 795 #ifdef ENABLE_LOGGING_AND_PROFILING | 814 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 796 if (!Log::IsEnabled() || !FLAG_log_code) return; | 815 if (!Log::IsEnabled() || !FLAG_log_code) return; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 856 LogMessageBuilder msg; | 875 LogMessageBuilder msg; |
| 857 msg.Append("%s,", kLogEventsNames[SNAPSHOT_POSITION_EVENT]); | 876 msg.Append("%s,", kLogEventsNames[SNAPSHOT_POSITION_EVENT]); |
| 858 msg.AppendAddress(addr); | 877 msg.AppendAddress(addr); |
| 859 msg.Append(",%d", pos); | 878 msg.Append(",%d", pos); |
| 860 msg.Append('\n'); | 879 msg.Append('\n'); |
| 861 msg.WriteToLogFile(); | 880 msg.WriteToLogFile(); |
| 862 #endif | 881 #endif |
| 863 } | 882 } |
| 864 | 883 |
| 865 | 884 |
| 866 void Logger::FunctionCreateEvent(JSFunction* function) { | 885 void Logger::SFIMoveEvent(Address from, Address to) { |
| 867 #ifdef ENABLE_LOGGING_AND_PROFILING | 886 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 868 // This function can be called from GC iterators (during Scavenge, | 887 MoveEventInternal(SFI_MOVE_EVENT, from, to); |
| 869 // MC, and MS), so marking bits can be set on objects. That's | |
| 870 // why unchecked accessors are used here. | |
| 871 if (!Log::IsEnabled() || !FLAG_log_code) return; | |
| 872 LogMessageBuilder msg; | |
| 873 msg.Append("%s,", kLogEventsNames[FUNCTION_CREATION_EVENT]); | |
| 874 msg.AppendAddress(function->address()); | |
| 875 msg.Append(','); | |
| 876 msg.AppendAddress(function->unchecked_code()->address()); | |
| 877 msg.Append('\n'); | |
| 878 msg.WriteToLogFile(); | |
| 879 #endif | 888 #endif |
| 880 } | 889 } |
| 881 | 890 |
| 882 | |
| 883 void Logger::FunctionCreateEventFromMove(JSFunction* function) { | |
| 884 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 885 if (function->unchecked_code() != Builtins::builtin(Builtins::LazyCompile)) { | |
| 886 FunctionCreateEvent(function); | |
| 887 } | |
| 888 #endif | |
| 889 } | |
| 890 | |
| 891 | |
| 892 void Logger::FunctionMoveEvent(Address from, Address to) { | |
| 893 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 894 MoveEventInternal(FUNCTION_MOVE_EVENT, from, to); | |
| 895 #endif | |
| 896 } | |
| 897 | |
| 898 | |
| 899 void Logger::FunctionDeleteEvent(Address from) { | |
| 900 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 901 DeleteEventInternal(FUNCTION_DELETE_EVENT, from); | |
| 902 #endif | |
| 903 } | |
| 904 | |
| 905 | 891 |
| 906 #ifdef ENABLE_LOGGING_AND_PROFILING | 892 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 907 void Logger::MoveEventInternal(LogEventsAndTags event, | 893 void Logger::MoveEventInternal(LogEventsAndTags event, |
| 908 Address from, | 894 Address from, |
| 909 Address to) { | 895 Address to) { |
| 910 if (!Log::IsEnabled() || !FLAG_log_code) return; | 896 if (!Log::IsEnabled() || !FLAG_log_code) return; |
| 911 LogMessageBuilder msg; | 897 LogMessageBuilder msg; |
| 912 msg.Append("%s,", kLogEventsNames[event]); | 898 msg.Append("%s,", kLogEventsNames[event]); |
| 913 msg.AppendAddress(from); | 899 msg.AppendAddress(from); |
| 914 msg.Append(','); | 900 msg.Append(','); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1180 UncheckedIntEvent("open-tag", tag); | 1166 UncheckedIntEvent("open-tag", tag); |
| 1181 } | 1167 } |
| 1182 if (profiler_ != NULL && (flags & PROFILER_MODULE_CPU)) { | 1168 if (profiler_ != NULL && (flags & PROFILER_MODULE_CPU)) { |
| 1183 if (cpu_profiler_nesting_++ == 0) { | 1169 if (cpu_profiler_nesting_++ == 0) { |
| 1184 ++logging_nesting_; | 1170 ++logging_nesting_; |
| 1185 if (FLAG_prof_lazy) { | 1171 if (FLAG_prof_lazy) { |
| 1186 profiler_->Engage(); | 1172 profiler_->Engage(); |
| 1187 LOG(UncheckedStringEvent("profiler", "resume")); | 1173 LOG(UncheckedStringEvent("profiler", "resume")); |
| 1188 FLAG_log_code = true; | 1174 FLAG_log_code = true; |
| 1189 LogCompiledFunctions(); | 1175 LogCompiledFunctions(); |
| 1190 LogFunctionObjects(); | |
| 1191 LogAccessorCallbacks(); | 1176 LogAccessorCallbacks(); |
| 1192 if (!FLAG_sliding_state_window && !ticker_->IsActive()) { | 1177 if (!FLAG_sliding_state_window && !ticker_->IsActive()) { |
| 1193 ticker_->Start(); | 1178 ticker_->Start(); |
| 1194 } | 1179 } |
| 1195 } | 1180 } |
| 1196 profiler_->resume(); | 1181 profiler_->resume(); |
| 1197 } | 1182 } |
| 1198 } | 1183 } |
| 1199 if (flags & | 1184 if (flags & |
| 1200 (PROFILER_MODULE_HEAP_STATS | PROFILER_MODULE_JS_CONSTRUCTORS)) { | 1185 (PROFILER_MODULE_HEAP_STATS | PROFILER_MODULE_JS_CONSTRUCTORS)) { |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1382 HandleScope scope; | 1367 HandleScope scope; |
| 1383 const int compiled_funcs_count = EnumerateCompiledFunctions(NULL, NULL); | 1368 const int compiled_funcs_count = EnumerateCompiledFunctions(NULL, NULL); |
| 1384 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count); | 1369 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count); |
| 1385 ScopedVector< Handle<Code> > code_objects(compiled_funcs_count); | 1370 ScopedVector< Handle<Code> > code_objects(compiled_funcs_count); |
| 1386 EnumerateCompiledFunctions(sfis.start(), code_objects.start()); | 1371 EnumerateCompiledFunctions(sfis.start(), code_objects.start()); |
| 1387 | 1372 |
| 1388 // During iteration, there can be heap allocation due to | 1373 // During iteration, there can be heap allocation due to |
| 1389 // GetScriptLineNumber call. | 1374 // GetScriptLineNumber call. |
| 1390 for (int i = 0; i < compiled_funcs_count; ++i) { | 1375 for (int i = 0; i < compiled_funcs_count; ++i) { |
| 1391 Handle<SharedFunctionInfo> shared = sfis[i]; | 1376 Handle<SharedFunctionInfo> shared = sfis[i]; |
| 1392 Handle<String> name(String::cast(shared->name())); | 1377 Handle<String> func_name(shared->DebugName()); |
| 1393 Handle<String> func_name(name->length() > 0 ? | |
| 1394 *name : shared->inferred_name()); | |
| 1395 if (shared->script()->IsScript()) { | 1378 if (shared->script()->IsScript()) { |
| 1396 Handle<Script> script(Script::cast(shared->script())); | 1379 Handle<Script> script(Script::cast(shared->script())); |
| 1397 if (script->name()->IsString()) { | 1380 if (script->name()->IsString()) { |
| 1398 Handle<String> script_name(String::cast(script->name())); | 1381 Handle<String> script_name(String::cast(script->name())); |
| 1399 int line_num = GetScriptLineNumber(script, shared->start_position()); | 1382 int line_num = GetScriptLineNumber(script, shared->start_position()); |
| 1400 if (line_num > 0) { | 1383 if (line_num > 0) { |
| 1401 PROFILE(CodeCreateEvent( | 1384 PROFILE(CodeCreateEvent( |
| 1402 Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), | 1385 Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), |
| 1403 *code_objects[i], *func_name, | 1386 *code_objects[i], *shared, |
| 1404 *script_name, line_num + 1)); | 1387 *script_name, line_num + 1)); |
| 1405 } else { | 1388 } else { |
| 1406 // Can't distinguish eval and script here, so always use Script. | 1389 // Can't distinguish eval and script here, so always use Script. |
| 1407 PROFILE(CodeCreateEvent( | 1390 PROFILE(CodeCreateEvent( |
| 1408 Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), | 1391 Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), |
| 1409 *code_objects[i], *script_name)); | 1392 *code_objects[i], *shared, *script_name)); |
| 1410 } | 1393 } |
| 1411 } else { | 1394 } else { |
| 1412 PROFILE(CodeCreateEvent( | 1395 PROFILE(CodeCreateEvent( |
| 1413 Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), | 1396 Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), |
| 1414 *code_objects[i], *func_name)); | 1397 *code_objects[i], *shared, *func_name)); |
| 1415 } | 1398 } |
| 1416 } else if (shared->IsApiFunction()) { | 1399 } else if (shared->IsApiFunction()) { |
| 1417 // API function. | 1400 // API function. |
| 1418 FunctionTemplateInfo* fun_data = shared->get_api_func_data(); | 1401 FunctionTemplateInfo* fun_data = shared->get_api_func_data(); |
| 1419 Object* raw_call_data = fun_data->call_code(); | 1402 Object* raw_call_data = fun_data->call_code(); |
| 1420 if (!raw_call_data->IsUndefined()) { | 1403 if (!raw_call_data->IsUndefined()) { |
| 1421 CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data); | 1404 CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data); |
| 1422 Object* callback_obj = call_data->callback(); | 1405 Object* callback_obj = call_data->callback(); |
| 1423 Address entry_point = v8::ToCData<Address>(callback_obj); | 1406 Address entry_point = v8::ToCData<Address>(callback_obj); |
| 1424 PROFILE(CallbackEvent(*func_name, entry_point)); | 1407 PROFILE(CallbackEvent(*func_name, entry_point)); |
| 1425 } | 1408 } |
| 1426 } else { | 1409 } else { |
| 1427 PROFILE(CodeCreateEvent( | 1410 PROFILE(CodeCreateEvent( |
| 1428 Logger::LAZY_COMPILE_TAG, *code_objects[i], *func_name)); | 1411 Logger::LAZY_COMPILE_TAG, *code_objects[i], *shared, *func_name)); |
| 1429 } | 1412 } |
| 1430 } | 1413 } |
| 1431 } | 1414 } |
| 1432 | 1415 |
| 1433 | 1416 |
| 1434 void Logger::LogFunctionObjects() { | |
| 1435 AssertNoAllocation no_alloc; | |
| 1436 HeapIterator iterator; | |
| 1437 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | |
| 1438 if (!obj->IsJSFunction()) continue; | |
| 1439 JSFunction* jsf = JSFunction::cast(obj); | |
| 1440 if (!jsf->is_compiled()) continue; | |
| 1441 PROFILE(FunctionCreateEvent(jsf)); | |
| 1442 } | |
| 1443 } | |
| 1444 | |
| 1445 | |
| 1446 void Logger::LogAccessorCallbacks() { | 1417 void Logger::LogAccessorCallbacks() { |
| 1447 AssertNoAllocation no_alloc; | 1418 AssertNoAllocation no_alloc; |
| 1448 HeapIterator iterator; | 1419 HeapIterator iterator; |
| 1449 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1420 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
| 1450 if (!obj->IsAccessorInfo()) continue; | 1421 if (!obj->IsAccessorInfo()) continue; |
| 1451 AccessorInfo* ai = AccessorInfo::cast(obj); | 1422 AccessorInfo* ai = AccessorInfo::cast(obj); |
| 1452 if (!ai->name()->IsString()) continue; | 1423 if (!ai->name()->IsString()) continue; |
| 1453 String* name = String::cast(ai->name()); | 1424 String* name = String::cast(ai->name()); |
| 1454 Address getter_entry = v8::ToCData<Address>(ai->getter()); | 1425 Address getter_entry = v8::ToCData<Address>(ai->getter()); |
| 1455 if (getter_entry != 0) { | 1426 if (getter_entry != 0) { |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1628 } | 1599 } |
| 1629 // Otherwise, if the sliding state window computation has not been | 1600 // Otherwise, if the sliding state window computation has not been |
| 1630 // started we do it now. | 1601 // started we do it now. |
| 1631 if (sliding_state_window_ == NULL) { | 1602 if (sliding_state_window_ == NULL) { |
| 1632 sliding_state_window_ = new SlidingStateWindow(); | 1603 sliding_state_window_ = new SlidingStateWindow(); |
| 1633 } | 1604 } |
| 1634 #endif | 1605 #endif |
| 1635 } | 1606 } |
| 1636 | 1607 |
| 1637 } } // namespace v8::internal | 1608 } } // namespace v8::internal |
| OLD | NEW |