41 Log::Log(Logger* logger)
44 message_buffer_(
NULL),
54 FLAG_log_runtime =
true;
58 FLAG_log_suspect =
true;
59 FLAG_log_handles =
true;
60 FLAG_log_regexp =
true;
61 FLAG_log_internal_timer_events =
true;
65 if (FLAG_prof) FLAG_log_code =
true;
74 OpenFile(log_file_name);
80 void Log::OpenStdout() {
82 output_handle_ = stdout;
86 void Log::OpenTemporaryFile() {
92 void Log::OpenFile(
const char*
name) {
100 if (output_handle_ !=
NULL) {
102 fclose(output_handle_);
104 result = output_handle_;
107 output_handle_ =
NULL;
110 message_buffer_ =
NULL;
117 Log::MessageBuilder::MessageBuilder(
Log*
log)
119 lock_guard_(&log_->mutex_),
125 void Log::MessageBuilder::Append(
const char* format, ...) {
126 Vector<char> buf(log_->message_buffer_ + pos_,
129 va_start(args, format);
130 AppendVA(format, args);
136 void Log::MessageBuilder::AppendVA(
const char* format, va_list args) {
137 Vector<char> buf(log_->message_buffer_ + pos_,
151 void Log::MessageBuilder::Append(
const char c) {
153 log_->message_buffer_[pos_++] = c;
159 void Log::MessageBuilder::AppendDoubleQuotedString(
const char*
string) {
161 for (
const char* p =
string; *p !=
'\0'; p++) {
171 void Log::MessageBuilder::Append(String* str) {
173 int length = str->length();
174 for (
int i = 0; i < length; i++) {
175 Append(static_cast<char>(str->Get(i)));
180 void Log::MessageBuilder::AppendAddress(
Address addr) {
185 void Log::MessageBuilder::AppendSymbolName(
Symbol* symbol) {
188 if (!symbol->name()->IsUndefined()) {
193 Append(
"hash %x)", symbol->Hash());
197 void Log::MessageBuilder::AppendDetailed(String* str,
bool show_impl_info) {
198 if (str ==
NULL)
return;
200 int len = str->length();
203 if (show_impl_info) {
204 Append(str->IsOneByteRepresentation() ?
'a' :
'2');
205 if (StringShape(str).IsExternal())
207 if (StringShape(str).IsInternalized())
209 Append(
":%i:", str->length());
211 for (
int i = 0; i < len; i++) {
212 uc32 c = str->Get(i);
214 Append(
"\\u%04x", c);
215 }
else if (c < 32 || c > 126) {
216 Append(
"\\x%02x", c);
217 }
else if (c ==
',') {
219 }
else if (c ==
'\\') {
221 }
else if (c ==
'\"') {
230 void Log::MessageBuilder::AppendStringPart(
const char* str,
int len) {
234 if (len == 0)
return;
236 Vector<char> buf(log_->message_buffer_ + pos_,
244 void Log::MessageBuilder::WriteToLogFile() {
246 const int written = log_->WriteToFile(log_->message_buffer_, pos_);
247 if (written != pos_) {
249 log_->logger_->LogFailure();
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
static int VSNPrintF(Vector< char > str, const char *format, va_list args)
static const char *const kLogToConsole
static String * cast(Object *obj)
static const char *const kLogToTemporaryFile
static FILE * OpenTemporaryFile()
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in only print modified registers Don t break for ASM_UNIMPLEMENTED_BREAK macros print stack trace when an illegal exception is thrown randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot testing_bool_flag testing_int_flag string flag tmp file in which to serialize heap Print the time it takes to lazily compile hydrogen code stubs concurrent_recompilation concurrent_sweeping Print usage including on console Map counters to a file Enable debugger compile events enable GDBJIT enable GDBJIT interface for all code objects dump only objects containing this substring stress the GC compactor to flush out pretty print source code print source AST function name where to insert a breakpoint print scopes for builtins trace contexts operations print stuff during garbage collection report code statistics after GC report handles after GC trace cache state transitions print interface inference details prints when objects are turned into dictionaries report heap spill statistics along with trace isolate state changes trace regexp bytecode execution Minimal Log all events to the log file Log API events to the log file Log heap samples on garbage collection for the hp2ps tool log positions Log suspect operations Used with turns on browser compatible mode for profiling v8 log
static bool InitLogAtStart()
#define ASSERT(condition)
static FILE * FOpen(const char *path, const char *mode)
static const int kMessageBufferSize
static void StrNCpy(Vector< char > dest, const char *src, size_t n)
PerThreadAssertScopeDebugOnly< HEAP_ALLOCATION_ASSERT, false > DisallowHeapAllocation
IN DWORD64 OUT PDWORD64 OUT PIMAGEHLP_SYMBOL64 Symbol
void Initialize(const char *log_file_name)
void DeleteArray(T *array)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in name
static const char *const LogFileOpenMode