| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // --prof | 69 // --prof |
| 70 // Collect statistical profiling information (ticks), default is off. The | 70 // Collect statistical profiling information (ticks), default is off. The |
| 71 // tick profiler requires code events, so --prof implies --log-code. | 71 // tick profiler requires code events, so --prof implies --log-code. |
| 72 | 72 |
| 73 // Forward declarations. | 73 // Forward declarations. |
| 74 class LogMessageBuilder; | 74 class LogMessageBuilder; |
| 75 class Profiler; | 75 class Profiler; |
| 76 class Semaphore; | 76 class Semaphore; |
| 77 class Ticker; | 77 class Ticker; |
| 78 class Isolate; | 78 class Isolate; |
| 79 class PositionsRecorder; |
| 79 | 80 |
| 80 #undef LOG | 81 #undef LOG |
| 81 #define LOG(isolate, Call) \ | 82 #define LOG(isolate, Call) \ |
| 82 do { \ | 83 do { \ |
| 83 v8::internal::Logger* logger = \ | 84 v8::internal::Logger* logger = \ |
| 84 (isolate)->logger(); \ | 85 (isolate)->logger(); \ |
| 85 if (logger->is_logging()) \ | 86 if (logger->is_logging()) \ |
| 86 logger->Call; \ | 87 logger->Call; \ |
| 87 } while (false) | 88 } while (false) |
| 88 | 89 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 SharedFunctionInfo* shared, | 240 SharedFunctionInfo* shared, |
| 240 String* source, int line); | 241 String* source, int line); |
| 241 void CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count); | 242 void CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count); |
| 242 void CodeMovingGCEvent(); | 243 void CodeMovingGCEvent(); |
| 243 // Emits a code create event for a RegExp. | 244 // Emits a code create event for a RegExp. |
| 244 void RegExpCodeCreateEvent(Code* code, String* source); | 245 void RegExpCodeCreateEvent(Code* code, String* source); |
| 245 // Emits a code move event. | 246 // Emits a code move event. |
| 246 void CodeMoveEvent(Address from, Address to); | 247 void CodeMoveEvent(Address from, Address to); |
| 247 // Emits a code delete event. | 248 // Emits a code delete event. |
| 248 void CodeDeleteEvent(Address from); | 249 void CodeDeleteEvent(Address from); |
| 250 // Emits a code line info add event with Postion type. |
| 251 void CodeLinePosInfoAddPositionEvent(void* jit_handler_data, |
| 252 int pc_offset, |
| 253 int position); |
| 254 // Emits a code line info add event with StatementPostion type. |
| 255 void CodeLinePosInfoAddStatementPositionEvent(void* jit_handler_data, |
| 256 int pc_offset, |
| 257 int position); |
| 258 // Emits a code line info start to record event |
| 259 void CodeStartLinePosInfoRecordEvent(PositionsRecorder* pos_recorder); |
| 260 // Emits a code line info finish record event. |
| 261 // It's the callee's responsibility to dispose the parameter jit_handler_data. |
| 262 void CodeEndLinePosInfoRecordEvent(Code* code, void* jit_handler_data); |
| 249 | 263 |
| 250 void SharedFunctionInfoMoveEvent(Address from, Address to); | 264 void SharedFunctionInfoMoveEvent(Address from, Address to); |
| 251 | 265 |
| 252 void SnapshotPositionEvent(Address addr, int pos); | 266 void SnapshotPositionEvent(Address addr, int pos); |
| 253 | 267 |
| 254 // ==== Events logged by --log-gc. ==== | 268 // ==== Events logged by --log-gc. ==== |
| 255 // Heap sampling events: start, end, and individual types. | 269 // Heap sampling events: start, end, and individual types. |
| 256 void HeapSampleBeginEvent(const char* space, const char* kind); | 270 void HeapSampleBeginEvent(const char* space, const char* kind); |
| 257 void HeapSampleEndEvent(const char* space, const char* kind); | 271 void HeapSampleEndEvent(const char* space, const char* kind); |
| 258 void HeapSampleItemEvent(const char* type, int number, int bytes); | 272 void HeapSampleItemEvent(const char* type, int number, int bytes); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 323 |
| 310 void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache); | 324 void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache); |
| 311 | 325 |
| 312 // Log an event reported from generated code | 326 // Log an event reported from generated code |
| 313 void LogRuntime(Isolate* isolate, Vector<const char> format, JSArray* args); | 327 void LogRuntime(Isolate* isolate, Vector<const char> format, JSArray* args); |
| 314 | 328 |
| 315 bool is_logging() { | 329 bool is_logging() { |
| 316 return logging_nesting_ > 0; | 330 return logging_nesting_ > 0; |
| 317 } | 331 } |
| 318 | 332 |
| 333 bool is_code_event_handler_enabled() { |
| 334 return code_event_handler_ != NULL; |
| 335 } |
| 336 |
| 319 bool is_logging_code_events() { | 337 bool is_logging_code_events() { |
| 320 return is_logging() || code_event_handler_ != NULL; | 338 return is_logging() || code_event_handler_ != NULL; |
| 321 } | 339 } |
| 322 | 340 |
| 323 // Pause/Resume collection of profiling data. | 341 // Pause/Resume collection of profiling data. |
| 324 // When data collection is paused, CPU Tick events are discarded until | 342 // When data collection is paused, CPU Tick events are discarded until |
| 325 // data collection is Resumed. | 343 // data collection is Resumed. |
| 326 void PauseProfiler(); | 344 void PauseProfiler(); |
| 327 void ResumeProfiler(); | 345 void ResumeProfiler(); |
| 328 bool IsProfilerPaused(); | 346 bool IsProfilerPaused(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 352 void LogFailure(); | 370 void LogFailure(); |
| 353 | 371 |
| 354 private: | 372 private: |
| 355 class NameBuffer; | 373 class NameBuffer; |
| 356 class NameMap; | 374 class NameMap; |
| 357 | 375 |
| 358 explicit Logger(Isolate* isolate); | 376 explicit Logger(Isolate* isolate); |
| 359 ~Logger(); | 377 ~Logger(); |
| 360 | 378 |
| 361 // Issue code notifications. | 379 // Issue code notifications. |
| 362 void IssueCodeAddedEvent(Code* code, const char* name, size_t name_len); | 380 void IssueCodeAddedEvent(Code* code, |
| 381 Script* script, |
| 382 const char* name, |
| 383 size_t name_len); |
| 363 void IssueCodeMovedEvent(Address from, Address to); | 384 void IssueCodeMovedEvent(Address from, Address to); |
| 364 void IssueCodeRemovedEvent(Address from); | 385 void IssueCodeRemovedEvent(Address from); |
| 365 | 386 void IssueAddCodeLinePosInfoEvent(void* jit_handler_data, |
| 387 int pc_offset, |
| 388 int position, |
| 389 JitCodeEvent::PositionType position_Type); |
| 390 void* IssueStartCodePosInfoEvent(); |
| 391 void IssueEndCodePosInfoEvent(Code* code, void* jit_handler_data); |
| 366 // Emits the profiler's first message. | 392 // Emits the profiler's first message. |
| 367 void ProfilerBeginEvent(); | 393 void ProfilerBeginEvent(); |
| 368 | 394 |
| 369 // Emits callback event messages. | 395 // Emits callback event messages. |
| 370 void CallbackEventInternal(const char* prefix, | 396 void CallbackEventInternal(const char* prefix, |
| 371 const char* name, | 397 const char* name, |
| 372 Address entry_point); | 398 Address entry_point); |
| 373 | 399 |
| 374 // Internal configurable move event. | 400 // Internal configurable move event. |
| 375 void MoveEventInternal(LogEventsAndTags event, Address from, Address to); | 401 void MoveEventInternal(LogEventsAndTags event, Address from, Address to); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 // Class that extracts stack trace, used for profiling. | 544 // Class that extracts stack trace, used for profiling. |
| 519 class StackTracer : public AllStatic { | 545 class StackTracer : public AllStatic { |
| 520 public: | 546 public: |
| 521 static void Trace(Isolate* isolate, TickSample* sample); | 547 static void Trace(Isolate* isolate, TickSample* sample); |
| 522 }; | 548 }; |
| 523 | 549 |
| 524 } } // namespace v8::internal | 550 } } // namespace v8::internal |
| 525 | 551 |
| 526 | 552 |
| 527 #endif // V8_LOG_H_ | 553 #endif // V8_LOG_H_ |
| OLD | NEW |