Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1345)

Side by Side Diff: src/log.cc

Issue 19916002: Move CpuProfiler code create events behind Logger code api. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: cosmetic changes Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/cpu-profiler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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) \
Sven Panne 2013/07/23 08:04:20 This macro is unsafe because of 2 reasons (well, a
loislo 2013/07/23 08:12:55 Done.
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
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
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
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;
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));
1239 CallbackEventInternal("", name, entry_point); 1245 CallbackEventInternal("", name, entry_point);
1240 } 1246 }
1241 1247
1242 1248
1243 void Logger::GetterCallbackEvent(Name* name, Address entry_point) { 1249 void Logger::GetterCallbackEvent(Name* name, Address entry_point) {
1244 if (!log_->IsEnabled() || !FLAG_log_code) return; 1250 PROFILER_LOG(GetterCallbackEvent(name, entry_point));
1245 CallbackEventInternal("get ", name, entry_point); 1251 CallbackEventInternal("get ", name, entry_point);
1246 } 1252 }
1247 1253
1248 1254
1249 void Logger::SetterCallbackEvent(Name* name, Address entry_point) { 1255 void Logger::SetterCallbackEvent(Name* name, Address entry_point) {
1250 if (!log_->IsEnabled() || !FLAG_log_code) return; 1256 PROFILER_LOG(SetterCallbackEvent(name, entry_point));
1251 CallbackEventInternal("set ", name, entry_point); 1257 CallbackEventInternal("set ", name, entry_point);
1252 } 1258 }
1253 1259
1254 1260
1255 static void AppendCodeCreateHeader(Log::MessageBuilder* msg, 1261 static void AppendCodeCreateHeader(Log::MessageBuilder* msg,
1256 Logger::LogEventsAndTags tag, 1262 Logger::LogEventsAndTags tag,
1257 Code* code) { 1263 Code* code) {
1258 ASSERT(msg); 1264 ASSERT(msg);
1259 msg->Append("%s,%s,%d,", 1265 msg->Append("%s,%s,%d,",
1260 kLogEventsNames[Logger::CODE_CREATION_EVENT], 1266 kLogEventsNames[Logger::CODE_CREATION_EVENT],
1261 kLogEventsNames[tag], 1267 kLogEventsNames[tag],
1262 code->kind()); 1268 code->kind());
1263 msg->AppendAddress(code->address()); 1269 msg->AppendAddress(code->address());
1264 msg->Append(",%d,", code->ExecutableSize()); 1270 msg->Append(",%d,", code->ExecutableSize());
1265 } 1271 }
1266 1272
1267 1273
1268 void Logger::CodeCreateEvent(LogEventsAndTags tag, 1274 void Logger::CodeCreateEvent(LogEventsAndTags tag,
1269 Code* code, 1275 Code* code,
1270 const char* comment) { 1276 const char* comment) {
1277 PROFILER_LOG(CodeCreateEvent(tag, code, comment));
1278
1271 if (!is_logging_code_events()) return; 1279 if (!is_logging_code_events()) return;
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));
1276 1283
1277 if (!FLAG_log_code || !log_->IsEnabled()) return; 1284 if (!FLAG_log_code || !log_->IsEnabled()) return;
1278 Log::MessageBuilder msg(log_); 1285 Log::MessageBuilder msg(log_);
1279 AppendCodeCreateHeader(&msg, tag, code); 1286 AppendCodeCreateHeader(&msg, tag, code);
1280 msg.AppendDoubleQuotedString(comment); 1287 msg.AppendDoubleQuotedString(comment);
1281 msg.Append('\n'); 1288 msg.Append('\n');
1282 msg.WriteToLogFile(); 1289 msg.WriteToLogFile();
1283 } 1290 }
1284 1291
1285 1292
1286 void Logger::CodeCreateEvent(LogEventsAndTags tag, 1293 void Logger::CodeCreateEvent(LogEventsAndTags tag,
1287 Code* code, 1294 Code* code,
1288 Name* name) { 1295 Name* name) {
1296 PROFILER_LOG(CodeCreateEvent(tag, code, name));
1297
1289 if (!is_logging_code_events()) return; 1298 if (!is_logging_code_events()) return;
1290
1291 JIT_LOG(CodeCreateEvent(tag, code, name)); 1299 JIT_LOG(CodeCreateEvent(tag, code, name));
1292 LL_LOG(CodeCreateEvent(tag, code, name)); 1300 LL_LOG(CodeCreateEvent(tag, code, name));
1293 CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, name)); 1301 CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, name));
1294 1302
1295 if (!FLAG_log_code || !log_->IsEnabled()) return; 1303 if (!FLAG_log_code || !log_->IsEnabled()) return;
1296 Log::MessageBuilder msg(log_); 1304 Log::MessageBuilder msg(log_);
1297 AppendCodeCreateHeader(&msg, tag, code); 1305 AppendCodeCreateHeader(&msg, tag, code);
1298 if (name->IsString()) { 1306 if (name->IsString()) {
1299 msg.Append('"'); 1307 msg.Append('"');
1300 msg.AppendDetailed(String::cast(name), false); 1308 msg.AppendDetailed(String::cast(name), false);
1301 msg.Append('"'); 1309 msg.Append('"');
1302 } else { 1310 } else {
1303 msg.AppendSymbolName(Symbol::cast(name)); 1311 msg.AppendSymbolName(Symbol::cast(name));
1304 } 1312 }
1305 msg.Append('\n'); 1313 msg.Append('\n');
1306 msg.WriteToLogFile(); 1314 msg.WriteToLogFile();
1307 } 1315 }
1308 1316
1309 1317
1310 void Logger::CodeCreateEvent(LogEventsAndTags tag, 1318 void Logger::CodeCreateEvent(LogEventsAndTags tag,
1311 Code* code, 1319 Code* code,
1312 SharedFunctionInfo* shared, 1320 SharedFunctionInfo* shared,
1313 CompilationInfo* info, 1321 CompilationInfo* info,
1314 Name* name) { 1322 Name* name) {
1323 PROFILER_LOG(CodeCreateEvent(tag, code, shared, info, name));
1324
1315 if (!is_logging_code_events()) return; 1325 if (!is_logging_code_events()) return;
1316
1317 JIT_LOG(CodeCreateEvent(tag, code, shared, info, name)); 1326 JIT_LOG(CodeCreateEvent(tag, code, shared, info, name));
1318 LL_LOG(CodeCreateEvent(tag, code, shared, info, name)); 1327 LL_LOG(CodeCreateEvent(tag, code, shared, info, name));
1319 CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, shared, info, name)); 1328 CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, shared, info, name));
1320 1329
1321 if (!FLAG_log_code || !log_->IsEnabled()) return; 1330 if (!FLAG_log_code || !log_->IsEnabled()) return;
1322 if (code == isolate_->builtins()->builtin( 1331 if (code == isolate_->builtins()->builtin(
1323 Builtins::kLazyCompile)) 1332 Builtins::kLazyCompile))
1324 return; 1333 return;
1325 1334
1326 Log::MessageBuilder msg(log_); 1335 Log::MessageBuilder msg(log_);
(...skipping 14 matching lines...) Expand all
1341 1350
1342 1351
1343 // Although, it is possible to extract source and line from 1352 // Although, it is possible to extract source and line from
1344 // the SharedFunctionInfo object, we left it to caller 1353 // the SharedFunctionInfo object, we left it to caller
1345 // to leave logging functions free from heap allocations. 1354 // to leave logging functions free from heap allocations.
1346 void Logger::CodeCreateEvent(LogEventsAndTags tag, 1355 void Logger::CodeCreateEvent(LogEventsAndTags tag,
1347 Code* code, 1356 Code* code,
1348 SharedFunctionInfo* shared, 1357 SharedFunctionInfo* shared,
1349 CompilationInfo* info, 1358 CompilationInfo* info,
1350 Name* source, int line) { 1359 Name* source, int line) {
1360 PROFILER_LOG(CodeCreateEvent(tag, code, shared, info, source, line));
1361
1351 if (!is_logging_code_events()) return; 1362 if (!is_logging_code_events()) return;
1352
1353 JIT_LOG(CodeCreateEvent(tag, code, shared, info, source, line)); 1363 JIT_LOG(CodeCreateEvent(tag, code, shared, info, source, line));
1354 LL_LOG(CodeCreateEvent(tag, code, shared, info, source, line)); 1364 LL_LOG(CodeCreateEvent(tag, code, shared, info, source, line));
1355 CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, shared, info, source, line)); 1365 CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, shared, info, source, line));
1356 1366
1357 if (!FLAG_log_code || !log_->IsEnabled()) return; 1367 if (!FLAG_log_code || !log_->IsEnabled()) return;
1358 Log::MessageBuilder msg(log_); 1368 Log::MessageBuilder msg(log_);
1359 AppendCodeCreateHeader(&msg, tag, code); 1369 AppendCodeCreateHeader(&msg, tag, code);
1360 SmartArrayPointer<char> name = 1370 SmartArrayPointer<char> name =
1361 shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); 1371 shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
1362 msg.Append("\"%s ", *name); 1372 msg.Append("\"%s ", *name);
1363 if (source->IsString()) { 1373 if (source->IsString()) {
1364 SmartArrayPointer<char> sourcestr = 1374 SmartArrayPointer<char> sourcestr =
1365 String::cast(source)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); 1375 String::cast(source)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
1366 msg.Append("%s", *sourcestr); 1376 msg.Append("%s", *sourcestr);
1367 } else { 1377 } else {
1368 msg.AppendSymbolName(Symbol::cast(source)); 1378 msg.AppendSymbolName(Symbol::cast(source));
1369 } 1379 }
1370 msg.Append(":%d\",", line); 1380 msg.Append(":%d\",", line);
1371 msg.AppendAddress(shared->address()); 1381 msg.AppendAddress(shared->address());
1372 msg.Append(",%s", ComputeMarker(code)); 1382 msg.Append(",%s", ComputeMarker(code));
1373 msg.Append('\n'); 1383 msg.Append('\n');
1374 msg.WriteToLogFile(); 1384 msg.WriteToLogFile();
1375 } 1385 }
1376 1386
1377 1387
1378 void Logger::CodeCreateEvent(LogEventsAndTags tag, 1388 void Logger::CodeCreateEvent(LogEventsAndTags tag,
1379 Code* code, 1389 Code* code,
1380 int args_count) { 1390 int args_count) {
1391 PROFILER_LOG(CodeCreateEvent(tag, code, args_count));
1392
1381 if (!is_logging_code_events()) return; 1393 if (!is_logging_code_events()) return;
1382
1383 JIT_LOG(CodeCreateEvent(tag, code, args_count)); 1394 JIT_LOG(CodeCreateEvent(tag, code, args_count));
1384 LL_LOG(CodeCreateEvent(tag, code, args_count)); 1395 LL_LOG(CodeCreateEvent(tag, code, args_count));
1385 CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, args_count)); 1396 CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, args_count));
1386 1397
1387 if (!FLAG_log_code || !log_->IsEnabled()) return; 1398 if (!FLAG_log_code || !log_->IsEnabled()) return;
1388 Log::MessageBuilder msg(log_); 1399 Log::MessageBuilder msg(log_);
1389 AppendCodeCreateHeader(&msg, tag, code); 1400 AppendCodeCreateHeader(&msg, tag, code);
1390 msg.Append("\"args_count: %d\"", args_count); 1401 msg.Append("\"args_count: %d\"", args_count);
1391 msg.Append('\n'); 1402 msg.Append('\n');
1392 msg.WriteToLogFile(); 1403 msg.WriteToLogFile();
1393 } 1404 }
1394 1405
1395 1406
1396 void Logger::CodeMovingGCEvent() { 1407 void Logger::CodeMovingGCEvent() {
1408 PROFILER_LOG(CodeMovingGCEvent());
1409
1410 if (!is_logging_code_events()) return;
1397 if (!log_->IsEnabled() || !FLAG_ll_prof) return; 1411 if (!log_->IsEnabled() || !FLAG_ll_prof) return;
1398 LL_LOG(CodeMovingGCEvent()); 1412 LL_LOG(CodeMovingGCEvent());
1399 OS::SignalCodeMovingGC(); 1413 OS::SignalCodeMovingGC();
1400 } 1414 }
1401 1415
1402 1416
1403 void Logger::RegExpCodeCreateEvent(Code* code, String* source) { 1417 void Logger::RegExpCodeCreateEvent(Code* code, String* source) {
1418 PROFILER_LOG(RegExpCodeCreateEvent(code, source));
1419
1404 if (!is_logging_code_events()) return; 1420 if (!is_logging_code_events()) return;
1405
1406 JIT_LOG(RegExpCodeCreateEvent(code, source)); 1421 JIT_LOG(RegExpCodeCreateEvent(code, source));
1407 LL_LOG(RegExpCodeCreateEvent(code, source)); 1422 LL_LOG(RegExpCodeCreateEvent(code, source));
1408 CODE_ADDRESS_MAP_LOG(RegExpCodeCreateEvent(code, source)); 1423 CODE_ADDRESS_MAP_LOG(RegExpCodeCreateEvent(code, source));
1409 1424
1410 if (!FLAG_log_code || !log_->IsEnabled()) return; 1425 if (!FLAG_log_code || !log_->IsEnabled()) return;
1411 Log::MessageBuilder msg(log_); 1426 Log::MessageBuilder msg(log_);
1412 AppendCodeCreateHeader(&msg, REG_EXP_TAG, code); 1427 AppendCodeCreateHeader(&msg, REG_EXP_TAG, code);
1413 msg.Append('"'); 1428 msg.Append('"');
1414 msg.AppendDetailed(source, false); 1429 msg.AppendDetailed(source, false);
1415 msg.Append('"'); 1430 msg.Append('"');
1416 msg.Append('\n'); 1431 msg.Append('\n');
1417 msg.WriteToLogFile(); 1432 msg.WriteToLogFile();
1418 } 1433 }
1419 1434
1420 1435
1421 void Logger::CodeMoveEvent(Address from, Address to) { 1436 void Logger::CodeMoveEvent(Address from, Address to) {
1422 JIT_LOG(CodeMovedEvent(from, to)); 1437 PROFILER_LOG(CodeMoveEvent(from, to));
1423 if (!log_->IsEnabled()) return; 1438
1439 if (!is_logging_code_events()) return;
1440 JIT_LOG(CodeMoveEvent(from, to));
1424 LL_LOG(CodeMoveEvent(from, to)); 1441 LL_LOG(CodeMoveEvent(from, to));
1425 CODE_ADDRESS_MAP_LOG(CodeMoveEvent(from, to)); 1442 CODE_ADDRESS_MAP_LOG(CodeMoveEvent(from, to));
1426 MoveEventInternal(CODE_MOVE_EVENT, from, to); 1443 MoveEventInternal(CODE_MOVE_EVENT, from, to);
1427 } 1444 }
1428 1445
1429 1446
1430 void Logger::CodeDeleteEvent(Address from) { 1447 void Logger::CodeDeleteEvent(Address from) {
1448 PROFILER_LOG(CodeDeleteEvent(from));
1449
1450 if (!is_logging_code_events()) return;
1431 JIT_LOG(CodeDeleteEvent(from)); 1451 JIT_LOG(CodeDeleteEvent(from));
1432 if (!log_->IsEnabled()) return;
1433 LL_LOG(CodeDeleteEvent(from)); 1452 LL_LOG(CodeDeleteEvent(from));
1434 CODE_ADDRESS_MAP_LOG(CodeDeleteEvent(from)); 1453 CODE_ADDRESS_MAP_LOG(CodeDeleteEvent(from));
1435 1454
1436 if (!log_->IsEnabled() || !FLAG_log_code) return; 1455 if (!FLAG_log_code || !log_->IsEnabled()) return;
1437 Log::MessageBuilder msg(log_); 1456 Log::MessageBuilder msg(log_);
1438 msg.Append("%s,", kLogEventsNames[CODE_DELETE_EVENT]); 1457 msg.Append("%s,", kLogEventsNames[CODE_DELETE_EVENT]);
1439 msg.AppendAddress(from); 1458 msg.AppendAddress(from);
1440 msg.Append('\n'); 1459 msg.Append('\n');
1441 msg.WriteToLogFile(); 1460 msg.WriteToLogFile();
1442 } 1461 }
1443 1462
1444 1463
1445 void Logger::CodeLinePosInfoAddPositionEvent(void* jit_handler_data, 1464 void Logger::CodeLinePosInfoAddPositionEvent(void* jit_handler_data,
1446 int pc_offset, 1465 int pc_offset,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 Log::MessageBuilder msg(log_); 1510 Log::MessageBuilder msg(log_);
1492 msg.Append("%s,", kLogEventsNames[SNAPSHOT_POSITION_EVENT]); 1511 msg.Append("%s,", kLogEventsNames[SNAPSHOT_POSITION_EVENT]);
1493 msg.AppendAddress(addr); 1512 msg.AppendAddress(addr);
1494 msg.Append(",%d", pos); 1513 msg.Append(",%d", pos);
1495 msg.Append('\n'); 1514 msg.Append('\n');
1496 msg.WriteToLogFile(); 1515 msg.WriteToLogFile();
1497 } 1516 }
1498 1517
1499 1518
1500 void Logger::SharedFunctionInfoMoveEvent(Address from, Address to) { 1519 void Logger::SharedFunctionInfoMoveEvent(Address from, Address to) {
1520 PROFILER_LOG(SharedFunctionInfoMoveEvent(from, to));
1521
1522 if (!is_logging_code_events()) return;
1501 MoveEventInternal(SHARED_FUNC_MOVE_EVENT, from, to); 1523 MoveEventInternal(SHARED_FUNC_MOVE_EVENT, from, to);
1502 } 1524 }
1503 1525
1504 1526
1505 void Logger::MoveEventInternal(LogEventsAndTags event, 1527 void Logger::MoveEventInternal(LogEventsAndTags event,
1506 Address from, 1528 Address from,
1507 Address to) { 1529 Address to) {
1508 if (!log_->IsEnabled() || !FLAG_log_code) return; 1530 if (!FLAG_log_code || !log_->IsEnabled()) return;
1509 Log::MessageBuilder msg(log_); 1531 Log::MessageBuilder msg(log_);
1510 msg.Append("%s,", kLogEventsNames[event]); 1532 msg.Append("%s,", kLogEventsNames[event]);
1511 msg.AppendAddress(from); 1533 msg.AppendAddress(from);
1512 msg.Append(','); 1534 msg.Append(',');
1513 msg.AppendAddress(to); 1535 msg.AppendAddress(to);
1514 msg.Append('\n'); 1536 msg.Append('\n');
1515 msg.WriteToLogFile(); 1537 msg.WriteToLogFile();
1516 } 1538 }
1517 1539
1518 1540
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
2057 2079
2058 if (jit_logger_) { 2080 if (jit_logger_) {
2059 delete jit_logger_; 2081 delete jit_logger_;
2060 jit_logger_ = NULL; 2082 jit_logger_ = NULL;
2061 } 2083 }
2062 2084
2063 return log_->Close(); 2085 return log_->Close();
2064 } 2086 }
2065 2087
2066 } } // namespace v8::internal 2088 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/cpu-profiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698