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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } while (false) | 75 } while (false) |
76 | 76 |
77 #define LOG_CODE_EVENT(isolate, Call) \ | 77 #define LOG_CODE_EVENT(isolate, Call) \ |
78 do { \ | 78 do { \ |
79 v8::internal::Logger* logger = \ | 79 v8::internal::Logger* logger = \ |
80 (isolate)->logger(); \ | 80 (isolate)->logger(); \ |
81 if (logger->is_logging_code_events()) \ | 81 if (logger->is_logging_code_events()) \ |
82 logger->Call; \ | 82 logger->Call; \ |
83 } while (false) | 83 } while (false) |
84 | 84 |
85 | 85 #define LOG_EVENTS_AND_TAGS_LIST(V) \ |
86 #define LOG_EVENTS_AND_TAGS_LIST(V) \ | 86 V(CODE_CREATION_EVENT, "code-creation") \ |
87 V(CODE_CREATION_EVENT, "code-creation") \ | 87 V(CODE_DISABLE_OPT_EVENT, "code-disable-optimization") \ |
88 V(CODE_DISABLE_OPT_EVENT, "code-disable-optimization") \ | 88 V(CODE_MOVE_EVENT, "code-move") \ |
89 V(CODE_MOVE_EVENT, "code-move") \ | 89 V(CODE_DELETE_EVENT, "code-delete") \ |
90 V(CODE_DELETE_EVENT, "code-delete") \ | 90 V(CODE_MOVING_GC, "code-moving-gc") \ |
91 V(CODE_MOVING_GC, "code-moving-gc") \ | 91 V(SHARED_FUNC_MOVE_EVENT, "sfi-move") \ |
92 V(SHARED_FUNC_MOVE_EVENT, "sfi-move") \ | 92 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos") \ |
93 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos") \ | 93 V(SNAPSHOT_CODE_NAME_EVENT, "snapshot-code-name") \ |
94 V(SNAPSHOT_CODE_NAME_EVENT, "snapshot-code-name") \ | 94 V(TICK_EVENT, "tick") \ |
95 V(TICK_EVENT, "tick") \ | 95 V(REPEAT_META_EVENT, "repeat") \ |
96 V(REPEAT_META_EVENT, "repeat") \ | 96 V(BUILTIN_TAG, "Builtin") \ |
97 V(BUILTIN_TAG, "Builtin") \ | 97 V(CALL_DEBUG_BREAK_TAG, "CallDebugBreak") \ |
98 V(CALL_DEBUG_BREAK_TAG, "CallDebugBreak") \ | 98 V(CALL_DEBUG_PREPARE_STEP_IN_TAG, "CallDebugPrepareStepIn") \ |
99 V(CALL_DEBUG_PREPARE_STEP_IN_TAG, "CallDebugPrepareStepIn") \ | 99 V(CALL_INITIALIZE_TAG, "CallInitialize") \ |
100 V(CALL_INITIALIZE_TAG, "CallInitialize") \ | 100 V(CALL_MEGAMORPHIC_TAG, "CallMegamorphic") \ |
101 V(CALL_MEGAMORPHIC_TAG, "CallMegamorphic") \ | 101 V(CALL_MISS_TAG, "CallMiss") \ |
102 V(CALL_MISS_TAG, "CallMiss") \ | 102 V(CALL_NORMAL_TAG, "CallNormal") \ |
103 V(CALL_NORMAL_TAG, "CallNormal") \ | 103 V(CALL_PRE_MONOMORPHIC_TAG, "CallPreMonomorphic") \ |
104 V(CALL_PRE_MONOMORPHIC_TAG, "CallPreMonomorphic") \ | 104 V(LOAD_INITIALIZE_TAG, "LoadInitialize") \ |
105 V(LOAD_INITIALIZE_TAG, "LoadInitialize") \ | 105 V(LOAD_PREMONOMORPHIC_TAG, "LoadPreMonomorphic") \ |
106 V(LOAD_PREMONOMORPHIC_TAG, "LoadPreMonomorphic") \ | 106 V(LOAD_MEGAMORPHIC_TAG, "LoadMegamorphic") \ |
107 V(LOAD_MEGAMORPHIC_TAG, "LoadMegamorphic") \ | 107 V(STORE_INITIALIZE_TAG, "StoreInitialize") \ |
108 V(STORE_INITIALIZE_TAG, "StoreInitialize") \ | 108 V(STORE_PREMONOMORPHIC_TAG, "StorePreMonomorphic") \ |
109 V(STORE_PREMONOMORPHIC_TAG, "StorePreMonomorphic") \ | 109 V(STORE_GENERIC_TAG, "StoreGeneric") \ |
110 V(STORE_GENERIC_TAG, "StoreGeneric") \ | 110 V(STORE_MEGAMORPHIC_TAG, "StoreMegamorphic") \ |
111 V(STORE_MEGAMORPHIC_TAG, "StoreMegamorphic") \ | 111 V(KEYED_CALL_DEBUG_BREAK_TAG, "KeyedCallDebugBreak") \ |
112 V(KEYED_CALL_DEBUG_BREAK_TAG, "KeyedCallDebugBreak") \ | 112 V(KEYED_CALL_DEBUG_PREPARE_STEP_IN_TAG, "KeyedCallDebugPrepareStepIn") \ |
113 V(KEYED_CALL_DEBUG_PREPARE_STEP_IN_TAG, \ | 113 V(KEYED_CALL_INITIALIZE_TAG, "KeyedCallInitialize") \ |
114 "KeyedCallDebugPrepareStepIn") \ | 114 V(KEYED_CALL_MEGAMORPHIC_TAG, "KeyedCallMegamorphic") \ |
115 V(KEYED_CALL_INITIALIZE_TAG, "KeyedCallInitialize") \ | 115 V(KEYED_CALL_MISS_TAG, "KeyedCallMiss") \ |
116 V(KEYED_CALL_MEGAMORPHIC_TAG, "KeyedCallMegamorphic") \ | 116 V(KEYED_CALL_NORMAL_TAG, "KeyedCallNormal") \ |
117 V(KEYED_CALL_MISS_TAG, "KeyedCallMiss") \ | 117 V(KEYED_CALL_PRE_MONOMORPHIC_TAG, "KeyedCallPreMonomorphic") \ |
118 V(KEYED_CALL_NORMAL_TAG, "KeyedCallNormal") \ | 118 V(CALLBACK_TAG, "Callback") \ |
119 V(KEYED_CALL_PRE_MONOMORPHIC_TAG, "KeyedCallPreMonomorphic") \ | 119 V(EVAL_TAG, "Eval") \ |
120 V(CALLBACK_TAG, "Callback") \ | 120 V(FUNCTION_TAG, "Function") \ |
121 V(EVAL_TAG, "Eval") \ | 121 V(HANDLER_TAG, "Handler") \ |
122 V(FUNCTION_TAG, "Function") \ | 122 V(BYTECODE_HANDLER_TAG, "BytecodeHandler") \ |
123 V(HANDLER_TAG, "Handler") \ | 123 V(KEYED_LOAD_IC_TAG, "KeyedLoadIC") \ |
124 V(KEYED_LOAD_IC_TAG, "KeyedLoadIC") \ | 124 V(KEYED_LOAD_POLYMORPHIC_IC_TAG, "KeyedLoadPolymorphicIC") \ |
125 V(KEYED_LOAD_POLYMORPHIC_IC_TAG, "KeyedLoadPolymorphicIC") \ | 125 V(KEYED_EXTERNAL_ARRAY_LOAD_IC_TAG, "KeyedExternalArrayLoadIC") \ |
126 V(KEYED_EXTERNAL_ARRAY_LOAD_IC_TAG, "KeyedExternalArrayLoadIC") \ | 126 V(KEYED_STORE_IC_TAG, "KeyedStoreIC") \ |
127 V(KEYED_STORE_IC_TAG, "KeyedStoreIC") \ | 127 V(KEYED_STORE_POLYMORPHIC_IC_TAG, "KeyedStorePolymorphicIC") \ |
128 V(KEYED_STORE_POLYMORPHIC_IC_TAG, "KeyedStorePolymorphicIC") \ | 128 V(KEYED_EXTERNAL_ARRAY_STORE_IC_TAG, "KeyedExternalArrayStoreIC") \ |
129 V(KEYED_EXTERNAL_ARRAY_STORE_IC_TAG, "KeyedExternalArrayStoreIC") \ | 129 V(LAZY_COMPILE_TAG, "LazyCompile") \ |
130 V(LAZY_COMPILE_TAG, "LazyCompile") \ | 130 V(CALL_IC_TAG, "CallIC") \ |
131 V(CALL_IC_TAG, "CallIC") \ | 131 V(LOAD_IC_TAG, "LoadIC") \ |
132 V(LOAD_IC_TAG, "LoadIC") \ | 132 V(LOAD_POLYMORPHIC_IC_TAG, "LoadPolymorphicIC") \ |
133 V(LOAD_POLYMORPHIC_IC_TAG, "LoadPolymorphicIC") \ | 133 V(REG_EXP_TAG, "RegExp") \ |
134 V(REG_EXP_TAG, "RegExp") \ | 134 V(SCRIPT_TAG, "Script") \ |
135 V(SCRIPT_TAG, "Script") \ | 135 V(STORE_IC_TAG, "StoreIC") \ |
136 V(STORE_IC_TAG, "StoreIC") \ | 136 V(STORE_POLYMORPHIC_IC_TAG, "StorePolymorphicIC") \ |
137 V(STORE_POLYMORPHIC_IC_TAG, "StorePolymorphicIC") \ | 137 V(STUB_TAG, "Stub") \ |
138 V(STUB_TAG, "Stub") \ | 138 V(NATIVE_FUNCTION_TAG, "Function") \ |
139 V(NATIVE_FUNCTION_TAG, "Function") \ | 139 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \ |
140 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \ | 140 V(NATIVE_SCRIPT_TAG, "Script") |
141 V(NATIVE_SCRIPT_TAG, "Script") | |
142 // Note that 'NATIVE_' cases for functions and scripts are mapped onto | 141 // Note that 'NATIVE_' cases for functions and scripts are mapped onto |
143 // original tags when writing to the log. | 142 // original tags when writing to the log. |
144 | 143 |
145 | 144 |
146 class JitLogger; | 145 class JitLogger; |
147 class PerfBasicLogger; | 146 class PerfBasicLogger; |
148 class LowLevelLogger; | 147 class LowLevelLogger; |
149 class Sampler; | 148 class Sampler; |
150 | 149 |
151 class Logger { | 150 class Logger { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 void StopProfiler(); | 310 void StopProfiler(); |
312 | 311 |
313 void LogExistingFunction(Handle<SharedFunctionInfo> shared, | 312 void LogExistingFunction(Handle<SharedFunctionInfo> shared, |
314 Handle<AbstractCode> code); | 313 Handle<AbstractCode> code); |
315 // Logs all compiled functions found in the heap. | 314 // Logs all compiled functions found in the heap. |
316 void LogCompiledFunctions(); | 315 void LogCompiledFunctions(); |
317 // Logs all accessor callbacks found in the heap. | 316 // Logs all accessor callbacks found in the heap. |
318 void LogAccessorCallbacks(); | 317 void LogAccessorCallbacks(); |
319 // Used for logging stubs found in the snapshot. | 318 // Used for logging stubs found in the snapshot. |
320 void LogCodeObjects(); | 319 void LogCodeObjects(); |
| 320 // Used for logging bytecode handlers found in the snapshot. |
| 321 void LogBytecodeHandlers(); |
321 | 322 |
322 // Converts tag to a corresponding NATIVE_... if the script is native. | 323 // Converts tag to a corresponding NATIVE_... if the script is native. |
323 INLINE(static LogEventsAndTags ToNativeByScript(LogEventsAndTags, Script*)); | 324 INLINE(static LogEventsAndTags ToNativeByScript(LogEventsAndTags, Script*)); |
324 | 325 |
325 // Profiler's sampling interval (in milliseconds). | 326 // Profiler's sampling interval (in milliseconds). |
326 #if defined(ANDROID) | 327 #if defined(ANDROID) |
327 // Phones and tablets have processors that are much slower than desktop | 328 // Phones and tablets have processors that are much slower than desktop |
328 // and laptop computers for which current heuristics are tuned. | 329 // and laptop computers for which current heuristics are tuned. |
329 static const int kSamplingIntervalMs = 5; | 330 static const int kSamplingIntervalMs = 5; |
330 #else | 331 #else |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 | 525 |
525 NameBuffer* name_buffer_; | 526 NameBuffer* name_buffer_; |
526 }; | 527 }; |
527 | 528 |
528 | 529 |
529 } // namespace internal | 530 } // namespace internal |
530 } // namespace v8 | 531 } // namespace v8 |
531 | 532 |
532 | 533 |
533 #endif // V8_LOG_H_ | 534 #endif // V8_LOG_H_ |
OLD | NEW |