v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
macros.h File Reference
#include <limits>
#include <type_traits>
#include "include/v8config.h"
#include "src/base/compiler-specific.h"
#include "src/base/logging.h"
Include dependency graph for macros.h:

Go to the source code of this file.

Classes

struct  v8::base::is_trivially_copyable< T >
 
struct  v8::base::is_trivially_destructible< T >
 
struct  v8::base::Use
 

Namespaces

namespace  v8
 
namespace  v8::base
 

Macros

#define EXPAND(X)
 
#define NOTHING(...)
 
#define CONCAT_(a, ...)
 
#define CONCAT(a, ...)
 
#define UNIQUE_IDENTIFIER(base)
 
#define COUNT_MACRO_ARGS(...)
 
#define COUNT_MACRO_ARGS_IMPL(_8, _7, _6, _5, _4, _3, _2, _1, N, ...)
 
#define GET_NTH_ARG(N, ...)
 
#define GET_NTH_ARG_IMPL_0(_0, ...)
 
#define GET_NTH_ARG_IMPL_1(_0, _1, ...)
 
#define GET_NTH_ARG_IMPL_2(_0, _1, _2, ...)
 
#define GET_NTH_ARG_IMPL_3(_0, _1, _2, _3, ...)
 
#define GET_NTH_ARG_IMPL_4(_0, _1, _2, _3, _4, ...)
 
#define GET_NTH_ARG_IMPL_5(_0, _1, _2, _3, _4, _5, ...)
 
#define GET_NTH_ARG_IMPL_6(_0, _1, _2, _3, _4, _5, _6, ...)
 
#define GET_NTH_ARG_IMPL_7(_0, _1, _2, _3, _4, _5, _6, _7, ...)
 
#define UNPAREN(X)
 
#define UNPAREN_(...)
 
#define DROP_UNPAREN_
 
#define OFFSET_OF(type, field)
 
#define LITERAL_COMMA   ,
 
#define arraysize(array)
 
#define DISALLOW_ASSIGN(TypeName)
 
#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName)
 
#define MOVE_ONLY_WITH_DEFAULT_CONSTRUCTORS(TypeName)
 
#define MOVE_ONLY_NO_DEFAULT_CONSTRUCTOR(TypeName)
 
#define DISALLOW_NEW_AND_DELETE()
 
#define DISABLE_CFI_PERF   V8_CLANG_NO_SANITIZE("cfi")
 
#define DISABLE_CFI_ICALL
 
#define V8_PRETTY_FUNCTION_VALUE_OR(ELSE)
 
#define ASSERT_TRIVIALLY_COPYABLE(T)
 
#define ASSERT_NOT_TRIVIALLY_COPYABLE(T)
 
#define ASSERT_TRIVIALLY_DESTRUCTIBLE(T)
 
#define ASSERT_NOT_TRIVIALLY_DESTRUCTIBLE(T)
 
#define USE(...)
 
#define V8_PTR_PREFIX   ""
 
#define V8PRIxPTR   V8_PTR_PREFIX "x"
 
#define V8PRIdPTR   V8_PTR_PREFIX "d"
 
#define V8PRIuPTR   V8_PTR_PREFIX "u"
 
#define V8_PTR_HEX_DIGITS   8
 
#define V8PRIxPTR_FMT   "0x%08" V8PRIxPTR
 
#define V8PRIxPTRDIFF   "tx"
 
#define V8PRIdPTRDIFF   "td"
 
#define V8PRIuPTRDIFF   "tu"
 
#define V8_EXPORT_PRIVATE
 
#define V8_EXPORT_ENUM
 
#define IF_WASM(V, ...)
 
#define IF_WASM_DRUMBRAKE(V, ...)
 
#define IF_WASM_DRUMBRAKE_INSTR_HANDLER(V, ...)
 
#define IF_TSAN(V, ...)
 
#define IF_INTL(V, ...)
 
#define IF_SHADOW_STACK(V, ...)
 
#define IF_TARGET_ARCH_64_BIT(V, ...)
 
#define IF_V8_WASM_RANDOM_FUZZERS(V, ...)
 
#define IF_NO_V8_WASM_RANDOM_FUZZERS(V, ...)
 

Functions

template<typename T , size_t N>
char(& ArraySizeHelper (T(&array)[N]))[N]
 
