V8 Project
logging.h File Reference
#include <string.h>
#include "include/v8stdint.h"
#include "src/base/build_config.h"
+ Include dependency graph for logging.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 v8
 Debugger support for the V8 JavaScript engine.
 
 v8::base
 

Macros

#define FATAL(msg)    V8_Fatal("", 0, "%s", (msg))
 
#define UNIMPLEMENTED()    V8_Fatal("", 0, "unimplemented code")
 
#define UNREACHABLE()   ((void) 0)
 
#define CHECK(condition)
 
#define CHECK_EQ(expected, value)
 
#define CHECK_NE(unexpected, value)
 
#define CHECK_GT(a, b)   CHECK((a) > (b))
 
#define CHECK_GE(a, b)   CHECK((a) >= (b))
 
#define CHECK_LT(a, b)   CHECK((a) < (b))
 
#define CHECK_LE(a, b)   CHECK((a) <= (b))
 
#define DCHECK_RESULT(expr)   (expr)
 
#define DCHECK(condition)   ((void) 0)
 
#define DCHECK_EQ(v1, v2)   ((void) 0)
 
#define DCHECK_NE(v1, v2)   ((void) 0)
 
#define DCHECK_GE(v1, v2)   ((void) 0)
 
#define DCHECK_LT(v1, v2)   ((void) 0)
 
#define DCHECK_LE(v1, v2)   ((void) 0)
 
#define DCHECK_NOT_NULL(p)   DCHECK_NE(NULL, p)
 
#define EXTRA_CHECK(condition)   ((void) 0)
 

Functions

void V8_Fatal (const char *file, int line, const char *format,...)
 
void CheckEqualsHelper (const char *file, int line, const char *expected_source, int expected, const char *value_source, int value)
 
void CheckEqualsHelper (const char *file, int line, const char *expected_source, int64_t expected, const char *value_source, int64_t value)
 
void CheckNonEqualsHelper (const char *file, int line, const char *unexpected_source, int unexpected, const char *value_source, int value)
 
void CheckEqualsHelper (const char *file, int line, const char *expected_source, const char *expected, const char *value_source, const char *value)
 
void CheckNonEqualsHelper (const char *file, int line, const char *expected_source, const char *expected, const char *value_source, const char *value)
 
void CheckEqualsHelper (const char *file, int line, const char *expected_source, const void *expected, const char *value_source, const void *value)
 
void CheckNonEqualsHelper (const char *file, int line, const char *expected_source, const void *expected, const char *value_source, const void *value)
 
void CheckNonEqualsHelper (const char *file, int line, const char *expected_source, int64_t expected, const char *value_source, int64_t value)
 
void v8::base::DumpBacktrace ()
 

Macro Definition Documentation

◆ CHECK

#define CHECK (   condition)
Value:
do { \
if (!(condition)) { \
V8_Fatal(__FILE__, __LINE__, "CHECK(%s) failed", #condition); \
} \
} while (0)

Definition at line 36 of file logging.h.

◆ CHECK_EQ

#define CHECK_EQ (   expected,
  value 
)
Value:
CheckEqualsHelper(__FILE__, __LINE__, \
#expected, expected, #value, value)
void CheckEqualsHelper(const char *file, int line, const char *expected_source, int expected, const char *value_source, int value)
Definition: logging.h:45

Definition at line 169 of file logging.h.

◆ CHECK_GE

#define CHECK_GE (   a,
 
)    CHECK((a) >= (b))

Definition at line 178 of file logging.h.

◆ CHECK_GT

#define CHECK_GT (   a,
 
)    CHECK((a) > (b))

Definition at line 177 of file logging.h.

◆ CHECK_LE

#define CHECK_LE (   a,
 
)    CHECK((a) <= (b))

Definition at line 180 of file logging.h.

◆ CHECK_LT

#define CHECK_LT (   a,
 
)    CHECK((a) < (b))

Definition at line 179 of file logging.h.

◆ CHECK_NE

