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" |
11 #include "src/base/compiler-specific.h" | 11 #include "src/base/compiler-specific.h" |
12 #include "src/base/platform/elapsed-timer.h" | 12 #include "src/base/platform/elapsed-timer.h" |
13 #include "src/base/platform/platform.h" | 13 #include "src/base/platform/platform.h" |
| 14 #include "src/code-events.h" |
| 15 #include "src/isolate.h" |
14 #include "src/objects.h" | 16 #include "src/objects.h" |
15 | 17 |
16 namespace v8 { | 18 namespace v8 { |
17 | 19 |
18 namespace base { | 20 namespace base { |
19 class Semaphore; | 21 class Semaphore; |
20 } | 22 } |
21 | 23 |
22 namespace sampler { | 24 namespace sampler { |
23 class Sampler; | 25 class Sampler; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 class CpuProfiler; | 66 class CpuProfiler; |
65 class Isolate; | 67 class Isolate; |
66 class Log; | 68 class Log; |
67 class PositionsRecorder; | 69 class PositionsRecorder; |
68 class Profiler; | 70 class Profiler; |
69 class Ticker; | 71 class Ticker; |
70 struct TickSample; | 72 struct TickSample; |
71 class RuntimeCallTimer; | 73 class RuntimeCallTimer; |
72 | 74 |
73 #undef LOG | 75 #undef LOG |
74 #define LOG(isolate, Call) \ | 76 #define LOG(isolate, Call) \ |
75 do { \ | 77 do { \ |
76 v8::internal::Logger* logger = \ | 78 v8::internal::Logger* logger = (isolate)->logger(); \ |
77 (isolate)->logger(); \ | 79 if (logger->is_logging()) logger->Call; \ |
78 if (logger->is_logging()) \ | |
79 logger->Call; \ | |
80 } while (false) | 80 } while (false) |
81 | 81 |
82 #define LOG_CODE_EVENT(isolate, Call) \ | 82 #define LOG_CODE_EVENT(isolate, Call) \ |
83 do { \ | 83 do { \ |
84 v8::internal::Logger* logger = \ | 84 v8::internal::Logger* logger = (isolate)->logger(); \ |
85 (isolate)->logger(); \ | 85 if (logger->is_logging_code_events()) logger->Call; \ |
86 if (logger->is_logging_code_events()) \ | |
87 logger->Call; \ | |
88 } while (false) | 86 } while (false) |
89 | 87 |
90 #define LOG_EVENTS_AND_TAGS_LIST(V) \ | |
91 V(CODE_CREATION_EVENT, "code-creation") \ | |
92 V(CODE_DISABLE_OPT_EVENT, "code-disable-optimization") \ | |
93 V(CODE_MOVE_EVENT, "code-move") \ | |
94 V(CODE_DELETE_EVENT, "code-delete") \ | |
95 V(CODE_MOVING_GC, "code-moving-gc") \ | |
96 V(SHARED_FUNC_MOVE_EVENT, "sfi-move") \ | |
97 V(SNAPSHOT_CODE_NAME_EVENT, "snapshot-code-name") \ | |
98 V(TICK_EVENT, "tick") \ | |
99 V(REPEAT_META_EVENT, "repeat") \ | |
100 V(BUILTIN_TAG, "Builtin") \ | |
101 V(CALL_DEBUG_BREAK_TAG, "CallDebugBreak") \ | |
102 V(CALL_DEBUG_PREPARE_STEP_IN_TAG, "CallDebugPrepareStepIn") \ | |
103 V(CALL_INITIALIZE_TAG, "CallInitialize") \ | |
104 V(CALL_MEGAMORPHIC_TAG, "CallMegamorphic") \ | |
105 V(CALL_MISS_TAG, "CallMiss") \ | |
106 V(CALL_NORMAL_TAG, "CallNormal") \ | |
107 V(LOAD_INITIALIZE_TAG, "LoadInitialize") \ | |
108 V(LOAD_MEGAMORPHIC_TAG, "LoadMegamorphic") \ | |
109 V(STORE_INITIALIZE_TAG, "StoreInitialize") \ | |
110 V(STORE_GENERIC_TAG, "StoreGeneric") \ | |
111 V(STORE_MEGAMORPHIC_TAG, "StoreMegamorphic") \ | |
112 V(KEYED_CALL_DEBUG_BREAK_TAG, "KeyedCallDebugBreak") \ | |
113 V(KEYED_CALL_DEBUG_PREPARE_STEP_IN_TAG, "KeyedCallDebugPrepareStepIn") \ | |
114 V(KEYED_CALL_INITIALIZE_TAG, "KeyedCallInitialize") \ | |
115 V(KEYED_CALL_MEGAMORPHIC_TAG, "KeyedCallMegamorphic") \ | |
116 V(KEYED_CALL_MISS_TAG, "KeyedCallMiss") \ | |
117 V(KEYED_CALL_NORMAL_TAG, "KeyedCallNormal") \ | |
118 V(CALLBACK_TAG, "Callback") \ | |
119 V(EVAL_TAG, "Eval") \ | |
120 V(FUNCTION_TAG, "Function") \ | |
121 V(HANDLER_TAG, "Handler") \ | |
122 V(BYTECODE_HANDLER_TAG, "BytecodeHandler") \ | |
123 V(KEYED_LOAD_IC_TAG, "KeyedLoadIC") \ | |
124 V(KEYED_LOAD_POLYMORPHIC_IC_TAG, "KeyedLoadPolymorphicIC") \ | |
125 V(KEYED_EXTERNAL_ARRAY_LOAD_IC_TAG, "KeyedExternalArrayLoadIC") \ | |
126 V(KEYED_STORE_IC_TAG, "KeyedStoreIC") \ | |
127 V(KEYED_STORE_POLYMORPHIC_IC_TAG, "KeyedStorePolymorphicIC") \ | |
128 V(KEYED_EXTERNAL_ARRAY_STORE_IC_TAG, "KeyedExternalArrayStoreIC") \ | |
129 V(LAZY_COMPILE_TAG, "LazyCompile") \ | |
130 V(CALL_IC_TAG, "CallIC") \ | |
131 V(LOAD_IC_TAG, "LoadIC") \ | |
132 V(LOAD_POLYMORPHIC_IC_TAG, "LoadPolymorphicIC") \ | |
133 V(REG_EXP_TAG, "RegExp") \ | |
134 V(SCRIPT_TAG, "Script") \ | |
135 V(STORE_IC_TAG, "StoreIC") \ | |
136 V(STORE_POLYMORPHIC_IC_TAG, "StorePolymorphicIC") \ | |
137 V(STUB_TAG, "Stub") \ | |
138 V(NATIVE_FUNCTION_TAG, "Function") \ | |
139 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \ | |
140 V(NATIVE_SCRIPT_TAG, "Script") | |
141 // Note that 'NATIVE_' cases for functions and scripts are mapped onto | |
142 // original tags when writing to the log. | |
143 | |
144 | |
145 class JitLogger; | 88 class JitLogger; |
146 class PerfBasicLogger; | 89 class PerfBasicLogger; |
147 class LowLevelLogger; | 90 class LowLevelLogger; |
148 class PerfJitLogger; | 91 class PerfJitLogger; |
149 | 92 |
150 class Logger { | 93 class Logger : public CodeEventListener { |
151 public: | 94 public: |
152 enum StartEnd { START = 0, END = 1 }; | 95 enum StartEnd { START = 0, END = 1 }; |
153 | 96 |
154 #define DECLARE_ENUM(enum_item, ignore) enum_item, | |
155 enum LogEventsAndTags { | |
156 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) | |
157 NUMBER_OF_LOG_EVENTS | |
158 }; | |
159 #undef DECLARE_ENUM | |
160 | |
161 // Acquires resources for logging if the right flags are set. | 97 // Acquires resources for logging if the right flags are set. |
162 bool SetUp(Isolate* isolate); | 98 bool SetUp(Isolate* isolate); |
163 | 99 |
164 // Sets the current code event handler. | 100 // Sets the current code event handler. |
165 void SetCodeEventHandler(uint32_t options, | 101 void SetCodeEventHandler(uint32_t options, |
166 JitCodeEventHandler event_handler); | 102 JitCodeEventHandler event_handler); |
167 | 103 |
168 sampler::Sampler* sampler(); | 104 sampler::Sampler* sampler(); |
169 | 105 |
170 // Frees resources acquired in SetUp. | 106 // Frees resources acquired in SetUp. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 140 |
205 // ==== Events logged by --log-api. ==== | 141 // ==== Events logged by --log-api. ==== |
206 void ApiSecurityCheck(); | 142 void ApiSecurityCheck(); |
207 void ApiNamedPropertyAccess(const char* tag, JSObject* holder, Object* name); | 143 void ApiNamedPropertyAccess(const char* tag, JSObject* holder, Object* name); |
208 void ApiIndexedPropertyAccess(const char* tag, | 144 void ApiIndexedPropertyAccess(const char* tag, |
209 JSObject* holder, | 145 JSObject* holder, |
210 uint32_t index); | 146 uint32_t index); |
211 void ApiObjectAccess(const char* tag, JSObject* obj); | 147 void ApiObjectAccess(const char* tag, JSObject* obj); |
212 void ApiEntryCall(const char* name); | 148 void ApiEntryCall(const char* name); |
213 | 149 |
214 | |
215 // ==== Events logged by --log-code. ==== | 150 // ==== Events logged by --log-code. ==== |
216 void addCodeEventListener(CodeEventListener* listener); | 151 void addCodeEventListener(CodeEventListener* listener); |
217 void removeCodeEventListener(CodeEventListener* listener); | 152 void removeCodeEventListener(CodeEventListener* listener); |
218 bool hasCodeEventListener(CodeEventListener* listener); | |
219 | |
220 | 153 |
221 // Emits a code event for a callback function. | 154 // Emits a code event for a callback function. |
222 void CallbackEvent(Name* name, Address entry_point); | 155 void CallbackEvent(Name* name, Address entry_point); |
223 void GetterCallbackEvent(Name* name, Address entry_point); | 156 void GetterCallbackEvent(Name* name, Address entry_point); |
224 void SetterCallbackEvent(Name* name, Address entry_point); | 157 void SetterCallbackEvent(Name* name, Address entry_point); |
225 // Emits a code create event. | 158 // Emits a code create event. |
226 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, | 159 void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, |
227 const char* source); | 160 AbstractCode* code, const char* source); |
228 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, Name* name); | 161 void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, |
229 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, | 162 AbstractCode* code, Name* name); |
230 SharedFunctionInfo* shared, Name* name); | 163 void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, |
231 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, | 164 AbstractCode* code, SharedFunctionInfo* shared, |
232 SharedFunctionInfo* shared, Name* source, int line, | 165 Name* name); |
233 int column); | 166 void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, |
234 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, | 167 AbstractCode* code, SharedFunctionInfo* shared, |
235 int args_count); | 168 Name* source, int line, int column); |
| 169 void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, |
| 170 AbstractCode* code, int args_count); |
236 // Emits a code deoptimization event. | 171 // Emits a code deoptimization event. |
237 void CodeDisableOptEvent(AbstractCode* code, SharedFunctionInfo* shared); | 172 void CodeDisableOptEvent(AbstractCode* code, SharedFunctionInfo* shared); |
238 void CodeMovingGCEvent(); | 173 void CodeMovingGCEvent(); |
239 // Emits a code create event for a RegExp. | 174 // Emits a code create event for a RegExp. |
240 void RegExpCodeCreateEvent(AbstractCode* code, String* source); | 175 void RegExpCodeCreateEvent(AbstractCode* code, String* source); |
241 // Emits a code move event. | 176 // Emits a code move event. |
242 void CodeMoveEvent(AbstractCode* from, Address to); | 177 void CodeMoveEvent(AbstractCode* from, Address to); |
243 // Emits a code line info add event with Postion type. | 178 // Emits a code line info add event with Postion type. |
244 void CodeLinePosInfoAddPositionEvent(void* jit_handler_data, | 179 void CodeLinePosInfoAddPositionEvent(void* jit_handler_data, |
245 int pc_offset, | 180 int pc_offset, |
246 int position); | 181 int position); |
247 // Emits a code line info add event with StatementPostion type. | 182 // Emits a code line info add event with StatementPostion type. |
248 void CodeLinePosInfoAddStatementPositionEvent(void* jit_handler_data, | 183 void CodeLinePosInfoAddStatementPositionEvent(void* jit_handler_data, |
249 int pc_offset, | 184 int pc_offset, |
250 int position); | 185 int position); |
251 // Emits a code line info start to record event | 186 // Emits a code line info start to record event |
252 void CodeStartLinePosInfoRecordEvent(PositionsRecorder* pos_recorder); | 187 void CodeStartLinePosInfoRecordEvent(PositionsRecorder* pos_recorder); |
253 // Emits a code line info finish record event. | 188 // Emits a code line info finish record event. |
254 // It's the callee's responsibility to dispose the parameter jit_handler_data. | 189 // It's the callee's responsibility to dispose the parameter jit_handler_data. |
255 void CodeEndLinePosInfoRecordEvent(AbstractCode* code, | 190 void CodeEndLinePosInfoRecordEvent(AbstractCode* code, |
256 void* jit_handler_data); | 191 void* jit_handler_data); |
257 | 192 |
258 void SharedFunctionInfoMoveEvent(Address from, Address to); | 193 void SharedFunctionInfoMoveEvent(Address from, Address to); |
259 | 194 |
260 void CodeNameEvent(Address addr, int pos, const char* code_name); | 195 void CodeNameEvent(Address addr, int pos, const char* code_name); |
261 | 196 |
| 197 void CodeDeoptEvent(Code* code, Address pc, int fp_to_sp_delta); |
| 198 |
262 // ==== Events logged by --log-gc. ==== | 199 // ==== Events logged by --log-gc. ==== |
263 // Heap sampling events: start, end, and individual types. | 200 // Heap sampling events: start, end, and individual types. |
264 void HeapSampleBeginEvent(const char* space, const char* kind); | 201 void HeapSampleBeginEvent(const char* space, const char* kind); |
265 void HeapSampleEndEvent(const char* space, const char* kind); | 202 void HeapSampleEndEvent(const char* space, const char* kind); |
266 void HeapSampleItemEvent(const char* type, int number, int bytes); | 203 void HeapSampleItemEvent(const char* type, int number, int bytes); |
267 void HeapSampleJSConstructorEvent(const char* constructor, | 204 void HeapSampleJSConstructorEvent(const char* constructor, |
268 int number, int bytes); | 205 int number, int bytes); |
269 void HeapSampleJSRetainersEvent(const char* constructor, | 206 void HeapSampleJSRetainersEvent(const char* constructor, |
270 const char* event); | 207 const char* event); |
271 void HeapSampleJSProducerEvent(const char* constructor, | 208 void HeapSampleJSProducerEvent(const char* constructor, |
272 Address* stack); | 209 Address* stack); |
273 void HeapSampleStats(const char* space, const char* kind, | 210 void HeapSampleStats(const char* space, const char* kind, |
274 intptr_t capacity, intptr_t used); | 211 intptr_t capacity, intptr_t used); |
275 | 212 |
276 void SharedLibraryEvent(const std::string& library_path, uintptr_t start, | 213 void SharedLibraryEvent(const std::string& library_path, uintptr_t start, |
277 uintptr_t end, intptr_t aslr_slide); | 214 uintptr_t end, intptr_t aslr_slide); |
278 | 215 |
279 void CodeDeoptEvent(Code* code, Address pc, int fp_to_sp_delta); | |
280 void CurrentTimeEvent(); | 216 void CurrentTimeEvent(); |
281 | 217 |
282 void TimerEvent(StartEnd se, const char* name); | 218 void TimerEvent(StartEnd se, const char* name); |
283 | 219 |
284 static void EnterExternal(Isolate* isolate); | 220 static void EnterExternal(Isolate* isolate); |
285 static void LeaveExternal(Isolate* isolate); | 221 static void LeaveExternal(Isolate* isolate); |
286 | 222 |
287 static void DefaultEventLoggerSentinel(const char* name, int event) {} | 223 static void DefaultEventLoggerSentinel(const char* name, int event) {} |
288 | 224 |
289 INLINE(static void CallEventLogger(Isolate* isolate, const char* name, | 225 INLINE(static void CallEventLogger(Isolate* isolate, const char* name, |
(...skipping 21 matching lines...) Expand all Loading... |
311 // Logs all compiled functions found in the heap. | 247 // Logs all compiled functions found in the heap. |
312 void LogCompiledFunctions(); | 248 void LogCompiledFunctions(); |
313 // Logs all accessor callbacks found in the heap. | 249 // Logs all accessor callbacks found in the heap. |
314 void LogAccessorCallbacks(); | 250 void LogAccessorCallbacks(); |
315 // Used for logging stubs found in the snapshot. | 251 // Used for logging stubs found in the snapshot. |
316 void LogCodeObjects(); | 252 void LogCodeObjects(); |
317 // Used for logging bytecode handlers found in the snapshot. | 253 // Used for logging bytecode handlers found in the snapshot. |
318 void LogBytecodeHandlers(); | 254 void LogBytecodeHandlers(); |
319 | 255 |
320 // Converts tag to a corresponding NATIVE_... if the script is native. | 256 // Converts tag to a corresponding NATIVE_... if the script is native. |
321 INLINE(static LogEventsAndTags ToNativeByScript(LogEventsAndTags, Script*)); | 257 INLINE(static CodeEventListener::LogEventsAndTags ToNativeByScript( |
| 258 CodeEventListener::LogEventsAndTags, Script*)); |
322 | 259 |
323 // Profiler's sampling interval (in milliseconds). | 260 // Profiler's sampling interval (in milliseconds). |
324 #if defined(ANDROID) | 261 #if defined(ANDROID) |
325 // Phones and tablets have processors that are much slower than desktop | 262 // Phones and tablets have processors that are much slower than desktop |
326 // and laptop computers for which current heuristics are tuned. | 263 // and laptop computers for which current heuristics are tuned. |
327 static const int kSamplingIntervalMs = 5; | 264 static const int kSamplingIntervalMs = 5; |
328 #else | 265 #else |
329 static const int kSamplingIntervalMs = 1; | 266 static const int kSamplingIntervalMs = 1; |
330 #endif | 267 #endif |
331 | 268 |
332 // Callback from Log, stops profiling in case of insufficient resources. | 269 // Callback from Log, stops profiling in case of insufficient resources. |
333 void LogFailure(); | 270 void LogFailure(); |
334 | 271 |
335 private: | 272 private: |
336 explicit Logger(Isolate* isolate); | 273 explicit Logger(Isolate* isolate); |
337 ~Logger(); | 274 ~Logger(); |
338 | 275 |
339 // Emits the profiler's first message. | 276 // Emits the profiler's first message. |
340 void ProfilerBeginEvent(); | 277 void ProfilerBeginEvent(); |
341 | 278 |
342 // Emits callback event messages. | 279 // Emits callback event messages. |
343 void CallbackEventInternal(const char* prefix, | 280 void CallbackEventInternal(const char* prefix, |
344 Name* name, | 281 Name* name, |
345 Address entry_point); | 282 Address entry_point); |
346 | 283 |
347 // Internal configurable move event. | 284 // Internal configurable move event. |
348 void MoveEventInternal(LogEventsAndTags event, Address from, Address to); | 285 void MoveEventInternal(CodeEventListener::LogEventsAndTags event, |
| 286 Address from, Address to); |
349 | 287 |
350 // Used for logging stubs found in the snapshot. | 288 // Used for logging stubs found in the snapshot. |
351 void LogCodeObject(Object* code_object); | 289 void LogCodeObject(Object* code_object); |
352 | 290 |
353 // Helper method. It resets name_buffer_ and add tag name into it. | 291 // Helper method. It resets name_buffer_ and add tag name into it. |
354 void InitNameBuffer(LogEventsAndTags tag); | 292 void InitNameBuffer(CodeEventListener::LogEventsAndTags tag); |
355 | 293 |
356 // Emits a profiler tick event. Used by the profiler thread. | 294 // Emits a profiler tick event. Used by the profiler thread. |
357 void TickEvent(TickSample* sample, bool overflow); | 295 void TickEvent(TickSample* sample, bool overflow); |
358 void RuntimeCallTimerEvent(); | 296 void RuntimeCallTimerEvent(); |
359 | 297 |
360 PRINTF_FORMAT(2, 3) void ApiEvent(const char* format, ...); | 298 PRINTF_FORMAT(2, 3) void ApiEvent(const char* format, ...); |
361 | 299 |
362 // Logs a StringEvent regardless of whether FLAG_log is true. | 300 // Logs a StringEvent regardless of whether FLAG_log is true. |
363 void UncheckedStringEvent(const char* name, const char* value); | 301 void UncheckedStringEvent(const char* name, const char* value); |
364 | 302 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 | 394 |
457 protected: | 395 protected: |
458 // Currently jit_handler_data_ is used to store JITHandler-specific data | 396 // Currently jit_handler_data_ is used to store JITHandler-specific data |
459 // over the lifetime of a PositionsRecorder | 397 // over the lifetime of a PositionsRecorder |
460 void* jit_handler_data_; | 398 void* jit_handler_data_; |
461 | 399 |
462 private: | 400 private: |
463 DISALLOW_COPY_AND_ASSIGN(PositionsRecorder); | 401 DISALLOW_COPY_AND_ASSIGN(PositionsRecorder); |
464 }; | 402 }; |
465 | 403 |
466 class CodeEventListener { | |
467 public: | |
468 virtual ~CodeEventListener() {} | |
469 | |
470 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, | |
471 const char* comment) = 0; | |
472 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, | |
473 Name* name) = 0; | |
474 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, | |
475 SharedFunctionInfo* shared, Name* name) = 0; | |
476 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, | |
477 SharedFunctionInfo* shared, Name* source, | |
478 int line, int column) = 0; | |
479 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, | |
480 int args_count) = 0; | |
481 virtual void CallbackEvent(Name* name, Address entry_point) = 0; | |
482 virtual void GetterCallbackEvent(Name* name, Address entry_point) = 0; | |
483 virtual void SetterCallbackEvent(Name* name, Address entry_point) = 0; | |
484 virtual void RegExpCodeCreateEvent(AbstractCode* code, String* source) = 0; | |
485 virtual void CodeMoveEvent(AbstractCode* from, Address to) = 0; | |
486 virtual void SharedFunctionInfoMoveEvent(Address from, Address to) = 0; | |
487 virtual void CodeMovingGCEvent() = 0; | |
488 virtual void CodeDisableOptEvent(AbstractCode* code, | |
489 SharedFunctionInfo* shared) = 0; | |
490 }; | |
491 | |
492 | |
493 class CodeEventLogger : public CodeEventListener { | 404 class CodeEventLogger : public CodeEventListener { |
494 public: | 405 public: |
495 CodeEventLogger(); | 406 CodeEventLogger(); |
496 ~CodeEventLogger() override; | 407 ~CodeEventLogger() override; |
497 | 408 |
498 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, | 409 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
499 const char* comment) override; | 410 const char* comment) override; |
500 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, | 411 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
501 Name* name) override; | 412 Name* name) override; |
502 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, | 413 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
503 int args_count) override; | 414 int args_count) override; |
504 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, | 415 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
505 SharedFunctionInfo* shared, Name* name) override; | 416 SharedFunctionInfo* shared, Name* name) override; |
506 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, | 417 void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
507 SharedFunctionInfo* shared, Name* source, int line, | 418 SharedFunctionInfo* shared, Name* source, int line, |
508 int column) override; | 419 int column) override; |
509 void RegExpCodeCreateEvent(AbstractCode* code, String* source) override; | 420 void RegExpCodeCreateEvent(AbstractCode* code, String* source) override; |
510 | 421 |
511 void CallbackEvent(Name* name, Address entry_point) override {} | 422 void CallbackEvent(Name* name, Address entry_point) override {} |
512 void GetterCallbackEvent(Name* name, Address entry_point) override {} | 423 void GetterCallbackEvent(Name* name, Address entry_point) override {} |
513 void SetterCallbackEvent(Name* name, Address entry_point) override {} | 424 void SetterCallbackEvent(Name* name, Address entry_point) override {} |
514 void SharedFunctionInfoMoveEvent(Address from, Address to) override {} | 425 void SharedFunctionInfoMoveEvent(Address from, Address to) override {} |
515 void CodeMovingGCEvent() override {} | 426 void CodeMovingGCEvent() override {} |
| 427 void CodeDeoptEvent(Code* code, Address pc, int fp_to_sp_delta) override {} |
516 | 428 |
517 private: | 429 private: |
518 class NameBuffer; | 430 class NameBuffer; |
519 | 431 |
520 virtual void LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo* shared, | 432 virtual void LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo* shared, |
521 const char* name, int length) = 0; | 433 const char* name, int length) = 0; |
522 | 434 |
523 NameBuffer* name_buffer_; | 435 NameBuffer* name_buffer_; |
524 }; | 436 }; |
525 | 437 |
526 | 438 |
527 } // namespace internal | 439 } // namespace internal |
528 } // namespace v8 | 440 } // namespace v8 |
529 | 441 |
530 | 442 |
531 #endif // V8_LOG_H_ | 443 #endif // V8_LOG_H_ |
OLD | NEW |