template<typename T , size_t N>
char(& ArraySizeHelper (const T(&array)[N]))[N]
 
template<class Dest , class Source >
V8_INLINE Dest v8::base::bit_cast (Source const &source)
 
template<class A >
V8_INLINEimplicit_cast (A x)
 
uint64_t make_uint64 (uint32_t high, uint32_t low)
 
template<typename T >
constexpr T RoundDown (T x, intptr_t m)
 
template<intptr_t m, typename T >
constexpr T RoundDown (T x)
 
template<typename T >
constexpr T RoundUp (T x, intptr_t m)
 
template<intptr_t m, typename T >
constexpr T RoundUp (T x)
 
template<typename T , typename U >
constexpr bool IsAligned (T value, U alignment)
 
void * AlignedAddress (void *address, size_t alignment)
 
void * RoundUpAddress (void *address, size_t alignment)
 
template<typename int_t , typename float_t , typename biggest_int_t = int64_t>
bool is_inbounds (float_t v)
 

Macro Definition Documentation

◆ arraysize

#define arraysize ( array)
Value:
(sizeof(ArraySizeHelper(array)))
char(& ArraySizeHelper(T(&array)[N]))[N]

Definition at line 67 of file macros.h.

◆ ASSERT_NOT_TRIVIALLY_COPYABLE

#define ASSERT_NOT_TRIVIALLY_COPYABLE ( T)
Value:
#T " should not be trivially copyable")

Definition at line 270 of file macros.h.

◆ ASSERT_NOT_TRIVIALLY_DESTRUCTIBLE

#define ASSERT_NOT_TRIVIALLY_DESTRUCTIBLE ( T)
Value:
#T " should not be trivially destructible")

Definition at line 282 of file macros.h.

◆ ASSERT_TRIVIALLY_COPYABLE

#define ASSERT_TRIVIALLY_COPYABLE ( T)
Value:
#T " should be trivially copyable")

Definition at line 267 of file macros.h.

◆ ASSERT_TRIVIALLY_DESTRUCTIBLE

#define ASSERT_TRIVIALLY_DESTRUCTIBLE ( T)
Value:
#T " should be trivially destructible")

Definition at line 279 of file macros.h.

◆ CONCAT

#define CONCAT ( a,
... )
Value:
CONCAT_(a, __VA_ARGS__)
#define CONCAT_(a,...)
Definition macros.h:21

Definition at line 22 of file macros.h.

◆ CONCAT_

#define CONCAT_ ( a,
... )
Value:
a##__VA_ARGS__

Definition at line 21 of file macros.h.

◆ COUNT_MACRO_ARGS

#define COUNT_MACRO_ARGS ( ...)
Value:
EXPAND(COUNT_MACRO_ARGS_IMPL(__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1, 0))
#define COUNT_MACRO_ARGS_IMPL(_8, _7, _6, _5, _4, _3, _2, _1, N,...)
Definition macros.h:30
#define EXPAND(X)
Definition macros.h:16

Definition at line 28 of file macros.h.

◆ COUNT_MACRO_ARGS_IMPL

#define COUNT_MACRO_ARGS_IMPL ( _8,
_7,
_6,
_5,
_4,
_3,
_2,
_1,
N,
... )
Value:
N

Definition at line 30 of file macros.h.

◆ DISABLE_CFI_ICALL

#define DISABLE_CFI_ICALL
Value:
V8_CLANG_NO_SANITIZE("cfi-icall") \
V8_CLANG_NO_SANITIZE("function")
#define V8_CLANG_NO_SANITIZE(what)
defined(V8_TRIVIAL_ABI)
Definition v8config.h:765

Definition at line 209 of file macros.h.

◆ DISABLE_CFI_PERF

#define DISABLE_CFI_PERF   V8_CLANG_NO_SANITIZE("cfi")

Definition at line 197 of file macros.h.

◆ DISALLOW_ASSIGN

#define DISALLOW_ASSIGN ( TypeName)
Value:
TypeName& operator=(const TypeName&) = delete

Definition at line 125 of file macros.h.

◆ DISALLOW_IMPLICIT_CONSTRUCTORS