#define CHECK_NE (   unexpected,
  value 
)
Value:
CheckNonEqualsHelper(__FILE__, __LINE__, \
#unexpected, unexpected, #value, value)
void CheckNonEqualsHelper(const char *file, int line, const char *unexpected_source, int unexpected, const char *value_source, int value)
Definition: logging.h:80

Definition at line 173 of file logging.h.

◆ DCHECK

#define DCHECK (   condition)    ((void) 0)

Definition at line 205 of file logging.h.

◆ DCHECK_EQ

#define DCHECK_EQ (   v1,
  v2 
)    ((void) 0)

Definition at line 206 of file logging.h.

◆ DCHECK_GE

#define DCHECK_GE (   v1,
  v2 
)    ((void) 0)

Definition at line 208 of file logging.h.

◆ DCHECK_LE

#define DCHECK_LE (   v1,
  v2 
)    ((void) 0)

Definition at line 210 of file logging.h.

◆ DCHECK_LT

#define DCHECK_LT (   v1,
  v2 
)    ((void) 0)

Definition at line 209 of file logging.h.

◆ DCHECK_NE

#define DCHECK_NE (   v1,
  v2 
)    ((void) 0)

Definition at line 207 of file logging.h.

◆ DCHECK_NOT_NULL

#define DCHECK_NOT_NULL (   p)    DCHECK_NE(NULL, p)

Definition at line 213 of file logging.h.

◆ DCHECK_RESULT

#define DCHECK_RESULT (   expr)    (expr)

Definition at line 204 of file logging.h.

◆ EXTRA_CHECK

#define EXTRA_CHECK (   condition)    ((void) 0)

Definition at line 220 of file logging.h.

◆ FATAL

#define FATAL (   msg)     V8_Fatal("", 0, "%s", (msg))

Definition at line 26 of file logging.h.

◆ UNIMPLEMENTED

#define UNIMPLEMENTED ( )     V8_Fatal("", 0, "unimplemented code")

Definition at line 28 of file logging.h.

◆ UNREACHABLE

#define UNREACHABLE ( )    ((void) 0)

Definition at line 30 of file logging.h.

Function Documentation

◆ CheckEqualsHelper() [1/4]

void CheckEqualsHelper ( const char *  file,
int  line,
const char *  expected_source,
const char *  expected,
const char *  value_source,
const char *  value 
)
inline

Definition at line 95 of file logging.h.

100  {
101  if ((expected == NULL && value != NULL) ||
102  (expected != NULL && value == NULL) ||
103  (expected != NULL && value != NULL && strcmp(expected, value) != 0)) {
104  V8_Fatal(file, line,
105  "CHECK_EQ(%s, %s) failed\n# Expected: %s\n# Found: %s",
106  expected_source, value_source, expected, value);
107  }
108 }
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS 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 enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes A file to write the raw context snapshot bytes Write V8 startup blob file(mksnapshot only)") DEFINE_BOOL(profile_hydrogen_code_stub_compilation
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS 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 enable alignment of csp to bytes on platforms which prefer the register to always be NULL
void V8_Fatal(const char *file, int line, const char *format,...)
Definition: logging.cc:75

References file(), NULL, and V8_Fatal().

+ Here is the call graph for this function:

◆ CheckEqualsHelper() [2/4]

void CheckEqualsHelper ( const char *  file,
int  line,
const char *  expected_source,
const void *  expected,
const char *  value_source,
const void *  value 
)
inline

Definition at line 127 of file logging.h.

132  {
133  if (expected != value) {
134  V8_Fatal(file, line,
135  "CHECK_EQ(%s, %s) failed\n# Expected: %p\n# Found: %p",
136  expected_source, value_source,
137  expected, value);
138  }
139 }

References file(), and V8_Fatal().

+ Here is the call graph for this function:

◆ CheckEqualsHelper() [3/4]

void CheckEqualsHelper ( const char *  file,
int  line,
const char *  expected_source,
int  expected,
const char *  value_source,
int  value 
)
inline

Definition at line 45 of file logging.h.

47  {
48  if (expected != value) {
49  V8_Fatal(file, line,
50  "CHECK_EQ(%s, %s) failed\n# Expected: %i\n# Found: %i",
51  expected_source, value_source, expected, value);
52  }
53 }

