| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 } while (false) | 84 } while (false) |
| 85 #else | 85 #else |
| 86 #define LOG(Call) ((void) 0) | 86 #define LOG(Call) ((void) 0) |
| 87 #endif | 87 #endif |
| 88 | 88 |
| 89 #define LOG_EVENTS_AND_TAGS_LIST(V) \ | 89 #define LOG_EVENTS_AND_TAGS_LIST(V) \ |
| 90 V(CODE_CREATION_EVENT, "code-creation") \ | 90 V(CODE_CREATION_EVENT, "code-creation") \ |
| 91 V(CODE_MOVE_EVENT, "code-move") \ | 91 V(CODE_MOVE_EVENT, "code-move") \ |
| 92 V(CODE_DELETE_EVENT, "code-delete") \ | 92 V(CODE_DELETE_EVENT, "code-delete") \ |
| 93 V(CODE_MOVING_GC, "code-moving-gc") \ | 93 V(CODE_MOVING_GC, "code-moving-gc") \ |
| 94 V(FUNCTION_CREATION_EVENT, "function-creation") \ | 94 V(SHARED_FUNC_MOVE_EVENT, "sfi-move") \ |
| 95 V(FUNCTION_MOVE_EVENT, "function-move") \ | |
| 96 V(FUNCTION_DELETE_EVENT, "function-delete") \ | |
| 97 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos") \ | 95 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos") \ |
| 98 V(TICK_EVENT, "tick") \ | 96 V(TICK_EVENT, "tick") \ |
| 99 V(REPEAT_META_EVENT, "repeat") \ | 97 V(REPEAT_META_EVENT, "repeat") \ |
| 100 V(BUILTIN_TAG, "Builtin") \ | 98 V(BUILTIN_TAG, "Builtin") \ |
| 101 V(CALL_DEBUG_BREAK_TAG, "CallDebugBreak") \ | 99 V(CALL_DEBUG_BREAK_TAG, "CallDebugBreak") \ |
| 102 V(CALL_DEBUG_PREPARE_STEP_IN_TAG, "CallDebugPrepareStepIn") \ | 100 V(CALL_DEBUG_PREPARE_STEP_IN_TAG, "CallDebugPrepareStepIn") \ |
| 103 V(CALL_IC_TAG, "CallIC") \ | 101 V(CALL_IC_TAG, "CallIC") \ |
| 104 V(CALL_INITIALIZE_TAG, "CallInitialize") \ | 102 V(CALL_INITIALIZE_TAG, "CallInitialize") \ |
| 105 V(CALL_MEGAMORPHIC_TAG, "CallMegamorphic") \ | 103 V(CALL_MEGAMORPHIC_TAG, "CallMegamorphic") \ |
| 106 V(CALL_MISS_TAG, "CallMiss") \ | 104 V(CALL_MISS_TAG, "CallMiss") \ |
| 107 V(CALL_NORMAL_TAG, "CallNormal") \ | 105 V(CALL_NORMAL_TAG, "CallNormal") \ |
| 108 V(CALL_PRE_MONOMORPHIC_TAG, "CallPreMonomorphic") \ | 106 V(CALL_PRE_MONOMORPHIC_TAG, "CallPreMonomorphic") \ |
| 109 V(KEYED_CALL_DEBUG_BREAK_TAG, "KeyedCallDebugBreak") \ | 107 V(KEYED_CALL_DEBUG_BREAK_TAG, "KeyedCallDebugBreak") \ |
| 110 V(KEYED_CALL_DEBUG_PREPARE_STEP_IN_TAG, \ | 108 V(KEYED_CALL_DEBUG_PREPARE_STEP_IN_TAG, \ |
| 111 "KeyedCallDebugPrepareStepIn") \ | 109 "KeyedCallDebugPrepareStepIn") \ |
| 112 V(KEYED_CALL_IC_TAG, "KeyedCallIC") \ | 110 V(KEYED_CALL_IC_TAG, "KeyedCallIC") \ |
| 113 V(KEYED_CALL_INITIALIZE_TAG, "KeyedCallInitialize") \ | 111 V(KEYED_CALL_INITIALIZE_TAG, "KeyedCallInitialize") \ |
| 114 V(KEYED_CALL_MEGAMORPHIC_TAG, "KeyedCallMegamorphic") \ | 112 V(KEYED_CALL_MEGAMORPHIC_TAG, "KeyedCallMegamorphic") \ |
| 115 V(KEYED_CALL_MISS_TAG, "KeyedCallMiss") \ | 113 V(KEYED_CALL_MISS_TAG, "KeyedCallMiss") \ |
| 116 V(KEYED_CALL_NORMAL_TAG, "KeyedCallNormal") \ | 114 V(KEYED_CALL_NORMAL_TAG, "KeyedCallNormal") \ |
| 117 V(KEYED_CALL_PRE_MONOMORPHIC_TAG, "KeyedCallPreMonomorphic") \ | 115 V(KEYED_CALL_PRE_MONOMORPHIC_TAG, "KeyedCallPreMonomorphic") \ |
| 118 V(CALLBACK_TAG, "Callback") \ | 116 V(CALLBACK_TAG, "Callback") \ |
| 119 V(EVAL_TAG, "Eval") \ | 117 V(EVAL_TAG, "Eval") \ |
| 120 V(FUNCTION_TAG, "Function") \ | 118 V(FUNCTION_TAG, "Function") \ |
| 121 V(KEYED_LOAD_IC_TAG, "KeyedLoadIC") \ | 119 V(KEYED_LOAD_IC_TAG, "KeyedLoadIC") \ |
| 120 V(KEYED_EXTERNAL_ARRAY_LOAD_IC_TAG, "KeyedExternalArrayLoadIC") \ |
| 122 V(KEYED_STORE_IC_TAG, "KeyedStoreIC") \ | 121 V(KEYED_STORE_IC_TAG, "KeyedStoreIC") \ |
| 122 V(KEYED_EXTERNAL_ARRAY_STORE_IC_TAG, "KeyedExternalArrayStoreIC")\ |
| 123 V(LAZY_COMPILE_TAG, "LazyCompile") \ | 123 V(LAZY_COMPILE_TAG, "LazyCompile") \ |
| 124 V(LOAD_IC_TAG, "LoadIC") \ | 124 V(LOAD_IC_TAG, "LoadIC") \ |
| 125 V(REG_EXP_TAG, "RegExp") \ | 125 V(REG_EXP_TAG, "RegExp") \ |
| 126 V(SCRIPT_TAG, "Script") \ | 126 V(SCRIPT_TAG, "Script") \ |
| 127 V(STORE_IC_TAG, "StoreIC") \ | 127 V(STORE_IC_TAG, "StoreIC") \ |
| 128 V(STUB_TAG, "Stub") \ | 128 V(STUB_TAG, "Stub") \ |
| 129 V(NATIVE_FUNCTION_TAG, "Function") \ | 129 V(NATIVE_FUNCTION_TAG, "Function") \ |
| 130 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \ | 130 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \ |
| 131 V(NATIVE_SCRIPT_TAG, "Script") | 131 V(NATIVE_SCRIPT_TAG, "Script") |
| 132 // Note that 'NATIVE_' cases for functions and scripts are mapped onto | 132 // Note that 'NATIVE_' cases for functions and scripts are mapped onto |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 198 |
| 199 | 199 |
| 200 // ==== Events logged by --log-code. ==== | 200 // ==== Events logged by --log-code. ==== |
| 201 // Emits a code event for a callback function. | 201 // Emits a code event for a callback function. |
| 202 static void CallbackEvent(String* name, Address entry_point); | 202 static void CallbackEvent(String* name, Address entry_point); |
| 203 static void GetterCallbackEvent(String* name, Address entry_point); | 203 static void GetterCallbackEvent(String* name, Address entry_point); |
| 204 static void SetterCallbackEvent(String* name, Address entry_point); | 204 static void SetterCallbackEvent(String* name, Address entry_point); |
| 205 // Emits a code create event. | 205 // Emits a code create event. |
| 206 static void CodeCreateEvent(LogEventsAndTags tag, | 206 static void CodeCreateEvent(LogEventsAndTags tag, |
| 207 Code* code, const char* source); | 207 Code* code, const char* source); |
| 208 static void CodeCreateEvent(LogEventsAndTags tag, Code* code, String* name); | 208 static void CodeCreateEvent(LogEventsAndTags tag, |
| 209 static void CodeCreateEvent(LogEventsAndTags tag, Code* code, String* name, | 209 Code* code, String* name); |
| 210 static void CodeCreateEvent(LogEventsAndTags tag, |
| 211 Code* code, |
| 212 SharedFunctionInfo* shared, |
| 213 String* name); |
| 214 static void CodeCreateEvent(LogEventsAndTags tag, |
| 215 Code* code, |
| 216 SharedFunctionInfo* shared, |
| 210 String* source, int line); | 217 String* source, int line); |
| 211 static void CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count); | 218 static void CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count); |
| 212 static void CodeMovingGCEvent(); | 219 static void CodeMovingGCEvent(); |
| 213 // Emits a code create event for a RegExp. | 220 // Emits a code create event for a RegExp. |
| 214 static void RegExpCodeCreateEvent(Code* code, String* source); | 221 static void RegExpCodeCreateEvent(Code* code, String* source); |
| 215 // Emits a code move event. | 222 // Emits a code move event. |
| 216 static void CodeMoveEvent(Address from, Address to); | 223 static void CodeMoveEvent(Address from, Address to); |
| 217 // Emits a code delete event. | 224 // Emits a code delete event. |
| 218 static void CodeDeleteEvent(Address from); | 225 static void CodeDeleteEvent(Address from); |
| 219 // Emits a function object create event. | 226 |
| 220 static void FunctionCreateEvent(JSFunction* function); | 227 static void SharedFunctionInfoMoveEvent(Address from, Address to); |
| 221 static void FunctionCreateEventFromMove(JSFunction* function); | |
| 222 // Emits a function move event. | |
| 223 static void FunctionMoveEvent(Address from, Address to); | |
| 224 // Emits a function delete event. | |
| 225 static void FunctionDeleteEvent(Address from); | |
| 226 | 228 |
| 227 static void SnapshotPositionEvent(Address addr, int pos); | 229 static void SnapshotPositionEvent(Address addr, int pos); |
| 228 | 230 |
| 229 // ==== Events logged by --log-gc. ==== | 231 // ==== Events logged by --log-gc. ==== |
| 230 // Heap sampling events: start, end, and individual types. | 232 // Heap sampling events: start, end, and individual types. |
| 231 static void HeapSampleBeginEvent(const char* space, const char* kind); | 233 static void HeapSampleBeginEvent(const char* space, const char* kind); |
| 232 static void HeapSampleEndEvent(const char* space, const char* kind); | 234 static void HeapSampleEndEvent(const char* space, const char* kind); |
| 233 static void HeapSampleItemEvent(const char* type, int number, int bytes); | 235 static void HeapSampleItemEvent(const char* type, int number, int bytes); |
| 234 static void HeapSampleJSConstructorEvent(const char* constructor, | 236 static void HeapSampleJSConstructorEvent(const char* constructor, |
| 235 int number, int bytes); | 237 int number, int bytes); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 266 static void PauseProfiler(int flags, int tag); | 268 static void PauseProfiler(int flags, int tag); |
| 267 static void ResumeProfiler(int flags, int tag); | 269 static void ResumeProfiler(int flags, int tag); |
| 268 static int GetActiveProfilerModules(); | 270 static int GetActiveProfilerModules(); |
| 269 | 271 |
| 270 // If logging is performed into a memory buffer, allows to | 272 // If logging is performed into a memory buffer, allows to |
| 271 // retrieve previously written messages. See v8.h. | 273 // retrieve previously written messages. See v8.h. |
| 272 static int GetLogLines(int from_pos, char* dest_buf, int max_size); | 274 static int GetLogLines(int from_pos, char* dest_buf, int max_size); |
| 273 | 275 |
| 274 // Logs all compiled functions found in the heap. | 276 // Logs all compiled functions found in the heap. |
| 275 static void LogCompiledFunctions(); | 277 static void LogCompiledFunctions(); |
| 276 // Logs all compiled JSFunction objects found in the heap. | |
| 277 static void LogFunctionObjects(); | |
| 278 // Logs all accessor callbacks found in the heap. | 278 // Logs all accessor callbacks found in the heap. |
| 279 static void LogAccessorCallbacks(); | 279 static void LogAccessorCallbacks(); |
| 280 // Used for logging stubs found in the snapshot. | 280 // Used for logging stubs found in the snapshot. |
| 281 static void LogCodeObjects(); | 281 static void LogCodeObjects(); |
| 282 | 282 |
| 283 // Converts tag to a corresponding NATIVE_... if the script is native. | 283 // Converts tag to a corresponding NATIVE_... if the script is native. |
| 284 INLINE(static LogEventsAndTags ToNativeByScript(LogEventsAndTags, Script*)); | 284 INLINE(static LogEventsAndTags ToNativeByScript(LogEventsAndTags, Script*)); |
| 285 | 285 |
| 286 // Profiler's sampling interval (in milliseconds). | 286 // Profiler's sampling interval (in milliseconds). |
| 287 static const int kSamplingIntervalMs = 1; | 287 static const int kSamplingIntervalMs = 1; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 // Class that extracts stack trace, used for profiling. | 372 // Class that extracts stack trace, used for profiling. |
| 373 class StackTracer : public AllStatic { | 373 class StackTracer : public AllStatic { |
| 374 public: | 374 public: |
| 375 static void Trace(TickSample* sample); | 375 static void Trace(TickSample* sample); |
| 376 }; | 376 }; |
| 377 | 377 |
| 378 } } // namespace v8::internal | 378 } } // namespace v8::internal |
| 379 | 379 |
| 380 | 380 |
| 381 #endif // V8_LOG_H_ | 381 #endif // V8_LOG_H_ |
| OLD | NEW |