V8 Project
v8::internal::Unique< T > Class Template Reference

#include <unique.h>

+ Inheritance diagram for v8::internal::Unique< T >:
+ Collaboration diagram for v8::internal::Unique< T >:

Public Member Functions

 Unique ()
 
 Unique (Handle< T > handle)
 
 Unique (Address raw_address, Handle< T > handle)
 
template<class S >
 Unique (Unique< S > uniq)
 
template<typename U >
bool operator== (const Unique< U > &other) const
 
template<typename U >
bool operator!= (const Unique< U > &other) const
 
intptr_t Hashcode () const
 
bool IsNull () const
 
bool IsKnownGlobal (void *global) const
 
Handle< Thandle () const
 
bool IsInitialized () const
 

Static Public Member Functions

template<class S >
static Unique< Tcast (Unique< S > that)
 
static Unique< TCreateUninitialized (Handle< T > handle)
 
static Unique< TCreateImmovable (Handle< T > handle)
 

Protected Attributes

Address raw_address_
 
Handle< Thandle_
 

Friends

class UniqueSet< T >
 
template<class U >
class Unique
 
class SideEffectsTracker
 

Detailed Description

template<typename T>
class v8::internal::Unique< T >

Definition at line 33 of file unique.h.

Constructor & Destructor Documentation

◆ Unique() [1/4]

template<typename T >
v8::internal::Unique< T >::Unique ( )
inline

Definition at line 1 of file unique.h.

35 : raw_address_(NULL) {}
Address raw_address_
Definition: unique.h:125
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

◆ Unique() [2/4]

template<typename T >
v8::internal::Unique< T >::Unique ( Handle< T handle)
inlineexplicit

Definition at line 38 of file unique.h.

38  {
39  if (handle.is_null()) {
41  } else {
42  // This is a best-effort check to prevent comparing Unique<T>'s created
43  // in different GC eras; we require heap allocation to be disallowed at
44  // creation time.
45  // NOTE: we currently consider maps to be non-movable, so no special
46  // assurance is required for creating a Unique<Map>.
47  // TODO(titzer): other immortable immovable objects are also fine.
48  DCHECK(!AllowHeapAllocation::IsAllowed() || handle->IsMap());
49  raw_address_ = reinterpret_cast<Address>(*handle);
50  DCHECK_NE(raw_address_, NULL); // Non-null should imply non-zero address.
51  }
52  handle_ = handle;
53  }
Handle< T > handle() const
Definition: unique.h:99
Handle< T > handle_
Definition: unique.h:126
#define DCHECK_NE(v1, v2)
Definition: logging.h:207
#define DCHECK(condition)
Definition: logging.h:205
byte * Address
Definition: globals.h:101

References DCHECK, DCHECK_NE, v8::internal::Unique< T >::handle(), v8::internal::Unique< T >::handle_, NULL, and v8::internal::Unique< T >::raw_address_.

+ Here is the call graph for this function:

◆ Unique() [3/4]

template<typename T >
v8::internal::Unique< T >::Unique ( Address  raw_address,
Handle< T handle 
)
inline

Definition at line 56 of file unique.h.

57  : raw_address_(raw_address), handle_(handle) { }

◆ Unique() [4/4]

template<typename T >
template<class S >
v8::internal::Unique< T >::Unique ( Unique< S uniq)
inline

Definition at line 61 of file unique.h.

61  {
62 #ifdef DEBUG
63  T* a = NULL;
64  S* b = NULL;
65  a = b; // Fake assignment to enforce type checks.
66  USE(a);
67 #endif
68  raw_address_ = uniq.raw_address_;
69  handle_ = uniq.handle_;
70  }
void USE(T)
Definition: macros.h:322
#define T(name, string, precedence)
Definition: token.cc:25

References v8::internal::Unique< T >::handle_, NULL, v8::internal::Unique< T >::raw_address_, v8::internal::S, T, and USE().

+ Here is the call graph for this function:

Member Function Documentation

◆ cast()

template<typename T >
template<class S >
static Unique<T> v8::internal::Unique< T >::cast ( Unique< S that)
inlinestatic

Definition at line 103 of file unique.h.

103  {
104  return Unique<T>(that.raw_address_, Handle<T>::cast(that.handle_));
105  }
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116

References v8::internal::Unique< T >::handle_, and v8::internal::Unique< T >::raw_address_.

Referenced by v8::internal::FINAL< kOperandKind, kNumCachedOperands >::MapValue().

+ Here is the caller graph for this function:

◆ CreateImmovable()

template<typename T >
static Unique<T> v8::internal::Unique< T >::CreateImmovable ( Handle< T handle)
inlinestatic

Definition at line 116 of file unique.h.