References file(), and V8_Fatal().

+ Here is the call graph for this function:

◆ CheckEqualsHelper() [4/4]

void CheckEqualsHelper ( const char *  file,
int  line,
const char *  expected_source,
int64_t  expected,
const char *  value_source,
int64_t  value 
)
inline

Definition at line 58 of file logging.h.

62  {
63  if (expected != value) {
64  // Print int64_t values in hex, as two int32s,
65  // to avoid platform-dependencies.
66  V8_Fatal(file, line,
67  "CHECK_EQ(%s, %s) failed\n#"
68  " Expected: 0x%08x%08x\n# Found: 0x%08x%08x",
69  expected_source, value_source,
70  static_cast<uint32_t>(expected >> 32),
71  static_cast<uint32_t>(expected),
72  static_cast<uint32_t>(value >> 32),
73  static_cast<uint32_t>(value));
74  }
75 }

References file(), and V8_Fatal().

+ Here is the call graph for this function:

◆ CheckNonEqualsHelper() [1/4]

void CheckNonEqualsHelper ( const char *  file,
int  line,
const char *  expected_source,
const char *  expected,
const char *  value_source,
const char *  value 
)
inline

Definition at line 111 of file logging.h.

116  {
117  if (expected == value ||
118  (expected != NULL && value != NULL && strcmp(expected, value) == 0)) {
119  V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n# Value: %s",
120  expected_source, value_source, value);
121  }
122 }

References file(), NULL, and V8_Fatal().

+ Here is the call graph for this function:

◆ CheckNonEqualsHelper() [2/4]

void CheckNonEqualsHelper ( const char *  file,
int  line,
const char *  expected_source,
const void *  expected,
const char *  value_source,
const void *  value 
)
inline

Definition at line 142 of file logging.h.

147  {
148  if (expected == value) {
149  V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n# Value: %p",
150  expected_source, value_source, value);
151  }
152 }

References file(), and V8_Fatal().

+ Here is the call graph for this function:

◆ CheckNonEqualsHelper() [3/4]

void CheckNonEqualsHelper ( const char *  file,
int  line,
const char *  expected_source,
int64_t  expected,
const char *  value_source,
int64_t  value 
)
inline

Definition at line 155 of file logging.h.

160  {
161  if (expected == value) {
162  V8_Fatal(file, line,
163  "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f",
164  expected_source, value_source, expected, value);
165  }
166 }

References file(), and V8_Fatal().

+ Here is the call graph for this function:

◆ CheckNonEqualsHelper() [4/4]

void CheckNonEqualsHelper ( const char *  file,
int  line,
const char *  unexpected_source,
int  unexpected,
const char *  value_source,
int  value 
)
inline

Definition at line 80 of file logging.h.

85  {
86  if (unexpected == value) {
87  V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n# Value: %i",
88  unexpected_source, value_source, value);
89  }
90 }

References file(), and V8_Fatal().

+ Here is the call graph for this function:

◆ V8_Fatal()

void V8_Fatal ( const char *  file,
int  line,
const char *  format,
  ... 
)

Definition at line 75 of file logging.cc.

75  {
76  fflush(stdout);
77  fflush(stderr);
78  v8::base::OS::PrintError("\n\n#\n# Fatal error in %s, line %d\n# ", file,
79  line);
80  va_list arguments;
81  va_start(arguments, format);
82  v8::base::OS::VPrintError(format, arguments);
83  va_end(arguments);
84  v8::base::OS::PrintError("\n#\n");
86  fflush(stderr);
88 }
static void VPrintError(const char *format, va_list args)
static void Abort()
static void PrintError(const char *format,...)
void DumpBacktrace()
Definition: logging.cc:22

References v8::base::OS::Abort(), v8::base::DumpBacktrace(), file(), v8::base::OS::PrintError(), and v8::base::OS::VPrintError().

Referenced by CheckEqualsHelper(), v8::internal::compiler::CheckInputsDominate(), CheckNonEqualsHelper(), v8::internal::compiler::ScheduleVerifier::Run(), and v8::internal::compiler::RepresentationChanger::TypeError().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: