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