116  {
117  return Unique<T>(reinterpret_cast<Address>(*handle), handle);
118  }

References v8::internal::Unique< T >::handle().

Referenced by v8::internal::compiler::JSGraph::ImmovableHeapConstant(), and v8::internal::compiler::RawMachineAssembler::UndefinedConstant().

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

◆ CreateUninitialized()

template<typename T >
static Unique<T> v8::internal::Unique< T >::CreateUninitialized ( Handle< T handle)
inlinestatic

Definition at line 112 of file unique.h.

112  {
113  return Unique<T>(reinterpret_cast<Address>(NULL), handle);
114  }

References v8::internal::Unique< T >::handle(), and NULL.

Referenced by v8::internal::FINAL< kOperandKind, kNumCachedOperands >::handle(), v8::internal::compiler::RawMachineAssembler::HeapConstant(), v8::internal::compiler::StructuredGraphBuilder::MakeUnique(), and v8::internal::FINAL< kOperandKind, kNumCachedOperands >::New().

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

◆ handle()

◆ Hashcode()

template<typename T >
intptr_t v8::internal::Unique< T >::Hashcode ( ) const
inline

Definition at line 84 of file unique.h.

84  {
86  return reinterpret_cast<intptr_t>(raw_address_);
87  }
bool IsInitialized() const
Definition: unique.h:107

References DCHECK, v8::internal::Unique< T >::IsInitialized(), and v8::internal::Unique< T >::raw_address_.

Referenced by v8::internal::compiler::StaticParameterTraits< Unique< Name > >::HashCode(), and v8::internal::compiler::StaticParameterTraits< Unique< Object > >::HashCode().

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

◆ IsInitialized()

template<typename T >
bool v8::internal::Unique< T >::IsInitialized ( ) const
inline

Definition at line 107 of file unique.h.

107  {
108  return raw_address_ != NULL || handle_.is_null();
109  }

References v8::internal::Unique< T >::handle_, NULL, and v8::internal::Unique< T >::raw_address_.

Referenced by v8::internal::FINAL< kOperandKind, kNumCachedOperands >::Add(), v8::internal::Unique< T >::Hashcode(), v8::internal::Unique< T >::IsKnownGlobal(), v8::internal::Unique< T >::IsNull(), v8::internal::Unique< T >::operator!=(), and v8::internal::Unique< T >::operator==().

+ Here is the caller graph for this function:

◆ IsKnownGlobal()

template<typename T >
bool v8::internal::Unique< T >::IsKnownGlobal ( void *  global) const
inline

Definition at line 94 of file unique.h.

94  {
96  return raw_address_ == reinterpret_cast<Address>(global);
97  }

References DCHECK, v8::internal::Unique< T >::IsInitialized(), and v8::internal::Unique< T >::raw_address_.

Referenced by v8::internal::TypeOfString().

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

◆ IsNull()

template<typename T >
bool v8::internal::Unique< T >::IsNull ( ) const
inline

Definition at line 89 of file unique.h.

89  {
91  return raw_address_ == NULL;
92  }

References DCHECK, v8::internal::Unique< T >::IsInitialized(), NULL, and v8::internal::Unique< T >::raw_address_.

+ Here is the call graph for this function:

◆ operator!=()

template<typename T >
template<typename U >
bool v8::internal::Unique< T >::operator!= ( const Unique< U > &  other) const
inline

Definition at line 79 of file unique.h.

79  {
80  DCHECK(IsInitialized() && other.IsInitialized());
81  return raw_address_ != other.raw_address_;
82  }

References DCHECK, v8::internal::Unique< T >::IsInitialized(), and v8::internal::Unique< T >::raw_address_.

+ Here is the call graph for this function:

◆ operator==()

template<typename T >
template<typename U >
bool v8::internal::Unique< T >::operator== ( const Unique< U > &  other) const
inline

Definition at line 73 of file unique.h.

73  {
74  DCHECK(IsInitialized() && other.IsInitialized());
75  return raw_address_ == other.raw_address_;
76  }

References DCHECK, v8::internal::Unique< T >::IsInitialized(), and v8::internal::Unique< T >::raw_address_.

+ Here is the call graph for this function:

Friends And Related Function Documentation

◆ SideEffectsTracker

template<typename T >
friend class SideEffectsTracker
friend

Definition at line 128 of file unique.h.

◆ Unique

template<typename T >
template<class U >
friend class Unique
friend

Definition at line 122 of file unique.h.

◆ UniqueSet< T >

template<typename T >
friend class UniqueSet< T >
friend

Definition at line 116 of file unique.h.

Member Data Documentation

◆ handle_

◆ raw_address_


The documentation for this class was generated from the following files: