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

Side by Side Diff: src/log.h

Issue 435003: Patch for allowing several V8 instances in process:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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/jump-target.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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 V(FUNCTION_TAG, "Function", "f") \ 132 V(FUNCTION_TAG, "Function", "f") \
133 V(KEYED_LOAD_IC_TAG, "KeyedLoadIC", "klic") \ 133 V(KEYED_LOAD_IC_TAG, "KeyedLoadIC", "klic") \
134 V(KEYED_STORE_IC_TAG, "KeyedStoreIC", "ksic") \ 134 V(KEYED_STORE_IC_TAG, "KeyedStoreIC", "ksic") \
135 V(LAZY_COMPILE_TAG, "LazyCompile", "lc") \ 135 V(LAZY_COMPILE_TAG, "LazyCompile", "lc") \
136 V(LOAD_IC_TAG, "LoadIC", "lic") \ 136 V(LOAD_IC_TAG, "LoadIC", "lic") \
137 V(REG_EXP_TAG, "RegExp", "re") \ 137 V(REG_EXP_TAG, "RegExp", "re") \
138 V(SCRIPT_TAG, "Script", "sc") \ 138 V(SCRIPT_TAG, "Script", "sc") \
139 V(STORE_IC_TAG, "StoreIC", "sic") \ 139 V(STORE_IC_TAG, "StoreIC", "sic") \
140 V(STUB_TAG, "Stub", "s") 140 V(STUB_TAG, "Stub", "s")
141 141
142 class LoggerPrivateData;
143
144 class LoggerData {
145 #ifdef ENABLE_LOGGING_AND_PROFILING
146 // The sampler used by the profiler and the sliding state window.
147 Ticker* ticker_;
148
149 // When the statistical profile is active, profiler_
150 // points to a Profiler, that handles collection
151 // of samples.
152 Profiler* profiler_;
153
154 // A stack of VM states.
155 VMState* current_state_;
156
157 // Singleton bottom or default vm state.
158 VMState bottom_state_;
159
160 // SlidingStateWindow instance keeping a sliding window of the most
161 // recent VM states.
162 SlidingStateWindow* sliding_state_window_;
163
164 // An array of log events names.
165 const char** log_events_;
166
167 // An instance of helper created if log compression is enabled.
168 CompressionHelper* compression_helper_;
169
170 bool is_logging_;
171
172 LoggerPrivateData& private_data_;
173 #endif
174
175 friend class V8Context;
176 friend class Logger;
177 friend class VMState;
178 friend class Profiler;
179 friend class SlidingStateWindow;
180 friend class StackTracer;
181 friend class CompressionHelper;
182
183 LoggerData();
184 ~LoggerData();
185 DISALLOW_COPY_AND_ASSIGN(LoggerData);
186 };
187
142 class Logger { 188 class Logger {
143 public: 189 public:
144 #define DECLARE_ENUM(enum_item, ignore1, ignore2) enum_item, 190 #define DECLARE_ENUM(enum_item, ignore1, ignore2) enum_item,
145 enum LogEventsAndTags { 191 enum LogEventsAndTags {
146 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) 192 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM)
147 NUMBER_OF_LOG_EVENTS 193 NUMBER_OF_LOG_EVENTS
148 }; 194 };
149 #undef DECLARE_ENUM 195 #undef DECLARE_ENUM
150 196
151 // Acquires resources for logging if the right flags are set. 197 // Acquires resources for logging if the right flags are set.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 // ==== Events logged by --log-regexp ==== 294 // ==== Events logged by --log-regexp ====
249 // Regexp compilation and execution events. 295 // Regexp compilation and execution events.
250 296
251 static void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache); 297 static void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache);
252 298
253 // Log an event reported from generated code 299 // Log an event reported from generated code
254 static void LogRuntime(Vector<const char> format, JSArray* args); 300 static void LogRuntime(Vector<const char> format, JSArray* args);
255 301
256 #ifdef ENABLE_LOGGING_AND_PROFILING 302 #ifdef ENABLE_LOGGING_AND_PROFILING
257 static StateTag state() { 303 static StateTag state() {
258 return current_state_ ? current_state_->state() : OTHER; 304 LoggerData& data = v8_context()->logger_data_;
305 return data.current_state_ ? data.current_state_->state() : OTHER;
259 } 306 }
260 307
261 static bool is_logging() { 308 static bool is_logging() {
262 return is_logging_; 309 V8Context* const v8context = v8_context();
310 return v8context != NULL ? v8context->logger_data_.is_logging_:false;
263 } 311 }
264 312
265 // Pause/Resume collection of profiling data. 313 // Pause/Resume collection of profiling data.
266 // When data collection is paused, CPU Tick events are discarded until 314 // When data collection is paused, CPU Tick events are discarded until
267 // data collection is Resumed. 315 // data collection is Resumed.
268 static void PauseProfiler(int flags); 316 static void PauseProfiler(int flags);
269 static void ResumeProfiler(int flags); 317 static void ResumeProfiler(int flags);
270 static int GetActiveProfilerModules(); 318 static int GetActiveProfilerModules();
271 319
272 // If logging is performed into a memory buffer, allows to 320 // If logging is performed into a memory buffer, allows to
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 357
310 // Logs a StringEvent regardless of whether FLAG_log is true. 358 // Logs a StringEvent regardless of whether FLAG_log is true.
311 static void UncheckedStringEvent(const char* name, const char* value); 359 static void UncheckedStringEvent(const char* name, const char* value);
312 360
313 // Stops logging and profiling in case of insufficient resources. 361 // Stops logging and profiling in case of insufficient resources.
314 static void StopLoggingAndProfiling(); 362 static void StopLoggingAndProfiling();
315 363
316 // Returns whether profiler's sampler is active. 364 // Returns whether profiler's sampler is active.
317 static bool IsProfilerSamplerActive(); 365 static bool IsProfilerSamplerActive();
318 366
319 // The sampler used by the profiler and the sliding state window.
320 static Ticker* ticker_;
321
322 // When the statistical profile is active, profiler_
323 // points to a Profiler, that handles collection
324 // of samples.
325 static Profiler* profiler_;
326
327 // A stack of VM states.
328 static VMState* current_state_;
329
330 // Singleton bottom or default vm state.
331 static VMState bottom_state_;
332
333 // SlidingStateWindow instance keeping a sliding window of the most
334 // recent VM states.
335 static SlidingStateWindow* sliding_state_window_;
336
337 // An array of log events names.
338 static const char** log_events_;
339
340 // An instance of helper created if log compression is enabled.
341 static CompressionHelper* compression_helper_;
342
343 // Internal implementation classes with access to 367 // Internal implementation classes with access to
344 // private members. 368 // private members.
345 friend class CompressionHelper; 369 friend class CompressionHelper;
346 friend class EventLog; 370 friend class EventLog;
347 friend class TimeLog; 371 friend class TimeLog;
348 friend class Profiler; 372 friend class Profiler;
349 friend class SlidingStateWindow;
350 friend class StackTracer; 373 friend class StackTracer;
351 friend class VMState; 374 friend class VMState;
352 375
353 friend class LoggerTestHelper; 376 friend class LoggerTestHelper;
354
355 static bool is_logging_;
356 #else 377 #else
357 static bool is_logging() { return false; } 378 static bool is_logging() { return false; }
358 #endif 379 #endif
359 }; 380 };
360 381
361 382
362 // Class that extracts stack trace, used for profiling. 383 // Class that extracts stack trace, used for profiling.
363 class StackTracer : public AllStatic { 384 class StackTracer : public AllStatic {
364 public: 385 public:
365 static void Trace(TickSample* sample); 386 static void Trace(TickSample* sample);
366 }; 387 };
367 388
368 389
369 } } // namespace v8::internal 390 } } // namespace v8::internal
370 391
371 #endif // V8_LOG_H_ 392 #endif // V8_LOG_H_
OLDNEW
« no previous file with comments | « src/jump-target.cc ('k') | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698