Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: src/log.h

Issue 6532091: Merge bleeding_edge revision (5922, 5934] to isolates branch.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // --prof 67 // --prof
68 // Collect statistical profiling information (ticks), default is off. The 68 // Collect statistical profiling information (ticks), default is off. The
69 // tick profiler requires code events, so --prof implies --log-code. 69 // tick profiler requires code events, so --prof implies --log-code.
70 70
71 // Forward declarations. 71 // Forward declarations.
72 class Ticker; 72 class Ticker;
73 class Profiler; 73 class Profiler;
74 class Semaphore; 74 class Semaphore;
75 class SlidingStateWindow; 75 class SlidingStateWindow;
76 class LogMessageBuilder; 76 class LogMessageBuilder;
77 class CompressionHelper;
78 77
79 #undef LOG 78 #undef LOG
80 // TODO(isolates): pass isolate pointer here. 79 // TODO(isolates): pass isolate pointer here.
81 #ifdef ENABLE_LOGGING_AND_PROFILING 80 #ifdef ENABLE_LOGGING_AND_PROFILING
82 #define LOG(Call) \ 81 #define LOG(Call) \
83 do { \ 82 do { \
84 v8::internal::Logger* logger = \ 83 v8::internal::Logger* logger = \
85 v8::internal::Isolate::Current()->logger(); \ 84 v8::internal::Isolate::Current()->logger(); \
86 if (logger->is_logging()) \ 85 if (logger->is_logging()) \
87 logger->Call; \ 86 logger->Call; \
88 } while (false) 87 } while (false)
89 #else 88 #else
90 #define LOG(Call) ((void) 0) 89 #define LOG(Call) ((void) 0)
91 #endif 90 #endif
92 91
93 #define LOG_EVENTS_AND_TAGS_LIST(V) \ 92 #define LOG_EVENTS_AND_TAGS_LIST(V) \
94 V(CODE_CREATION_EVENT, "code-creation", "cc") \ 93 V(CODE_CREATION_EVENT, "code-creation") \
95 V(CODE_MOVE_EVENT, "code-move", "cm") \ 94 V(CODE_MOVE_EVENT, "code-move") \
96 V(CODE_DELETE_EVENT, "code-delete", "cd") \ 95 V(CODE_DELETE_EVENT, "code-delete") \
97 V(CODE_MOVING_GC, "code-moving-gc", "cg") \ 96 V(CODE_MOVING_GC, "code-moving-gc") \
98 V(FUNCTION_CREATION_EVENT, "function-creation", "fc") \ 97 V(FUNCTION_CREATION_EVENT, "function-creation") \
99 V(FUNCTION_MOVE_EVENT, "function-move", "fm") \ 98 V(FUNCTION_MOVE_EVENT, "function-move") \
100 V(FUNCTION_DELETE_EVENT, "function-delete", "fd") \ 99 V(FUNCTION_DELETE_EVENT, "function-delete") \
101 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos", "sp") \ 100 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos") \
102 V(TICK_EVENT, "tick", "t") \ 101 V(TICK_EVENT, "tick") \
103 V(REPEAT_META_EVENT, "repeat", "r") \ 102 V(REPEAT_META_EVENT, "repeat") \
104 V(BUILTIN_TAG, "Builtin", "bi") \ 103 V(BUILTIN_TAG, "Builtin") \
105 V(CALL_DEBUG_BREAK_TAG, "CallDebugBreak", "cdb") \ 104 V(CALL_DEBUG_BREAK_TAG, "CallDebugBreak") \
106 V(CALL_DEBUG_PREPARE_STEP_IN_TAG, "CallDebugPrepareStepIn", "cdbsi") \ 105 V(CALL_DEBUG_PREPARE_STEP_IN_TAG, "CallDebugPrepareStepIn") \
107 V(CALL_IC_TAG, "CallIC", "cic") \ 106 V(CALL_IC_TAG, "CallIC") \
108 V(CALL_INITIALIZE_TAG, "CallInitialize", "ci") \ 107 V(CALL_INITIALIZE_TAG, "CallInitialize") \
109 V(CALL_MEGAMORPHIC_TAG, "CallMegamorphic", "cmm") \ 108 V(CALL_MEGAMORPHIC_TAG, "CallMegamorphic") \
110 V(CALL_MISS_TAG, "CallMiss", "cm") \ 109 V(CALL_MISS_TAG, "CallMiss") \
111 V(CALL_NORMAL_TAG, "CallNormal", "cn") \ 110 V(CALL_NORMAL_TAG, "CallNormal") \
112 V(CALL_PRE_MONOMORPHIC_TAG, "CallPreMonomorphic", "cpm") \ 111 V(CALL_PRE_MONOMORPHIC_TAG, "CallPreMonomorphic") \
113 V(KEYED_CALL_DEBUG_BREAK_TAG, "KeyedCallDebugBreak", "kcdb") \ 112 V(KEYED_CALL_DEBUG_BREAK_TAG, "KeyedCallDebugBreak") \
114 V(KEYED_CALL_DEBUG_PREPARE_STEP_IN_TAG, \ 113 V(KEYED_CALL_DEBUG_PREPARE_STEP_IN_TAG, \
115 "KeyedCallDebugPrepareStepIn", \ 114 "KeyedCallDebugPrepareStepIn") \
116 "kcdbsi") \ 115 V(KEYED_CALL_IC_TAG, "KeyedCallIC") \
117 V(KEYED_CALL_IC_TAG, "KeyedCallIC", "kcic") \ 116 V(KEYED_CALL_INITIALIZE_TAG, "KeyedCallInitialize") \
118 V(KEYED_CALL_INITIALIZE_TAG, "KeyedCallInitialize", "kci") \ 117 V(KEYED_CALL_MEGAMORPHIC_TAG, "KeyedCallMegamorphic") \
119 V(KEYED_CALL_MEGAMORPHIC_TAG, "KeyedCallMegamorphic", "kcmm") \ 118 V(KEYED_CALL_MISS_TAG, "KeyedCallMiss") \
120 V(KEYED_CALL_MISS_TAG, "KeyedCallMiss", "kcm") \ 119 V(KEYED_CALL_NORMAL_TAG, "KeyedCallNormal") \
121 V(KEYED_CALL_NORMAL_TAG, "KeyedCallNormal", "kcn") \ 120 V(KEYED_CALL_PRE_MONOMORPHIC_TAG, "KeyedCallPreMonomorphic") \
122 V(KEYED_CALL_PRE_MONOMORPHIC_TAG, \ 121 V(CALLBACK_TAG, "Callback") \
123 "KeyedCallPreMonomorphic", \ 122 V(EVAL_TAG, "Eval") \
124 "kcpm") \ 123 V(FUNCTION_TAG, "Function") \
125 V(CALLBACK_TAG, "Callback", "cb") \ 124 V(KEYED_LOAD_IC_TAG, "KeyedLoadIC") \
126 V(EVAL_TAG, "Eval", "e") \ 125 V(KEYED_STORE_IC_TAG, "KeyedStoreIC") \
127 V(FUNCTION_TAG, "Function", "f") \ 126 V(LAZY_COMPILE_TAG, "LazyCompile") \
128 V(KEYED_LOAD_IC_TAG, "KeyedLoadIC", "klic") \ 127 V(LOAD_IC_TAG, "LoadIC") \
129 V(KEYED_STORE_IC_TAG, "KeyedStoreIC", "ksic") \ 128 V(REG_EXP_TAG, "RegExp") \
130 V(LAZY_COMPILE_TAG, "LazyCompile", "lc") \ 129 V(SCRIPT_TAG, "Script") \
131 V(LOAD_IC_TAG, "LoadIC", "lic") \ 130 V(STORE_IC_TAG, "StoreIC") \
132 V(REG_EXP_TAG, "RegExp", "re") \ 131 V(STUB_TAG, "Stub") \
133 V(SCRIPT_TAG, "Script", "sc") \ 132 V(NATIVE_FUNCTION_TAG, "Function") \
134 V(STORE_IC_TAG, "StoreIC", "sic") \ 133 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \
135 V(STUB_TAG, "Stub", "s") \ 134 V(NATIVE_SCRIPT_TAG, "Script")
136 V(NATIVE_FUNCTION_TAG, "Function", "f") \
137 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile", "lc") \
138 V(NATIVE_SCRIPT_TAG, "Script", "sc")
139 // Note that 'NATIVE_' cases for functions and scripts are mapped onto 135 // Note that 'NATIVE_' cases for functions and scripts are mapped onto
140 // original tags when writing to the log. 136 // original tags when writing to the log.
141 137
142 138
143 class Sampler; 139 class Sampler;
144 140
145 141
146 class Logger { 142 class Logger {
147 public: 143 public:
148 #define DECLARE_ENUM(enum_item, ignore1, ignore2) enum_item, 144 #define DECLARE_ENUM(enum_item, ignore) enum_item,
149 enum LogEventsAndTags { 145 enum LogEventsAndTags {
150 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) 146 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM)
151 NUMBER_OF_LOG_EVENTS 147 NUMBER_OF_LOG_EVENTS
152 }; 148 };
153 #undef DECLARE_ENUM 149 #undef DECLARE_ENUM
154 150
155 // Acquires resources for logging if the right flags are set. 151 // Acquires resources for logging if the right flags are set.
156 bool Setup(); 152 bool Setup();
157 153
158 void EnsureTickerStarted(); 154 void EnsureTickerStarted();
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 // Profiler's sampling interval (in milliseconds). 296 // Profiler's sampling interval (in milliseconds).
301 static const int kSamplingIntervalMs = 1; 297 static const int kSamplingIntervalMs = 1;
302 298
303 // Callback from Log, stops profiling in case of insufficient resources. 299 // Callback from Log, stops profiling in case of insufficient resources.
304 void LogFailure(); 300 void LogFailure();
305 301
306 private: 302 private:
307 Logger(); 303 Logger();
308 ~Logger(); 304 ~Logger();
309 305
310 // Size of window used for log records compression.
311 static const int kCompressionWindowSize = 4;
312
313 // Emits the profiler's first message. 306 // Emits the profiler's first message.
314 void ProfilerBeginEvent(); 307 void ProfilerBeginEvent();
315 308
316 // Emits callback event messages. 309 // Emits callback event messages.
317 void CallbackEventInternal(const char* prefix, 310 void CallbackEventInternal(const char* prefix,
318 const char* name, 311 const char* name,
319 Address entry_point); 312 Address entry_point);
320 313
321 // Internal configurable move event. 314 // Internal configurable move event.
322 void MoveEventInternal(LogEventsAndTags event, Address from, Address to); 315 void MoveEventInternal(LogEventsAndTags event, Address from, Address to);
323 316
324 // Internal configurable move event. 317 // Internal configurable move event.
325 void DeleteEventInternal(LogEventsAndTags event, Address from); 318 void DeleteEventInternal(LogEventsAndTags event, Address from);
326 319
327 // Emits aliases for compressed messages.
328 void LogAliases();
329
330 // Emits the source code of a regexp. Used by regexp events. 320 // Emits the source code of a regexp. Used by regexp events.
331 void LogRegExpSource(Handle<JSRegExp> regexp); 321 void LogRegExpSource(Handle<JSRegExp> regexp);
332 322
333 // Used for logging stubs found in the snapshot. 323 // Used for logging stubs found in the snapshot.
334 void LogCodeObject(Object* code_object); 324 void LogCodeObject(Object* code_object);
335 325
336 // Emits general information about generated code. 326 // Emits general information about generated code.
337 void LogCodeInfo(); 327 void LogCodeInfo();
338 328
339 // Handles code creation when low-level profiling is active. 329 // Handles code creation when low-level profiling is active.
(...skipping 22 matching lines...) Expand all
362 // of samples. 352 // of samples.
363 Profiler* profiler_; 353 Profiler* profiler_;
364 354
365 // SlidingStateWindow instance keeping a sliding window of the most 355 // SlidingStateWindow instance keeping a sliding window of the most
366 // recent VM states. 356 // recent VM states.
367 SlidingStateWindow* sliding_state_window_; 357 SlidingStateWindow* sliding_state_window_;
368 358
369 // An array of log events names. 359 // An array of log events names.
370 const char* const* log_events_; 360 const char* const* log_events_;
371 361
372 // An instance of helper created if log compression is enabled.
373 CompressionHelper* compression_helper_;
374
375 // Internal implementation classes with access to 362 // Internal implementation classes with access to
376 // private members. 363 // private members.
377 friend class CompressionHelper;
378 friend class EventLog; 364 friend class EventLog;
379 friend class Isolate; 365 friend class Isolate;
380 friend class LogMessageBuilder; 366 friend class LogMessageBuilder;
381 friend class TimeLog; 367 friend class TimeLog;
382 friend class Profiler; 368 friend class Profiler;
383 friend class SlidingStateWindow; 369 friend class SlidingStateWindow;
384 friend class StackTracer; 370 friend class StackTracer;
385 friend class VMState; 371 friend class VMState;
386 372
387 friend class LoggerTestHelper; 373 friend class LoggerTestHelper;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 // Class that extracts stack trace, used for profiling. 437 // Class that extracts stack trace, used for profiling.
452 class StackTracer : public AllStatic { 438 class StackTracer : public AllStatic {
453 public: 439 public:
454 static void Trace(Isolate* isolate, TickSample* sample); 440 static void Trace(Isolate* isolate, TickSample* sample);
455 }; 441 };
456 442
457 } } // namespace v8::internal 443 } } // namespace v8::internal
458 444
459 445
460 #endif // V8_LOG_H_ 446 #endif // V8_LOG_H_
OLDNEW
« no previous file with comments | « src/ia32/deoptimizer-ia32.cc ('k') | src/log.cc » ('j') | src/log.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698