v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
logging.h File Reference
#include <cstdint>
#include <cstring>
#include <iterator>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include "src/base/abort-mode.h"
#include "src/base/base-export.h"
#include "src/base/build_config.h"
#include "src/base/compiler-specific.h"
#include "src/base/immediate-crash.h"
#include "src/base/template-utils.h"
Include dependency graph for logging.h:

Go to the source code of this file.

Classes

class  v8::base::CheckMessageStream
 
struct  v8::base::comparison_underlying_type< T >
 
struct  v8::base::is_signed_vs_unsigned< Lhs, Rhs >
 
struct  v8::base::is_unsigned_vs_signed< Lhs, Rhs >
 

Namespaces

namespace  v8
 
namespace  v8::base
 
namespace  v8::base::detail
 

Macros

#define GRACEFUL_FATAL(...)
 
#define FATAL(...)
 
#define UNIMPLEMENTED()
 
#define UNREACHABLE()
 
#define CONSTEXPR_UNREACHABLE()
 
#define CHECK_FAILED_HANDLER(message)
 
#define CHECK_WITH_MSG(condition, message)
 
#define CHECK(condition)
 
#define CHECK_OP(name, op, lhs, rhs)
 
#define DCHECK_WITH_MSG(condition, msg)
 
#define DEFINE_PRINT_CHECK_OPERAND_CHAR(type)
 
#define EXPLICIT_CHECK_OP_INSTANTIATION(type)
 
#define MAKE_UNDERLYING(Type, value)
 
#define DEFINE_CMP_IMPL(NAME, op)
 
#define MAKE_UNSIGNED(Type, value)
 
#define DEFINE_SIGNED_MISMATCH_COMP(CHECK, NAME, IMPL)
 
#define DEFINE_CHECK_OP_IMPL(NAME)
 
#define CHECK_EQ(lhs, rhs)
 
#define CHECK_NE(lhs, rhs)
 
#define CHECK_LE(lhs, rhs)
 
#define CHECK_LT(lhs, rhs)
 
#define CHECK_GE(lhs, rhs)
 
#define CHECK_GT(lhs, rhs)
 
#define CHECK_NULL(val)
 
#define CHECK_NOT_NULL(val)
 
#define CHECK_IMPLIES(lhs, rhs)
 
#define CHECK_BOUNDS(index, limit)
 
#define DCHECK(condition)
 
#define DCHECK_WITH_LOC(condition, location)
 
#define DCHECK_WITH_MSG_AND_LOC(condition, message, location)
 
#define DCHECK_EQ(v1, v2)
 
#define DCHECK_NE(v1, v2)
 
#define DCHECK_GT(v1, v2)
 
#define DCHECK_GE(v1, v2)
 
#define DCHECK_LT(v1, v2)
 
#define DCHECK_LE(v1, v2)
 
#define DCHECK_NULL(val)
 
#define DCHECK_NOT_NULL(val)
 
#define DCHECK_IMPLIES(v1, v2)
 
#define DCHECK_BOUNDS(index, limit)
 

Enumerations

enum class  v8::base::OOMType { v8::base::kJavaScript , v8::base::kProcess }
 

Functions

V8_BASE_EXPORT V8_NOINLINE void V8_Dcheck (const char *file, int line, const char *message)
 
 PRINTF_FORMAT (1, 2) V8_BASE_EXPORT V8_NOINLINE void V8_Fatal(const char *format
 
void v8::base::SetPrintStackTrace (void(*print_stack_trace)())
 
void v8::base::SetDcheckFunction (void(*dcheck_function)(const char *, int, const char *))
 
void v8::base::SetFatalFunction (void(*fatal_function)(const char *, int, const char *))
 
void v8::base::FatalOOM (OOMType type, const char *msg)
 
template<typename... Ts>
std::string v8::base::detail::PrintToString (Ts &&... ts)
 
template<typename T >
auto v8::base::detail::GetUnderlyingEnumTypeForPrinting (T val)
 
template<typename T >
std::string v8::base::PrintCheckOperand (T val)
 
template<typename T >
requires (!std::is_function_v<typename std::remove_pointer<T>::type> && !std::is_enum_v<T> && has_output_operator<T, CheckMessageStream>)
std::string v8::base::PrintCheckOperand (T val)
 
template<typename T >
requires (std::is_function_v<typename std::remove_pointer_t<T>>)
std::string v8::base::PrintCheckOperand (T val)
 
template<typename T >
requires (std::is_enum_v<T>)
std::string v8::base::PrintCheckOperand (T val)
 
template<typename T >
requires (!has_output_operator<T, CheckMessageStream> && requires(T t) { { t.begin() } -> std::forward_iterator; })
std::string v8::base::PrintCheckOperand (T container)
 
template<typename Lhs , typename Rhs >
V8_NOINLINE std::string * v8::base::MakeCheckOpString (Lhs lhs, Rhs rhs, char const *msg)
 
 v8::base::DEFINE_SIGNED_MISMATCH_COMP (is_signed_vs_unsigned, EQ, lhs >=0 &&MAKE_UNSIGNED(Lhs, lhs)==MAKE_UNDERLYING(Rhs, rhs)) DEFINE_SIGNED_MISMATCH_COMP(is_signed_vs_unsigned
 

Variables

constexpr const char * v8::base::kUnimplementedCodeMessage = "unimplemented code"
 
constexpr const char * v8::base::kUnreachableCodeMessage = "unreachable code"
 
 v8::base::LT
 

Macro Definition Documentation

◆ CHECK

#define CHECK ( condition)
Value:
#define CHECK_WITH_MSG(condition, message)
Definition logging.h:118

Definition at line 124 of file logging.h.

◆ CHECK_BOUNDS

#define CHECK_BOUNDS ( index,
limit )
Value:
CHECK_LT(static_cast<std::make_unsigned_t<decltype(index)>>(index), \
static_cast<std::make_unsigned_t<decltype(limit)>>(limit))
#define CHECK_LT(lhs, rhs)

◆ CHECK_EQ

#define CHECK_EQ ( lhs,
rhs )
Value:
CHECK_OP(EQ, ==, lhs, rhs)
#define CHECK_OP(name, op, lhs, rhs)
Definition logging.h:173

