OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_LOG_H_ | 5 #ifndef V8_LOG_H_ |
6 #define V8_LOG_H_ | 6 #define V8_LOG_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // | 59 // |
60 // --prof | 60 // --prof |
61 // Collect statistical profiling information (ticks), default is off. The | 61 // Collect statistical profiling information (ticks), default is off. The |
62 // tick profiler requires code events, so --prof implies --log-code. | 62 // tick profiler requires code events, so --prof implies --log-code. |
63 | 63 |
64 // Forward declarations. | 64 // Forward declarations. |
65 class CodeEventListener; | 65 class CodeEventListener; |
66 class CpuProfiler; | 66 class CpuProfiler; |
67 class Isolate; | 67 class Isolate; |
68 class Log; | 68 class Log; |
69 class PositionsRecorder; | |
70 class Profiler; | 69 class Profiler; |
71 class Ticker; | 70 class Ticker; |
72 struct TickSample; | 71 struct TickSample; |
73 class RuntimeCallTimer; | 72 class RuntimeCallTimer; |
74 | 73 |
75 #undef LOG | 74 #undef LOG |
76 #define LOG(isolate, Call) \ | 75 #define LOG(isolate, Call) \ |
77 do { \ | 76 do { \ |
78 v8::internal::Logger* logger = (isolate)->logger(); \ | 77 v8::internal::Logger* logger = (isolate)->logger(); \ |
79 if (logger->is_logging()) logger->Call; \ | 78 if (logger->is_logging()) logger->Call; \ |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 void CodeMoveEvent(AbstractCode* from, Address to); | 185 void CodeMoveEvent(AbstractCode* from, Address to); |
187 // Emits a code line info add event with Postion type. | 186 // Emits a code line info add event with Postion type. |
188 void CodeLinePosInfoAddPositionEvent(void* jit_handler_data, | 187 void CodeLinePosInfoAddPositionEvent(void* jit_handler_data, |
189 int pc_offset, | 188 int pc_offset, |
190 int position); | 189 int position); |
191 // Emits a code line info add event with StatementPostion type. | 190 // Emits a code line info add event with StatementPostion type. |
192 void CodeLinePosInfoAddStatementPositionEvent(void* jit_handler_data, | 191 void CodeLinePosInfoAddStatementPositionEvent(void* jit_handler_data, |
193 int pc_offset, | 192 int pc_offset, |
194 int position); | 193 int position); |
195 // Emits a code line info start to record event | 194 // Emits a code line info start to record event |
196 void CodeStartLinePosInfoRecordEvent(PositionsRecorder* pos_recorder); | 195 void CodeStartLinePosInfoRecordEvent(void** jit_handler_data_out); |
197 // Emits a code line info finish record event. | 196 // Emits a code line info finish record event. |
198 // It's the callee's responsibility to dispose the parameter jit_handler_data. | 197 // It's the callee's responsibility to dispose the parameter jit_handler_data. |
199 void CodeEndLinePosInfoRecordEvent(AbstractCode* code, | 198 void CodeEndLinePosInfoRecordEvent(AbstractCode* code, |
200 void* jit_handler_data); | 199 void* jit_handler_data); |
201 | 200 |
202 void SharedFunctionInfoMoveEvent(Address from, Address to); | 201 void SharedFunctionInfoMoveEvent(Address from, Address to); |
203 | 202 |
204 void CodeNameEvent(Address addr, int pos, const char* code_name); | 203 void CodeNameEvent(Address addr, int pos, const char* code_name); |
205 | 204 |
206 void CodeDeoptEvent(Code* code, Address pc, int fp_to_sp_delta); | 205 void CodeDeoptEvent(Code* code, Address pc, int fp_to_sp_delta); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 std::unique_ptr<ProfilerListener> profiler_listener_; | 343 std::unique_ptr<ProfilerListener> profiler_listener_; |
345 List<CodeEventListener*> listeners_; | 344 List<CodeEventListener*> listeners_; |
346 | 345 |
347 // Guards against multiple calls to TearDown() that can happen in some tests. | 346 // Guards against multiple calls to TearDown() that can happen in some tests. |
348 // 'true' between SetUp() and TearDown(). | 347 // 'true' between SetUp() and TearDown(). |
349 bool is_initialized_; | 348 bool is_initialized_; |
350 | 349 |
351 base::ElapsedTimer timer_; | 350 base::ElapsedTimer timer_; |
352 | 351 |
353 friend class CpuProfiler; | 352 friend class CpuProfiler; |
| 353 friend class SourcePositionTableBuilder; |
354 }; | 354 }; |
355 | 355 |
356 #define TIMER_EVENTS_LIST(V) \ | 356 #define TIMER_EVENTS_LIST(V) \ |
357 V(RecompileSynchronous, true) \ | 357 V(RecompileSynchronous, true) \ |
358 V(RecompileConcurrent, true) \ | 358 V(RecompileConcurrent, true) \ |
359 V(CompileIgnition, true) \ | 359 V(CompileIgnition, true) \ |
360 V(CompileFullCode, true) \ | 360 V(CompileFullCode, true) \ |
361 V(OptimizeCode, true) \ | 361 V(OptimizeCode, true) \ |
362 V(CompileCode, true) \ | 362 V(CompileCode, true) \ |
363 V(DeoptimizeCode, true) \ | 363 V(DeoptimizeCode, true) \ |
(...skipping 19 matching lines...) Expand all Loading... |
383 } | 383 } |
384 | 384 |
385 ~TimerEventScope() { LogTimerEvent(Logger::END); } | 385 ~TimerEventScope() { LogTimerEvent(Logger::END); } |
386 | 386 |
387 void LogTimerEvent(Logger::StartEnd se); | 387 void LogTimerEvent(Logger::StartEnd se); |
388 | 388 |
389 private: | 389 private: |
390 Isolate* isolate_; | 390 Isolate* isolate_; |
391 }; | 391 }; |
392 | 392 |
393 class PositionsRecorder BASE_EMBEDDED { | |
394 public: | |
395 PositionsRecorder() { jit_handler_data_ = NULL; } | |
396 | |
397 void AttachJITHandlerData(void* user_data) { jit_handler_data_ = user_data; } | |
398 | |
399 void* DetachJITHandlerData() { | |
400 void* old_data = jit_handler_data_; | |
401 jit_handler_data_ = NULL; | |
402 return old_data; | |
403 } | |
404 | |
405 protected: | |
406 // Currently jit_handler_data_ is used to store JITHandler-specific data | |
407 // over the lifetime of a PositionsRecorder | |
408 void* jit_handler_data_; | |
409 | |
410 private: | |
411 DISALLOW_COPY_AND_ASSIGN(PositionsRecorder); | |
412 }; | |
413 | |
414 class CodeEventLogger : public CodeEventListener { | 393 class CodeEventLogger : public CodeEventListener { |
415 public: | 394 public: |
416 CodeEventLogger(); | 395 CodeEventLogger(); |
417 ~CodeEventLogger() override; | 396 ~CodeEventLogger() override; |
418 | 397 |
419 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, | 398 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
420 const char* comment) override; | 399 const char* comment) override; |
421 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, | 400 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
422 Name* name) override; | 401 Name* name) override; |
423 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, | 402 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
(...skipping 20 matching lines...) Expand all Loading... |
444 | 423 |
445 NameBuffer* name_buffer_; | 424 NameBuffer* name_buffer_; |
446 }; | 425 }; |
447 | 426 |
448 | 427 |
449 } // namespace internal | 428 } // namespace internal |
450 } // namespace v8 | 429 } // namespace v8 |
451 | 430 |
452 | 431 |
453 #endif // V8_LOG_H_ | 432 #endif // V8_LOG_H_ |
OLD | NEW |