OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_LOG_H_ | 5 #ifndef V8_LOG_H_ |
6 #define V8_LOG_H_ | 6 #define V8_LOG_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // | 50 // |
51 // --logfile <filename> | 51 // --logfile <filename> |
52 // Specify the name of the logfile, default is "v8.log". | 52 // Specify the name of the logfile, default is "v8.log". |
53 // | 53 // |
54 // --prof | 54 // --prof |
55 // Collect statistical profiling information (ticks), default is off. The | 55 // Collect statistical profiling information (ticks), default is off. The |
56 // tick profiler requires code events, so --prof implies --log-code. | 56 // tick profiler requires code events, so --prof implies --log-code. |
57 | 57 |
58 // Forward declarations. | 58 // Forward declarations. |
59 class CodeEventListener; | 59 class CodeEventListener; |
60 class CompilationInfo; | |
61 class CpuProfiler; | 60 class CpuProfiler; |
62 class Isolate; | 61 class Isolate; |
63 class Log; | 62 class Log; |
64 class PositionsRecorder; | 63 class PositionsRecorder; |
65 class Profiler; | 64 class Profiler; |
66 class Ticker; | 65 class Ticker; |
67 struct TickSample; | 66 struct TickSample; |
68 | 67 |
69 #undef LOG | 68 #undef LOG |
70 #define LOG(isolate, Call) \ | 69 #define LOG(isolate, Call) \ |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 void CallbackEvent(Name* name, Address entry_point); | 218 void CallbackEvent(Name* name, Address entry_point); |
220 void GetterCallbackEvent(Name* name, Address entry_point); | 219 void GetterCallbackEvent(Name* name, Address entry_point); |
221 void SetterCallbackEvent(Name* name, Address entry_point); | 220 void SetterCallbackEvent(Name* name, Address entry_point); |
222 // Emits a code create event. | 221 // Emits a code create event. |
223 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, | 222 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
224 const char* source); | 223 const char* source); |
225 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, Name* name); | 224 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, Name* name); |
226 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, | 225 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
227 SharedFunctionInfo* shared, Name* name); | 226 SharedFunctionInfo* shared, Name* name); |
228 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, | 227 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
229 SharedFunctionInfo* shared, CompilationInfo* info, | 228 SharedFunctionInfo* shared, Name* source, int line, |
230 Name* source, int line, int column); | 229 int column); |
231 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, | 230 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
232 int args_count); | 231 int args_count); |
233 // Emits a code deoptimization event. | 232 // Emits a code deoptimization event. |
234 void CodeDisableOptEvent(AbstractCode* code, SharedFunctionInfo* shared); | 233 void CodeDisableOptEvent(AbstractCode* code, SharedFunctionInfo* shared); |
235 void CodeMovingGCEvent(); | 234 void CodeMovingGCEvent(); |
236 // Emits a code create event for a RegExp. | 235 // Emits a code create event for a RegExp. |
237 void RegExpCodeCreateEvent(AbstractCode* code, String* source); | 236 void RegExpCodeCreateEvent(AbstractCode* code, String* source); |
238 // Emits a code move event. | 237 // Emits a code move event. |
239 void CodeMoveEvent(AbstractCode* from, Address to); | 238 void CodeMoveEvent(AbstractCode* from, Address to); |
240 // Emits a code line info add event with Postion type. | 239 // Emits a code line info add event with Postion type. |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 public: | 462 public: |
464 virtual ~CodeEventListener() {} | 463 virtual ~CodeEventListener() {} |
465 | 464 |
466 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, | 465 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
467 const char* comment) = 0; | 466 const char* comment) = 0; |
468 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, | 467 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
469 Name* name) = 0; | 468 Name* name) = 0; |
470 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, | 469 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
471 SharedFunctionInfo* shared, Name* name) = 0; | 470 SharedFunctionInfo* shared, Name* name) = 0; |
472 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, | 471 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
473 SharedFunctionInfo* shared, | 472 SharedFunctionInfo* shared, Name* source, |
474 CompilationInfo* info, Name* source, int line, | 473 int line, int column) = 0; |
475 int column) = 0; | |
476 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, | 474 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
477 int args_count) = 0; | 475 int args_count) = 0; |
478 virtual void CallbackEvent(Name* name, Address entry_point) = 0; | 476 virtual void CallbackEvent(Name* name, Address entry_point) = 0; |
479 virtual void GetterCallbackEvent(Name* name, Address entry_point) = 0; | 477 virtual void GetterCallbackEvent(Name* name, Address entry_point) = 0; |
480 virtual void SetterCallbackEvent(Name* name, Address entry_point) = 0; | 478 virtual void SetterCallbackEvent(Name* name, Address entry_point) = 0; |
481 virtual void RegExpCodeCreateEvent(AbstractCode* code, String* source) = 0; | 479 virtual void RegExpCodeCreateEvent(AbstractCode* code, String* source) = 0; |
482 virtual void CodeMoveEvent(AbstractCode* from, Address to) = 0; | 480 virtual void CodeMoveEvent(AbstractCode* from, Address to) = 0; |
483 virtual void SharedFunctionInfoMoveEvent(Address from, Address to) = 0; | 481 virtual void SharedFunctionInfoMoveEvent(Address from, Address to) = 0; |
484 virtual void CodeMovingGCEvent() = 0; | 482 virtual void CodeMovingGCEvent() = 0; |
485 virtual void CodeDisableOptEvent(AbstractCode* code, | 483 virtual void CodeDisableOptEvent(AbstractCode* code, |
486 SharedFunctionInfo* shared) = 0; | 484 SharedFunctionInfo* shared) = 0; |
487 }; | 485 }; |
488 | 486 |
489 | 487 |
490 class CodeEventLogger : public CodeEventListener { | 488 class CodeEventLogger : public CodeEventListener { |
491 public: | 489 public: |
492 CodeEventLogger(); | 490 CodeEventLogger(); |
493 ~CodeEventLogger() override; | 491 ~CodeEventLogger() override; |
494 | 492 |
495 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, | 493 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
496 const char* comment) override; | 494 const char* comment) override; |
497 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, | 495 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
498 Name* name) override; | 496 Name* name) override; |
499 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, | 497 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
500 int args_count) override; | 498 int args_count) override; |
501 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, | 499 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
502 SharedFunctionInfo* shared, Name* name) override; | 500 SharedFunctionInfo* shared, Name* name) override; |
503 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, | 501 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
504 SharedFunctionInfo* shared, CompilationInfo* info, | 502 SharedFunctionInfo* shared, Name* source, int line, |
505 Name* source, int line, int column) override; | 503 int column) override; |
506 void RegExpCodeCreateEvent(AbstractCode* code, String* source) override; | 504 void RegExpCodeCreateEvent(AbstractCode* code, String* source) override; |
507 | 505 |
508 void CallbackEvent(Name* name, Address entry_point) override {} | 506 void CallbackEvent(Name* name, Address entry_point) override {} |
509 void GetterCallbackEvent(Name* name, Address entry_point) override {} | 507 void GetterCallbackEvent(Name* name, Address entry_point) override {} |
510 void SetterCallbackEvent(Name* name, Address entry_point) override {} | 508 void SetterCallbackEvent(Name* name, Address entry_point) override {} |
511 void SharedFunctionInfoMoveEvent(Address from, Address to) override {} | 509 void SharedFunctionInfoMoveEvent(Address from, Address to) override {} |
512 void CodeMovingGCEvent() override {} | 510 void CodeMovingGCEvent() override {} |
513 | 511 |
514 private: | 512 private: |
515 class NameBuffer; | 513 class NameBuffer; |
516 | 514 |
517 virtual void LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo* shared, | 515 virtual void LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo* shared, |
518 const char* name, int length) = 0; | 516 const char* name, int length) = 0; |
519 | 517 |
520 NameBuffer* name_buffer_; | 518 NameBuffer* name_buffer_; |
521 }; | 519 }; |
522 | 520 |
523 | 521 |
524 } // namespace internal | 522 } // namespace internal |
525 } // namespace v8 | 523 } // namespace v8 |
526 | 524 |
527 | 525 |
528 #endif // V8_LOG_H_ | 526 #endif // V8_LOG_H_ |
OLD | NEW |