◆ CHECK_FAILED_HANDLER

#define CHECK_FAILED_HANDLER ( message)
Value:
FATAL("Check failed: %s.", message)
#define FATAL(...)
Definition logging.h:47

Definition at line 109 of file logging.h.

◆ CHECK_GE

#define CHECK_GE ( lhs,
rhs )
Value:
CHECK_OP(GE, >=, lhs, rhs)

◆ CHECK_GT

#define CHECK_GT ( lhs,
rhs )
Value:
CHECK_OP(GT, >, lhs, rhs)

◆ CHECK_IMPLIES

#define CHECK_IMPLIES ( lhs,
rhs )
Value:
CHECK_WITH_MSG(!(lhs) || (rhs), #lhs " implies " #rhs)

◆ CHECK_LE

#define CHECK_LE ( lhs,
rhs )
Value:
CHECK_OP(LE, <=, lhs, rhs)

◆ CHECK_LT

#define CHECK_LT ( lhs,
rhs )
Value:
CHECK_OP(LT, <, lhs, rhs)

◆ CHECK_NE

#define CHECK_NE ( lhs,
rhs )
Value:
CHECK_OP(NE, !=, lhs, rhs)

◆ CHECK_NOT_NULL

#define CHECK_NOT_NULL ( val)
Value:
CHECK((val) != nullptr)
#define CHECK(condition)
Definition logging.h:124

◆ CHECK_NULL

#define CHECK_NULL ( val)
Value:
CHECK((val) == nullptr)

◆ CHECK_OP

#define CHECK_OP ( name,
op,
lhs,
rhs )
Value:
do { \
bool _cmp = ::v8::base::Cmp##name##Impl< \
typename ::v8::base::pass_value_or_ref<decltype(lhs)>::type, \
typename ::v8::base::pass_value_or_ref<decltype(rhs)>::type>((lhs), \
(rhs)); \
CHECK_WITH_MSG(_cmp, #lhs " " #op " " #rhs); \
} while (false)

Definition at line 173 of file logging.h.

◆ CHECK_WITH_MSG

#define CHECK_WITH_MSG ( condition,
message )
Value:
do { \
if (V8_UNLIKELY(!(condition))) { \
CHECK_FAILED_HANDLER(message); \
} \
} while (false)
#define V8_UNLIKELY(condition)
Definition v8config.h:660

Definition at line 118 of file logging.h.

◆ CONSTEXPR_UNREACHABLE

#define CONSTEXPR_UNREACHABLE ( )
Value:
#define UNREACHABLE()
Definition logging.h:67

Definition at line 73 of file logging.h.

◆ DCHECK

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

Definition at line 482 of file logging.h.

◆ DCHECK_BOUNDS

#define DCHECK_BOUNDS ( index,
limit )
Value:
((void)0)

Definition at line 494 of file logging.h.

◆ DCHECK_EQ

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

Definition at line 485 of file logging.h.

◆ DCHECK_GE

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

Definition at line 488 of file logging.h.

◆ DCHECK_GT

#define DCHECK_GT ( v1,
v2 )
Value:
((void) 0)

Definition at line 487 of file logging.h.

◆ DCHECK_IMPLIES

#define DCHECK_IMPLIES ( v1,
v2 )
Value:
((void) 0)

Definition at line 493 of file logging.h.

◆ DCHECK_LE

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

Definition at line 490 of file logging.h.

◆ DCHECK_LT

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

Definition at line 489 of file logging.h.

◆ DCHECK_NE

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

Definition at line 486 of file logging.h.

◆ DCHECK_NOT_NULL

#define DCHECK_NOT_NULL ( val)
Value:
((void) 0)

Definition at line 492 of file logging.h.

◆ DCHECK_NULL

