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

Side by Side Diff: src/log.h

Issue 1519027: Make VM state tracking to be independent of logging and profiling. (Closed)
Patch Set: Created 10 years, 8 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
« no previous file with comments | « src/api.cc ('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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 #ifdef ENABLE_LOGGING_AND_PROFILING 80 #ifdef ENABLE_LOGGING_AND_PROFILING
81 #define LOG(Call) \ 81 #define LOG(Call) \
82 do { \ 82 do { \
83 if (v8::internal::Logger::is_logging()) \ 83 if (v8::internal::Logger::is_logging()) \
84 v8::internal::Logger::Call; \ 84 v8::internal::Logger::Call; \
85 } while (false) 85 } while (false)
86 #else 86 #else
87 #define LOG(Call) ((void) 0) 87 #define LOG(Call) ((void) 0)
88 #endif 88 #endif
89 89
90 class VMState BASE_EMBEDDED {
91 #ifdef ENABLE_LOGGING_AND_PROFILING
92 public:
93 inline VMState(StateTag state);
94 inline ~VMState();
95
96 StateTag state() { return state_; }
97 Address external_callback() { return external_callback_; }
98 void set_external_callback(Address external_callback) {
99 external_callback_ = external_callback;
100 }
101
102 private:
103 bool disabled_;
104 StateTag state_;
105 VMState* previous_;
106 Address external_callback_;
107 #else
108 public:
109 explicit VMState(StateTag state) {}
110 #endif
111 };
112
113
114 #define LOG_EVENTS_AND_TAGS_LIST(V) \ 90 #define LOG_EVENTS_AND_TAGS_LIST(V) \
115 V(CODE_CREATION_EVENT, "code-creation", "cc") \ 91 V(CODE_CREATION_EVENT, "code-creation", "cc") \
116 V(CODE_MOVE_EVENT, "code-move", "cm") \ 92 V(CODE_MOVE_EVENT, "code-move", "cm") \
117 V(CODE_DELETE_EVENT, "code-delete", "cd") \ 93 V(CODE_DELETE_EVENT, "code-delete", "cd") \
118 V(FUNCTION_CREATION_EVENT, "function-creation", "fc") \ 94 V(FUNCTION_CREATION_EVENT, "function-creation", "fc") \
119 V(FUNCTION_MOVE_EVENT, "function-move", "fm") \ 95 V(FUNCTION_MOVE_EVENT, "function-move", "fm") \
120 V(FUNCTION_DELETE_EVENT, "function-delete", "fd") \ 96 V(FUNCTION_DELETE_EVENT, "function-delete", "fd") \
121 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos", "sp") \ 97 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos", "sp") \
122 V(TICK_EVENT, "tick", "t") \ 98 V(TICK_EVENT, "tick", "t") \
123 V(REPEAT_META_EVENT, "repeat", "r") \ 99 V(REPEAT_META_EVENT, "repeat", "r") \
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 233
258 // ==== Events logged by --log-regexp ==== 234 // ==== Events logged by --log-regexp ====
259 // Regexp compilation and execution events. 235 // Regexp compilation and execution events.
260 236
261 static void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache); 237 static void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache);
262 238
263 // Log an event reported from generated code 239 // Log an event reported from generated code
264 static void LogRuntime(Vector<const char> format, JSArray* args); 240 static void LogRuntime(Vector<const char> format, JSArray* args);
265 241
266 #ifdef ENABLE_LOGGING_AND_PROFILING 242 #ifdef ENABLE_LOGGING_AND_PROFILING
267 static StateTag state() {
268 return current_state_ ? current_state_->state() : OTHER;
269 }
270
271 static bool is_logging() { 243 static bool is_logging() {
272 return logging_nesting_ > 0; 244 return logging_nesting_ > 0;
273 } 245 }
274 246
275 // Pause/Resume collection of profiling data. 247 // Pause/Resume collection of profiling data.
276 // When data collection is paused, CPU Tick events are discarded until 248 // When data collection is paused, CPU Tick events are discarded until
277 // data collection is Resumed. 249 // data collection is Resumed.
278 static void PauseProfiler(int flags, int tag); 250 static void PauseProfiler(int flags, int tag);
279 static void ResumeProfiler(int flags, int tag); 251 static void ResumeProfiler(int flags, int tag);
280 static int GetActiveProfilerModules(); 252 static int GetActiveProfilerModules();
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 static bool IsProfilerSamplerActive(); 319 static bool IsProfilerSamplerActive();
348 320
349 // The sampler used by the profiler and the sliding state window. 321 // The sampler used by the profiler and the sliding state window.
350 static Ticker* ticker_; 322 static Ticker* ticker_;
351 323
352 // When the statistical profile is active, profiler_ 324 // When the statistical profile is active, profiler_
353 // points to a Profiler, that handles collection 325 // points to a Profiler, that handles collection
354 // of samples. 326 // of samples.
355 static Profiler* profiler_; 327 static Profiler* profiler_;
356 328
357 // A stack of VM states.
358 static VMState* current_state_;
359
360 // Singleton bottom or default vm state.
361 static VMState bottom_state_;
362
363 // SlidingStateWindow instance keeping a sliding window of the most 329 // SlidingStateWindow instance keeping a sliding window of the most
364 // recent VM states. 330 // recent VM states.
365 static SlidingStateWindow* sliding_state_window_; 331 static SlidingStateWindow* sliding_state_window_;
366 332
367 // An array of log events names. 333 // An array of log events names.
368 static const char** log_events_; 334 static const char** log_events_;
369 335
370 // An instance of helper created if log compression is enabled. 336 // An instance of helper created if log compression is enabled.
371 static CompressionHelper* compression_helper_; 337 static CompressionHelper* compression_helper_;
372 338
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 void SetProfiler(Profiler* profiler) { } 382 void SetProfiler(Profiler* profiler) { }
417 void ClearProfiler() { } 383 void ClearProfiler() { }
418 }; 384 };
419 385
420 #endif // ENABLE_CPP_PROFILES_PROCESSOR 386 #endif // ENABLE_CPP_PROFILES_PROCESSOR
421 387
422 } } // namespace v8::internal 388 } } // namespace v8::internal
423 389
424 390
425 #endif // V8_LOG_H_ 391 #endif // V8_LOG_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698