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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // --prof | 69 // --prof |
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 class Isolate; |
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 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 void SharedLibraryEvent(const char* library_path, | 272 void SharedLibraryEvent(const char* library_path, |
272 uintptr_t start, | 273 uintptr_t start, |
273 uintptr_t end); | 274 uintptr_t end); |
274 void SharedLibraryEvent(const wchar_t* library_path, | 275 void SharedLibraryEvent(const wchar_t* library_path, |
275 uintptr_t start, | 276 uintptr_t start, |
276 uintptr_t end); | 277 uintptr_t end); |
277 void TimerEvent(const char* name, int64_t start, int64_t end); | 278 void TimerEvent(const char* name, int64_t start, int64_t end); |
278 | 279 |
279 class TimerEventScope { | 280 class TimerEventScope { |
280 public: | 281 public: |
281 TimerEventScope(Logger* logger, const char* name) | 282 TimerEventScope(Isolate* isolate, const char* name) |
282 : logger_(logger), name_(name), start_(0) { | 283 : isolate_(isolate), name_(name), start_(0) { |
283 if (FLAG_log_timer_events) start_ = OS::Ticks(); | 284 if (FLAG_log_timer_events) start_ = OS::Ticks(); |
284 } | 285 } |
285 | 286 |
286 ~TimerEventScope() { | 287 ~TimerEventScope() { |
287 if (FLAG_log_timer_events) { | 288 if (FLAG_log_timer_events) LogTimerEvent(); |
288 logger_->TimerEvent(name_, start_, OS::Ticks()); | |
289 } | |
290 } | 289 } |
291 | 290 |
| 291 void LogTimerEvent(); |
| 292 |
292 static const char* v8_recompile_synchronous; | 293 static const char* v8_recompile_synchronous; |
293 static const char* v8_recompile_parallel; | 294 static const char* v8_recompile_parallel; |
294 static const char* v8_compile_full_code; | 295 static const char* v8_compile_full_code; |
295 static const char* v8_execute; | 296 static const char* v8_execute; |
296 | 297 |
297 private: | 298 private: |
298 Logger* logger_; | 299 Isolate* isolate_; |
299 const char* name_; | 300 const char* name_; |
300 int64_t start_; | 301 int64_t start_; |
301 }; | 302 }; |
302 | 303 |
303 // ==== Events logged by --log-regexp ==== | 304 // ==== Events logged by --log-regexp ==== |
304 // Regexp compilation and execution events. | 305 // Regexp compilation and execution events. |
305 | 306 |
306 void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache); | 307 void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache); |
307 | 308 |
308 // Log an event reported from generated code | 309 // Log an event reported from generated code |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 // Class that extracts stack trace, used for profiling. | 518 // Class that extracts stack trace, used for profiling. |
518 class StackTracer : public AllStatic { | 519 class StackTracer : public AllStatic { |
519 public: | 520 public: |
520 static void Trace(Isolate* isolate, TickSample* sample); | 521 static void Trace(Isolate* isolate, TickSample* sample); |
521 }; | 522 }; |
522 | 523 |
523 } } // namespace v8::internal | 524 } } // namespace v8::internal |
524 | 525 |
525 | 526 |
526 #endif // V8_LOG_H_ | 527 #endif // V8_LOG_H_ |
OLD | NEW |