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

Go to the source code of this file.

Classes

class  v8::internal::SetOncePointer< T >
 
class  v8::internal::FeedbackSlot
 
class  v8::internal::BytecodeOffset
 

Namespaces

namespace  v8
 
namespace  v8::internal
 

Macros

#define DEFINE_ONE_FIELD_OFFSET(Name, Size, ...)
 
#define DEFINE_FIELD_OFFSET_CONSTANTS(StartOffset, LIST_MACRO)
 
#define DEFINE_ONE_FIELD_OFFSET_PURE_NAME(CamelName, Size, ...)
 
#define DEFINE_FIELD_OFFSET_CONSTANTS_WITH_PURE_NAME(StartOffset, LIST_MACRO)
 
#define FIELD_SIZE(Name)
 
#define STATIC_ASSERT_FIELD_OFFSETS_EQUAL(Offset1, Offset2)
 
#define INT_1_TO_63_LIST(V)
 
#define DECLARE_IS_INT_N(N)
 
#define DECLARE_IS_UINT_N(N)
 
#define DECLARE_TRUNCATE_TO_INT_N(N)
 
#define DECLARE_CHECKED_TRUNCATE_TO_INT_N(N)
 
#define INT_0_TO_127_LIST(V)
 

Enumerations

enum  v8::internal::ToIndexMode { v8::internal::kToArrayIndex , v8::internal::kToIntegerIndex }
 

Functions

template<typename T >
static T v8::internal::ArithmeticShiftRight (T x, int shift)
 
template<typename T >
T v8::internal::JSMax (T x, T y)
 
template<typename T >
T v8::internal::JSMin (T x, T y)
 
template<typename T >
requires std::is_signed<T>::value
std::make_unsigned< T >::type v8::internal::Abs (T a)
 
double v8::internal::Modulo (double x, double y)
 
template<typename T >
T v8::internal::SaturateAdd (T a, T b)
 
template<typename T >
T v8::internal::SaturateSub (T a, T b)
 
template<typename T >
T v8::internal::SaturateRoundingQMul (T a, T b)
 
template<typename Wide , typename Narrow >
Wide v8::internal::MultiplyLong (Narrow a, Narrow b)
 
template<typename Wide , typename Narrow >
Wide v8::internal::AddLong (Narrow a, Narrow b)
 
template<typename T >
T v8::internal::RoundingAverageUnsigned (T a, T b)
 
uint32_t v8::internal::ComputeUnseededHash (uint32_t key)
 
uint32_t v8::internal::ComputeLongHash (uint64_t key)
 
uint32_t v8::internal::ComputeSeededHash (uint32_t key, uint64_t seed)
 
uint32_t v8::internal::ComputePointerHash (void *ptr)
 
uint32_t v8::internal::ComputeAddressHash (Address address)
 
template<typename IntType , typename Char >
V8_INLINE bool v8::internal::OverlappingCompare (const Char *lhs, const Char *rhs, size_t count)
 
template<typename Char >
V8_INLINE bool v8::internal::SimdMemEqual (const Char *lhs, const Char *rhs, size_t count)
 
template<typename lchar , typename rchar >
bool v8::internal::CompareCharsEqualUnsigned (const lchar *lhs, const rchar *rhs, size_t chars)
 
template<typename lchar , typename rchar >
bool v8::internal::CompareCharsEqual (const lchar *lhs, const rchar *rhs, size_t chars)
 
template<typename lchar , typename rchar >
int v8::internal::CompareCharsUnsigned (const lchar *lhs, const rchar *rhs, size_t chars)
 
template<typename lchar , typename rchar >
int v8::internal::CompareChars (const lchar *lhs, const rchar *rhs, size_t chars)
 
constexpr uint64_t v8::internal::TenToThe (uint32_t exponent)
 
uint32_t v8::internal::unsigned_bitextract_32 (int msb, int lsb, uint32_t x)
 
uint64_t v8::internal::unsigned_bitextract_64 (int msb, int lsb, uint64_t x)
 
