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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 public: | 109 public: |
110 explicit VMState(StateTag state) {} | 110 explicit VMState(StateTag state) {} |
111 #endif | 111 #endif |
112 }; | 112 }; |
113 | 113 |
114 | 114 |
115 #define LOG_EVENTS_AND_TAGS_LIST(V) \ | 115 #define LOG_EVENTS_AND_TAGS_LIST(V) \ |
116 V(CODE_CREATION_EVENT, "code-creation", "cc") \ | 116 V(CODE_CREATION_EVENT, "code-creation", "cc") \ |
117 V(CODE_MOVE_EVENT, "code-move", "cm") \ | 117 V(CODE_MOVE_EVENT, "code-move", "cm") \ |
118 V(CODE_DELETE_EVENT, "code-delete", "cd") \ | 118 V(CODE_DELETE_EVENT, "code-delete", "cd") \ |
| 119 V(FUNCTION_CREATION_EVENT, "function-creation", "fc") \ |
| 120 V(FUNCTION_MOVE_EVENT, "function-move", "fm") \ |
| 121 V(FUNCTION_DELETE_EVENT, "function-delete", "fd") \ |
119 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos", "sp") \ | 122 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos", "sp") \ |
120 V(TICK_EVENT, "tick", "t") \ | 123 V(TICK_EVENT, "tick", "t") \ |
121 V(REPEAT_META_EVENT, "repeat", "r") \ | 124 V(REPEAT_META_EVENT, "repeat", "r") \ |
122 V(BUILTIN_TAG, "Builtin", "bi") \ | 125 V(BUILTIN_TAG, "Builtin", "bi") \ |
123 V(CALL_DEBUG_BREAK_TAG, "CallDebugBreak", "cdb") \ | 126 V(CALL_DEBUG_BREAK_TAG, "CallDebugBreak", "cdb") \ |
124 V(CALL_DEBUG_PREPARE_STEP_IN_TAG, "CallDebugPrepareStepIn", "cdbsi") \ | 127 V(CALL_DEBUG_PREPARE_STEP_IN_TAG, "CallDebugPrepareStepIn", "cdbsi") \ |
125 V(CALL_IC_TAG, "CallIC", "cic") \ | 128 V(CALL_IC_TAG, "CallIC", "cic") \ |
126 V(CALL_INITIALIZE_TAG, "CallInitialize", "ci") \ | 129 V(CALL_INITIALIZE_TAG, "CallInitialize", "ci") \ |
127 V(CALL_MEGAMORPHIC_TAG, "CallMegamorphic", "cmm") \ | 130 V(CALL_MEGAMORPHIC_TAG, "CallMegamorphic", "cmm") \ |
128 V(CALL_MISS_TAG, "CallMiss", "cm") \ | 131 V(CALL_MISS_TAG, "CallMiss", "cm") \ |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 static void CodeCreateEvent(LogEventsAndTags tag, Code* code, String* name); | 220 static void CodeCreateEvent(LogEventsAndTags tag, Code* code, String* name); |
218 static void CodeCreateEvent(LogEventsAndTags tag, Code* code, String* name, | 221 static void CodeCreateEvent(LogEventsAndTags tag, Code* code, String* name, |
219 String* source, int line); | 222 String* source, int line); |
220 static void CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count); | 223 static void CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count); |
221 // Emits a code create event for a RegExp. | 224 // Emits a code create event for a RegExp. |
222 static void RegExpCodeCreateEvent(Code* code, String* source); | 225 static void RegExpCodeCreateEvent(Code* code, String* source); |
223 // Emits a code move event. | 226 // Emits a code move event. |
224 static void CodeMoveEvent(Address from, Address to); | 227 static void CodeMoveEvent(Address from, Address to); |
225 // Emits a code delete event. | 228 // Emits a code delete event. |
226 static void CodeDeleteEvent(Address from); | 229 static void CodeDeleteEvent(Address from); |
| 230 // Emits a function object create event. |
| 231 static void FunctionCreateEvent(JSFunction* function); |
| 232 // Emits a function move event. |
| 233 static void FunctionMoveEvent(Address from, Address to); |
| 234 // Emits a function delete event. |
| 235 static void FunctionDeleteEvent(Address from); |
227 | 236 |
228 static void SnapshotPositionEvent(Address addr, int pos); | 237 static void SnapshotPositionEvent(Address addr, int pos); |
229 | 238 |
230 // ==== Events logged by --log-gc. ==== | 239 // ==== Events logged by --log-gc. ==== |
231 // Heap sampling events: start, end, and individual types. | 240 // Heap sampling events: start, end, and individual types. |
232 static void HeapSampleBeginEvent(const char* space, const char* kind); | 241 static void HeapSampleBeginEvent(const char* space, const char* kind); |
233 static void HeapSampleEndEvent(const char* space, const char* kind); | 242 static void HeapSampleEndEvent(const char* space, const char* kind); |
234 static void HeapSampleItemEvent(const char* type, int number, int bytes); | 243 static void HeapSampleItemEvent(const char* type, int number, int bytes); |
235 static void HeapSampleJSConstructorEvent(const char* constructor, | 244 static void HeapSampleJSConstructorEvent(const char* constructor, |
236 int number, int bytes); | 245 int number, int bytes); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 static void PauseProfiler(int flags); | 280 static void PauseProfiler(int flags); |
272 static void ResumeProfiler(int flags); | 281 static void ResumeProfiler(int flags); |
273 static int GetActiveProfilerModules(); | 282 static int GetActiveProfilerModules(); |
274 | 283 |
275 // If logging is performed into a memory buffer, allows to | 284 // If logging is performed into a memory buffer, allows to |
276 // retrieve previously written messages. See v8.h. | 285 // retrieve previously written messages. See v8.h. |
277 static int GetLogLines(int from_pos, char* dest_buf, int max_size); | 286 static int GetLogLines(int from_pos, char* dest_buf, int max_size); |
278 | 287 |
279 // Logs all compiled functions found in the heap. | 288 // Logs all compiled functions found in the heap. |
280 static void LogCompiledFunctions(); | 289 static void LogCompiledFunctions(); |
| 290 // Logs all compiled JSFunction objects found in the heap. |
| 291 static void LogFunctionObjects(); |
281 // Logs all accessor callbacks found in the heap. | 292 // Logs all accessor callbacks found in the heap. |
282 static void LogAccessorCallbacks(); | 293 static void LogAccessorCallbacks(); |
283 // Used for logging stubs found in the snapshot. | 294 // Used for logging stubs found in the snapshot. |
284 static void LogCodeObject(Object* code_object); | 295 static void LogCodeObject(Object* code_object); |
285 | 296 |
286 private: | 297 private: |
287 | 298 |
288 // Profiler's sampling interval (in milliseconds). | 299 // Profiler's sampling interval (in milliseconds). |
289 static const int kSamplingIntervalMs = 1; | 300 static const int kSamplingIntervalMs = 1; |
290 | 301 |
291 // Size of window used for log records compression. | 302 // Size of window used for log records compression. |
292 static const int kCompressionWindowSize = 4; | 303 static const int kCompressionWindowSize = 4; |
293 | 304 |
294 // Emits the profiler's first message. | 305 // Emits the profiler's first message. |
295 static void ProfilerBeginEvent(); | 306 static void ProfilerBeginEvent(); |
296 | 307 |
297 // Emits callback event messages. | 308 // Emits callback event messages. |
298 static void CallbackEventInternal(const char* prefix, | 309 static void CallbackEventInternal(const char* prefix, |
299 const char* name, | 310 const char* name, |
300 Address entry_point); | 311 Address entry_point); |
301 | 312 |
| 313 // Internal configurable move event. |
| 314 static void MoveEventInternal(LogEventsAndTags event, |
| 315 Address from, |
| 316 Address to); |
| 317 |
| 318 // Internal configurable move event. |
| 319 static void DeleteEventInternal(LogEventsAndTags event, |
| 320 Address from); |
| 321 |
302 // Emits aliases for compressed messages. | 322 // Emits aliases for compressed messages. |
303 static void LogAliases(); | 323 static void LogAliases(); |
304 | 324 |
305 // Emits the source code of a regexp. Used by regexp events. | 325 // Emits the source code of a regexp. Used by regexp events. |
306 static void LogRegExpSource(Handle<JSRegExp> regexp); | 326 static void LogRegExpSource(Handle<JSRegExp> regexp); |
307 | 327 |
308 // Emits a profiler tick event. Used by the profiler thread. | 328 // Emits a profiler tick event. Used by the profiler thread. |
309 static void TickEvent(TickSample* sample, bool overflow); | 329 static void TickEvent(TickSample* sample, bool overflow); |
310 | 330 |
311 static void ApiEvent(const char* name, ...); | 331 static void ApiEvent(const char* name, ...); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 // Class that extracts stack trace, used for profiling. | 385 // Class that extracts stack trace, used for profiling. |
366 class StackTracer : public AllStatic { | 386 class StackTracer : public AllStatic { |
367 public: | 387 public: |
368 static void Trace(TickSample* sample); | 388 static void Trace(TickSample* sample); |
369 }; | 389 }; |
370 | 390 |
371 | 391 |
372 } } // namespace v8::internal | 392 } } // namespace v8::internal |
373 | 393 |
374 #endif // V8_LOG_H_ | 394 #endif // V8_LOG_H_ |
OLD | NEW |