| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/log.h" | 5 #include "src/log.h" |
| 6 | 6 |
| 7 #include <cstdarg> | 7 #include <cstdarg> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
| 11 #include "src/base/platform/platform.h" | 11 #include "src/base/platform/platform.h" |
| 12 #include "src/bootstrapper.h" | 12 #include "src/bootstrapper.h" |
| 13 #include "src/code-stubs.h" | 13 #include "src/code-stubs.h" |
| 14 #include "src/deoptimizer.h" | 14 #include "src/deoptimizer.h" |
| 15 #include "src/global-handles.h" | 15 #include "src/global-handles.h" |
| 16 #include "src/interpreter/bytecodes.h" | 16 #include "src/interpreter/bytecodes.h" |
| 17 #include "src/interpreter/interpreter.h" | 17 #include "src/interpreter/interpreter.h" |
| 18 #include "src/libsampler/v8-sampler.h" | 18 #include "src/libsampler/v8-sampler.h" |
| 19 #include "src/log-inl.h" | 19 #include "src/log-inl.h" |
| 20 #include "src/log-utils.h" | 20 #include "src/log-utils.h" |
| 21 #include "src/macro-assembler.h" | 21 #include "src/macro-assembler.h" |
| 22 #include "src/perf-jit.h" | 22 #include "src/perf-jit.h" |
| 23 #include "src/profiler/cpu-profiler-inl.h" | 23 #include "src/profiler/cpu-profiler-inl.h" |
| 24 #include "src/profiler/profiler-listener.h" |
| 24 #include "src/runtime-profiler.h" | 25 #include "src/runtime-profiler.h" |
| 25 #include "src/string-stream.h" | 26 #include "src/string-stream.h" |
| 26 #include "src/vm-state-inl.h" | 27 #include "src/vm-state-inl.h" |
| 27 | 28 |
| 28 namespace v8 { | 29 namespace v8 { |
| 29 namespace internal { | 30 namespace internal { |
| 30 | 31 |
| 31 | 32 |
| 32 #define DECLARE_EVENT(ignore1, name) name, | 33 #define DECLARE_EVENT(ignore1, name) name, |
| 33 static const char* const kLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { | 34 static const char* const kLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { |
| 34 LOG_EVENTS_AND_TAGS_LIST(DECLARE_EVENT) | 35 LOG_EVENTS_AND_TAGS_LIST(DECLARE_EVENT) |
| 35 }; | 36 }; |
| 36 #undef DECLARE_EVENT | 37 #undef DECLARE_EVENT |
| 37 | 38 |
| 38 | 39 |
| 39 #define CALL_LISTENERS(Call) \ | 40 #define CALL_LISTENERS(Call) \ |
| 40 for (int i = 0; i < listeners_.length(); ++i) { \ | 41 for (int i = 0; i < listeners_.length(); ++i) { \ |
| 41 listeners_[i]->Call; \ | 42 listeners_[i]->Call; \ |
| 42 } | 43 } |
| 43 | 44 |
| 44 #define PROFILER_LOG(Call) \ | |
| 45 if (isolate_->is_profiling()) { \ | |
| 46 isolate_->cpu_profiler()->Call; \ | |
| 47 } else { \ | |
| 48 } | |
| 49 | |
| 50 static const char* ComputeMarker(SharedFunctionInfo* shared, | 45 static const char* ComputeMarker(SharedFunctionInfo* shared, |
| 51 AbstractCode* code) { | 46 AbstractCode* code) { |
| 52 switch (code->kind()) { | 47 switch (code->kind()) { |
| 53 case AbstractCode::FUNCTION: | 48 case AbstractCode::FUNCTION: |
| 54 case AbstractCode::INTERPRETED_FUNCTION: | 49 case AbstractCode::INTERPRETED_FUNCTION: |
| 55 return shared->optimization_disabled() ? "" : "~"; | 50 return shared->optimization_disabled() ? "" : "~"; |
| 56 case AbstractCode::OPTIMIZED_FUNCTION: | 51 case AbstractCode::OPTIMIZED_FUNCTION: |
| 57 return "*"; | 52 return "*"; |
| 58 default: | 53 default: |
| 59 return ""; | 54 return ""; |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 : isolate_(isolate), | 754 : isolate_(isolate), |
| 760 ticker_(NULL), | 755 ticker_(NULL), |
| 761 profiler_(NULL), | 756 profiler_(NULL), |
| 762 log_events_(NULL), | 757 log_events_(NULL), |
| 763 is_logging_(false), | 758 is_logging_(false), |
| 764 log_(new Log(this)), | 759 log_(new Log(this)), |
| 765 perf_basic_logger_(NULL), | 760 perf_basic_logger_(NULL), |
| 766 perf_jit_logger_(NULL), | 761 perf_jit_logger_(NULL), |
| 767 ll_logger_(NULL), | 762 ll_logger_(NULL), |
| 768 jit_logger_(NULL), | 763 jit_logger_(NULL), |
| 764 profiler_listener_(new ProfilerListener(isolate)), |
| 769 listeners_(5), | 765 listeners_(5), |
| 770 is_initialized_(false) {} | 766 is_initialized_(false) {} |
| 771 | 767 |
| 772 Logger::~Logger() { | 768 Logger::~Logger() { |
| 773 delete log_; | 769 delete log_; |
| 770 delete profiler_listener_; |
| 774 } | 771 } |
| 775 | 772 |
| 776 | 773 |
| 777 void Logger::addCodeEventListener(CodeEventListener* listener) { | 774 void Logger::addCodeEventListener(CodeEventListener* listener) { |
| 778 DCHECK(!hasCodeEventListener(listener)); | 775 DCHECK(!hasCodeEventListener(listener)); |
| 779 listeners_.Add(listener); | 776 listeners_.Add(listener); |
| 780 } | 777 } |
| 781 | 778 |
| 782 | 779 |
| 783 void Logger::removeCodeEventListener(CodeEventListener* listener) { | 780 void Logger::removeCodeEventListener(CodeEventListener* listener) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 if (!log_->IsEnabled() || !FLAG_prof_cpp) return; | 868 if (!log_->IsEnabled() || !FLAG_prof_cpp) return; |
| 872 Log::MessageBuilder msg(log_); | 869 Log::MessageBuilder msg(log_); |
| 873 msg.Append("shared-library,\"%s\",0x%08" V8PRIxPTR ",0x%08" V8PRIxPTR | 870 msg.Append("shared-library,\"%s\",0x%08" V8PRIxPTR ",0x%08" V8PRIxPTR |
| 874 ",%" V8PRIdPTR, | 871 ",%" V8PRIdPTR, |
| 875 library_path.c_str(), start, end, aslr_slide); | 872 library_path.c_str(), start, end, aslr_slide); |
| 876 msg.WriteToLogFile(); | 873 msg.WriteToLogFile(); |
| 877 } | 874 } |
| 878 | 875 |
| 879 | 876 |
| 880 void Logger::CodeDeoptEvent(Code* code, Address pc, int fp_to_sp_delta) { | 877 void Logger::CodeDeoptEvent(Code* code, Address pc, int fp_to_sp_delta) { |
| 881 PROFILER_LOG(CodeDeoptEvent(code, pc, fp_to_sp_delta)); | 878 profiler_listener_->CodeDeoptEvent(code, pc, fp_to_sp_delta); |
| 882 if (!log_->IsEnabled() || !FLAG_log_internal_timer_events) return; | 879 if (!log_->IsEnabled() || !FLAG_log_internal_timer_events) return; |
| 883 Log::MessageBuilder msg(log_); | 880 Log::MessageBuilder msg(log_); |
| 884 int since_epoch = static_cast<int>(timer_.Elapsed().InMicroseconds()); | 881 int since_epoch = static_cast<int>(timer_.Elapsed().InMicroseconds()); |
| 885 msg.Append("code-deopt,%d,%d", since_epoch, code->CodeSize()); | 882 msg.Append("code-deopt,%d,%d", since_epoch, code->CodeSize()); |
| 886 msg.WriteToLogFile(); | 883 msg.WriteToLogFile(); |
| 887 } | 884 } |
| 888 | 885 |
| 889 | 886 |
| 890 void Logger::CurrentTimeEvent() { | 887 void Logger::CurrentTimeEvent() { |
| 891 if (!log_->IsEnabled()) return; | 888 if (!log_->IsEnabled()) return; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 ->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 1084 ->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 1088 msg.Append(",1,symbol(\"%s%s\" hash %x)", prefix, str.get(), | 1085 msg.Append(",1,symbol(\"%s%s\" hash %x)", prefix, str.get(), |
| 1089 symbol->Hash()); | 1086 symbol->Hash()); |
| 1090 } | 1087 } |
| 1091 } | 1088 } |
| 1092 msg.WriteToLogFile(); | 1089 msg.WriteToLogFile(); |
| 1093 } | 1090 } |
| 1094 | 1091 |
| 1095 | 1092 |
| 1096 void Logger::CallbackEvent(Name* name, Address entry_point) { | 1093 void Logger::CallbackEvent(Name* name, Address entry_point) { |
| 1097 PROFILER_LOG(CallbackEvent(name, entry_point)); | 1094 profiler_listener_->CallbackEvent(name, entry_point); |
| 1098 CallbackEventInternal("", name, entry_point); | 1095 CallbackEventInternal("", name, entry_point); |
| 1099 } | 1096 } |
| 1100 | 1097 |
| 1101 | 1098 |
| 1102 void Logger::GetterCallbackEvent(Name* name, Address entry_point) { | 1099 void Logger::GetterCallbackEvent(Name* name, Address entry_point) { |
| 1103 PROFILER_LOG(GetterCallbackEvent(name, entry_point)); | 1100 profiler_listener_->GetterCallbackEvent(name, entry_point); |
| 1104 CallbackEventInternal("get ", name, entry_point); | 1101 CallbackEventInternal("get ", name, entry_point); |
| 1105 } | 1102 } |
| 1106 | 1103 |
| 1107 | 1104 |
| 1108 void Logger::SetterCallbackEvent(Name* name, Address entry_point) { | 1105 void Logger::SetterCallbackEvent(Name* name, Address entry_point) { |
| 1109 PROFILER_LOG(SetterCallbackEvent(name, entry_point)); | 1106 profiler_listener_->SetterCallbackEvent(name, entry_point); |
| 1110 CallbackEventInternal("set ", name, entry_point); | 1107 CallbackEventInternal("set ", name, entry_point); |
| 1111 } | 1108 } |
| 1112 | 1109 |
| 1113 static void AppendCodeCreateHeader(Log::MessageBuilder* msg, | 1110 static void AppendCodeCreateHeader(Log::MessageBuilder* msg, |
| 1114 Logger::LogEventsAndTags tag, | 1111 Logger::LogEventsAndTags tag, |
| 1115 AbstractCode* code) { | 1112 AbstractCode* code) { |
| 1116 DCHECK(msg); | 1113 DCHECK(msg); |
| 1117 msg->Append("%s,%s,%d,", | 1114 msg->Append("%s,%s,%d,", |
| 1118 kLogEventsNames[Logger::CODE_CREATION_EVENT], | 1115 kLogEventsNames[Logger::CODE_CREATION_EVENT], |
| 1119 kLogEventsNames[tag], | 1116 kLogEventsNames[tag], |
| 1120 code->kind()); | 1117 code->kind()); |
| 1121 msg->AppendAddress(code->address()); | 1118 msg->AppendAddress(code->address()); |
| 1122 msg->Append(",%d,", code->ExecutableSize()); | 1119 msg->Append(",%d,", code->ExecutableSize()); |
| 1123 } | 1120 } |
| 1124 | 1121 |
| 1125 void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, | 1122 void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
| 1126 const char* comment) { | 1123 const char* comment) { |
| 1127 PROFILER_LOG(CodeCreateEvent(tag, code, comment)); | 1124 profiler_listener_->CodeCreateEvent(tag, code, comment); |
| 1128 | 1125 |
| 1129 if (!is_logging_code_events()) return; | 1126 if (!is_logging_code_events()) return; |
| 1130 CALL_LISTENERS(CodeCreateEvent(tag, code, comment)); | 1127 CALL_LISTENERS(CodeCreateEvent(tag, code, comment)); |
| 1131 | 1128 |
| 1132 if (!FLAG_log_code || !log_->IsEnabled()) return; | 1129 if (!FLAG_log_code || !log_->IsEnabled()) return; |
| 1133 Log::MessageBuilder msg(log_); | 1130 Log::MessageBuilder msg(log_); |
| 1134 AppendCodeCreateHeader(&msg, tag, code); | 1131 AppendCodeCreateHeader(&msg, tag, code); |
| 1135 msg.AppendDoubleQuotedString(comment); | 1132 msg.AppendDoubleQuotedString(comment); |
| 1136 msg.WriteToLogFile(); | 1133 msg.WriteToLogFile(); |
| 1137 } | 1134 } |
| 1138 | 1135 |
| 1139 void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, | 1136 void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
| 1140 Name* name) { | 1137 Name* name) { |
| 1141 PROFILER_LOG(CodeCreateEvent(tag, code, name)); | 1138 profiler_listener_->CodeCreateEvent(tag, code, name); |
| 1142 | 1139 |
| 1143 if (!is_logging_code_events()) return; | 1140 if (!is_logging_code_events()) return; |
| 1144 CALL_LISTENERS(CodeCreateEvent(tag, code, name)); | 1141 CALL_LISTENERS(CodeCreateEvent(tag, code, name)); |
| 1145 | 1142 |
| 1146 if (!FLAG_log_code || !log_->IsEnabled()) return; | 1143 if (!FLAG_log_code || !log_->IsEnabled()) return; |
| 1147 Log::MessageBuilder msg(log_); | 1144 Log::MessageBuilder msg(log_); |
| 1148 AppendCodeCreateHeader(&msg, tag, code); | 1145 AppendCodeCreateHeader(&msg, tag, code); |
| 1149 if (name->IsString()) { | 1146 if (name->IsString()) { |
| 1150 msg.Append('"'); | 1147 msg.Append('"'); |
| 1151 msg.AppendDetailed(String::cast(name), false); | 1148 msg.AppendDetailed(String::cast(name), false); |
| 1152 msg.Append('"'); | 1149 msg.Append('"'); |
| 1153 } else { | 1150 } else { |
| 1154 msg.AppendSymbolName(Symbol::cast(name)); | 1151 msg.AppendSymbolName(Symbol::cast(name)); |
| 1155 } | 1152 } |
| 1156 msg.WriteToLogFile(); | 1153 msg.WriteToLogFile(); |
| 1157 } | 1154 } |
| 1158 | 1155 |
| 1159 void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, | 1156 void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
| 1160 SharedFunctionInfo* shared, Name* name) { | 1157 SharedFunctionInfo* shared, Name* name) { |
| 1161 PROFILER_LOG(CodeCreateEvent(tag, code, shared, name)); | 1158 profiler_listener_->CodeCreateEvent(tag, code, shared, name); |
| 1162 | 1159 |
| 1163 if (!is_logging_code_events()) return; | 1160 if (!is_logging_code_events()) return; |
| 1164 CALL_LISTENERS(CodeCreateEvent(tag, code, shared, name)); | 1161 CALL_LISTENERS(CodeCreateEvent(tag, code, shared, name)); |
| 1165 | 1162 |
| 1166 if (!FLAG_log_code || !log_->IsEnabled()) return; | 1163 if (!FLAG_log_code || !log_->IsEnabled()) return; |
| 1167 if (code == AbstractCode::cast( | 1164 if (code == AbstractCode::cast( |
| 1168 isolate_->builtins()->builtin(Builtins::kCompileLazy))) { | 1165 isolate_->builtins()->builtin(Builtins::kCompileLazy))) { |
| 1169 return; | 1166 return; |
| 1170 } | 1167 } |
| 1171 | 1168 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1184 msg.WriteToLogFile(); | 1181 msg.WriteToLogFile(); |
| 1185 } | 1182 } |
| 1186 | 1183 |
| 1187 | 1184 |
| 1188 // Although, it is possible to extract source and line from | 1185 // Although, it is possible to extract source and line from |
| 1189 // the SharedFunctionInfo object, we left it to caller | 1186 // the SharedFunctionInfo object, we left it to caller |
| 1190 // to leave logging functions free from heap allocations. | 1187 // to leave logging functions free from heap allocations. |
| 1191 void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, | 1188 void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
| 1192 SharedFunctionInfo* shared, Name* source, int line, | 1189 SharedFunctionInfo* shared, Name* source, int line, |
| 1193 int column) { | 1190 int column) { |
| 1194 PROFILER_LOG(CodeCreateEvent(tag, code, shared, source, line, column)); | 1191 profiler_listener_->CodeCreateEvent(tag, code, shared, source, line, column); |
| 1195 | 1192 |
| 1196 if (!is_logging_code_events()) return; | 1193 if (!is_logging_code_events()) return; |
| 1197 CALL_LISTENERS(CodeCreateEvent(tag, code, shared, source, line, column)); | 1194 CALL_LISTENERS(CodeCreateEvent(tag, code, shared, source, line, column)); |
| 1198 | 1195 |
| 1199 if (!FLAG_log_code || !log_->IsEnabled()) return; | 1196 if (!FLAG_log_code || !log_->IsEnabled()) return; |
| 1200 Log::MessageBuilder msg(log_); | 1197 Log::MessageBuilder msg(log_); |
| 1201 AppendCodeCreateHeader(&msg, tag, code); | 1198 AppendCodeCreateHeader(&msg, tag, code); |
| 1202 base::SmartArrayPointer<char> name = | 1199 base::SmartArrayPointer<char> name = |
| 1203 shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 1200 shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 1204 msg.Append("\"%s ", name.get()); | 1201 msg.Append("\"%s ", name.get()); |
| 1205 if (source->IsString()) { | 1202 if (source->IsString()) { |
| 1206 base::SmartArrayPointer<char> sourcestr = String::cast(source)->ToCString( | 1203 base::SmartArrayPointer<char> sourcestr = String::cast(source)->ToCString( |
| 1207 DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 1204 DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 1208 msg.Append("%s", sourcestr.get()); | 1205 msg.Append("%s", sourcestr.get()); |
| 1209 } else { | 1206 } else { |
| 1210 msg.AppendSymbolName(Symbol::cast(source)); | 1207 msg.AppendSymbolName(Symbol::cast(source)); |
| 1211 } | 1208 } |
| 1212 msg.Append(":%d:%d\",", line, column); | 1209 msg.Append(":%d:%d\",", line, column); |
| 1213 msg.AppendAddress(shared->address()); | 1210 msg.AppendAddress(shared->address()); |
| 1214 msg.Append(",%s", ComputeMarker(shared, code)); | 1211 msg.Append(",%s", ComputeMarker(shared, code)); |
| 1215 msg.WriteToLogFile(); | 1212 msg.WriteToLogFile(); |
| 1216 } | 1213 } |
| 1217 | 1214 |
| 1218 void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, | 1215 void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
| 1219 int args_count) { | 1216 int args_count) { |
| 1220 PROFILER_LOG(CodeCreateEvent(tag, code, args_count)); | 1217 profiler_listener_->CodeCreateEvent(tag, code, args_count); |
| 1221 | 1218 |
| 1222 if (!is_logging_code_events()) return; | 1219 if (!is_logging_code_events()) return; |
| 1223 CALL_LISTENERS(CodeCreateEvent(tag, code, args_count)); | 1220 CALL_LISTENERS(CodeCreateEvent(tag, code, args_count)); |
| 1224 | 1221 |
| 1225 if (!FLAG_log_code || !log_->IsEnabled()) return; | 1222 if (!FLAG_log_code || !log_->IsEnabled()) return; |
| 1226 Log::MessageBuilder msg(log_); | 1223 Log::MessageBuilder msg(log_); |
| 1227 AppendCodeCreateHeader(&msg, tag, code); | 1224 AppendCodeCreateHeader(&msg, tag, code); |
| 1228 msg.Append("\"args_count: %d\"", args_count); | 1225 msg.Append("\"args_count: %d\"", args_count); |
| 1229 msg.WriteToLogFile(); | 1226 msg.WriteToLogFile(); |
| 1230 } | 1227 } |
| 1231 | 1228 |
| 1232 void Logger::CodeDisableOptEvent(AbstractCode* code, | 1229 void Logger::CodeDisableOptEvent(AbstractCode* code, |
| 1233 SharedFunctionInfo* shared) { | 1230 SharedFunctionInfo* shared) { |
| 1234 PROFILER_LOG(CodeDisableOptEvent(code, shared)); | 1231 profiler_listener_->CodeDisableOptEvent(code, shared); |
| 1235 | 1232 |
| 1236 if (!is_logging_code_events()) return; | 1233 if (!is_logging_code_events()) return; |
| 1237 CALL_LISTENERS(CodeDisableOptEvent(code, shared)); | 1234 CALL_LISTENERS(CodeDisableOptEvent(code, shared)); |
| 1238 | 1235 |
| 1239 if (!FLAG_log_code || !log_->IsEnabled()) return; | 1236 if (!FLAG_log_code || !log_->IsEnabled()) return; |
| 1240 Log::MessageBuilder msg(log_); | 1237 Log::MessageBuilder msg(log_); |
| 1241 msg.Append("%s,", kLogEventsNames[CODE_DISABLE_OPT_EVENT]); | 1238 msg.Append("%s,", kLogEventsNames[CODE_DISABLE_OPT_EVENT]); |
| 1242 base::SmartArrayPointer<char> name = | 1239 base::SmartArrayPointer<char> name = |
| 1243 shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 1240 shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 1244 msg.Append("\"%s\",", name.get()); | 1241 msg.Append("\"%s\",", name.get()); |
| 1245 msg.Append("\"%s\"", GetBailoutReason(shared->disable_optimization_reason())); | 1242 msg.Append("\"%s\"", GetBailoutReason(shared->disable_optimization_reason())); |
| 1246 msg.WriteToLogFile(); | 1243 msg.WriteToLogFile(); |
| 1247 } | 1244 } |
| 1248 | 1245 |
| 1249 | 1246 |
| 1250 void Logger::CodeMovingGCEvent() { | 1247 void Logger::CodeMovingGCEvent() { |
| 1251 PROFILER_LOG(CodeMovingGCEvent()); | 1248 profiler_listener_->CodeMovingGCEvent(); |
| 1252 | 1249 |
| 1253 if (!is_logging_code_events()) return; | 1250 if (!is_logging_code_events()) return; |
| 1254 if (!log_->IsEnabled() || !FLAG_ll_prof) return; | 1251 if (!log_->IsEnabled() || !FLAG_ll_prof) return; |
| 1255 CALL_LISTENERS(CodeMovingGCEvent()); | 1252 CALL_LISTENERS(CodeMovingGCEvent()); |
| 1256 base::OS::SignalCodeMovingGC(); | 1253 base::OS::SignalCodeMovingGC(); |
| 1257 } | 1254 } |
| 1258 | 1255 |
| 1259 void Logger::RegExpCodeCreateEvent(AbstractCode* code, String* source) { | 1256 void Logger::RegExpCodeCreateEvent(AbstractCode* code, String* source) { |
| 1260 PROFILER_LOG(RegExpCodeCreateEvent(code, source)); | 1257 profiler_listener_->RegExpCodeCreateEvent(code, source); |
| 1261 | 1258 |
| 1262 if (!is_logging_code_events()) return; | 1259 if (!is_logging_code_events()) return; |
| 1263 CALL_LISTENERS(RegExpCodeCreateEvent(code, source)); | 1260 CALL_LISTENERS(RegExpCodeCreateEvent(code, source)); |
| 1264 | 1261 |
| 1265 if (!FLAG_log_code || !log_->IsEnabled()) return; | 1262 if (!FLAG_log_code || !log_->IsEnabled()) return; |
| 1266 Log::MessageBuilder msg(log_); | 1263 Log::MessageBuilder msg(log_); |
| 1267 AppendCodeCreateHeader(&msg, REG_EXP_TAG, code); | 1264 AppendCodeCreateHeader(&msg, REG_EXP_TAG, code); |
| 1268 msg.Append('"'); | 1265 msg.Append('"'); |
| 1269 msg.AppendDetailed(source, false); | 1266 msg.AppendDetailed(source, false); |
| 1270 msg.Append('"'); | 1267 msg.Append('"'); |
| 1271 msg.WriteToLogFile(); | 1268 msg.WriteToLogFile(); |
| 1272 } | 1269 } |
| 1273 | 1270 |
| 1274 void Logger::CodeMoveEvent(AbstractCode* from, Address to) { | 1271 void Logger::CodeMoveEvent(AbstractCode* from, Address to) { |
| 1275 PROFILER_LOG(CodeMoveEvent(from, to)); | 1272 profiler_listener_->CodeMoveEvent(from, to); |
| 1276 | 1273 |
| 1277 if (!is_logging_code_events()) return; | 1274 if (!is_logging_code_events()) return; |
| 1278 CALL_LISTENERS(CodeMoveEvent(from, to)); | 1275 CALL_LISTENERS(CodeMoveEvent(from, to)); |
| 1279 MoveEventInternal(CODE_MOVE_EVENT, from->address(), to); | 1276 MoveEventInternal(CODE_MOVE_EVENT, from->address(), to); |
| 1280 } | 1277 } |
| 1281 | 1278 |
| 1282 void Logger::CodeLinePosInfoAddPositionEvent(void* jit_handler_data, | 1279 void Logger::CodeLinePosInfoAddPositionEvent(void* jit_handler_data, |
| 1283 int pc_offset, int position) { | 1280 int pc_offset, int position) { |
| 1284 JIT_LOG(AddCodeLinePosInfoEvent(jit_handler_data, | 1281 JIT_LOG(AddCodeLinePosInfoEvent(jit_handler_data, |
| 1285 pc_offset, | 1282 pc_offset, |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1893 removeCodeEventListener(jit_logger_); | 1890 removeCodeEventListener(jit_logger_); |
| 1894 delete jit_logger_; | 1891 delete jit_logger_; |
| 1895 jit_logger_ = NULL; | 1892 jit_logger_ = NULL; |
| 1896 } | 1893 } |
| 1897 | 1894 |
| 1898 return log_->Close(); | 1895 return log_->Close(); |
| 1899 } | 1896 } |
| 1900 | 1897 |
| 1901 } // namespace internal | 1898 } // namespace internal |
| 1902 } // namespace v8 | 1899 } // namespace v8 |
| OLD | NEW |