Chromium Code Reviews| 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 Ticker; | 77 class Ticker; |
| 78 class Isolate; | 78 class Isolate; |
| 79 class JITCodeLineInfo; | |
| 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 150 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(JITCodeLineInfo* lineinfostruct, | |
| 252 int pc_offset, | |
| 253 int position, | |
| 254 bool is_statement); | |
| 255 // Emits a code line info start to record event | |
| 256 void CodeStartLinePosInfoRecordEvent(JITCodeLineInfo* lineinfo); | |
| 257 // Emits a code line info finish record event | |
|
danno
2012/12/20 16:27:20
Can you add comments about the memory management o
| |
| 258 void CodeEndLinePosInfoRecordEvent(Code* code, void* lineinfostruct); | |
| 249 | 259 |
| 250 void SharedFunctionInfoMoveEvent(Address from, Address to); | 260 void SharedFunctionInfoMoveEvent(Address from, Address to); |
| 251 | 261 |
| 252 void SnapshotPositionEvent(Address addr, int pos); | 262 void SnapshotPositionEvent(Address addr, int pos); |
| 253 | 263 |
| 254 // ==== Events logged by --log-gc. ==== | 264 // ==== Events logged by --log-gc. ==== |
| 255 // Heap sampling events: start, end, and individual types. | 265 // Heap sampling events: start, end, and individual types. |
| 256 void HeapSampleBeginEvent(const char* space, const char* kind); | 266 void HeapSampleBeginEvent(const char* space, const char* kind); |
| 257 void HeapSampleEndEvent(const char* space, const char* kind); | 267 void HeapSampleEndEvent(const char* space, const char* kind); |
| 258 void HeapSampleItemEvent(const char* type, int number, int bytes); | 268 void HeapSampleItemEvent(const char* type, int number, int bytes); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 void LogFailure(); | 361 void LogFailure(); |
| 352 | 362 |
| 353 private: | 363 private: |
| 354 class NameBuffer; | 364 class NameBuffer; |
| 355 class NameMap; | 365 class NameMap; |
| 356 | 366 |
| 357 Logger(); | 367 Logger(); |
| 358 ~Logger(); | 368 ~Logger(); |
| 359 | 369 |
| 360 // Issue code notifications. | 370 // Issue code notifications. |
| 361 void IssueCodeAddedEvent(Code* code, const char* name, size_t name_len); | 371 void IssueCodeAddedEvent(Code* code, |
| 372 Script* script, | |
| 373 const char* name, | |
| 374 size_t name_len); | |
| 362 void IssueCodeMovedEvent(Address from, Address to); | 375 void IssueCodeMovedEvent(Address from, Address to); |
| 363 void IssueCodeRemovedEvent(Address from); | 376 void IssueCodeRemovedEvent(Address from); |
| 364 | 377 void IssueAddCodeLinePosInfoEvent(JITCodeLineInfo* lineinfo, |
|
danno
2012/12/20 16:27:20
why not just line_info? Easier to read.
| |
| 378 int pc_offset, | |
| 379 int position, | |
| 380 bool is_statement); | |
| 381 void IssueStartCodePosInfoEvent(JITCodeLineInfo* lineinfo); | |
|
danno
2012/12/20 16:27:20
why not just line_info? Easier to read.
| |
| 382 void IssueEndCodePosInfoEvent(Code* code, void* lineinfostruct); | |
|
danno
2012/12/20 16:27:20
why not just line_info? Easier to read.
| |
| 365 // Emits the profiler's first message. | 383 // Emits the profiler's first message. |
| 366 void ProfilerBeginEvent(); | 384 void ProfilerBeginEvent(); |
| 367 | 385 |
| 368 // Emits callback event messages. | 386 // Emits callback event messages. |
| 369 void CallbackEventInternal(const char* prefix, | 387 void CallbackEventInternal(const char* prefix, |
| 370 const char* name, | 388 const char* name, |
| 371 Address entry_point); | 389 Address entry_point); |
| 372 | 390 |
| 373 // Internal configurable move event. | 391 // Internal configurable move event. |
| 374 void MoveEventInternal(LogEventsAndTags event, Address from, Address to); | 392 void MoveEventInternal(LogEventsAndTags event, Address from, Address to); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 505 private: | 523 private: |
| 506 static bool ActiveSamplersExist() { | 524 static bool ActiveSamplersExist() { |
| 507 return active_samplers_ != NULL && !active_samplers_->is_empty(); | 525 return active_samplers_ != NULL && !active_samplers_->is_empty(); |
| 508 } | 526 } |
| 509 | 527 |
| 510 static List<Sampler*>* active_samplers_; | 528 static List<Sampler*>* active_samplers_; |
| 511 | 529 |
| 512 DISALLOW_IMPLICIT_CONSTRUCTORS(SamplerRegistry); | 530 DISALLOW_IMPLICIT_CONSTRUCTORS(SamplerRegistry); |
| 513 }; | 531 }; |
| 514 | 532 |
| 533 // This class is used to record the JITted code position info for JIT | |
| 534 // code profiling. | |
| 535 class JITCodeLineInfo : public Malloced { | |
| 536 public: | |
| 537 JITCodeLineInfo() : line_num_info_(10) { } | |
| 515 | 538 |
| 539 void SetPosition(intptr_t pc, int pos, bool is_statement) { | |
| 540 AddCodeLineInfo(LineNumInfo(pc, pos, is_statement)); | |
| 541 } | |
| 542 | |
| 543 struct LineNumInfo { | |
| 544 LineNumInfo(intptr_t pc, int pos, bool is_statement) | |
| 545 : pc_(pc), pos_(pos), is_statement_(is_statement) { } | |
|
danno
2012/12/20 16:27:20
nit: whitespace formatting needs to be according t
| |
| 546 | |
| 547 intptr_t pc_; | |
| 548 int pos_; | |
| 549 bool is_statement_; | |
| 550 }; | |
| 551 | |
| 552 List<LineNumInfo>* line_numinfo() { | |
| 553 return &line_num_info_; | |
| 554 } | |
| 555 | |
| 556 private: | |
| 557 void AddCodeLineInfo(const LineNumInfo& line_info) { | |
| 558 line_num_info_.Add(line_info); | |
| 559 } | |
| 560 List<LineNumInfo> line_num_info_; | |
| 561 }; | |
| 516 // Class that extracts stack trace, used for profiling. | 562 // Class that extracts stack trace, used for profiling. |
| 517 class StackTracer : public AllStatic { | 563 class StackTracer : public AllStatic { |
| 518 public: | 564 public: |
| 519 static void Trace(Isolate* isolate, TickSample* sample); | 565 static void Trace(Isolate* isolate, TickSample* sample); |
| 520 }; | 566 }; |
| 521 | 567 |
| 522 } } // namespace v8::internal | 568 } } // namespace v8::internal |
| 523 | 569 |
| 524 | 570 |
| 525 #endif // V8_LOG_H_ | 571 #endif // V8_LOG_H_ |
| OLD | NEW |