| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 // Forward declarations. | 72 // Forward declarations. |
| 73 class HashMap; | 73 class HashMap; |
| 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 #undef LOG | 80 #undef LOG |
| 81 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 82 #define LOG(isolate, Call) \ | 81 #define LOG(isolate, Call) \ |
| 83 do { \ | 82 do { \ |
| 84 v8::internal::Logger* logger = \ | 83 v8::internal::Logger* logger = \ |
| 85 (isolate)->logger(); \ | 84 (isolate)->logger(); \ |
| 86 if (logger->is_logging()) \ | 85 if (logger->is_logging()) \ |
| 87 logger->Call; \ | 86 logger->Call; \ |
| 88 } while (false) | 87 } while (false) |
| 89 #else | |
| 90 #define LOG(isolate, Call) ((void) 0) | |
| 91 #endif | |
| 92 | 88 |
| 93 #define LOG_EVENTS_AND_TAGS_LIST(V) \ | 89 #define LOG_EVENTS_AND_TAGS_LIST(V) \ |
| 94 V(CODE_CREATION_EVENT, "code-creation") \ | 90 V(CODE_CREATION_EVENT, "code-creation") \ |
| 95 V(CODE_MOVE_EVENT, "code-move") \ | 91 V(CODE_MOVE_EVENT, "code-move") \ |
| 96 V(CODE_DELETE_EVENT, "code-delete") \ | 92 V(CODE_DELETE_EVENT, "code-delete") \ |
| 97 V(CODE_MOVING_GC, "code-moving-gc") \ | 93 V(CODE_MOVING_GC, "code-moving-gc") \ |
| 98 V(SHARED_FUNC_MOVE_EVENT, "sfi-move") \ | 94 V(SHARED_FUNC_MOVE_EVENT, "sfi-move") \ |
| 99 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos") \ | 95 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos") \ |
| 100 V(SNAPSHOT_CODE_NAME_EVENT, "snapshot-code-name") \ | 96 V(SNAPSHOT_CODE_NAME_EVENT, "snapshot-code-name") \ |
| 101 V(TICK_EVENT, "tick") \ | 97 V(TICK_EVENT, "tick") \ |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 uintptr_t end); | 261 uintptr_t end); |
| 266 | 262 |
| 267 // ==== Events logged by --log-regexp ==== | 263 // ==== Events logged by --log-regexp ==== |
| 268 // Regexp compilation and execution events. | 264 // Regexp compilation and execution events. |
| 269 | 265 |
| 270 void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache); | 266 void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache); |
| 271 | 267 |
| 272 // Log an event reported from generated code | 268 // Log an event reported from generated code |
| 273 void LogRuntime(Vector<const char> format, JSArray* args); | 269 void LogRuntime(Vector<const char> format, JSArray* args); |
| 274 | 270 |
| 275 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 276 bool is_logging() { | 271 bool is_logging() { |
| 277 return logging_nesting_ > 0; | 272 return logging_nesting_ > 0; |
| 278 } | 273 } |
| 279 | 274 |
| 280 // Pause/Resume collection of profiling data. | 275 // Pause/Resume collection of profiling data. |
| 281 // When data collection is paused, CPU Tick events are discarded until | 276 // When data collection is paused, CPU Tick events are discarded until |
| 282 // data collection is Resumed. | 277 // data collection is Resumed. |
| 283 void PauseProfiler(); | 278 void PauseProfiler(); |
| 284 void ResumeProfiler(); | 279 void ResumeProfiler(); |
| 285 bool IsProfilerPaused(); | 280 bool IsProfilerPaused(); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 Address last_address_; | 412 Address last_address_; |
| 418 // Logger::TickEvent(...) | 413 // Logger::TickEvent(...) |
| 419 Address prev_sp_; | 414 Address prev_sp_; |
| 420 Address prev_function_; | 415 Address prev_function_; |
| 421 // Logger::MoveEventInternal(...) | 416 // Logger::MoveEventInternal(...) |
| 422 Address prev_to_; | 417 Address prev_to_; |
| 423 // Logger::FunctionCreateEvent(...) | 418 // Logger::FunctionCreateEvent(...) |
| 424 Address prev_code_; | 419 Address prev_code_; |
| 425 | 420 |
| 426 friend class CpuProfiler; | 421 friend class CpuProfiler; |
| 427 #else | |
| 428 bool is_logging() { return false; } | |
| 429 #endif | |
| 430 }; | 422 }; |
| 431 | 423 |
| 432 | 424 |
| 433 // Process wide registry of samplers. | 425 // Process wide registry of samplers. |
| 434 class SamplerRegistry : public AllStatic { | 426 class SamplerRegistry : public AllStatic { |
| 435 public: | 427 public: |
| 436 enum State { | 428 enum State { |
| 437 HAS_NO_SAMPLERS, | 429 HAS_NO_SAMPLERS, |
| 438 HAS_SAMPLERS, | 430 HAS_SAMPLERS, |
| 439 HAS_CPU_PROFILING_SAMPLERS | 431 HAS_CPU_PROFILING_SAMPLERS |
| (...skipping 26 matching lines...) Expand all Loading... |
| 466 // Class that extracts stack trace, used for profiling. | 458 // Class that extracts stack trace, used for profiling. |
| 467 class StackTracer : public AllStatic { | 459 class StackTracer : public AllStatic { |
| 468 public: | 460 public: |
| 469 static void Trace(Isolate* isolate, TickSample* sample); | 461 static void Trace(Isolate* isolate, TickSample* sample); |
| 470 }; | 462 }; |
| 471 | 463 |
| 472 } } // namespace v8::internal | 464 } } // namespace v8::internal |
| 473 | 465 |
| 474 | 466 |
| 475 #endif // V8_LOG_H_ | 467 #endif // V8_LOG_H_ |
| OLD | NEW |