#define DISALLOW_IMPLICIT_CONSTRUCTORS ( TypeName)
Value:
TypeName() = delete; \
TypeName(const TypeName&) = delete; \
DISALLOW_ASSIGN(TypeName)

Definition at line 130 of file macros.h.

◆ DISALLOW_NEW_AND_DELETE

#define DISALLOW_NEW_AND_DELETE ( )
Value:
void* operator new(size_t) { v8::base::OS::Abort(); } \
void* operator new[](size_t) { v8::base::OS::Abort(); } \
void operator delete(void*, size_t) { v8::base::OS::Abort(); } \
void operator delete[](void*, size_t) { v8::base::OS::Abort(); }
static void Abort()

Definition at line 155 of file macros.h.

◆ DROP_UNPAREN_

#define DROP_UNPAREN_

Definition at line 55 of file macros.h.

◆ EXPAND

#define EXPAND ( X)
Value:
too high values may cause the compiler to set high thresholds for inlining to as much as possible avoid inlined allocation of objects that cannot escape trace load stores from virtual maglev objects use TurboFan fast string builder analyze liveness of environment slots and zap dead values trace TurboFan load elimination emit data about basic block usage in builtins to this enable builtin reordering when run mksnapshot flag for emit warnings when applying builtin profile data verify register allocation in TurboFan randomly schedule instructions to stress dependency tracking enable store store elimination in TurboFan rewrite far to near simulate GC compiler thread race related to allow float parameters to be passed in simulator mode JS Wasm Run additional turbo_optimize_inlined_js_wasm_wrappers enable experimental feedback collection in generic lowering enable Turboshaft s WasmLoadElimination enable Turboshaft s low level load elimination for JS enable Turboshaft s escape analysis for string concatenation use enable Turbolev features that we want to ship in the not too far future trace individual Turboshaft reduction steps trace intermediate Turboshaft reduction steps invocation count threshold for early optimization Enables optimizations which favor memory size over execution speed Enables sampling allocation profiler with X as a sample interval min size of a semi the new space consists of two semi spaces max size of the Collect garbage after Collect garbage after keeps maps alive for< n > old space garbage collections print one detailed trace line in allocation gc speed threshold for starting incremental marking via a task in percent of available threshold for starting incremental marking immediately in percent of available Use a single schedule for determining a marking schedule between JS and C objects schedules the minor GC task with kUserVisible priority max worker number of concurrent for NumberOfWorkerThreads start background threads that allocate memory concurrent_array_buffer_sweeping use parallel threads to clear weak refs in the atomic pause trace progress of the incremental marking trace object counts and memory usage report a tick only when allocated zone memory changes by this amount TracingFlags::gc_stats TracingFlags::gc_stats track native contexts that are expected to be garbage collected verify heap pointers before and after GC memory reducer runs GC with ReduceMemoryFootprint flag Maximum number of memory reducer GCs scheduled Old gen GC speed is computed directly from gc tracer counters Perform compaction on full GCs based on V8 s default heuristics Perform compaction on every full GC Perform code space compaction when finalizing a full GC with stack Stress GC compaction to flush out bugs with moving objects flush of baseline code when it has not been executed recently Use time base code flushing instead of age Use a progress bar to scan large objects in increments when incremental marking is active force incremental marking for small heaps and run it more often force marking at random points between and X(inclusive) percent " "of the regular marking start limit") DEFINE_INT(stress_scavenge

Definition at line 16 of file macros.h.

◆ GET_NTH_ARG

#define GET_NTH_ARG ( N,
... )
Value:
CONCAT(GET_NTH_ARG_IMPL_, N)(__VA_ARGS__)
#define CONCAT(a,...)
Definition macros.h:22

Definition at line 33 of file macros.h.

◆ GET_NTH_ARG_IMPL_0

#define GET_NTH_ARG_IMPL_0 ( _0,
... )
Value:
_0

Definition at line 34 of file macros.h.

◆ GET_NTH_ARG_IMPL_1

#define GET_NTH_ARG_IMPL_1 ( _0,
_1,
... )
Value:
_1

Definition at line 35 of file macros.h.

◆ GET_NTH_ARG_IMPL_2

#define GET_NTH_ARG_IMPL_2 ( _0,
_1,
_2,
... )
Value:
_2

Definition at line 36 of file macros.h.

◆ GET_NTH_ARG_IMPL_3

