| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 SlidingStateWindow; | 77 class SlidingStateWindow; |
| 78 class Ticker; | 78 class Ticker; |
| 79 | 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 |
| 89 #define LOG_EVENTS_AND_TAGS_LIST(V) \ | 90 #define LOG_EVENTS_AND_TAGS_LIST(V) \ |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 265 |
| 265 // ==== Events logged by --log-regexp ==== | 266 // ==== Events logged by --log-regexp ==== |
| 266 // Regexp compilation and execution events. | 267 // Regexp compilation and execution events. |
| 267 | 268 |
| 268 void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache); | 269 void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache); |
| 269 | 270 |
| 270 // Log an event reported from generated code | 271 // Log an event reported from generated code |
| 271 void LogRuntime(Vector<const char> format, JSArray* args); | 272 void LogRuntime(Vector<const char> format, JSArray* args); |
| 272 | 273 |
| 273 bool is_logging() { | 274 bool is_logging() { |
| 274 return logging_nesting_ > 0; | 275 return logging_nesting_ > 0 || CodeAddressCallbackEnabled(); |
| 275 } | 276 } |
| 276 | 277 |
| 277 // Pause/Resume collection of profiling data. | 278 // Pause/Resume collection of profiling data. |
| 278 // When data collection is paused, CPU Tick events are discarded until | 279 // When data collection is paused, CPU Tick events are discarded until |
| 279 // data collection is Resumed. | 280 // data collection is Resumed. |
| 280 void PauseProfiler(); | 281 void PauseProfiler(); |
| 281 void ResumeProfiler(); | 282 void ResumeProfiler(); |
| 282 bool IsProfilerPaused(); | 283 bool IsProfilerPaused(); |
| 283 | 284 |
| 284 void LogExistingFunction(Handle<SharedFunctionInfo> shared, | 285 void LogExistingFunction(Handle<SharedFunctionInfo> shared, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 // Logs a StringEvent regardless of whether FLAG_log is true. | 365 // Logs a StringEvent regardless of whether FLAG_log is true. |
| 365 void UncheckedStringEvent(const char* name, const char* value); | 366 void UncheckedStringEvent(const char* name, const char* value); |
| 366 | 367 |
| 367 // Logs an IntEvent regardless of whether FLAG_log is true. | 368 // Logs an IntEvent regardless of whether FLAG_log is true. |
| 368 void UncheckedIntEvent(const char* name, int value); | 369 void UncheckedIntEvent(const char* name, int value); |
| 369 void UncheckedIntPtrTEvent(const char* name, intptr_t value); | 370 void UncheckedIntPtrTEvent(const char* name, intptr_t value); |
| 370 | 371 |
| 371 // Returns whether profiler's sampler is active. | 372 // Returns whether profiler's sampler is active. |
| 372 bool IsProfilerSamplerActive(); | 373 bool IsProfilerSamplerActive(); |
| 373 | 374 |
| 375 // Returns whether symbol callback is enabled. |
| 376 bool CodeAddressCallbackEnabled(); |
| 377 |
| 374 // The sampler used by the profiler and the sliding state window. | 378 // The sampler used by the profiler and the sliding state window. |
| 375 Ticker* ticker_; | 379 Ticker* ticker_; |
| 376 | 380 |
| 377 // When the statistical profile is active, profiler_ | 381 // When the statistical profile is active, profiler_ |
| 378 // points to a Profiler, that handles collection | 382 // points to a Profiler, that handles collection |
| 379 // of samples. | 383 // of samples. |
| 380 Profiler* profiler_; | 384 Profiler* profiler_; |
| 381 | 385 |
| 382 // SlidingStateWindow instance keeping a sliding window of the most | 386 // SlidingStateWindow instance keeping a sliding window of the most |
| 383 // recent VM states. | 387 // recent VM states. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 Address last_address_; | 422 Address last_address_; |
| 419 // Logger::TickEvent(...) | 423 // Logger::TickEvent(...) |
| 420 Address prev_sp_; | 424 Address prev_sp_; |
| 421 Address prev_function_; | 425 Address prev_function_; |
| 422 // Logger::MoveEventInternal(...) | 426 // Logger::MoveEventInternal(...) |
| 423 Address prev_to_; | 427 Address prev_to_; |
| 424 // Logger::FunctionCreateEvent(...) | 428 // Logger::FunctionCreateEvent(...) |
| 425 Address prev_code_; | 429 Address prev_code_; |
| 426 | 430 |
| 427 friend class CpuProfiler; | 431 friend class CpuProfiler; |
| 432 |
| 433 friend class CodeAddressNotification; |
| 434 |
| 435 int notified_reset_; |
| 428 }; | 436 }; |
| 429 | 437 |
| 430 | 438 |
| 439 class CodeAddressNotification { |
| 440 public: |
| 441 // called by host to set callbacks - null turns off callbacks |
| 442 static void SetCodeAddressEventCallback(CodeAddressEvent cb, |
| 443 bool enumExisting); |
| 444 |
| 445 // called by v8 when a symbol map is created or changed |
| 446 static void WriteSymbolMap(Logger* logger, |
| 447 CodeAddressOperation op, |
| 448 const void* addr1, |
| 449 int len, |
| 450 const char* symbol, |
| 451 Logger::LogEventsAndTags tag, |
| 452 const void* addr2, |
| 453 int line); |
| 454 |
| 455 // called by v8 to determine if callbacks are enabled |
| 456 static bool IsEnabled(); |
| 457 |
| 458 }; |
| 459 |
| 460 |
| 431 // Process wide registry of samplers. | 461 // Process wide registry of samplers. |
| 432 class SamplerRegistry : public AllStatic { | 462 class SamplerRegistry : public AllStatic { |
| 433 public: | 463 public: |
| 434 enum State { | 464 enum State { |
| 435 HAS_NO_SAMPLERS, | 465 HAS_NO_SAMPLERS, |
| 436 HAS_SAMPLERS, | 466 HAS_SAMPLERS, |
| 437 HAS_CPU_PROFILING_SAMPLERS | 467 HAS_CPU_PROFILING_SAMPLERS |
| 438 }; | 468 }; |
| 439 | 469 |
| 440 static void SetUp(); | 470 static void SetUp(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 465 // Class that extracts stack trace, used for profiling. | 495 // Class that extracts stack trace, used for profiling. |
| 466 class StackTracer : public AllStatic { | 496 class StackTracer : public AllStatic { |
| 467 public: | 497 public: |
| 468 static void Trace(Isolate* isolate, TickSample* sample); | 498 static void Trace(Isolate* isolate, TickSample* sample); |
| 469 }; | 499 }; |
| 470 | 500 |
| 471 } } // namespace v8::internal | 501 } } // namespace v8::internal |
| 472 | 502 |
| 473 | 503 |
| 474 #endif // V8_LOG_H_ | 504 #endif // V8_LOG_H_ |
| OLD | NEW |