int32_t v8::internal::signed_bitextract_32 (int msb, int lsb, uint32_t x)
 
constexpr bool v8::internal::is_intn (int64_t x, unsigned n)
 
constexpr bool v8::internal::is_uintn (int64_t x, unsigned n)
 
template<class T >
constexpr T v8::internal::truncate_to_intn (T x, unsigned n)
 
std::ostream & v8::internal::operator<< (std::ostream &os, FeedbackSlot slot)
 
V8_EXPORT_PRIVATE void v8::internal::PRINTF_FORMAT (1, 2) PrintF(const char *format
 
V8_EXPORT_PRIVATE void V8_EXPORT_PRIVATE void v8::internal::PRINTF_FORMAT (2, 3) PrintF(FILE *out
 
char * v8::internal::ReadLine (const char *prompt)
 
int v8::internal::WriteChars (const char *filename, const char *str, int size, bool verbose)
 
int v8::internal::WriteBytes (const char *filename, const uint8_t *bytes, int size, bool verbose)
 
std::string v8::internal::ReadFile (const char *filename, bool *exists, bool verbose)
 
std::string v8::internal::ReadFile (FILE *file, bool *exists, bool verbose)
 
bool v8::internal::DoubleToBoolean (double d)
 
template<typename Char >
bool v8::internal::TryAddIndexChar (uint32_t *index, Char c)
 
template<typename Stream , typename index_t , enum ToIndexMode mode>
bool v8::internal::StringToIndex (Stream *stream, index_t *index)
 
uintptr_t v8::internal::GetCurrentStackPosition ()
 
static uint16_t v8::internal::ByteReverse16 (uint16_t value)
 
static uint32_t v8::internal::ByteReverse32 (uint32_t value)
 
static uint64_t v8::internal::ByteReverse64 (uint64_t value)
 
template<typename V >
static V v8::internal::ByteReverse (V value)
 
bool v8::internal::PassesFilter (base::Vector< const char > name, base::Vector< const char > filter)
 
V8_INLINE void v8::internal::ZapCode (Address addr, size_t size_in_bytes)
 
bool v8::internal::RoundUpToPageSize (size_t byte_length, size_t page_size, size_t max_allowed_byte_length, size_t *pages)
 

Variables

static const uint64_t v8::internal::kZeroHashSeed = 0
 
V8_EXPORT_PRIVATE void V8_EXPORT_PRIVATE void const char * v8::internal::format
 

Macro Definition Documentation

◆ DECLARE_CHECKED_TRUNCATE_TO_INT_N

#define DECLARE_CHECKED_TRUNCATE_TO_INT_N ( N)
Value:
template <class T> \
inline constexpr T checked_truncate_to_int##N(T x) { \
CHECK(is_int##N(x)); \
return truncate_to_intn(x, N); \
}
int x

Definition at line 609 of file utils.h.

◆ DECLARE_IS_INT_N

#define DECLARE_IS_INT_N ( N)
Value:
inline constexpr bool is_int##N(int64_t x) { return is_intn(x, N); }

Definition at line 596 of file utils.h.

◆ DECLARE_IS_UINT_N

#define DECLARE_IS_UINT_N ( N)
Value:
template <class T> \
inline constexpr bool is_uint##N(T x) { \
return is_uintn(x, N); \
}

Definition at line 598 of file utils.h.

◆ DECLARE_TRUNCATE_TO_INT_N

#define DECLARE_TRUNCATE_TO_INT_N ( N)
Value:
template <class T> \
inline constexpr T truncate_to_int##N(T x) { \
return truncate_to_intn(x, N); \
}

Definition at line 603 of file utils.h.

◆ DEFINE_FIELD_OFFSET_CONSTANTS

#define DEFINE_FIELD_OFFSET_CONSTANTS ( StartOffset,
LIST_MACRO )
Value:
enum { \
LIST_MACRO##_StartOffset = StartOffset - 1, \
};
#define DEFINE_ONE_FIELD_OFFSET(Name, Size,...)
Definition utils.h:239

