| 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 <stdarg.h> | 5 #include <stdarg.h> |
| 6 | 6 |
| 7 #include "v8.h" | 7 #include "v8.h" |
| 8 | 8 |
| 9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
| 10 #include "code-stubs.h" | 10 #include "code-stubs.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 } | 223 } |
| 224 | 224 |
| 225 | 225 |
| 226 // Linux perf tool logging support | 226 // Linux perf tool logging support |
| 227 class PerfBasicLogger : public CodeEventLogger { | 227 class PerfBasicLogger : public CodeEventLogger { |
| 228 public: | 228 public: |
| 229 PerfBasicLogger(); | 229 PerfBasicLogger(); |
| 230 virtual ~PerfBasicLogger(); | 230 virtual ~PerfBasicLogger(); |
| 231 | 231 |
| 232 virtual void CodeMoveEvent(Address from, Address to) { } | 232 virtual void CodeMoveEvent(Address from, Address to) { } |
| 233 virtual void CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared) { } |
| 233 virtual void CodeDeleteEvent(Address from) { } | 234 virtual void CodeDeleteEvent(Address from) { } |
| 234 | 235 |
| 235 private: | 236 private: |
| 236 virtual void LogRecordedBuffer(Code* code, | 237 virtual void LogRecordedBuffer(Code* code, |
| 237 SharedFunctionInfo* shared, | 238 SharedFunctionInfo* shared, |
| 238 const char* name, | 239 const char* name, |
| 239 int length); | 240 int length); |
| 240 | 241 |
| 241 // Extension added to V8 log file name to get the low-level log name. | 242 // Extension added to V8 log file name to get the low-level log name. |
| 242 static const char kFilenameFormatString[]; | 243 static const char kFilenameFormatString[]; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 } | 289 } |
| 289 | 290 |
| 290 | 291 |
| 291 // Linux perf tool logging support | 292 // Linux perf tool logging support |
| 292 class PerfJitLogger : public CodeEventLogger { | 293 class PerfJitLogger : public CodeEventLogger { |
| 293 public: | 294 public: |
| 294 PerfJitLogger(); | 295 PerfJitLogger(); |
| 295 virtual ~PerfJitLogger(); | 296 virtual ~PerfJitLogger(); |
| 296 | 297 |
| 297 virtual void CodeMoveEvent(Address from, Address to) { } | 298 virtual void CodeMoveEvent(Address from, Address to) { } |
| 299 virtual void CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared) { } |
| 298 virtual void CodeDeleteEvent(Address from) { } | 300 virtual void CodeDeleteEvent(Address from) { } |
| 299 | 301 |
| 300 private: | 302 private: |
| 301 virtual void LogRecordedBuffer(Code* code, | 303 virtual void LogRecordedBuffer(Code* code, |
| 302 SharedFunctionInfo* shared, | 304 SharedFunctionInfo* shared, |
| 303 const char* name, | 305 const char* name, |
| 304 int length); | 306 int length); |
| 305 | 307 |
| 306 // Extension added to V8 log file name to get the low-level log name. | 308 // Extension added to V8 log file name to get the low-level log name. |
| 307 static const char kFilenameFormatString[]; | 309 static const char kFilenameFormatString[]; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 | 452 |
| 451 // Low-level logging support. | 453 // Low-level logging support. |
| 452 #define LL_LOG(Call) if (ll_logger_) ll_logger_->Call; | 454 #define LL_LOG(Call) if (ll_logger_) ll_logger_->Call; |
| 453 | 455 |
| 454 class LowLevelLogger : public CodeEventLogger { | 456 class LowLevelLogger : public CodeEventLogger { |
| 455 public: | 457 public: |
| 456 explicit LowLevelLogger(const char* file_name); | 458 explicit LowLevelLogger(const char* file_name); |
| 457 virtual ~LowLevelLogger(); | 459 virtual ~LowLevelLogger(); |
| 458 | 460 |
| 459 virtual void CodeMoveEvent(Address from, Address to); | 461 virtual void CodeMoveEvent(Address from, Address to); |
| 462 virtual void CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared) { } |
| 460 virtual void CodeDeleteEvent(Address from); | 463 virtual void CodeDeleteEvent(Address from); |
| 461 virtual void SnapshotPositionEvent(Address addr, int pos); | 464 virtual void SnapshotPositionEvent(Address addr, int pos); |
| 462 virtual void CodeMovingGCEvent(); | 465 virtual void CodeMovingGCEvent(); |
| 463 | 466 |
| 464 private: | 467 private: |
| 465 virtual void LogRecordedBuffer(Code* code, | 468 virtual void LogRecordedBuffer(Code* code, |
| 466 SharedFunctionInfo* shared, | 469 SharedFunctionInfo* shared, |
| 467 const char* name, | 470 const char* name, |
| 468 int length); | 471 int length); |
| 469 | 472 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 | 619 |
| 617 | 620 |
| 618 #define JIT_LOG(Call) if (jit_logger_) jit_logger_->Call; | 621 #define JIT_LOG(Call) if (jit_logger_) jit_logger_->Call; |
| 619 | 622 |
| 620 | 623 |
| 621 class JitLogger : public CodeEventLogger { | 624 class JitLogger : public CodeEventLogger { |
| 622 public: | 625 public: |
| 623 explicit JitLogger(JitCodeEventHandler code_event_handler); | 626 explicit JitLogger(JitCodeEventHandler code_event_handler); |
| 624 | 627 |
| 625 virtual void CodeMoveEvent(Address from, Address to); | 628 virtual void CodeMoveEvent(Address from, Address to); |
| 629 virtual void CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared) { } |
| 626 virtual void CodeDeleteEvent(Address from); | 630 virtual void CodeDeleteEvent(Address from); |
| 627 virtual void AddCodeLinePosInfoEvent( | 631 virtual void AddCodeLinePosInfoEvent( |
| 628 void* jit_handler_data, | 632 void* jit_handler_data, |
| 629 int pc_offset, | 633 int pc_offset, |
| 630 int position, | 634 int position, |
| 631 JitCodeEvent::PositionType position_type); | 635 JitCodeEvent::PositionType position_type); |
| 632 | 636 |
| 633 void* StartCodePosInfoEvent(); | 637 void* StartCodePosInfoEvent(); |
| 634 void EndCodePosInfoEvent(Code* code, void* jit_handler_data); | 638 void EndCodePosInfoEvent(Code* code, void* jit_handler_data); |
| 635 | 639 |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1439 | 1443 |
| 1440 if (!FLAG_log_code || !log_->IsEnabled()) return; | 1444 if (!FLAG_log_code || !log_->IsEnabled()) return; |
| 1441 Log::MessageBuilder msg(log_); | 1445 Log::MessageBuilder msg(log_); |
| 1442 AppendCodeCreateHeader(&msg, tag, code); | 1446 AppendCodeCreateHeader(&msg, tag, code); |
| 1443 msg.Append("\"args_count: %d\"", args_count); | 1447 msg.Append("\"args_count: %d\"", args_count); |
| 1444 msg.Append('\n'); | 1448 msg.Append('\n'); |
| 1445 msg.WriteToLogFile(); | 1449 msg.WriteToLogFile(); |
| 1446 } | 1450 } |
| 1447 | 1451 |
| 1448 | 1452 |
| 1453 void Logger::CodeDisableOptEvent(Code* code, |
| 1454 SharedFunctionInfo* shared) { |
| 1455 PROFILER_LOG(CodeDisableOptEvent(code, shared)); |
| 1456 |
| 1457 if (!is_logging_code_events()) return; |
| 1458 CALL_LISTENERS(CodeDisableOptEvent(code, shared)); |
| 1459 |
| 1460 if (!FLAG_log_code || !log_->IsEnabled()) return; |
| 1461 Log::MessageBuilder msg(log_); |
| 1462 msg.Append("%s,", kLogEventsNames[CODE_DISABLE_OPT_EVENT]); |
| 1463 SmartArrayPointer<char> name = |
| 1464 shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 1465 msg.Append("\"%s\",", name.get()); |
| 1466 msg.Append("\"%s\"\n", GetBailoutReason(shared->DisableOptimizationReason())); |
| 1467 msg.WriteToLogFile(); |
| 1468 } |
| 1469 |
| 1470 |
| 1449 void Logger::CodeMovingGCEvent() { | 1471 void Logger::CodeMovingGCEvent() { |
| 1450 PROFILER_LOG(CodeMovingGCEvent()); | 1472 PROFILER_LOG(CodeMovingGCEvent()); |
| 1451 | 1473 |
| 1452 if (!is_logging_code_events()) return; | 1474 if (!is_logging_code_events()) return; |
| 1453 if (!log_->IsEnabled() || !FLAG_ll_prof) return; | 1475 if (!log_->IsEnabled() || !FLAG_ll_prof) return; |
| 1454 CALL_LISTENERS(CodeMovingGCEvent()); | 1476 CALL_LISTENERS(CodeMovingGCEvent()); |
| 1455 OS::SignalCodeMovingGC(); | 1477 OS::SignalCodeMovingGC(); |
| 1456 } | 1478 } |
| 1457 | 1479 |
| 1458 | 1480 |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2089 if (jit_logger_) { | 2111 if (jit_logger_) { |
| 2090 removeCodeEventListener(jit_logger_); | 2112 removeCodeEventListener(jit_logger_); |
| 2091 delete jit_logger_; | 2113 delete jit_logger_; |
| 2092 jit_logger_ = NULL; | 2114 jit_logger_ = NULL; |
| 2093 } | 2115 } |
| 2094 | 2116 |
| 2095 return log_->Close(); | 2117 return log_->Close(); |
| 2096 } | 2118 } |
| 2097 | 2119 |
| 2098 } } // namespace v8::internal | 2120 } } // namespace v8::internal |
| OLD | NEW |