#define GET_NTH_ARG_IMPL_3 ( _0,
_1,
_2,
_3,
... )
Value:
_3

Definition at line 37 of file macros.h.

◆ GET_NTH_ARG_IMPL_4

#define GET_NTH_ARG_IMPL_4 ( _0,
_1,
_2,
_3,
_4,
... )
Value:
_4

Definition at line 38 of file macros.h.

◆ GET_NTH_ARG_IMPL_5

#define GET_NTH_ARG_IMPL_5 ( _0,
_1,
_2,
_3,
_4,
_5,
... )
Value:
_5

Definition at line 39 of file macros.h.

◆ GET_NTH_ARG_IMPL_6

#define GET_NTH_ARG_IMPL_6 ( _0,
_1,
_2,
_3,
_4,
_5,
_6,
... )
Value:
_6

Definition at line 40 of file macros.h.

◆ GET_NTH_ARG_IMPL_7

#define GET_NTH_ARG_IMPL_7 ( _0,
_1,
_2,
_3,
_4,
_5,
_6,
_7,
... )
Value:
_7

Definition at line 41 of file macros.h.

◆ IF_INTL

#define IF_INTL ( V,
... )

Definition at line 502 of file macros.h.

◆ IF_NO_V8_WASM_RANDOM_FUZZERS

#define IF_NO_V8_WASM_RANDOM_FUZZERS ( V,
... )
Value:
EXPAND(V(__VA_ARGS__))
#define V(Name)

Definition at line 532 of file macros.h.

◆ IF_SHADOW_STACK

#define IF_SHADOW_STACK ( V,
... )

Definition at line 511 of file macros.h.

◆ IF_TARGET_ARCH_64_BIT

#define IF_TARGET_ARCH_64_BIT ( V,
... )

Definition at line 520 of file macros.h.

◆ IF_TSAN

#define IF_TSAN ( V,
... )

Definition at line 493 of file macros.h.

◆ IF_V8_WASM_RANDOM_FUZZERS

#define IF_V8_WASM_RANDOM_FUZZERS ( V,
... )

Definition at line 531 of file macros.h.

◆ IF_WASM

#define IF_WASM ( V,
... )

Definition at line 472 of file macros.h.

◆ IF_WASM_DRUMBRAKE

#define IF_WASM_DRUMBRAKE ( V,
... )

Definition at line 478 of file macros.h.

◆ IF_WASM_DRUMBRAKE_INSTR_HANDLER

#define IF_WASM_DRUMBRAKE_INSTR_HANDLER ( V,
... )

Definition at line 484 of file macros.h.

◆ LITERAL_COMMA

#define LITERAL_COMMA   ,

Definition at line 61 of file macros.h.

◆ MOVE_ONLY_NO_DEFAULT_CONSTRUCTOR

#define MOVE_ONLY_NO_DEFAULT_CONSTRUCTOR ( TypeName)
Value:
TypeName(TypeName&&) V8_NOEXCEPT = default; \
TypeName& operator=(TypeName&&) V8_NOEXCEPT = default; \
TypeName(const TypeName&) = delete; \
DISALLOW_ASSIGN(TypeName)
#define V8_NOEXCEPT
#define DISALLOW_ASSIGN(TypeName)
Definition macros.h:125

Definition at line 143 of file macros.h.

◆ MOVE_ONLY_WITH_DEFAULT_CONSTRUCTORS

#define MOVE_ONLY_WITH_DEFAULT_CONSTRUCTORS ( TypeName)
Value:
TypeName() = default; \
MOVE_ONLY_NO_DEFAULT_CONSTRUCTOR(TypeName)

Definition at line 137 of file macros.h.

◆ NOTHING

#define NOTHING ( ...)

Definition at line 19 of file macros.h.

◆ OFFSET_OF

#define OFFSET_OF ( type,
field )
Value:
offsetof(type, field)

Definition at line 57 of file macros.h.

◆ UNIQUE_IDENTIFIER

#define UNIQUE_IDENTIFIER ( base)
Value:
CONCAT(base, __COUNTER__)

Definition at line 24 of file macros.h.

◆ UNPAREN

#define UNPAREN ( X)
Value:
CONCAT(DROP_, UNPAREN_ X)
#define UNPAREN_(...)
Definition macros.h:54