Definition at line 242 of file utils.h.

◆ DEFINE_FIELD_OFFSET_CONSTANTS_WITH_PURE_NAME

#define DEFINE_FIELD_OFFSET_CONSTANTS_WITH_PURE_NAME ( StartOffset,
LIST_MACRO )
Value:
enum { \
LIST_MACRO##_StartOffset = StartOffset - 1, \
};
#define DEFINE_ONE_FIELD_OFFSET_PURE_NAME(CamelName, Size,...)
Definition utils.h:248

Definition at line 252 of file utils.h.

◆ DEFINE_ONE_FIELD_OFFSET

#define DEFINE_ONE_FIELD_OFFSET ( Name,
Size,
... )
Value:
Name, Name##End = Name + (Size)-1,

Definition at line 239 of file utils.h.

◆ DEFINE_ONE_FIELD_OFFSET_PURE_NAME

#define DEFINE_ONE_FIELD_OFFSET_PURE_NAME ( CamelName,
Size,
... )
Value:
k##CamelName##Offset, \
k##CamelName##OffsetEnd = k##CamelName##Offset + (Size)-1,

Definition at line 248 of file utils.h.

◆ FIELD_SIZE

#define FIELD_SIZE ( Name)
Value:
(Name##End + 1 - Name)

Definition at line 259 of file utils.h.

◆ INT_0_TO_127_LIST

#define INT_0_TO_127_LIST ( V)
Value:
V(0) V(1) V(2) V(3) V(4) V(5) V(6) V(7) V(8) V(9) \
V(10) V(11) V(12) V(13) V(14) V(15) V(16) V(17) V(18) V(19) \
V(20) V(21) V(22) V(23) V(24) V(25) V(26) V(27) V(28) V(29) \
V(30) V(31) V(32) V(33) V(34) V(35) V(36) V(37) V(38) V(39) \
V(40) V(41) V(42) V(43) V(44) V(45) V(46) V(47) V(48) V(49) \
V(50) V(51) V(52) V(53) V(54) V(55) V(56) V(57) V(58) V(59) \
V(60) V(61) V(62) V(63) V(64) V(65) V(66) V(67) V(68) V(69) \
V(70) V(71) V(72) V(73) V(74) V(75) V(76) V(77) V(78) V(79) \
V(80) V(81) V(82) V(83) V(84) V(85) V(86) V(87) V(88) V(89) \
V(90) V(91) V(92) V(93) V(94) V(95) V(96) V(97) V(98) V(99) \
V(100) V(101) V(102) V(103) V(104) V(105) V(106) V(107) V(108) V(109) \
V(110) V(111) V(112) V(113) V(114) V(115) V(116) V(117) V(118) V(119) \
V(120) V(121) V(122) V(123) V(124) V(125) V(126) V(127)
#define V(Name)

Definition at line 625 of file utils.h.

◆ INT_1_TO_63_LIST

#define INT_1_TO_63_LIST ( V)
Value:
V(1) V(2) V(3) V(4) V(5) V(6) V(7) V(8) V(9) V(10) \
V(11) V(12) V(13) V(14) V(15) V(16) V(17) V(18) V(19) V(20) \
V(21) V(22) V(23) V(24) V(25) V(26) V(27) V(28) V(29) V(30) \
V(31) V(32) V(33) V(34) V(35) V(36) V(37) V(38) V(39) V(40) \
V(41) V(42) V(43) V(44) V(45) V(46) V(47) V(48) V(49) V(50) \
V(51) V(52) V(53) V(54) V(55) V(56) V(57) V(58) V(59) V(60) \
V(61) V(62) V(63)

Definition at line 586 of file utils.h.

◆ STATIC_ASSERT_FIELD_OFFSETS_EQUAL

#define STATIC_ASSERT_FIELD_OFFSETS_EQUAL ( Offset1,
Offset2 )
Value:
static_assert(static_cast<int>(Offset1) == Offset2)

Definition at line 262 of file utils.h.