blob: 3a4d79b8da09e08b15a0dd9e6406d635878ea7e3 [file] [log] [blame]
ager@chromium.org9258b6b2008-09-11 09:11:10 +00001// Copyright 2006-2008 the V8 project authors. All rights reserved.
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +00002// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions are
4// met:
5//
6// * Redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer.
8// * Redistributions in binary form must reproduce the above
9// copyright notice, this list of conditions and the following
10// disclaimer in the documentation and/or other materials provided
11// with the distribution.
12// * Neither the name of Google Inc. nor the names of its
13// contributors may be used to endorse or promote products derived
14// from this software without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28#ifndef V8_LOG_H_
29#define V8_LOG_H_
30
ager@chromium.org3e875802009-06-29 08:26:34 +000031#include "platform.h"
32#include "log-utils.h"
33
kasperl@chromium.org71affb52009-05-26 05:44:31 +000034namespace v8 {
35namespace internal {
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000036
37// Logger is used for collecting logging information from V8 during
38// execution. The result is dumped to a file.
39//
40// Available command line flags:
41//
42// --log
43// Minimal logging (no API, code, or GC sample events), default is off.
44//
45// --log-all
46// Log all events to the file, default is off. This is the same as combining
kasperl@chromium.orgb9123622008-09-17 14:05:56 +000047// --log-api, --log-code, --log-gc, and --log-regexp.
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000048//
49// --log-api
50// Log API events to the logfile, default is off. --log-api implies --log.
51//
52// --log-code
53// Log code (create, move, and delete) events to the logfile, default is off.
54// --log-code implies --log.
55//
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000056// --log-gc
57// Log GC heap samples after each GC that can be processed by hp2ps, default
58// is off. --log-gc implies --log.
59//
kasperl@chromium.orgb9123622008-09-17 14:05:56 +000060// --log-regexp
61// Log creation and use of regular expressions, Default is off.
62// --log-regexp implies --log.
63//
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000064// --logfile <filename>
65// Specify the name of the logfile, default is "v8.log".
66//
67// --prof
68// Collect statistical profiling information (ticks), default is off. The
69// tick profiler requires code events, so --prof implies --log-code.
70
71// Forward declarations.
72class Ticker;
73class Profiler;
74class Semaphore;
75class SlidingStateWindow;
ager@chromium.org381abbb2009-02-25 13:23:22 +000076class LogMessageBuilder;
ager@chromium.orgeadaf222009-06-16 09:43:10 +000077class CompressionHelper;
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000078
79#undef LOG
80#ifdef ENABLE_LOGGING_AND_PROFILING
christian.plesner.hansen@gmail.com37abdec2009-01-06 14:43:28 +000081#define LOG(Call) \
82 do { \
ager@chromium.org3e875802009-06-29 08:26:34 +000083 if (v8::internal::Logger::is_logging()) \
christian.plesner.hansen@gmail.com37abdec2009-01-06 14:43:28 +000084 v8::internal::Logger::Call; \
85 } while (false)
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000086#else
87#define LOG(Call) ((void) 0)
88#endif
89
ricow@chromium.orgc9c80822010-04-21 08:22:37 +000090#define LOG_EVENTS_AND_TAGS_LIST(V) \
ager@chromium.orgeadaf222009-06-16 09:43:10 +000091 V(CODE_CREATION_EVENT, "code-creation", "cc") \
92 V(CODE_MOVE_EVENT, "code-move", "cm") \
93 V(CODE_DELETE_EVENT, "code-delete", "cd") \
whesse@chromium.org4a5224e2010-10-20 12:37:07 +000094 V(CODE_MOVING_GC, "code-moving-gc", "cg") \
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +000095 V(FUNCTION_CREATION_EVENT, "function-creation", "fc") \
96 V(FUNCTION_MOVE_EVENT, "function-move", "fm") \
97 V(FUNCTION_DELETE_EVENT, "function-delete", "fd") \
98 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos", "sp") \
ager@chromium.orgeadaf222009-06-16 09:43:10 +000099 V(TICK_EVENT, "tick", "t") \
100 V(REPEAT_META_EVENT, "repeat", "r") \
101 V(BUILTIN_TAG, "Builtin", "bi") \
102 V(CALL_DEBUG_BREAK_TAG, "CallDebugBreak", "cdb") \
103 V(CALL_DEBUG_PREPARE_STEP_IN_TAG, "CallDebugPrepareStepIn", "cdbsi") \
104 V(CALL_IC_TAG, "CallIC", "cic") \
105 V(CALL_INITIALIZE_TAG, "CallInitialize", "ci") \
106 V(CALL_MEGAMORPHIC_TAG, "CallMegamorphic", "cmm") \
107 V(CALL_MISS_TAG, "CallMiss", "cm") \
108 V(CALL_NORMAL_TAG, "CallNormal", "cn") \
109 V(CALL_PRE_MONOMORPHIC_TAG, "CallPreMonomorphic", "cpm") \
lrn@chromium.org1af7e1b2010-06-07 11:12:01 +0000110 V(KEYED_CALL_DEBUG_BREAK_TAG, "KeyedCallDebugBreak", "kcdb") \
111 V(KEYED_CALL_DEBUG_PREPARE_STEP_IN_TAG, \
112 "KeyedCallDebugPrepareStepIn", \
113 "kcdbsi") \
114 V(KEYED_CALL_IC_TAG, "KeyedCallIC", "kcic") \
115 V(KEYED_CALL_INITIALIZE_TAG, "KeyedCallInitialize", "kci") \
116 V(KEYED_CALL_MEGAMORPHIC_TAG, "KeyedCallMegamorphic", "kcmm") \
117 V(KEYED_CALL_MISS_TAG, "KeyedCallMiss", "kcm") \
118 V(KEYED_CALL_NORMAL_TAG, "KeyedCallNormal", "kcn") \
119 V(KEYED_CALL_PRE_MONOMORPHIC_TAG, \
120 "KeyedCallPreMonomorphic", \
121 "kcpm") \
ager@chromium.org01beca72009-11-24 14:29:16 +0000122 V(CALLBACK_TAG, "Callback", "cb") \
ager@chromium.orgeadaf222009-06-16 09:43:10 +0000123 V(EVAL_TAG, "Eval", "e") \
124 V(FUNCTION_TAG, "Function", "f") \
125 V(KEYED_LOAD_IC_TAG, "KeyedLoadIC", "klic") \
126 V(KEYED_STORE_IC_TAG, "KeyedStoreIC", "ksic") \
127 V(LAZY_COMPILE_TAG, "LazyCompile", "lc") \
128 V(LOAD_IC_TAG, "LoadIC", "lic") \
129 V(REG_EXP_TAG, "RegExp", "re") \
130 V(SCRIPT_TAG, "Script", "sc") \
131 V(STORE_IC_TAG, "StoreIC", "sic") \
ricow@chromium.orgc9c80822010-04-21 08:22:37 +0000132 V(STUB_TAG, "Stub", "s") \
ager@chromium.org357bf652010-04-12 11:30:10 +0000133 V(NATIVE_FUNCTION_TAG, "Function", "f") \
134 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile", "lc") \
135 V(NATIVE_SCRIPT_TAG, "Script", "sc")
ricow@chromium.orgc9c80822010-04-21 08:22:37 +0000136// Note that 'NATIVE_' cases for functions and scripts are mapped onto
137// original tags when writing to the log.
138
ager@chromium.org357bf652010-04-12 11:30:10 +0000139
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000140class Logger {
141 public:
ager@chromium.orgeadaf222009-06-16 09:43:10 +0000142#define DECLARE_ENUM(enum_item, ignore1, ignore2) enum_item,
143 enum LogEventsAndTags {
144 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM)
145 NUMBER_OF_LOG_EVENTS
146 };
147#undef DECLARE_ENUM
148
ager@chromium.org9085a012009-05-11 19:22:57 +0000149 // Acquires resources for logging if the right flags are set.
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000150 static bool Setup();
151
ager@chromium.org9085a012009-05-11 19:22:57 +0000152 // Frees resources acquired in Setup.
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000153 static void TearDown();
154
155 // Enable the computation of a sliding window of states.
156 static void EnableSlidingStateWindow();
157
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000158 // Emits an event with a string value -> (name, value).
159 static void StringEvent(const char* name, const char* value);
160
161 // Emits an event with an int value -> (name, value).
162 static void IntEvent(const char* name, int value);
kmillikin@chromium.orgf05f2912010-09-30 10:07:24 +0000163 static void IntPtrTEvent(const char* name, intptr_t value);
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000164
165 // Emits an event with an handle value -> (name, location).
166 static void HandleEvent(const char* name, Object** location);
167
168 // Emits memory management events for C allocated structures.
169 static void NewEvent(const char* name, void* object, size_t size);
170 static void DeleteEvent(const char* name, void* object);
171
172 // Emits an event with a tag, and some resource usage information.
173 // -> (name, tag, <rusage information>).
174 // Currently, the resource usage information is a process time stamp
175 // and a real time timestamp.
176 static void ResourceEvent(const char* name, const char* tag);
177
178 // Emits an event that an undefined property was read from an
179 // object.
ager@chromium.org8bb60582008-12-11 12:02:20 +0000180 static void SuspectReadEvent(String* name, Object* obj);
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000181
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000182 // Emits an event when a message is put on or read from a debugging queue.
183 // DebugTag lets us put a call-site specific label on the event.
184 static void DebugTag(const char* call_site_tag);
185 static void DebugEvent(const char* event_type, Vector<uint16_t> parameter);
186
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000187
188 // ==== Events logged by --log-api. ====
189 static void ApiNamedSecurityCheck(Object* key);
190 static void ApiIndexedSecurityCheck(uint32_t index);
191 static void ApiNamedPropertyAccess(const char* tag,
192 JSObject* holder,
193 Object* name);
194 static void ApiIndexedPropertyAccess(const char* tag,
195 JSObject* holder,
196 uint32_t index);
197 static void ApiObjectAccess(const char* tag, JSObject* obj);
198 static void ApiEntryCall(const char* name);
199
200
201 // ==== Events logged by --log-code. ====
ager@chromium.org01beca72009-11-24 14:29:16 +0000202 // Emits a code event for a callback function.
203 static void CallbackEvent(String* name, Address entry_point);
sgjesse@chromium.orgac6aa172009-12-04 12:29:05 +0000204 static void GetterCallbackEvent(String* name, Address entry_point);
205 static void SetterCallbackEvent(String* name, Address entry_point);
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000206 // Emits a code create event.
ager@chromium.orgeadaf222009-06-16 09:43:10 +0000207 static void CodeCreateEvent(LogEventsAndTags tag,
208 Code* code, const char* source);
209 static void CodeCreateEvent(LogEventsAndTags tag, Code* code, String* name);
210 static void CodeCreateEvent(LogEventsAndTags tag, Code* code, String* name,
iposva@chromium.org245aa852009-02-10 00:49:54 +0000211 String* source, int line);
ager@chromium.orgeadaf222009-06-16 09:43:10 +0000212 static void CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count);
whesse@chromium.org4a5224e2010-10-20 12:37:07 +0000213 static void CodeMovingGCEvent();
ager@chromium.org71daaf62009-04-01 07:22:49 +0000214 // Emits a code create event for a RegExp.
215 static void RegExpCodeCreateEvent(Code* code, String* source);
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000216 // Emits a code move event.
217 static void CodeMoveEvent(Address from, Address to);
218 // Emits a code delete event.
219 static void CodeDeleteEvent(Address from);
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +0000220 // Emits a function object create event.
221 static void FunctionCreateEvent(JSFunction* function);
whesse@chromium.org4a5224e2010-10-20 12:37:07 +0000222 static void FunctionCreateEventFromMove(JSFunction* function);
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +0000223 // Emits a function move event.
224 static void FunctionMoveEvent(Address from, Address to);
225 // Emits a function delete event.
226 static void FunctionDeleteEvent(Address from);
227
228 static void SnapshotPositionEvent(Address addr, int pos);
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000229
230 // ==== Events logged by --log-gc. ====
231 // Heap sampling events: start, end, and individual types.
232 static void HeapSampleBeginEvent(const char* space, const char* kind);
233 static void HeapSampleEndEvent(const char* space, const char* kind);
234 static void HeapSampleItemEvent(const char* type, int number, int bytes);
sgjesse@chromium.org0b6db592009-07-30 14:48:31 +0000235 static void HeapSampleJSConstructorEvent(const char* constructor,
236 int number, int bytes);
christian.plesner.hansen@gmail.com2bc58ef2009-09-22 10:00:30 +0000237 static void HeapSampleJSRetainersEvent(const char* constructor,
238 const char* event);
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000239 static void HeapSampleJSProducerEvent(const char* constructor,
240 Address* stack);
kasperl@chromium.orge959c182009-07-27 08:59:04 +0000241 static void HeapSampleStats(const char* space, const char* kind,
kmillikin@chromium.orgf05f2912010-09-30 10:07:24 +0000242 intptr_t capacity, intptr_t used);
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000243
244 static void SharedLibraryEvent(const char* library_path,
ager@chromium.org5aa501c2009-06-23 07:57:28 +0000245 uintptr_t start,
246 uintptr_t end);
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000247 static void SharedLibraryEvent(const wchar_t* library_path,
ager@chromium.org5aa501c2009-06-23 07:57:28 +0000248 uintptr_t start,
249 uintptr_t end);
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000250
kasperl@chromium.orgb9123622008-09-17 14:05:56 +0000251 // ==== Events logged by --log-regexp ====
252 // Regexp compilation and execution events.
253
kasperl@chromium.org9fe21c62008-10-28 08:53:51 +0000254 static void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache);
kasperl@chromium.orgb9123622008-09-17 14:05:56 +0000255
christian.plesner.hansen@gmail.com37abdec2009-01-06 14:43:28 +0000256 // Log an event reported from generated code
257 static void LogRuntime(Vector<const char> format, JSArray* args);
kasperl@chromium.orgb9123622008-09-17 14:05:56 +0000258
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000259#ifdef ENABLE_LOGGING_AND_PROFILING
ager@chromium.org3e875802009-06-29 08:26:34 +0000260 static bool is_logging() {
ager@chromium.orgce5e87b2010-03-10 10:24:18 +0000261 return logging_nesting_ > 0;
ager@chromium.org3e875802009-06-29 08:26:34 +0000262 }
christian.plesner.hansen@gmail.com37abdec2009-01-06 14:43:28 +0000263
iposva@chromium.org245aa852009-02-10 00:49:54 +0000264 // Pause/Resume collection of profiling data.
sgjesse@chromium.orgb9d7da12009-08-05 08:38:10 +0000265 // When data collection is paused, CPU Tick events are discarded until
iposva@chromium.org245aa852009-02-10 00:49:54 +0000266 // data collection is Resumed.
ager@chromium.org5c838252010-02-19 08:53:10 +0000267 static void PauseProfiler(int flags, int tag);
268 static void ResumeProfiler(int flags, int tag);
sgjesse@chromium.orgb9d7da12009-08-05 08:38:10 +0000269 static int GetActiveProfilerModules();
iposva@chromium.org245aa852009-02-10 00:49:54 +0000270
ager@chromium.org9085a012009-05-11 19:22:57 +0000271 // If logging is performed into a memory buffer, allows to
272 // retrieve previously written messages. See v8.h.
273 static int GetLogLines(int from_pos, char* dest_buf, int max_size);
274
kasperl@chromium.org71affb52009-05-26 05:44:31 +0000275 // Logs all compiled functions found in the heap.
276 static void LogCompiledFunctions();
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +0000277 // Logs all compiled JSFunction objects found in the heap.
278 static void LogFunctionObjects();
sgjesse@chromium.orgac6aa172009-12-04 12:29:05 +0000279 // Logs all accessor callbacks found in the heap.
280 static void LogAccessorCallbacks();
ager@chromium.orgc4c92722009-11-18 14:12:51 +0000281 // Used for logging stubs found in the snapshot.
ager@chromium.org5c838252010-02-19 08:53:10 +0000282 static void LogCodeObjects();
kasperl@chromium.org71affb52009-05-26 05:44:31 +0000283
ager@chromium.org357bf652010-04-12 11:30:10 +0000284 // Converts tag to a corresponding NATIVE_... if the script is native.
285 INLINE(static LogEventsAndTags ToNativeByScript(LogEventsAndTags, Script*));
286
sgjesse@chromium.org755c5b12009-05-29 11:04:38 +0000287 // Profiler's sampling interval (in milliseconds).
288 static const int kSamplingIntervalMs = 1;
289
ricow@chromium.orgc9c80822010-04-21 08:22:37 +0000290 private:
291
ager@chromium.orgeadaf222009-06-16 09:43:10 +0000292 // Size of window used for log records compression.
293 static const int kCompressionWindowSize = 4;
294
sgjesse@chromium.org755c5b12009-05-29 11:04:38 +0000295 // Emits the profiler's first message.
296 static void ProfilerBeginEvent();
297
sgjesse@chromium.orgac6aa172009-12-04 12:29:05 +0000298 // Emits callback event messages.
299 static void CallbackEventInternal(const char* prefix,
300 const char* name,
301 Address entry_point);
302
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +0000303 // Internal configurable move event.
304 static void MoveEventInternal(LogEventsAndTags event,
305 Address from,
306 Address to);
307
308 // Internal configurable move event.
309 static void DeleteEventInternal(LogEventsAndTags event,
310 Address from);
311
ager@chromium.orgeadaf222009-06-16 09:43:10 +0000312 // Emits aliases for compressed messages.
313 static void LogAliases();
314
kasperl@chromium.orgb9123622008-09-17 14:05:56 +0000315 // Emits the source code of a regexp. Used by regexp events.
ager@chromium.org236ad962008-09-25 09:45:57 +0000316 static void LogRegExpSource(Handle<JSRegExp> regexp);
kasperl@chromium.orgb9123622008-09-17 14:05:56 +0000317
ager@chromium.org5c838252010-02-19 08:53:10 +0000318 // Used for logging stubs found in the snapshot.
319 static void LogCodeObject(Object* code_object);
320
whesse@chromium.org4a5224e2010-10-20 12:37:07 +0000321 // Emits general information about generated code.
322 static void LogCodeInfo();
323
324 // Handles code creation when low-level profiling is active.
325 static void LowLevelCodeCreateEvent(Code* code, LogMessageBuilder* msg);
326
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000327 // Emits a profiler tick event. Used by the profiler thread.
328 static void TickEvent(TickSample* sample, bool overflow);
329
330 static void ApiEvent(const char* name, ...);
331
ager@chromium.org6f10e412009-02-13 10:11:16 +0000332 // Logs a StringEvent regardless of whether FLAG_log is true.
333 static void UncheckedStringEvent(const char* name, const char* value);
334
ager@chromium.orgce5e87b2010-03-10 10:24:18 +0000335 // Logs an IntEvent regardless of whether FLAG_log is true.
336 static void UncheckedIntEvent(const char* name, int value);
kmillikin@chromium.orgf05f2912010-09-30 10:07:24 +0000337 static void UncheckedIntPtrTEvent(const char* name, intptr_t value);
ager@chromium.orgce5e87b2010-03-10 10:24:18 +0000338
sgjesse@chromium.org755c5b12009-05-29 11:04:38 +0000339 // Stops logging and profiling in case of insufficient resources.
340 static void StopLoggingAndProfiling();
341
kasperl@chromium.org71affb52009-05-26 05:44:31 +0000342 // Returns whether profiler's sampler is active.
343 static bool IsProfilerSamplerActive();
344
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000345 // The sampler used by the profiler and the sliding state window.
346 static Ticker* ticker_;
347
348 // When the statistical profile is active, profiler_
349 // points to a Profiler, that handles collection
350 // of samples.
351 static Profiler* profiler_;
352
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000353 // SlidingStateWindow instance keeping a sliding window of the most
354 // recent VM states.
355 static SlidingStateWindow* sliding_state_window_;
356
ager@chromium.orgeadaf222009-06-16 09:43:10 +0000357 // 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
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000363 // Internal implementation classes with access to
364 // private members.
ager@chromium.orgeadaf222009-06-16 09:43:10 +0000365 friend class CompressionHelper;
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000366 friend class EventLog;
367 friend class TimeLog;
368 friend class Profiler;
369 friend class SlidingStateWindow;
ager@chromium.org01beca72009-11-24 14:29:16 +0000370 friend class StackTracer;
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000371 friend class VMState;
kasperl@chromium.org71affb52009-05-26 05:44:31 +0000372
373 friend class LoggerTestHelper;
ager@chromium.org3e875802009-06-29 08:26:34 +0000374
ager@chromium.orgce5e87b2010-03-10 10:24:18 +0000375 static int logging_nesting_;
ager@chromium.org5c838252010-02-19 08:53:10 +0000376 static int cpu_profiler_nesting_;
377 static int heap_profiler_nesting_;
lrn@chromium.org25156de2010-04-06 13:10:27 +0000378
379 friend class CpuProfiler;
kasperl@chromium.org7be3c992009-03-12 07:19:55 +0000380#else
ager@chromium.org3e875802009-06-29 08:26:34 +0000381 static bool is_logging() { return false; }
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000382#endif
383};
384
385
ager@chromium.orgbb29dc92009-03-24 13:25:23 +0000386// Class that extracts stack trace, used for profiling.
ager@chromium.orge2902be2009-06-08 12:21:35 +0000387class StackTracer : public AllStatic {
kasperl@chromium.org061ef742009-02-27 12:16:20 +0000388 public:
ager@chromium.orge2902be2009-06-08 12:21:35 +0000389 static void Trace(TickSample* sample);
kasperl@chromium.org061ef742009-02-27 12:16:20 +0000390};
391
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000392} } // namespace v8::internal
393
lrn@chromium.org25156de2010-04-06 13:10:27 +0000394
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000395#endif // V8_LOG_H_