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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) | 155 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) |
156 NUMBER_OF_LOG_EVENTS | 156 NUMBER_OF_LOG_EVENTS |
157 }; | 157 }; |
158 #undef DECLARE_ENUM | 158 #undef DECLARE_ENUM |
159 | 159 |
160 // Acquires resources for logging if the right flags are set. | 160 // Acquires resources for logging if the right flags are set. |
161 bool SetUp(); | 161 bool SetUp(); |
162 | 162 |
163 // Sets the current code event handler. | 163 // Sets the current code event handler. |
164 void SetCodeEventHandler(uint32_t options, | 164 void SetCodeEventHandler(uint32_t options, |
165 JitCodeEventHandler event_handler); | 165 JitCodeEventHandler event_handler, |
166 bool support_moved_code); | |
166 | 167 |
167 void EnsureTickerStarted(); | 168 void EnsureTickerStarted(); |
168 void EnsureTickerStopped(); | 169 void EnsureTickerStopped(); |
169 | 170 |
170 Sampler* sampler(); | 171 Sampler* sampler(); |
171 | 172 |
172 // Frees resources acquired in SetUp. | 173 // Frees resources acquired in SetUp. |
173 // When a temporary file is used for the log, returns its stream descriptor, | 174 // When a temporary file is used for the log, returns its stream descriptor, |
174 // leaving the file open. | 175 // leaving the file open. |
175 FILE* TearDown(); | 176 FILE* TearDown(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 SharedFunctionInfo* shared, | 240 SharedFunctionInfo* shared, |
240 String* source, int line); | 241 String* source, int line); |
241 void CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count); | 242 void CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count); |
242 void CodeMovingGCEvent(); | 243 void CodeMovingGCEvent(); |
243 // Emits a code create event for a RegExp. | 244 // Emits a code create event for a RegExp. |
244 void RegExpCodeCreateEvent(Code* code, String* source); | 245 void RegExpCodeCreateEvent(Code* code, String* source); |
245 // Emits a code move event. | 246 // Emits a code move event. |
246 void CodeMoveEvent(Address from, Address to); | 247 void CodeMoveEvent(Address from, Address to); |
247 // Emits a code delete event. | 248 // Emits a code delete event. |
248 void CodeDeleteEvent(Address from); | 249 void CodeDeleteEvent(Address from); |
250 // Emits a code line info add event. | |
251 void CodeLinePosInfoAddEvent(void* line_info, | |
252 int pc_offset, | |
253 int position, | |
254 JitCodeEvent::PositionType position_type); | |
danno
2013/02/01 13:43:10
It seems like passing types associated with JitCod
| |
255 // Emits a code line info start to record event | |
256 void* CodeStartLinePosInfoRecordEvent(); | |
257 // Emits a code line info finish record event. | |
258 // It's the callee's responsibility to dispose the parameter line_info data. | |
259 void CodeEndLinePosInfoRecordEvent(Code* code, void* line_info); | |
249 | 260 |
250 void SharedFunctionInfoMoveEvent(Address from, Address to); | 261 void SharedFunctionInfoMoveEvent(Address from, Address to); |
251 | 262 |
252 void SnapshotPositionEvent(Address addr, int pos); | 263 void SnapshotPositionEvent(Address addr, int pos); |
253 | 264 |
254 // ==== Events logged by --log-gc. ==== | 265 // ==== Events logged by --log-gc. ==== |
255 // Heap sampling events: start, end, and individual types. | 266 // Heap sampling events: start, end, and individual types. |
256 void HeapSampleBeginEvent(const char* space, const char* kind); | 267 void HeapSampleBeginEvent(const char* space, const char* kind); |
257 void HeapSampleEndEvent(const char* space, const char* kind); | 268 void HeapSampleEndEvent(const char* space, const char* kind); |
258 void HeapSampleItemEvent(const char* type, int number, int bytes); | 269 void HeapSampleItemEvent(const char* type, int number, int bytes); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
308 | 319 |
309 void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache); | 320 void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache); |
310 | 321 |
311 // Log an event reported from generated code | 322 // Log an event reported from generated code |
312 void LogRuntime(Vector<const char> format, JSArray* args); | 323 void LogRuntime(Vector<const char> format, JSArray* args); |
313 | 324 |
314 bool is_logging() { | 325 bool is_logging() { |
315 return logging_nesting_ > 0; | 326 return logging_nesting_ > 0; |
316 } | 327 } |
317 | 328 |
329 bool is_code_event_handler_enabled() { | |
330 return code_event_handler_ != NULL; | |
331 } | |
332 | |
333 bool is_moved_code_supported() { | |
334 if (is_code_event_handler_enabled()) { | |
335 return support_moved_code_; | |
336 } else { | |
337 return true; | |
338 } | |
339 } | |
340 | |
318 bool is_logging_code_events() { | 341 bool is_logging_code_events() { |
319 return is_logging() || code_event_handler_ != NULL; | 342 return is_logging() || code_event_handler_ != NULL; |
320 } | 343 } |
321 | 344 |
322 // Pause/Resume collection of profiling data. | 345 // Pause/Resume collection of profiling data. |
323 // When data collection is paused, CPU Tick events are discarded until | 346 // When data collection is paused, CPU Tick events are discarded until |
324 // data collection is Resumed. | 347 // data collection is Resumed. |
325 void PauseProfiler(); | 348 void PauseProfiler(); |
326 void ResumeProfiler(); | 349 void ResumeProfiler(); |
327 bool IsProfilerPaused(); | 350 bool IsProfilerPaused(); |
(...skipping 23 matching lines...) Expand all Loading... | |
351 void LogFailure(); | 374 void LogFailure(); |
352 | 375 |
353 private: | 376 private: |
354 class NameBuffer; | 377 class NameBuffer; |
355 class NameMap; | 378 class NameMap; |
356 | 379 |
357 Logger(); | 380 Logger(); |
358 ~Logger(); | 381 ~Logger(); |
359 | 382 |
360 // Issue code notifications. | 383 // Issue code notifications. |
361 void IssueCodeAddedEvent(Code* code, const char* name, size_t name_len); | 384 void IssueCodeAddedEvent(Code* code, |
385 Script* script, | |
386 const char* name, | |
387 size_t name_len); | |
362 void IssueCodeMovedEvent(Address from, Address to); | 388 void IssueCodeMovedEvent(Address from, Address to); |
363 void IssueCodeRemovedEvent(Address from); | 389 void IssueCodeRemovedEvent(Address from); |
364 | 390 void IssueAddCodeLinePosInfoEvent(void* line_info, |
391 int pc_offset, | |
392 int position, | |
393 JitCodeEvent::PositionType position_Type); | |
394 void* IssueStartCodePosInfoEvent(); | |
395 void IssueEndCodePosInfoEvent(Code* code, void* line_info); | |
365 // Emits the profiler's first message. | 396 // Emits the profiler's first message. |
366 void ProfilerBeginEvent(); | 397 void ProfilerBeginEvent(); |
367 | 398 |
368 // Emits callback event messages. | 399 // Emits callback event messages. |
369 void CallbackEventInternal(const char* prefix, | 400 void CallbackEventInternal(const char* prefix, |
370 const char* name, | 401 const char* name, |
371 Address entry_point); | 402 Address entry_point); |
372 | 403 |
373 // Internal configurable move event. | 404 // Internal configurable move event. |
374 void MoveEventInternal(LogEventsAndTags event, Address from, Address to); | 405 void MoveEventInternal(LogEventsAndTags event, Address from, Address to); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
454 | 485 |
455 NameMap* address_to_name_map_; | 486 NameMap* address_to_name_map_; |
456 | 487 |
457 // Guards against multiple calls to TearDown() that can happen in some tests. | 488 // Guards against multiple calls to TearDown() that can happen in some tests. |
458 // 'true' between SetUp() and TearDown(). | 489 // 'true' between SetUp() and TearDown(). |
459 bool is_initialized_; | 490 bool is_initialized_; |
460 | 491 |
461 // The code event handler - if any. | 492 // The code event handler - if any. |
462 JitCodeEventHandler code_event_handler_; | 493 JitCodeEventHandler code_event_handler_; |
463 | 494 |
495 // Whether the code move is supported when JitCodeEventHandler is set. | |
496 bool support_moved_code_; | |
497 | |
464 // Support for 'incremental addresses' in compressed logs: | 498 // Support for 'incremental addresses' in compressed logs: |
465 // LogMessageBuilder::AppendAddress(Address addr) | 499 // LogMessageBuilder::AppendAddress(Address addr) |
466 Address last_address_; | 500 Address last_address_; |
467 // Logger::TickEvent(...) | 501 // Logger::TickEvent(...) |
468 Address prev_sp_; | 502 Address prev_sp_; |
469 Address prev_function_; | 503 Address prev_function_; |
470 // Logger::MoveEventInternal(...) | 504 // Logger::MoveEventInternal(...) |
471 Address prev_to_; | 505 Address prev_to_; |
472 // Logger::FunctionCreateEvent(...) | 506 // Logger::FunctionCreateEvent(...) |
473 Address prev_code_; | 507 Address prev_code_; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
516 // Class that extracts stack trace, used for profiling. | 550 // Class that extracts stack trace, used for profiling. |
517 class StackTracer : public AllStatic { | 551 class StackTracer : public AllStatic { |
518 public: | 552 public: |
519 static void Trace(Isolate* isolate, TickSample* sample); | 553 static void Trace(Isolate* isolate, TickSample* sample); |
520 }; | 554 }; |
521 | 555 |
522 } } // namespace v8::internal | 556 } } // namespace v8::internal |
523 | 557 |
524 | 558 |
525 #endif // V8_LOG_H_ | 559 #endif // V8_LOG_H_ |
OLD | NEW |