Definition at line 53 of file macros.h.

◆ UNPAREN_

#define UNPAREN_ ( ...)
Value:
UNPAREN_ __VA_ARGS__

Definition at line 54 of file macros.h.

◆ USE

#define USE ( ...)
Value:
do { \
::v8::base::Use unused_tmp_array_for_use_macro[]{__VA_ARGS__}; \
(void)unused_tmp_array_for_use_macro; \
} while (false)

Definition at line 293 of file macros.h.

◆ V8_EXPORT_ENUM

#define V8_EXPORT_ENUM

Definition at line 461 of file macros.h.

◆ V8_EXPORT_PRIVATE

#define V8_EXPORT_PRIVATE

Definition at line 460 of file macros.h.

◆ V8_PRETTY_FUNCTION_VALUE_OR

#define V8_PRETTY_FUNCTION_VALUE_OR ( ELSE)
Value:
#define ELSE

Definition at line 221 of file macros.h.

◆ V8_PTR_HEX_DIGITS

#define V8_PTR_HEX_DIGITS   8

Definition at line 339 of file macros.h.

◆ V8_PTR_PREFIX

#define V8_PTR_PREFIX   ""

Definition at line 327 of file macros.h.

◆ V8PRIdPTR

#define V8PRIdPTR   V8_PTR_PREFIX "d"

Definition at line 332 of file macros.h.

◆ V8PRIdPTRDIFF

#define V8PRIdPTRDIFF   "td"

Definition at line 350 of file macros.h.

◆ V8PRIuPTR

#define V8PRIuPTR   V8_PTR_PREFIX "u"

Definition at line 333 of file macros.h.

◆ V8PRIuPTRDIFF

#define V8PRIuPTRDIFF   "tu"

Definition at line 351 of file macros.h.

◆ V8PRIxPTR

#define V8PRIxPTR   V8_PTR_PREFIX "x"

Definition at line 331 of file macros.h.

◆ V8PRIxPTR_FMT

#define V8PRIxPTR_FMT   "0x%08" V8PRIxPTR

Definition at line 340 of file macros.h.

◆ V8PRIxPTRDIFF

#define V8PRIxPTRDIFF   "tx"

Definition at line 349 of file macros.h.

Function Documentation

◆ AlignedAddress()

void * AlignedAddress ( void * address,
size_t alignment )
inline

Definition at line 407 of file macros.h.

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

◆ ArraySizeHelper() [1/2]

template<typename T , size_t N>
char(& ArraySizeHelper ( const T(&) array[N]) )[N]

◆ ArraySizeHelper() [2/2]

template<typename T , size_t N>
char(& ArraySizeHelper ( T(&) array[N]) )[N]

◆ implicit_cast()

template<class A >
V8_INLINE A implicit_cast ( A x)

Definition at line 306 of file macros.h.

Here is the caller graph for this function:

◆ is_inbounds()

template<typename int_t , typename float_t , typename biggest_int_t = int64_t>
bool is_inbounds ( float_t v)

Definition at line 420 of file macros.h.

◆ IsAligned()

template<typename T , typename U >
bool IsAligned ( T value,
U alignment )
inlineconstexpr

Definition at line 403 of file macros.h.

◆ make_uint64()

uint64_t make_uint64 ( uint32_t high,
uint32_t low )
inline

Definition at line 365 of file macros.h.

Here is the caller graph for this function:

◆ RoundDown() [1/2]

template<intptr_t m, typename T >
T RoundDown ( T x)
constexpr

Definition at line 378 of file macros.h.

◆ RoundDown() [2/2]

template<typename T >
T RoundDown ( T x,
intptr_t m )
constexpr

Definition at line 371 of file macros.h.

Here is the caller graph for this function:

◆ RoundUp() [1/2]

template<intptr_t m, typename T >
T RoundUp ( T x)
constexpr

Definition at line 395 of file macros.h.

Here is the call graph for this function:

◆ RoundUp() [2/2]

template<typename T >
T RoundUp ( T x,
intptr_t m )
constexpr

Definition at line 387 of file macros.h.

Here is the call graph for this function:

◆ RoundUpAddress()

void * RoundUpAddress ( void * address,
size_t alignment )
inline

Definition at line 412 of file macros.h.

Here is the call graph for this function: