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

Side by Side Diff: src/log.h

Issue 7535004: Merge bleeding edge up to 8774 into the GC branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 4 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
« no previous file with comments | « src/jsregexp.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 // Forward declarations. 73 // Forward declarations.
74 class HashMap; 74 class HashMap;
75 class LogMessageBuilder; 75 class LogMessageBuilder;
76 class Profiler; 76 class Profiler;
77 class Semaphore; 77 class Semaphore;
78 class SlidingStateWindow; 78 class SlidingStateWindow;
79 class Ticker; 79 class Ticker;
80 80
81 #undef LOG 81 #undef LOG
82 #ifdef ENABLE_LOGGING_AND_PROFILING
83 #define LOG(isolate, Call) \ 82 #define LOG(isolate, Call) \
84 do { \ 83 do { \
85 v8::internal::Logger* logger = \ 84 v8::internal::Logger* logger = \
86 (isolate)->logger(); \ 85 (isolate)->logger(); \
87 if (logger->is_logging()) \ 86 if (logger->is_logging()) \
88 logger->Call; \ 87 logger->Call; \
89 } while (false) 88 } while (false)
90 #else
91 #define LOG(isolate, Call) ((void) 0)
92 #endif
93 89
94 #define LOG_EVENTS_AND_TAGS_LIST(V) \ 90 #define LOG_EVENTS_AND_TAGS_LIST(V) \
95 V(CODE_CREATION_EVENT, "code-creation") \ 91 V(CODE_CREATION_EVENT, "code-creation") \
96 V(CODE_MOVE_EVENT, "code-move") \ 92 V(CODE_MOVE_EVENT, "code-move") \
97 V(CODE_DELETE_EVENT, "code-delete") \ 93 V(CODE_DELETE_EVENT, "code-delete") \
98 V(CODE_MOVING_GC, "code-moving-gc") \ 94 V(CODE_MOVING_GC, "code-moving-gc") \
99 V(SHARED_FUNC_MOVE_EVENT, "sfi-move") \ 95 V(SHARED_FUNC_MOVE_EVENT, "sfi-move") \
100 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos") \ 96 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos") \
101 V(SNAPSHOT_CODE_NAME_EVENT, "snapshot-code-name") \ 97 V(SNAPSHOT_CODE_NAME_EVENT, "snapshot-code-name") \
102 V(TICK_EVENT, "tick") \ 98 V(TICK_EVENT, "tick") \
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 151
156 // Acquires resources for logging if the right flags are set. 152 // Acquires resources for logging if the right flags are set.
157 bool Setup(); 153 bool Setup();
158 154
159 void EnsureTickerStarted(); 155 void EnsureTickerStarted();
160 void EnsureTickerStopped(); 156 void EnsureTickerStopped();
161 157
162 Sampler* sampler(); 158 Sampler* sampler();
163 159
164 // Frees resources acquired in Setup. 160 // Frees resources acquired in Setup.
165 void TearDown(); 161 // When a temporary file is used for the log, returns its stream descriptor,
162 // leaving the file open.
163 FILE* TearDown();
166 164
167 // Enable the computation of a sliding window of states. 165 // Enable the computation of a sliding window of states.
168 void EnableSlidingStateWindow(); 166 void EnableSlidingStateWindow();
169 167
170 // Emits an event with a string value -> (name, value). 168 // Emits an event with a string value -> (name, value).
171 void StringEvent(const char* name, const char* value); 169 void StringEvent(const char* name, const char* value);
172 170
173 // Emits an event with an int value -> (name, value). 171 // Emits an event with an int value -> (name, value).
174 void IntEvent(const char* name, int value); 172 void IntEvent(const char* name, int value);
175 void IntPtrTEvent(const char* name, intptr_t value); 173 void IntPtrTEvent(const char* name, intptr_t value);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 uintptr_t end); 264 uintptr_t end);
267 265
268 // ==== Events logged by --log-regexp ==== 266 // ==== Events logged by --log-regexp ====
269 // Regexp compilation and execution events. 267 // Regexp compilation and execution events.
270 268
271 void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache); 269 void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache);
272 270
273 // Log an event reported from generated code 271 // Log an event reported from generated code
274 void LogRuntime(Vector<const char> format, JSArray* args); 272 void LogRuntime(Vector<const char> format, JSArray* args);
275 273
276 #ifdef ENABLE_LOGGING_AND_PROFILING
277 bool is_logging() { 274 bool is_logging() {
278 return logging_nesting_ > 0; 275 return logging_nesting_ > 0;
279 } 276 }
280 277
281 // Pause/Resume collection of profiling data. 278 // Pause/Resume collection of profiling data.
282 // When data collection is paused, CPU Tick events are discarded until 279 // When data collection is paused, CPU Tick events are discarded until
283 // data collection is Resumed. 280 // data collection is Resumed.
284 void PauseProfiler(); 281 void PauseProfiler();
285 void ResumeProfiler(); 282 void ResumeProfiler();
286 bool IsProfilerPaused(); 283 bool IsProfilerPaused();
287 284
288 // If logging is performed into a memory buffer, allows to
289 // retrieve previously written messages. See v8.h.
290 int GetLogLines(int from_pos, char* dest_buf, int max_size);
291
292 // Logs all compiled functions found in the heap. 285 // Logs all compiled functions found in the heap.
293 void LogCompiledFunctions(); 286 void LogCompiledFunctions();
294 // Logs all accessor callbacks found in the heap. 287 // Logs all accessor callbacks found in the heap.
295 void LogAccessorCallbacks(); 288 void LogAccessorCallbacks();
296 // Used for logging stubs found in the snapshot. 289 // Used for logging stubs found in the snapshot.
297 void LogCodeObjects(); 290 void LogCodeObjects();
298 291
299 // Converts tag to a corresponding NATIVE_... if the script is native. 292 // Converts tag to a corresponding NATIVE_... if the script is native.
300 INLINE(static LogEventsAndTags ToNativeByScript(LogEventsAndTags, Script*)); 293 INLINE(static LogEventsAndTags ToNativeByScript(LogEventsAndTags, Script*));
301 294
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 Address last_address_; 411 Address last_address_;
419 // Logger::TickEvent(...) 412 // Logger::TickEvent(...)
420 Address prev_sp_; 413 Address prev_sp_;
421 Address prev_function_; 414 Address prev_function_;
422 // Logger::MoveEventInternal(...) 415 // Logger::MoveEventInternal(...)
423 Address prev_to_; 416 Address prev_to_;
424 // Logger::FunctionCreateEvent(...) 417 // Logger::FunctionCreateEvent(...)
425 Address prev_code_; 418 Address prev_code_;
426 419
427 friend class CpuProfiler; 420 friend class CpuProfiler;
428 #else
429 bool is_logging() { return false; }
430 #endif
431 }; 421 };
432 422
433 423
434 // Process wide registry of samplers. 424 // Process wide registry of samplers.
435 class SamplerRegistry : public AllStatic { 425 class SamplerRegistry : public AllStatic {
436 public: 426 public:
437 enum State { 427 enum State {
438 HAS_NO_SAMPLERS, 428 HAS_NO_SAMPLERS,
439 HAS_SAMPLERS, 429 HAS_SAMPLERS,
440 HAS_CPU_PROFILING_SAMPLERS 430 HAS_CPU_PROFILING_SAMPLERS
(...skipping 26 matching lines...) Expand all
467 // Class that extracts stack trace, used for profiling. 457 // Class that extracts stack trace, used for profiling.
468 class StackTracer : public AllStatic { 458 class StackTracer : public AllStatic {
469 public: 459 public:
470 static void Trace(Isolate* isolate, TickSample* sample); 460 static void Trace(Isolate* isolate, TickSample* sample);
471 }; 461 };
472 462
473 } } // namespace v8::internal 463 } } // namespace v8::internal
474 464
475 465
476 #endif // V8_LOG_H_ 466 #endif // V8_LOG_H_
OLDNEW
« no previous file with comments | « src/jsregexp.cc ('k') | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698