| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 V(STORE_IC_TAG, "StoreIC") \ | 144 V(STORE_IC_TAG, "StoreIC") \ |
| 145 V(STORE_POLYMORPHIC_IC_TAG, "StorePolymorphicIC") \ | 145 V(STORE_POLYMORPHIC_IC_TAG, "StorePolymorphicIC") \ |
| 146 V(STUB_TAG, "Stub") \ | 146 V(STUB_TAG, "Stub") \ |
| 147 V(NATIVE_FUNCTION_TAG, "Function") \ | 147 V(NATIVE_FUNCTION_TAG, "Function") \ |
| 148 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \ | 148 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \ |
| 149 V(NATIVE_SCRIPT_TAG, "Script") | 149 V(NATIVE_SCRIPT_TAG, "Script") |
| 150 // Note that 'NATIVE_' cases for functions and scripts are mapped onto | 150 // Note that 'NATIVE_' cases for functions and scripts are mapped onto |
| 151 // original tags when writing to the log. | 151 // original tags when writing to the log. |
| 152 | 152 |
| 153 | 153 |
| 154 class JitLogger; |
| 154 class LowLevelLogger; | 155 class LowLevelLogger; |
| 155 class Sampler; | 156 class Sampler; |
| 156 | 157 |
| 157 | 158 |
| 158 class Logger { | 159 class Logger { |
| 159 public: | 160 public: |
| 160 #define DECLARE_ENUM(enum_item, ignore) enum_item, | 161 #define DECLARE_ENUM(enum_item, ignore) enum_item, |
| 161 enum LogEventsAndTags { | 162 enum LogEventsAndTags { |
| 162 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) | 163 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) |
| 163 NUMBER_OF_LOG_EVENTS | 164 NUMBER_OF_LOG_EVENTS |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 | 331 |
| 331 void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache); | 332 void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache); |
| 332 | 333 |
| 333 // Log an event reported from generated code | 334 // Log an event reported from generated code |
| 334 void LogRuntime(Vector<const char> format, JSArray* args); | 335 void LogRuntime(Vector<const char> format, JSArray* args); |
| 335 | 336 |
| 336 bool is_logging() { | 337 bool is_logging() { |
| 337 return logging_nesting_ > 0; | 338 return logging_nesting_ > 0; |
| 338 } | 339 } |
| 339 | 340 |
| 340 bool is_code_event_handler_enabled() { | |
| 341 return code_event_handler_ != NULL; | |
| 342 } | |
| 343 | |
| 344 bool is_logging_code_events() { | 341 bool is_logging_code_events() { |
| 345 return is_logging() || code_event_handler_ != NULL; | 342 return is_logging() || jit_logger_ != NULL; |
| 346 } | 343 } |
| 347 | 344 |
| 348 // Pause/Resume collection of profiling data. | 345 // Pause/Resume collection of profiling data. |
| 349 // When data collection is paused, CPU Tick events are discarded until | 346 // When data collection is paused, CPU Tick events are discarded until |
| 350 // data collection is Resumed. | 347 // data collection is Resumed. |
| 351 void PauseProfiler(); | 348 void PauseProfiler(); |
| 352 void ResumeProfiler(); | 349 void ResumeProfiler(); |
| 353 bool IsProfilerPaused(); | 350 bool IsProfilerPaused(); |
| 354 | 351 |
| 355 void LogExistingFunction(Handle<SharedFunctionInfo> shared, | 352 void LogExistingFunction(Handle<SharedFunctionInfo> shared, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 376 // Callback from Log, stops profiling in case of insufficient resources. | 373 // Callback from Log, stops profiling in case of insufficient resources. |
| 377 void LogFailure(); | 374 void LogFailure(); |
| 378 | 375 |
| 379 private: | 376 private: |
| 380 class NameBuffer; | 377 class NameBuffer; |
| 381 class NameMap; | 378 class NameMap; |
| 382 | 379 |
| 383 explicit Logger(Isolate* isolate); | 380 explicit Logger(Isolate* isolate); |
| 384 ~Logger(); | 381 ~Logger(); |
| 385 | 382 |
| 386 // Issue code notifications. | |
| 387 void IssueCodeAddedEvent(Code* code, | |
| 388 Script* script, | |
| 389 const char* name, | |
| 390 size_t name_len); | |
| 391 void IssueCodeMovedEvent(Address from, Address to); | |
| 392 void IssueCodeRemovedEvent(Address from); | |
| 393 void IssueAddCodeLinePosInfoEvent(void* jit_handler_data, | |
| 394 int pc_offset, | |
| 395 int position, | |
| 396 JitCodeEvent::PositionType position_Type); | |
| 397 void* IssueStartCodePosInfoEvent(); | |
| 398 void IssueEndCodePosInfoEvent(Code* code, void* jit_handler_data); | |
| 399 // Emits the profiler's first message. | 383 // Emits the profiler's first message. |
| 400 void ProfilerBeginEvent(); | 384 void ProfilerBeginEvent(); |
| 401 | 385 |
| 402 // Emits callback event messages. | 386 // Emits callback event messages. |
| 403 void CallbackEventInternal(const char* prefix, | 387 void CallbackEventInternal(const char* prefix, |
| 404 Name* name, | 388 Name* name, |
| 405 Address entry_point); | 389 Address entry_point); |
| 406 | 390 |
| 407 // Internal configurable move event. | 391 // Internal configurable move event. |
| 408 void MoveEventInternal(LogEventsAndTags event, Address from, Address to); | 392 void MoveEventInternal(LogEventsAndTags event, Address from, Address to); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 template <StateTag Tag> friend class VMState; | 452 template <StateTag Tag> friend class VMState; |
| 469 | 453 |
| 470 friend class LoggerTestHelper; | 454 friend class LoggerTestHelper; |
| 471 | 455 |
| 472 | 456 |
| 473 int logging_nesting_; | 457 int logging_nesting_; |
| 474 int cpu_profiler_nesting_; | 458 int cpu_profiler_nesting_; |
| 475 | 459 |
| 476 Log* log_; | 460 Log* log_; |
| 477 LowLevelLogger* ll_logger_; | 461 LowLevelLogger* ll_logger_; |
| 462 JitLogger* jit_logger_; |
| 478 | 463 |
| 479 NameBuffer* name_buffer_; | 464 NameBuffer* name_buffer_; |
| 480 | 465 |
| 481 NameMap* address_to_name_map_; | 466 NameMap* address_to_name_map_; |
| 482 | 467 |
| 483 // Guards against multiple calls to TearDown() that can happen in some tests. | 468 // Guards against multiple calls to TearDown() that can happen in some tests. |
| 484 // 'true' between SetUp() and TearDown(). | 469 // 'true' between SetUp() and TearDown(). |
| 485 bool is_initialized_; | 470 bool is_initialized_; |
| 486 | 471 |
| 487 // The code event handler - if any. | |
| 488 JitCodeEventHandler code_event_handler_; | |
| 489 | |
| 490 // Support for 'incremental addresses' in compressed logs: | 472 // Support for 'incremental addresses' in compressed logs: |
| 491 // LogMessageBuilder::AppendAddress(Address addr) | 473 // LogMessageBuilder::AppendAddress(Address addr) |
| 492 Address last_address_; | 474 Address last_address_; |
| 493 // Logger::TickEvent(...) | 475 // Logger::TickEvent(...) |
| 494 Address prev_sp_; | 476 Address prev_sp_; |
| 495 Address prev_function_; | 477 Address prev_function_; |
| 496 // Logger::MoveEventInternal(...) | 478 // Logger::MoveEventInternal(...) |
| 497 Address prev_to_; | 479 Address prev_to_; |
| 498 // Logger::FunctionCreateEvent(...) | 480 // Logger::FunctionCreateEvent(...) |
| 499 Address prev_code_; | 481 Address prev_code_; |
| 500 | 482 |
| 501 int64_t epoch_; | 483 int64_t epoch_; |
| 502 | 484 |
| 503 friend class CpuProfiler; | 485 friend class CpuProfiler; |
| 504 }; | 486 }; |
| 505 | 487 |
| 506 | 488 |
| 507 } } // namespace v8::internal | 489 } } // namespace v8::internal |
| 508 | 490 |
| 509 | 491 |
| 510 #endif // V8_LOG_H_ | 492 #endif // V8_LOG_H_ |
| OLD | NEW |