Chromium Code Reviews| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 namespace internal { | 47 namespace internal { |
| 48 | 48 |
| 49 | 49 |
| 50 #define DECLARE_EVENT(ignore1, name) name, | 50 #define DECLARE_EVENT(ignore1, name) name, |
| 51 static const char* const kLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { | 51 static const char* const kLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { |
| 52 LOG_EVENTS_AND_TAGS_LIST(DECLARE_EVENT) | 52 LOG_EVENTS_AND_TAGS_LIST(DECLARE_EVENT) |
| 53 }; | 53 }; |
| 54 #undef DECLARE_EVENT | 54 #undef DECLARE_EVENT |
| 55 | 55 |
| 56 | 56 |
| 57 #define PROFILER_LOG(Call) \ | |
| 58 CpuProfiler* cpu_profiler = isolate_->cpu_profiler(); \ | |
| 59 if (cpu_profiler->is_profiling()) { \ | |
| 60 cpu_profiler->Call; \ | |
| 61 } | |
| 62 | |
| 57 // ComputeMarker must only be used when SharedFunctionInfo is known. | 63 // ComputeMarker must only be used when SharedFunctionInfo is known. |
| 58 static const char* ComputeMarker(Code* code) { | 64 static const char* ComputeMarker(Code* code) { |
| 59 switch (code->kind()) { | 65 switch (code->kind()) { |
| 60 case Code::FUNCTION: return code->optimizable() ? "~" : ""; | 66 case Code::FUNCTION: return code->optimizable() ? "~" : ""; |
| 61 case Code::OPTIMIZED_FUNCTION: return "*"; | 67 case Code::OPTIMIZED_FUNCTION: return "*"; |
| 62 default: return ""; | 68 default: return ""; |
| 63 } | 69 } |
| 64 } | 70 } |
| 65 | 71 |
| 66 | 72 |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 536 | 542 |
| 537 | 543 |
| 538 #define CODE_ADDRESS_MAP_LOG(Call)\ | 544 #define CODE_ADDRESS_MAP_LOG(Call)\ |
| 539 if (Serializer::enabled()) code_address_map_->Call; | 545 if (Serializer::enabled()) code_address_map_->Call; |
| 540 | 546 |
| 541 | 547 |
| 542 class JitLogger : public CodeEventLogger { | 548 class JitLogger : public CodeEventLogger { |
| 543 public: | 549 public: |
| 544 explicit JitLogger(JitCodeEventHandler code_event_handler); | 550 explicit JitLogger(JitCodeEventHandler code_event_handler); |
| 545 | 551 |
| 546 void CodeMovedEvent(Address from, Address to); | 552 void CodeMoveEvent(Address from, Address to); |
| 547 void CodeDeleteEvent(Address from); | 553 void CodeDeleteEvent(Address from); |
| 548 void AddCodeLinePosInfoEvent( | 554 void AddCodeLinePosInfoEvent( |
| 549 void* jit_handler_data, | 555 void* jit_handler_data, |
| 550 int pc_offset, | 556 int pc_offset, |
| 551 int position, | 557 int position, |
| 552 JitCodeEvent::PositionType position_type); | 558 JitCodeEvent::PositionType position_type); |
| 553 void* StartCodePosInfoEvent(); | 559 void* StartCodePosInfoEvent(); |
| 554 void EndCodePosInfoEvent(Code* code, void* jit_handler_data); | 560 void EndCodePosInfoEvent(Code* code, void* jit_handler_data); |
| 555 | 561 |
| 556 private: | 562 private: |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 581 if (shared && shared->script()->IsScript()) { | 587 if (shared && shared->script()->IsScript()) { |
| 582 script_handle = Handle<Script>(Script::cast(shared->script())); | 588 script_handle = Handle<Script>(Script::cast(shared->script())); |
| 583 } | 589 } |
| 584 event.script = ToApiHandle<v8::Script>(script_handle); | 590 event.script = ToApiHandle<v8::Script>(script_handle); |
| 585 event.name.str = name_buffer->get(); | 591 event.name.str = name_buffer->get(); |
| 586 event.name.len = name_buffer->size(); | 592 event.name.len = name_buffer->size(); |
| 587 code_event_handler_(&event); | 593 code_event_handler_(&event); |
| 588 } | 594 } |
| 589 | 595 |
| 590 | 596 |
| 591 void JitLogger::CodeMovedEvent(Address from, Address to) { | 597 void JitLogger::CodeMoveEvent(Address from, Address to) { |
| 592 Code* from_code = Code::cast(HeapObject::FromAddress(from)); | 598 Code* from_code = Code::cast(HeapObject::FromAddress(from)); |
| 593 | 599 |
| 594 JitCodeEvent event; | 600 JitCodeEvent event; |
| 595 event.type = JitCodeEvent::CODE_MOVED; | 601 event.type = JitCodeEvent::CODE_MOVED; |
| 596 event.code_start = from_code->instruction_start(); | 602 event.code_start = from_code->instruction_start(); |
| 597 event.code_len = from_code->instruction_size(); | 603 event.code_len = from_code->instruction_size(); |
| 598 | 604 |
| 599 // Calculate the header size. | 605 // Calculate the header size. |
| 600 const size_t header_size = | 606 const size_t header_size = |
| 601 from_code->instruction_start() - reinterpret_cast<byte*>(from_code); | 607 from_code->instruction_start() - reinterpret_cast<byte*>(from_code); |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1202 } | 1208 } |
| 1203 | 1209 |
| 1204 | 1210 |
| 1205 void Logger::DeleteEventStatic(const char* name, void* object) { | 1211 void Logger::DeleteEventStatic(const char* name, void* object) { |
| 1206 Isolate::Current()->logger()->DeleteEvent(name, object); | 1212 Isolate::Current()->logger()->DeleteEvent(name, object); |
| 1207 } | 1213 } |
| 1208 | 1214 |
| 1209 | 1215 |
| 1210 void Logger::CallbackEventInternal(const char* prefix, Name* name, | 1216 void Logger::CallbackEventInternal(const char* prefix, Name* name, |
| 1211 Address entry_point) { | 1217 Address entry_point) { |
| 1212 if (!log_->IsEnabled() || !FLAG_log_code) return; | 1218 if (!FLAG_log_code || !log_->IsEnabled()) return; |
|
yurys
2013/07/22 07:39:41
What's the reason for this rearrangement here an i
loislo
2013/07/22 09:31:42
No special reason. I just made it consistent with
| |
| 1213 Log::MessageBuilder msg(log_); | 1219 Log::MessageBuilder msg(log_); |
| 1214 msg.Append("%s,%s,-2,", | 1220 msg.Append("%s,%s,-2,", |
| 1215 kLogEventsNames[CODE_CREATION_EVENT], | 1221 kLogEventsNames[CODE_CREATION_EVENT], |
| 1216 kLogEventsNames[CALLBACK_TAG]); | 1222 kLogEventsNames[CALLBACK_TAG]); |
| 1217 msg.AppendAddress(entry_point); | 1223 msg.AppendAddress(entry_point); |
| 1218 if (name->IsString()) { | 1224 if (name->IsString()) { |
| 1219 SmartArrayPointer<char> str = | 1225 SmartArrayPointer<char> str = |
| 1220 String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 1226 String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 1221 msg.Append(",1,\"%s%s\"", prefix, *str); | 1227 msg.Append(",1,\"%s%s\"", prefix, *str); |
| 1222 } else { | 1228 } else { |
| 1223 Symbol* symbol = Symbol::cast(name); | 1229 Symbol* symbol = Symbol::cast(name); |
| 1224 if (symbol->name()->IsUndefined()) { | 1230 if (symbol->name()->IsUndefined()) { |
| 1225 msg.Append(",1,symbol(hash %x)", prefix, symbol->Hash()); | 1231 msg.Append(",1,symbol(hash %x)", prefix, symbol->Hash()); |
| 1226 } else { | 1232 } else { |
| 1227 SmartArrayPointer<char> str = String::cast(symbol->name())->ToCString( | 1233 SmartArrayPointer<char> str = String::cast(symbol->name())->ToCString( |
| 1228 DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 1234 DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 1229 msg.Append(",1,symbol(\"%s\" hash %x)", prefix, *str, symbol->Hash()); | 1235 msg.Append(",1,symbol(\"%s\" hash %x)", prefix, *str, symbol->Hash()); |
| 1230 } | 1236 } |
| 1231 } | 1237 } |
| 1232 msg.Append('\n'); | 1238 msg.Append('\n'); |
| 1233 msg.WriteToLogFile(); | 1239 msg.WriteToLogFile(); |
| 1234 } | 1240 } |
| 1235 | 1241 |
| 1236 | 1242 |
| 1237 void Logger::CallbackEvent(Name* name, Address entry_point) { | 1243 void Logger::CallbackEvent(Name* name, Address entry_point) { |
| 1238 if (!log_->IsEnabled() || !FLAG_log_code) return; | 1244 PROFILER_LOG(CallbackEvent(name, entry_point)); |
| 1245 if (!FLAG_log_code || !log_->IsEnabled()) return; | |
| 1239 CallbackEventInternal("", name, entry_point); | 1246 CallbackEventInternal("", name, entry_point); |
| 1240 } | 1247 } |
| 1241 | 1248 |
| 1242 | 1249 |
| 1243 void Logger::GetterCallbackEvent(Name* name, Address entry_point) { | 1250 void Logger::GetterCallbackEvent(Name* name, Address entry_point) { |
| 1244 if (!log_->IsEnabled() || !FLAG_log_code) return; | 1251 PROFILER_LOG(GetterCallbackEvent(name, entry_point)); |
| 1252 if (!FLAG_log_code || !log_->IsEnabled()) return; | |
| 1245 CallbackEventInternal("get ", name, entry_point); | 1253 CallbackEventInternal("get ", name, entry_point); |
| 1246 } | 1254 } |
| 1247 | 1255 |
| 1248 | 1256 |
| 1249 void Logger::SetterCallbackEvent(Name* name, Address entry_point) { | 1257 void Logger::SetterCallbackEvent(Name* name, Address entry_point) { |
| 1250 if (!log_->IsEnabled() || !FLAG_log_code) return; | 1258 PROFILER_LOG(SetterCallbackEvent(name, entry_point)); |
| 1259 if (!FLAG_log_code || !log_->IsEnabled()) return; | |
| 1251 CallbackEventInternal("set ", name, entry_point); | 1260 CallbackEventInternal("set ", name, entry_point); |
| 1252 } | 1261 } |
| 1253 | 1262 |
| 1254 | 1263 |
| 1255 static void AppendCodeCreateHeader(Log::MessageBuilder* msg, | 1264 static void AppendCodeCreateHeader(Log::MessageBuilder* msg, |
| 1256 Logger::LogEventsAndTags tag, | 1265 Logger::LogEventsAndTags tag, |
| 1257 Code* code) { | 1266 Code* code) { |
| 1258 ASSERT(msg); | 1267 ASSERT(msg); |
| 1259 msg->Append("%s,%s,%d,", | 1268 msg->Append("%s,%s,%d,", |
| 1260 kLogEventsNames[Logger::CODE_CREATION_EVENT], | 1269 kLogEventsNames[Logger::CODE_CREATION_EVENT], |
| 1261 kLogEventsNames[tag], | 1270 kLogEventsNames[tag], |
| 1262 code->kind()); | 1271 code->kind()); |
| 1263 msg->AppendAddress(code->address()); | 1272 msg->AppendAddress(code->address()); |
| 1264 msg->Append(",%d,", code->ExecutableSize()); | 1273 msg->Append(",%d,", code->ExecutableSize()); |
| 1265 } | 1274 } |
| 1266 | 1275 |
| 1267 | 1276 |
| 1268 void Logger::CodeCreateEvent(LogEventsAndTags tag, | 1277 void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| 1269 Code* code, | 1278 Code* code, |
| 1270 const char* comment) { | 1279 const char* comment) { |
| 1271 if (!is_logging_code_events()) return; | |
|
yurys
2013/07/22 07:39:41
It checked for logging_nesting_ > 0; now there is
loislo
2013/07/22 09:31:42
We already have this check in the macro LOG_CODE_E
yurys
2013/07/22 09:39:30
I disagree, now all these calls will be executed i
| |
| 1272 | |
| 1273 JIT_LOG(CodeCreateEvent(tag, code, comment)); | 1280 JIT_LOG(CodeCreateEvent(tag, code, comment)); |
| 1274 LL_LOG(CodeCreateEvent(tag, code, comment)); | 1281 LL_LOG(CodeCreateEvent(tag, code, comment)); |
| 1275 CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, comment)); | 1282 CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, comment)); |
| 1283 PROFILER_LOG(CodeCreateEvent(tag, code, comment)); | |
| 1276 | 1284 |
| 1277 if (!FLAG_log_code || !log_->IsEnabled()) return; | 1285 if (!FLAG_log_code || !log_->IsEnabled()) return; |
| 1278 Log::MessageBuilder msg(log_); | 1286 Log::MessageBuilder msg(log_); |
| 1279 AppendCodeCreateHeader(&msg, tag, code); | 1287 AppendCodeCreateHeader(&msg, tag, code); |
| 1280 msg.AppendDoubleQuotedString(comment); | 1288 msg.AppendDoubleQuotedString(comment); |
| 1281 msg.Append('\n'); | 1289 msg.Append('\n'); |
| 1282 msg.WriteToLogFile(); | 1290 msg.WriteToLogFile(); |
| 1283 } | 1291 } |
| 1284 | 1292 |
| 1285 | 1293 |
| 1286 void Logger::CodeCreateEvent(LogEventsAndTags tag, | 1294 void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| 1287 Code* code, | 1295 Code* code, |
| 1288 Name* name) { | 1296 Name* name) { |
| 1289 if (!is_logging_code_events()) return; | |
| 1290 | |
| 1291 JIT_LOG(CodeCreateEvent(tag, code, name)); | 1297 JIT_LOG(CodeCreateEvent(tag, code, name)); |
| 1292 LL_LOG(CodeCreateEvent(tag, code, name)); | 1298 LL_LOG(CodeCreateEvent(tag, code, name)); |
| 1293 CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, name)); | 1299 CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, name)); |
| 1300 PROFILER_LOG(CodeCreateEvent(tag, code, name)); | |
| 1294 | 1301 |
| 1295 if (!FLAG_log_code || !log_->IsEnabled()) return; | 1302 if (!FLAG_log_code || !log_->IsEnabled()) return; |
| 1296 Log::MessageBuilder msg(log_); | 1303 Log::MessageBuilder msg(log_); |
| 1297 AppendCodeCreateHeader(&msg, tag, code); | 1304 AppendCodeCreateHeader(&msg, tag, code); |
| 1298 if (name->IsString()) { | 1305 if (name->IsString()) { |
| 1299 msg.Append('"'); | 1306 msg.Append('"'); |
| 1300 msg.AppendDetailed(String::cast(name), false); | 1307 msg.AppendDetailed(String::cast(name), false); |
| 1301 msg.Append('"'); | 1308 msg.Append('"'); |
| 1302 } else { | 1309 } else { |
| 1303 msg.AppendSymbolName(Symbol::cast(name)); | 1310 msg.AppendSymbolName(Symbol::cast(name)); |
| 1304 } | 1311 } |
| 1305 msg.Append('\n'); | 1312 msg.Append('\n'); |
| 1306 msg.WriteToLogFile(); | 1313 msg.WriteToLogFile(); |
| 1307 } | 1314 } |
| 1308 | 1315 |
| 1309 | 1316 |
| 1310 void Logger::CodeCreateEvent(LogEventsAndTags tag, | 1317 void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| 1311 Code* code, | 1318 Code* code, |
| 1312 SharedFunctionInfo* shared, | 1319 SharedFunctionInfo* shared, |
| 1313 CompilationInfo* info, | 1320 CompilationInfo* info, |
| 1314 Name* name) { | 1321 Name* name) { |
| 1315 if (!is_logging_code_events()) return; | |
| 1316 | |
| 1317 JIT_LOG(CodeCreateEvent(tag, code, shared, info, name)); | 1322 JIT_LOG(CodeCreateEvent(tag, code, shared, info, name)); |
| 1318 LL_LOG(CodeCreateEvent(tag, code, shared, info, name)); | 1323 LL_LOG(CodeCreateEvent(tag, code, shared, info, name)); |
| 1319 CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, shared, info, name)); | 1324 CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, shared, info, name)); |
| 1325 PROFILER_LOG(CodeCreateEvent(tag, code, shared, info, name)); | |
| 1320 | 1326 |
| 1321 if (!FLAG_log_code || !log_->IsEnabled()) return; | 1327 if (!FLAG_log_code || !log_->IsEnabled()) return; |
| 1322 if (code == isolate_->builtins()->builtin( | 1328 if (code == isolate_->builtins()->builtin( |
| 1323 Builtins::kLazyCompile)) | 1329 Builtins::kLazyCompile)) |
| 1324 return; | 1330 return; |
| 1325 | 1331 |
| 1326 Log::MessageBuilder msg(log_); | 1332 Log::MessageBuilder msg(log_); |
| 1327 AppendCodeCreateHeader(&msg, tag, code); | 1333 AppendCodeCreateHeader(&msg, tag, code); |
| 1328 if (name->IsString()) { | 1334 if (name->IsString()) { |
| 1329 SmartArrayPointer<char> str = | 1335 SmartArrayPointer<char> str = |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1341 | 1347 |
| 1342 | 1348 |
| 1343 // Although, it is possible to extract source and line from | 1349 // Although, it is possible to extract source and line from |
| 1344 // the SharedFunctionInfo object, we left it to caller | 1350 // the SharedFunctionInfo object, we left it to caller |
| 1345 // to leave logging functions free from heap allocations. | 1351 // to leave logging functions free from heap allocations. |
| 1346 void Logger::CodeCreateEvent(LogEventsAndTags tag, | 1352 void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| 1347 Code* code, | 1353 Code* code, |
| 1348 SharedFunctionInfo* shared, | 1354 SharedFunctionInfo* shared, |
| 1349 CompilationInfo* info, | 1355 CompilationInfo* info, |
| 1350 Name* source, int line) { | 1356 Name* source, int line) { |
| 1351 if (!is_logging_code_events()) return; | |
| 1352 | |
| 1353 JIT_LOG(CodeCreateEvent(tag, code, shared, info, source, line)); | 1357 JIT_LOG(CodeCreateEvent(tag, code, shared, info, source, line)); |
| 1354 LL_LOG(CodeCreateEvent(tag, code, shared, info, source, line)); | 1358 LL_LOG(CodeCreateEvent(tag, code, shared, info, source, line)); |
| 1355 CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, shared, info, source, line)); | 1359 CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, shared, info, source, line)); |
| 1360 PROFILER_LOG(CodeCreateEvent(tag, code, shared, info, source, line)); | |
| 1356 | 1361 |
| 1357 if (!FLAG_log_code || !log_->IsEnabled()) return; | 1362 if (!FLAG_log_code || !log_->IsEnabled()) return; |
| 1358 Log::MessageBuilder msg(log_); | 1363 Log::MessageBuilder msg(log_); |
| 1359 AppendCodeCreateHeader(&msg, tag, code); | 1364 AppendCodeCreateHeader(&msg, tag, code); |
| 1360 SmartArrayPointer<char> name = | 1365 SmartArrayPointer<char> name = |
| 1361 shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 1366 shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 1362 msg.Append("\"%s ", *name); | 1367 msg.Append("\"%s ", *name); |
| 1363 if (source->IsString()) { | 1368 if (source->IsString()) { |
| 1364 SmartArrayPointer<char> sourcestr = | 1369 SmartArrayPointer<char> sourcestr = |
| 1365 String::cast(source)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 1370 String::cast(source)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 1366 msg.Append("%s", *sourcestr); | 1371 msg.Append("%s", *sourcestr); |
| 1367 } else { | 1372 } else { |
| 1368 msg.AppendSymbolName(Symbol::cast(source)); | 1373 msg.AppendSymbolName(Symbol::cast(source)); |
| 1369 } | 1374 } |
| 1370 msg.Append(":%d\",", line); | 1375 msg.Append(":%d\",", line); |
| 1371 msg.AppendAddress(shared->address()); | 1376 msg.AppendAddress(shared->address()); |
| 1372 msg.Append(",%s", ComputeMarker(code)); | 1377 msg.Append(",%s", ComputeMarker(code)); |
| 1373 msg.Append('\n'); | 1378 msg.Append('\n'); |
| 1374 msg.WriteToLogFile(); | 1379 msg.WriteToLogFile(); |
| 1375 } | 1380 } |
| 1376 | 1381 |
| 1377 | 1382 |
| 1378 void Logger::CodeCreateEvent(LogEventsAndTags tag, | 1383 void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| 1379 Code* code, | 1384 Code* code, |
| 1380 int args_count) { | 1385 int args_count) { |
| 1381 if (!is_logging_code_events()) return; | |
| 1382 | |
| 1383 JIT_LOG(CodeCreateEvent(tag, code, args_count)); | 1386 JIT_LOG(CodeCreateEvent(tag, code, args_count)); |
| 1384 LL_LOG(CodeCreateEvent(tag, code, args_count)); | 1387 LL_LOG(CodeCreateEvent(tag, code, args_count)); |
| 1385 CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, args_count)); | 1388 CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, args_count)); |
| 1389 PROFILER_LOG(CodeCreateEvent(tag, code, args_count)); | |
| 1386 | 1390 |
| 1387 if (!FLAG_log_code || !log_->IsEnabled()) return; | 1391 if (!FLAG_log_code || !log_->IsEnabled()) return; |
| 1388 Log::MessageBuilder msg(log_); | 1392 Log::MessageBuilder msg(log_); |
| 1389 AppendCodeCreateHeader(&msg, tag, code); | 1393 AppendCodeCreateHeader(&msg, tag, code); |
| 1390 msg.Append("\"args_count: %d\"", args_count); | 1394 msg.Append("\"args_count: %d\"", args_count); |
| 1391 msg.Append('\n'); | 1395 msg.Append('\n'); |
| 1392 msg.WriteToLogFile(); | 1396 msg.WriteToLogFile(); |
| 1393 } | 1397 } |
| 1394 | 1398 |
| 1395 | 1399 |
| 1396 void Logger::CodeMovingGCEvent() { | 1400 void Logger::CodeMovingGCEvent() { |
| 1401 PROFILER_LOG(CodeMovingGCEvent()); | |
| 1397 if (!log_->IsEnabled() || !FLAG_ll_prof) return; | 1402 if (!log_->IsEnabled() || !FLAG_ll_prof) return; |
| 1398 LL_LOG(CodeMovingGCEvent()); | 1403 LL_LOG(CodeMovingGCEvent()); |
| 1399 OS::SignalCodeMovingGC(); | 1404 OS::SignalCodeMovingGC(); |
| 1400 } | 1405 } |
| 1401 | 1406 |
| 1402 | 1407 |
| 1403 void Logger::RegExpCodeCreateEvent(Code* code, String* source) { | 1408 void Logger::RegExpCodeCreateEvent(Code* code, String* source) { |
| 1404 if (!is_logging_code_events()) return; | |
| 1405 | |
| 1406 JIT_LOG(RegExpCodeCreateEvent(code, source)); | 1409 JIT_LOG(RegExpCodeCreateEvent(code, source)); |
| 1407 LL_LOG(RegExpCodeCreateEvent(code, source)); | 1410 LL_LOG(RegExpCodeCreateEvent(code, source)); |
| 1408 CODE_ADDRESS_MAP_LOG(RegExpCodeCreateEvent(code, source)); | 1411 CODE_ADDRESS_MAP_LOG(RegExpCodeCreateEvent(code, source)); |
| 1412 PROFILER_LOG(RegExpCodeCreateEvent(code, source)); | |
| 1409 | 1413 |
| 1410 if (!FLAG_log_code || !log_->IsEnabled()) return; | 1414 if (!FLAG_log_code || !log_->IsEnabled()) return; |
| 1411 Log::MessageBuilder msg(log_); | 1415 Log::MessageBuilder msg(log_); |
| 1412 AppendCodeCreateHeader(&msg, REG_EXP_TAG, code); | 1416 AppendCodeCreateHeader(&msg, REG_EXP_TAG, code); |
| 1413 msg.Append('"'); | 1417 msg.Append('"'); |
| 1414 msg.AppendDetailed(source, false); | 1418 msg.AppendDetailed(source, false); |
| 1415 msg.Append('"'); | 1419 msg.Append('"'); |
| 1416 msg.Append('\n'); | 1420 msg.Append('\n'); |
| 1417 msg.WriteToLogFile(); | 1421 msg.WriteToLogFile(); |
| 1418 } | 1422 } |
| 1419 | 1423 |
| 1420 | 1424 |
| 1421 void Logger::CodeMoveEvent(Address from, Address to) { | 1425 void Logger::CodeMoveEvent(Address from, Address to) { |
| 1422 JIT_LOG(CodeMovedEvent(from, to)); | 1426 JIT_LOG(CodeMoveEvent(from, to)); |
| 1423 if (!log_->IsEnabled()) return; | |
| 1424 LL_LOG(CodeMoveEvent(from, to)); | 1427 LL_LOG(CodeMoveEvent(from, to)); |
| 1425 CODE_ADDRESS_MAP_LOG(CodeMoveEvent(from, to)); | 1428 CODE_ADDRESS_MAP_LOG(CodeMoveEvent(from, to)); |
| 1429 PROFILER_LOG(CodeMoveEvent(from, to)); | |
| 1430 if (!log_->IsEnabled()) return; | |
| 1431 | |
| 1426 MoveEventInternal(CODE_MOVE_EVENT, from, to); | 1432 MoveEventInternal(CODE_MOVE_EVENT, from, to); |
| 1427 } | 1433 } |
| 1428 | 1434 |
| 1429 | 1435 |
| 1430 void Logger::CodeDeleteEvent(Address from) { | 1436 void Logger::CodeDeleteEvent(Address from) { |
| 1431 JIT_LOG(CodeDeleteEvent(from)); | 1437 JIT_LOG(CodeDeleteEvent(from)); |
| 1432 if (!log_->IsEnabled()) return; | |
| 1433 LL_LOG(CodeDeleteEvent(from)); | 1438 LL_LOG(CodeDeleteEvent(from)); |
| 1434 CODE_ADDRESS_MAP_LOG(CodeDeleteEvent(from)); | 1439 CODE_ADDRESS_MAP_LOG(CodeDeleteEvent(from)); |
| 1440 PROFILER_LOG(CodeDeleteEvent(from)); | |
| 1435 | 1441 |
| 1436 if (!log_->IsEnabled() || !FLAG_log_code) return; | 1442 if (!FLAG_log_code || !log_->IsEnabled()) return; |
| 1437 Log::MessageBuilder msg(log_); | 1443 Log::MessageBuilder msg(log_); |
| 1438 msg.Append("%s,", kLogEventsNames[CODE_DELETE_EVENT]); | 1444 msg.Append("%s,", kLogEventsNames[CODE_DELETE_EVENT]); |
| 1439 msg.AppendAddress(from); | 1445 msg.AppendAddress(from); |
| 1440 msg.Append('\n'); | 1446 msg.Append('\n'); |
| 1441 msg.WriteToLogFile(); | 1447 msg.WriteToLogFile(); |
| 1442 } | 1448 } |
| 1443 | 1449 |
| 1444 | 1450 |
| 1445 void Logger::CodeLinePosInfoAddPositionEvent(void* jit_handler_data, | 1451 void Logger::CodeLinePosInfoAddPositionEvent(void* jit_handler_data, |
| 1446 int pc_offset, | 1452 int pc_offset, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1491 Log::MessageBuilder msg(log_); | 1497 Log::MessageBuilder msg(log_); |
| 1492 msg.Append("%s,", kLogEventsNames[SNAPSHOT_POSITION_EVENT]); | 1498 msg.Append("%s,", kLogEventsNames[SNAPSHOT_POSITION_EVENT]); |
| 1493 msg.AppendAddress(addr); | 1499 msg.AppendAddress(addr); |
| 1494 msg.Append(",%d", pos); | 1500 msg.Append(",%d", pos); |
| 1495 msg.Append('\n'); | 1501 msg.Append('\n'); |
| 1496 msg.WriteToLogFile(); | 1502 msg.WriteToLogFile(); |
| 1497 } | 1503 } |
| 1498 | 1504 |
| 1499 | 1505 |
| 1500 void Logger::SharedFunctionInfoMoveEvent(Address from, Address to) { | 1506 void Logger::SharedFunctionInfoMoveEvent(Address from, Address to) { |
| 1507 PROFILER_LOG(SharedFunctionInfoMoveEvent(from, to)); | |
| 1501 MoveEventInternal(SHARED_FUNC_MOVE_EVENT, from, to); | 1508 MoveEventInternal(SHARED_FUNC_MOVE_EVENT, from, to); |
| 1502 } | 1509 } |
| 1503 | 1510 |
| 1504 | 1511 |
| 1505 void Logger::MoveEventInternal(LogEventsAndTags event, | 1512 void Logger::MoveEventInternal(LogEventsAndTags event, |
| 1506 Address from, | 1513 Address from, |
| 1507 Address to) { | 1514 Address to) { |
| 1508 if (!log_->IsEnabled() || !FLAG_log_code) return; | 1515 if (!FLAG_log_code || !log_->IsEnabled()) return; |
| 1509 Log::MessageBuilder msg(log_); | 1516 Log::MessageBuilder msg(log_); |
| 1510 msg.Append("%s,", kLogEventsNames[event]); | 1517 msg.Append("%s,", kLogEventsNames[event]); |
| 1511 msg.AppendAddress(from); | 1518 msg.AppendAddress(from); |
| 1512 msg.Append(','); | 1519 msg.Append(','); |
| 1513 msg.AppendAddress(to); | 1520 msg.AppendAddress(to); |
| 1514 msg.Append('\n'); | 1521 msg.Append('\n'); |
| 1515 msg.WriteToLogFile(); | 1522 msg.WriteToLogFile(); |
| 1516 } | 1523 } |
| 1517 | 1524 |
| 1518 | 1525 |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2057 | 2064 |
| 2058 if (jit_logger_) { | 2065 if (jit_logger_) { |
| 2059 delete jit_logger_; | 2066 delete jit_logger_; |
| 2060 jit_logger_ = NULL; | 2067 jit_logger_ = NULL; |
| 2061 } | 2068 } |
| 2062 | 2069 |
| 2063 return log_->Close(); | 2070 return log_->Close(); |
| 2064 } | 2071 } |
| 2065 | 2072 |
| 2066 } } // namespace v8::internal | 2073 } } // namespace v8::internal |
| OLD | NEW |