v8  3.25.30(node0.11.13)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
utils.h File Reference
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include "allocation.h"
#include "checks.h"
#include "globals.h"
Include dependency graph for utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  Handle< T >
 
class  BitFieldBase< T, shift, size, U >
 
class  BitField< T, shift, size >
 
class  BitField64< T, shift, size >
 
class  StaticResource< T >
 
class  Access< T >
 
class  Vector< T >
 
class  SetOncePointer< T >
 
class  EmbeddedVector< T, kSize >
 
class  ScopedVector< T >
 
class  Collector< T, growth_factor, max_growth >
 
class  SequenceCollector< T, growth_factor, max_growth >
 
struct  BitCastHelper< Dest, Source >
 
struct  BitCastHelper< Dest, Source * >
 
class  EmbeddedContainer< ElementType, NumElements >
 
class  EmbeddedContainer< ElementType, 0 >
 
class  SimpleStringBuilder
 
class  EnumSet< E, T >
 
class  TypeFeedbackId
 
class  BailoutId
 
class  ContainerPointerWrapper< C >
 

Namespaces

 v8
 
 v8::internal
 

Macros

#define IS_POWER_OF_TWO(x)   (((x) & ((x) - 1)) == 0)
 
#define STATIC_ASCII_VECTOR(x)
 
#define INT_1_TO_63_LIST(V)
 
#define DECLARE_IS_INT_N(N)   inline bool is_int##N(int64_t x) { return is_intn(x, N); }
 
#define DECLARE_IS_UINT_N(N)
 
#define DECLARE_TRUNCATE_TO_INT_N(N)
 

Functions

template<typename T >
bool IsPowerOf2 (T x)
 
int WhichPowerOf2 (uint32_t x)
 
int MostSignificantBit (uint32_t x)
 
int ArithmeticShiftRight (int x, int s)
 
template<typename T >
intptr_t OffsetFrom (T x)
 
template<typename T >
T AddressFrom (intptr_t x)
 
template<typename T >
T RoundDown (T x, intptr_t m)
 
template<typename T >
T RoundUp (T x, intptr_t m)
 
template<class T >
T AlignUp (T pointer, size_t alignment)
 
template<typename T >
int Compare (const T &a, const T &b)
 
template<typename T >
int PointerValueCompare (const T *a, const T *b)
 
template<typename T >
int HandleObjectPointerCompare (const Handle< T > *a, const Handle< T > *b)
 
uint32_t RoundUpToPowerOf2 (uint32_t x)
 
uint32_t RoundDownToPowerOf2 (uint32_t x)
 
template<typename T , typename U >
bool IsAligned (T value, U alignment)
 
bool IsAddressAligned (Address addr, intptr_t alignment, int offset=0)
 
template<typename T >
T Max (T a, T b)
 
template<typename T >
T Min (T a, T b)
 
template<typename T >
T Abs (T a)
 
template<typename T >
T NegAbs (T a)
 
int StrLength (const char *string)
 
int32_t WhichPowerOf2Abs (int32_t x)
 
uint32_t ComputeIntegerHash (uint32_t key, uint32_t seed)
 
uint32_t ComputeLongHash (uint64_t key)
 
uint32_t ComputePointerHash (void *ptr)
 
Vector< const char > CStrVector (const char *data)
 
Vector< const uint8_t > OneByteVector (const char *data, int length)
 
Vector< const uint8_t > OneByteVector (const char *data)
 
Vector< char > MutableCStrVector (char *data)
 
Vector< char > MutableCStrVector (char *data, int max)
 
template<typename lchar , typename rchar >
int CompareCharsUnsigned (const lchar *lhs, const rchar *rhs, int chars)
 
template<typename lchar , typename rchar >
int CompareChars (const lchar *lhs, const rchar *rhs, int chars)
 
int TenToThe (int exponent)
 
template<class Dest , class Source >
 INLINE (Dest BitCast(const Source &source))
 
template<class Dest , class Source >
Dest BitCast (const Source &source)
 
uint32_t unsigned_bitextract_32 (int msb, int lsb, uint32_t x)
 
uint64_t unsigned_bitextract_64 (int msb, int lsb, uint64_t x)
 
int32_t signed_bitextract_32 (int msb, int lsb, int32_t x)
 
int signed_bitextract_64 (int msb, int lsb, int x)
 
bool is_intn (int64_t x, unsigned n)
 
bool is_uintn (int64_t x, unsigned n)
 
template<class T >
T truncate_to_intn (T x, unsigned n)
 

Macro Definition Documentation

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

Definition at line 1129 of file utils.h.

#define DECLARE_IS_UINT_N (   N)
Value:
template <class T> \
inline bool is_uint##N(T x) { return is_uintn(x, N); }
#define T(name, string, precedence)
Definition: token.cc:48
bool is_uintn(int64_t x, unsigned n)
Definition: utils.h:1108

Definition at line 1131 of file utils.h.

#define DECLARE_TRUNCATE_TO_INT_N (   N)
Value:
template <class T> \
inline T truncate_to_int##N(T x) { return truncate_to_intn(x, N); }
T truncate_to_intn(T x, unsigned n)
Definition: utils.h:1114
#define T(name, string, precedence)
Definition: token.cc:48

Definition at line 1134 of file utils.h.

#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 1119 of file utils.h.

#define IS_POWER_OF_TWO (   x)    (((x) & ((x) - 1)) == 0)

Definition at line 46 of file utils.h.

Referenced by HashTable< Shape, Key >::Allocate(), and v8::internal::IsPowerOf2().