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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 void addCodeEventListener(CodeEventListener* listener); | 217 void addCodeEventListener(CodeEventListener* listener); |
218 void removeCodeEventListener(CodeEventListener* listener); | 218 void removeCodeEventListener(CodeEventListener* listener); |
219 bool hasCodeEventListener(CodeEventListener* listener); | 219 bool hasCodeEventListener(CodeEventListener* listener); |
220 | 220 |
221 | 221 |
222 // Emits a code event for a callback function. | 222 // Emits a code event for a callback function. |
223 void CallbackEvent(Name* name, Address entry_point); | 223 void CallbackEvent(Name* name, Address entry_point); |
224 void GetterCallbackEvent(Name* name, Address entry_point); | 224 void GetterCallbackEvent(Name* name, Address entry_point); |
225 void SetterCallbackEvent(Name* name, Address entry_point); | 225 void SetterCallbackEvent(Name* name, Address entry_point); |
226 // Emits a code create event. | 226 // Emits a code create event. |
227 void CodeCreateEvent(LogEventsAndTags tag, | 227 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
228 Code* code, const char* source); | 228 const char* source); |
229 void CodeCreateEvent(LogEventsAndTags tag, | 229 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, Name* name); |
230 Code* code, Name* name); | 230 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
231 void CodeCreateEvent(LogEventsAndTags tag, | 231 SharedFunctionInfo* shared, CompilationInfo* info, |
232 Code* code, | |
233 SharedFunctionInfo* shared, | |
234 CompilationInfo* info, | |
235 Name* name); | 232 Name* name); |
236 void CodeCreateEvent(LogEventsAndTags tag, | 233 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
237 Code* code, | 234 SharedFunctionInfo* shared, CompilationInfo* info, |
238 SharedFunctionInfo* shared, | |
239 CompilationInfo* info, | |
240 Name* source, int line, int column); | 235 Name* source, int line, int column); |
241 void CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count); | 236 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
| 237 int args_count); |
242 // Emits a code deoptimization event. | 238 // Emits a code deoptimization event. |
243 void CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared); | 239 void CodeDisableOptEvent(AbstractCode* code, SharedFunctionInfo* shared); |
244 void CodeMovingGCEvent(); | 240 void CodeMovingGCEvent(); |
245 // Emits a code create event for a RegExp. | 241 // Emits a code create event for a RegExp. |
246 void RegExpCodeCreateEvent(Code* code, String* source); | 242 void RegExpCodeCreateEvent(AbstractCode* code, String* source); |
247 // Emits a code move event. | 243 // Emits a code move event. |
248 void CodeMoveEvent(Address from, Address to); | 244 void CodeMoveEvent(AbstractCode* from, Address to); |
249 // Emits a code delete event. | 245 // Emits a code delete event. |
250 void CodeDeleteEvent(Address from); | 246 void CodeDeleteEvent(AbstractCode* from); |
251 // Emits a code line info add event with Postion type. | 247 // Emits a code line info add event with Postion type. |
252 void CodeLinePosInfoAddPositionEvent(void* jit_handler_data, | 248 void CodeLinePosInfoAddPositionEvent(void* jit_handler_data, |
253 int pc_offset, | 249 int pc_offset, |
254 int position); | 250 int position); |
255 // Emits a code line info add event with StatementPostion type. | 251 // Emits a code line info add event with StatementPostion type. |
256 void CodeLinePosInfoAddStatementPositionEvent(void* jit_handler_data, | 252 void CodeLinePosInfoAddStatementPositionEvent(void* jit_handler_data, |
257 int pc_offset, | 253 int pc_offset, |
258 int position); | 254 int position); |
259 // Emits a code line info start to record event | 255 // Emits a code line info start to record event |
260 void CodeStartLinePosInfoRecordEvent(PositionsRecorder* pos_recorder); | 256 void CodeStartLinePosInfoRecordEvent(PositionsRecorder* pos_recorder); |
261 // Emits a code line info finish record event. | 257 // Emits a code line info finish record event. |
262 // It's the callee's responsibility to dispose the parameter jit_handler_data. | 258 // It's the callee's responsibility to dispose the parameter jit_handler_data. |
263 void CodeEndLinePosInfoRecordEvent(Code* code, void* jit_handler_data); | 259 void CodeEndLinePosInfoRecordEvent(AbstractCode* code, |
| 260 void* jit_handler_data); |
264 | 261 |
265 void SharedFunctionInfoMoveEvent(Address from, Address to); | 262 void SharedFunctionInfoMoveEvent(Address from, Address to); |
266 | 263 |
267 void CodeNameEvent(Address addr, int pos, const char* code_name); | 264 void CodeNameEvent(Address addr, int pos, const char* code_name); |
268 void SnapshotPositionEvent(Address addr, int pos); | 265 void SnapshotPositionEvent(Address addr, int pos); |
269 | 266 |
270 // ==== Events logged by --log-gc. ==== | 267 // ==== Events logged by --log-gc. ==== |
271 // Heap sampling events: start, end, and individual types. | 268 // Heap sampling events: start, end, and individual types. |
272 void HeapSampleBeginEvent(const char* space, const char* kind); | 269 void HeapSampleBeginEvent(const char* space, const char* kind); |
273 void HeapSampleEndEvent(const char* space, const char* kind); | 270 void HeapSampleEndEvent(const char* space, const char* kind); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 306 |
310 bool is_logging_code_events() { | 307 bool is_logging_code_events() { |
311 return is_logging() || jit_logger_ != NULL; | 308 return is_logging() || jit_logger_ != NULL; |
312 } | 309 } |
313 | 310 |
314 // Stop collection of profiling data. | 311 // Stop collection of profiling data. |
315 // When data collection is paused, CPU Tick events are discarded. | 312 // When data collection is paused, CPU Tick events are discarded. |
316 void StopProfiler(); | 313 void StopProfiler(); |
317 | 314 |
318 void LogExistingFunction(Handle<SharedFunctionInfo> shared, | 315 void LogExistingFunction(Handle<SharedFunctionInfo> shared, |
319 Handle<Code> code); | 316 Handle<AbstractCode> code); |
320 // Logs all compiled functions found in the heap. | 317 // Logs all compiled functions found in the heap. |
321 void LogCompiledFunctions(); | 318 void LogCompiledFunctions(); |
322 // Logs all accessor callbacks found in the heap. | 319 // Logs all accessor callbacks found in the heap. |
323 void LogAccessorCallbacks(); | 320 void LogAccessorCallbacks(); |
324 // Used for logging stubs found in the snapshot. | 321 // Used for logging stubs found in the snapshot. |
325 void LogCodeObjects(); | 322 void LogCodeObjects(); |
326 | 323 |
327 // Converts tag to a corresponding NATIVE_... if the script is native. | 324 // Converts tag to a corresponding NATIVE_... if the script is native. |
328 INLINE(static LogEventsAndTags ToNativeByScript(LogEventsAndTags, Script*)); | 325 INLINE(static LogEventsAndTags ToNativeByScript(LogEventsAndTags, Script*)); |
329 | 326 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 | 441 |
445 private: | 442 private: |
446 Isolate* isolate_; | 443 Isolate* isolate_; |
447 }; | 444 }; |
448 | 445 |
449 | 446 |
450 class CodeEventListener { | 447 class CodeEventListener { |
451 public: | 448 public: |
452 virtual ~CodeEventListener() {} | 449 virtual ~CodeEventListener() {} |
453 | 450 |
454 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, | 451 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
455 Code* code, | |
456 const char* comment) = 0; | 452 const char* comment) = 0; |
457 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, | 453 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
458 Code* code, | |
459 Name* name) = 0; | 454 Name* name) = 0; |
460 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, | 455 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
461 Code* code, | |
462 SharedFunctionInfo* shared, | 456 SharedFunctionInfo* shared, |
463 CompilationInfo* info, | 457 CompilationInfo* info, Name* name) = 0; |
464 Name* name) = 0; | 458 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
465 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, | |
466 Code* code, | |
467 SharedFunctionInfo* shared, | 459 SharedFunctionInfo* shared, |
468 CompilationInfo* info, | 460 CompilationInfo* info, Name* source, int line, |
469 Name* source, | 461 int column) = 0; |
470 int line, int column) = 0; | 462 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
471 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, | |
472 Code* code, | |
473 int args_count) = 0; | 463 int args_count) = 0; |
474 virtual void CallbackEvent(Name* name, Address entry_point) = 0; | 464 virtual void CallbackEvent(Name* name, Address entry_point) = 0; |
475 virtual void GetterCallbackEvent(Name* name, Address entry_point) = 0; | 465 virtual void GetterCallbackEvent(Name* name, Address entry_point) = 0; |
476 virtual void SetterCallbackEvent(Name* name, Address entry_point) = 0; | 466 virtual void SetterCallbackEvent(Name* name, Address entry_point) = 0; |
477 virtual void RegExpCodeCreateEvent(Code* code, String* source) = 0; | 467 virtual void RegExpCodeCreateEvent(AbstractCode* code, String* source) = 0; |
478 virtual void CodeMoveEvent(Address from, Address to) = 0; | 468 virtual void CodeMoveEvent(AbstractCode* from, Address to) = 0; |
479 virtual void CodeDeleteEvent(Address from) = 0; | 469 virtual void CodeDeleteEvent(AbstractCode* from) = 0; |
480 virtual void SharedFunctionInfoMoveEvent(Address from, Address to) = 0; | 470 virtual void SharedFunctionInfoMoveEvent(Address from, Address to) = 0; |
481 virtual void CodeMovingGCEvent() = 0; | 471 virtual void CodeMovingGCEvent() = 0; |
482 virtual void CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared) = 0; | 472 virtual void CodeDisableOptEvent(AbstractCode* code, |
| 473 SharedFunctionInfo* shared) = 0; |
483 }; | 474 }; |
484 | 475 |
485 | 476 |
486 class CodeEventLogger : public CodeEventListener { | 477 class CodeEventLogger : public CodeEventListener { |
487 public: | 478 public: |
488 CodeEventLogger(); | 479 CodeEventLogger(); |
489 virtual ~CodeEventLogger(); | 480 ~CodeEventLogger() override; |
490 | 481 |
491 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, | 482 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
492 Code* code, | 483 const char* comment) override; |
493 const char* comment); | 484 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
494 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, | 485 Name* name) override; |
495 Code* code, | 486 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
496 Name* name); | 487 int args_count) override; |
497 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, | 488 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
498 Code* code, | 489 SharedFunctionInfo* shared, CompilationInfo* info, |
499 int args_count); | 490 Name* name) override; |
500 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, | 491 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
501 Code* code, | 492 SharedFunctionInfo* shared, CompilationInfo* info, |
502 SharedFunctionInfo* shared, | 493 Name* source, int line, int column) override; |
503 CompilationInfo* info, | 494 void RegExpCodeCreateEvent(AbstractCode* code, String* source) override; |
504 Name* name); | |
505 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, | |
506 Code* code, | |
507 SharedFunctionInfo* shared, | |
508 CompilationInfo* info, | |
509 Name* source, | |
510 int line, int column); | |
511 virtual void RegExpCodeCreateEvent(Code* code, String* source); | |
512 | 495 |
513 virtual void CallbackEvent(Name* name, Address entry_point) { } | 496 void CallbackEvent(Name* name, Address entry_point) override {} |
514 virtual void GetterCallbackEvent(Name* name, Address entry_point) { } | 497 void GetterCallbackEvent(Name* name, Address entry_point) override {} |
515 virtual void SetterCallbackEvent(Name* name, Address entry_point) { } | 498 void SetterCallbackEvent(Name* name, Address entry_point) override {} |
516 virtual void SharedFunctionInfoMoveEvent(Address from, Address to) { } | 499 void SharedFunctionInfoMoveEvent(Address from, Address to) override {} |
517 virtual void CodeMovingGCEvent() { } | 500 void CodeMovingGCEvent() override {} |
518 | 501 |
519 private: | 502 private: |
520 class NameBuffer; | 503 class NameBuffer; |
521 | 504 |
522 virtual void LogRecordedBuffer(Code* code, | 505 virtual void LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo* shared, |
523 SharedFunctionInfo* shared, | 506 const char* name, int length) = 0; |
524 const char* name, | |
525 int length) = 0; | |
526 | 507 |
527 NameBuffer* name_buffer_; | 508 NameBuffer* name_buffer_; |
528 }; | 509 }; |
529 | 510 |
530 | 511 |
531 } // namespace internal | 512 } // namespace internal |
532 } // namespace v8 | 513 } // namespace v8 |
533 | 514 |
534 | 515 |
535 #endif // V8_LOG_H_ | 516 #endif // V8_LOG_H_ |
OLD | NEW |