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