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

Side by Side Diff: src/log.h

Issue 5575006: Remove log compression support. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 10 years 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
« no previous file with comments | « src/flag-definitions.h ('k') | src/log.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifdef ENABLE_LOGGING_AND_PROFILING 79 #ifdef ENABLE_LOGGING_AND_PROFILING
81 #define LOG(Call) \ 80 #define LOG(Call) \
82 do { \ 81 do { \
83 if (v8::internal::Logger::is_logging()) \ 82 if (v8::internal::Logger::is_logging()) \
84 v8::internal::Logger::Call; \ 83 v8::internal::Logger::Call; \
85 } while (false) 84 } while (false)
86 #else 85 #else
87 #define LOG(Call) ((void) 0) 86 #define LOG(Call) ((void) 0)
88 #endif 87 #endif
89 88
90 #define LOG_EVENTS_AND_TAGS_LIST(V) \ 89 #define LOG_EVENTS_AND_TAGS_LIST(V) \
91 V(CODE_CREATION_EVENT, "code-creation", "cc") \ 90 V(CODE_CREATION_EVENT, "code-creation") \
92 V(CODE_MOVE_EVENT, "code-move", "cm") \ 91 V(CODE_MOVE_EVENT, "code-move") \
93 V(CODE_DELETE_EVENT, "code-delete", "cd") \ 92 V(CODE_DELETE_EVENT, "code-delete") \
94 V(CODE_MOVING_GC, "code-moving-gc", "cg") \ 93 V(CODE_MOVING_GC, "code-moving-gc") \
95 V(FUNCTION_CREATION_EVENT, "function-creation", "fc") \ 94 V(FUNCTION_CREATION_EVENT, "function-creation") \
96 V(FUNCTION_MOVE_EVENT, "function-move", "fm") \ 95 V(FUNCTION_MOVE_EVENT, "function-move") \
97 V(FUNCTION_DELETE_EVENT, "function-delete", "fd") \ 96 V(FUNCTION_DELETE_EVENT, "function-delete") \
98 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos", "sp") \ 97 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos") \
99 V(TICK_EVENT, "tick", "t") \ 98 V(TICK_EVENT, "tick") \
100 V(REPEAT_META_EVENT, "repeat", "r") \ 99 V(REPEAT_META_EVENT, "repeat") \
101 V(BUILTIN_TAG, "Builtin", "bi") \ 100 V(BUILTIN_TAG, "Builtin") \
102 V(CALL_DEBUG_BREAK_TAG, "CallDebugBreak", "cdb") \ 101 V(CALL_DEBUG_BREAK_TAG, "CallDebugBreak") \
103 V(CALL_DEBUG_PREPARE_STEP_IN_TAG, "CallDebugPrepareStepIn", "cdbsi") \ 102 V(CALL_DEBUG_PREPARE_STEP_IN_TAG, "CallDebugPrepareStepIn") \
104 V(CALL_IC_TAG, "CallIC", "cic") \ 103 V(CALL_IC_TAG, "CallIC") \
105 V(CALL_INITIALIZE_TAG, "CallInitialize", "ci") \ 104 V(CALL_INITIALIZE_TAG, "CallInitialize") \
106 V(CALL_MEGAMORPHIC_TAG, "CallMegamorphic", "cmm") \ 105 V(CALL_MEGAMORPHIC_TAG, "CallMegamorphic") \
107 V(CALL_MISS_TAG, "CallMiss", "cm") \ 106 V(CALL_MISS_TAG, "CallMiss") \
108 V(CALL_NORMAL_TAG, "CallNormal", "cn") \ 107 V(CALL_NORMAL_TAG, "CallNormal") \
109 V(CALL_PRE_MONOMORPHIC_TAG, "CallPreMonomorphic", "cpm") \ 108 V(CALL_PRE_MONOMORPHIC_TAG, "CallPreMonomorphic") \
110 V(KEYED_CALL_DEBUG_BREAK_TAG, "KeyedCallDebugBreak", "kcdb") \ 109 V(KEYED_CALL_DEBUG_BREAK_TAG, "KeyedCallDebugBreak") \
111 V(KEYED_CALL_DEBUG_PREPARE_STEP_IN_TAG, \ 110 V(KEYED_CALL_DEBUG_PREPARE_STEP_IN_TAG, \
112 "KeyedCallDebugPrepareStepIn", \ 111 "KeyedCallDebugPrepareStepIn") \
113 "kcdbsi") \ 112 V(KEYED_CALL_IC_TAG, "KeyedCallIC") \
114 V(KEYED_CALL_IC_TAG, "KeyedCallIC", "kcic") \ 113 V(KEYED_CALL_INITIALIZE_TAG, "KeyedCallInitialize") \
115 V(KEYED_CALL_INITIALIZE_TAG, "KeyedCallInitialize", "kci") \ 114 V(KEYED_CALL_MEGAMORPHIC_TAG, "KeyedCallMegamorphic") \
116 V(KEYED_CALL_MEGAMORPHIC_TAG, "KeyedCallMegamorphic", "kcmm") \ 115 V(KEYED_CALL_MISS_TAG, "KeyedCallMiss") \
117 V(KEYED_CALL_MISS_TAG, "KeyedCallMiss", "kcm") \ 116 V(KEYED_CALL_NORMAL_TAG, "KeyedCallNormal") \
118 V(KEYED_CALL_NORMAL_TAG, "KeyedCallNormal", "kcn") \ 117 V(KEYED_CALL_PRE_MONOMORPHIC_TAG, "KeyedCallPreMonomorphic") \
119 V(KEYED_CALL_PRE_MONOMORPHIC_TAG, \ 118 V(CALLBACK_TAG, "Callback") \
120 "KeyedCallPreMonomorphic", \ 119 V(EVAL_TAG, "Eval") \
121 "kcpm") \ 120 V(FUNCTION_TAG, "Function") \
122 V(CALLBACK_TAG, "Callback", "cb") \ 121 V(KEYED_LOAD_IC_TAG, "KeyedLoadIC") \
123 V(EVAL_TAG, "Eval", "e") \ 122 V(KEYED_STORE_IC_TAG, "KeyedStoreIC") \
124 V(FUNCTION_TAG, "Function", "f") \ 123 V(LAZY_COMPILE_TAG, "LazyCompile") \
125 V(KEYED_LOAD_IC_TAG, "KeyedLoadIC", "klic") \ 124 V(LOAD_IC_TAG, "LoadIC") \
126 V(KEYED_STORE_IC_TAG, "KeyedStoreIC", "ksic") \ 125 V(REG_EXP_TAG, "RegExp") \
127 V(LAZY_COMPILE_TAG, "LazyCompile", "lc") \ 126 V(SCRIPT_TAG, "Script") \
128 V(LOAD_IC_TAG, "LoadIC", "lic") \ 127 V(STORE_IC_TAG, "StoreIC") \
129 V(REG_EXP_TAG, "RegExp", "re") \ 128 V(STUB_TAG, "Stub") \
130 V(SCRIPT_TAG, "Script", "sc") \ 129 V(NATIVE_FUNCTION_TAG, "Function") \
131 V(STORE_IC_TAG, "StoreIC", "sic") \ 130 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \
132 V(STUB_TAG, "Stub", "s") \ 131 V(NATIVE_SCRIPT_TAG, "Script")
133 V(NATIVE_FUNCTION_TAG, "Function", "f") \
134 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile", "lc") \
135 V(NATIVE_SCRIPT_TAG, "Script", "sc")
136 // Note that 'NATIVE_' cases for functions and scripts are mapped onto 132 // Note that 'NATIVE_' cases for functions and scripts are mapped onto
137 // original tags when writing to the log. 133 // original tags when writing to the log.
138 134
139 135
140 class Logger { 136 class Logger {
141 public: 137 public:
142 #define DECLARE_ENUM(enum_item, ignore1, ignore2) enum_item, 138 #define DECLARE_ENUM(enum_item, ignore) enum_item,
143 enum LogEventsAndTags { 139 enum LogEventsAndTags {
144 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) 140 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM)
145 NUMBER_OF_LOG_EVENTS 141 NUMBER_OF_LOG_EVENTS
146 }; 142 };
147 #undef DECLARE_ENUM 143 #undef DECLARE_ENUM
148 144
149 // Acquires resources for logging if the right flags are set. 145 // Acquires resources for logging if the right flags are set.
150 static bool Setup(); 146 static bool Setup();
151 147
152 // Frees resources acquired in Setup. 148 // Frees resources acquired in Setup.
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 static void LogCodeObjects(); 278 static void LogCodeObjects();
283 279
284 // Converts tag to a corresponding NATIVE_... if the script is native. 280 // Converts tag to a corresponding NATIVE_... if the script is native.
285 INLINE(static LogEventsAndTags ToNativeByScript(LogEventsAndTags, Script*)); 281 INLINE(static LogEventsAndTags ToNativeByScript(LogEventsAndTags, Script*));
286 282
287 // Profiler's sampling interval (in milliseconds). 283 // Profiler's sampling interval (in milliseconds).
288 static const int kSamplingIntervalMs = 1; 284 static const int kSamplingIntervalMs = 1;
289 285
290 private: 286 private:
291 287
292 // Size of window used for log records compression.
293 static const int kCompressionWindowSize = 4;
294
295 // Emits the profiler's first message. 288 // Emits the profiler's first message.
296 static void ProfilerBeginEvent(); 289 static void ProfilerBeginEvent();
297 290
298 // Emits callback event messages. 291 // Emits callback event messages.
299 static void CallbackEventInternal(const char* prefix, 292 static void CallbackEventInternal(const char* prefix,
300 const char* name, 293 const char* name,
301 Address entry_point); 294 Address entry_point);
302 295
303 // Internal configurable move event. 296 // Internal configurable move event.
304 static void MoveEventInternal(LogEventsAndTags event, 297 static void MoveEventInternal(LogEventsAndTags event,
305 Address from, 298 Address from,
306 Address to); 299 Address to);
307 300
308 // Internal configurable move event. 301 // Internal configurable move event.
309 static void DeleteEventInternal(LogEventsAndTags event, 302 static void DeleteEventInternal(LogEventsAndTags event,
310 Address from); 303 Address from);
311 304
312 // Emits aliases for compressed messages.
313 static void LogAliases();
314
315 // Emits the source code of a regexp. Used by regexp events. 305 // Emits the source code of a regexp. Used by regexp events.
316 static void LogRegExpSource(Handle<JSRegExp> regexp); 306 static void LogRegExpSource(Handle<JSRegExp> regexp);
317 307
318 // Used for logging stubs found in the snapshot. 308 // Used for logging stubs found in the snapshot.
319 static void LogCodeObject(Object* code_object); 309 static void LogCodeObject(Object* code_object);
320 310
321 // Emits general information about generated code. 311 // Emits general information about generated code.
322 static void LogCodeInfo(); 312 static void LogCodeInfo();
323 313
324 // Handles code creation when low-level profiling is active. 314 // Handles code creation when low-level profiling is active.
(...skipping 22 matching lines...) Expand all
347 337
348 // When the statistical profile is active, profiler_ 338 // When the statistical profile is active, profiler_
349 // points to a Profiler, that handles collection 339 // points to a Profiler, that handles collection
350 // of samples. 340 // of samples.
351 static Profiler* profiler_; 341 static Profiler* profiler_;
352 342
353 // SlidingStateWindow instance keeping a sliding window of the most 343 // SlidingStateWindow instance keeping a sliding window of the most
354 // recent VM states. 344 // recent VM states.
355 static SlidingStateWindow* sliding_state_window_; 345 static SlidingStateWindow* sliding_state_window_;
356 346
357 // An array of log events names.
358 static const char** log_events_;
359
360 // An instance of helper created if log compression is enabled.
361 static CompressionHelper* compression_helper_;
362
363 // Internal implementation classes with access to 347 // Internal implementation classes with access to
364 // private members. 348 // private members.
365 friend class CompressionHelper;
366 friend class EventLog; 349 friend class EventLog;
367 friend class TimeLog; 350 friend class TimeLog;
368 friend class Profiler; 351 friend class Profiler;
369 friend class SlidingStateWindow; 352 friend class SlidingStateWindow;
370 friend class StackTracer; 353 friend class StackTracer;
371 friend class VMState; 354 friend class VMState;
372 355
373 friend class LoggerTestHelper; 356 friend class LoggerTestHelper;
374 357
375 static int logging_nesting_; 358 static int logging_nesting_;
(...skipping 10 matching lines...) Expand all
386 // Class that extracts stack trace, used for profiling. 369 // Class that extracts stack trace, used for profiling.
387 class StackTracer : public AllStatic { 370 class StackTracer : public AllStatic {
388 public: 371 public:
389 static void Trace(TickSample* sample); 372 static void Trace(TickSample* sample);
390 }; 373 };
391 374
392 } } // namespace v8::internal 375 } } // namespace v8::internal
393 376
394 377
395 #endif // V8_LOG_H_ 378 #endif // V8_LOG_H_
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698