#define DCHECK_NULL ( val)
Value:
((void) 0)

Definition at line 491 of file logging.h.

◆ DCHECK_WITH_LOC

#define DCHECK_WITH_LOC ( condition,
location )
Value:
((void)0)

Definition at line 483 of file logging.h.

◆ DCHECK_WITH_MSG

#define DCHECK_WITH_MSG ( condition,
msg )
Value:
void(0);

Definition at line 182 of file logging.h.

◆ DCHECK_WITH_MSG_AND_LOC

#define DCHECK_WITH_MSG_AND_LOC ( condition,
message,
location )
Value:
((void)0)

Definition at line 484 of file logging.h.

◆ DEFINE_CHECK_OP_IMPL

#define DEFINE_CHECK_OP_IMPL ( NAME)
Value:
template <typename Lhs, typename Rhs> \
V8_INLINE constexpr std::string* Check##NAME##Impl(Lhs lhs, Rhs rhs, \
char const* msg) { \
using LhsPassT = typename pass_value_or_ref<Lhs>::type; \
using RhsPassT = typename pass_value_or_ref<Rhs>::type; \
bool cmp = Cmp##NAME##Impl<LhsPassT, RhsPassT>(lhs, rhs); \
return V8_LIKELY(cmp) \
? nullptr \
: MakeCheckOpString<LhsPassT, RhsPassT>(lhs, rhs, msg); \
}
#define V8_INLINE
Definition v8config.h:500
#define V8_LIKELY(condition)
Definition v8config.h:661
#define NAME(feat,...)

◆ DEFINE_CMP_IMPL

#define DEFINE_CMP_IMPL ( NAME,
op )
Value:
template <typename Lhs, typename Rhs> \
V8_INLINE constexpr bool Cmp##NAME##Impl(Lhs lhs, Rhs rhs) { \
return lhs op rhs; \
}

Definition at line 379 of file logging.h.

◆ DEFINE_PRINT_CHECK_OPERAND_CHAR

#define DEFINE_PRINT_CHECK_OPERAND_CHAR ( type)
Value:
template <> \
V8_BASE_EXPORT std::string PrintCheckOperand<type>(type ch); \
template <> \
V8_BASE_EXPORT std::string PrintCheckOperand<type*>(type * cstr); \
template <> \
V8_BASE_EXPORT std::string PrintCheckOperand<const type*>(const type* cstr);
#define V8_BASE_EXPORT
Definition base-export.h:26

Definition at line 283 of file logging.h.

◆ DEFINE_SIGNED_MISMATCH_COMP

#define DEFINE_SIGNED_MISMATCH_COMP ( CHECK,
NAME,
IMPL )
Value:
template <typename Lhs, typename Rhs> \
requires(CHECK<Lhs, Rhs>::value) \
V8_INLINE constexpr bool Cmp##NAME##Impl(Lhs lhs, Rhs rhs) { \
return IMPL; \
}

Definition at line 397 of file logging.h.

◆ EXPLICIT_CHECK_OP_INSTANTIATION

#define EXPLICIT_CHECK_OP_INSTANTIATION ( type)
Value:
extern template V8_BASE_EXPORT std::string* MakeCheckOpString<type, type>( \
type, type, char const*); \
extern template V8_BASE_EXPORT std::string PrintCheckOperand<type>(type);

Definition at line 318 of file logging.h.

◆ FATAL

#define FATAL ( ...)
Value:
V8_Fatal(__VA_ARGS__)
void V8_Fatal(const char *format,...)
Definition logging.cc:170

Definition at line 47 of file logging.h.

◆ GRACEFUL_FATAL

#define GRACEFUL_FATAL ( ...)
Value:
V8_Fatal(__VA_ARGS__)

Definition at line 41 of file logging.h.

◆ MAKE_UNDERLYING

#define MAKE_UNDERLYING ( Type,
value )
Value:
static_cast<typename comparison_underlying_type<Type>::type>(value)
std::unique_ptr< ValueMirror > value

Definition at line 350 of file logging.h.

◆ MAKE_UNSIGNED

#define MAKE_UNSIGNED ( Type,
value )
Value:
static_cast<typename std::make_unsigned< \
typename comparison_underlying_type<Type>::type>::type>(value)

Definition at line 394 of file logging.h.

◆ UNIMPLEMENTED

#define UNIMPLEMENTED ( )
Value:
constexpr const char * kUnimplementedCodeMessage
Definition logging.h:62

Definition at line 66 of file logging.h.

◆ UNREACHABLE

#define UNREACHABLE ( )
Value:
constexpr const char * kUnreachableCodeMessage
Definition logging.h:63

Definition at line 67 of file logging.h.

Function Documentation

◆ PRINTF_FORMAT()

PRINTF_FORMAT ( 1 ,
2  ) const

◆ V8_Dcheck()

V8_BASE_EXPORT V8_NOINLINE void V8_Dcheck ( const char * file,
int line,
const char * message )

Definition at line 218 of file logging.cc.

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