V8 Project
v8::internal::TypeImpl< Config >::UnionType Class Reference

#include <types.h>

+ Inheritance diagram for v8::internal::TypeImpl< Config >::UnionType:
+ Collaboration diagram for v8::internal::TypeImpl< Config >::UnionType:

Public Member Functions

bool Wellformed ()
 
- Public Member Functions inherited from v8::internal::TypeImpl< Config >
bool IsInhabited ()
 
bool Is (TypeImpl *that)
 
template<class TypeHandle >
bool Is (TypeHandle that)
 
bool Maybe (TypeImpl *that)
 
template<class TypeHandle >
bool Maybe (TypeHandle that)
 
bool Equals (TypeImpl *that)
 
template<class TypeHandle >
bool Equals (TypeHandle that)
 
bool Contains (i::Object *val)
 
bool Contains (i::Handle< i::Object > val)
 
bool NowIs (TypeImpl *that)
 
template<class TypeHandle >
bool NowIs (TypeHandle that)
 
bool NowContains (i::Object *val)
 
bool NowContains (i::Handle< i::Object > val)
 
bool NowStable ()
 
bool IsClass ()
 
bool IsConstant ()
 
bool IsRange ()
 
bool IsContext ()
 
bool IsArray ()
 
bool IsFunction ()
 
ClassTypeAsClass ()
 
ConstantTypeAsConstant ()
 
RangeTypeAsRange ()
 
ContextTypeAsContext ()
 
ArrayTypeAsArray ()
 
FunctionTypeAsFunction ()
 
double Min ()
 
double Max ()
 
int NumClasses ()
 
int NumConstants ()
 
Iterator< i::MapClasses ()
 
Iterator< i::ObjectConstants ()
 
void PrintTo (OStream &os, PrintDimension dim=BOTH_DIMS)
 
template<class OtherType >
TypeImpl< Config >::TypeHandle Convert (typename OtherType::TypeHandle type, Region *region)
 

Static Public Member Functions

static UnionHandle New (int length, Region *region)
 
static UnionTypecast (TypeImpl *type)
 
- Static Public Member Functions inherited from v8::internal::TypeImpl< Config >
static TypeHandle Class (i::Handle< i::Map > map, Region *region)
 
static TypeHandle Constant (i::Handle< i::Object > value, Region *region)
 
static TypeHandle Range (i::Handle< i::Object > min, i::Handle< i::Object > max, Region *region)
 
static TypeHandle Context (TypeHandle outer, Region *region)
 
static TypeHandle Array (TypeHandle element, Region *region)
 
static FunctionHandle Function (TypeHandle result, TypeHandle receiver, int arity, Region *region)
 
static TypeHandle Function (TypeHandle result, Region *region)
 
static TypeHandle Function (TypeHandle result, TypeHandle param0, Region *region)
 
static TypeHandle Function (TypeHandle result, TypeHandle param0, TypeHandle param1, Region *region)
 
static TypeHandle Function (TypeHandle result, TypeHandle param0, TypeHandle param1, TypeHandle param2, Region *region)
 
static TypeHandle Union (TypeHandle type1, TypeHandle type2, Region *reg)
 
static TypeHandle Intersect (TypeHandle type1, TypeHandle type2, Region *reg)
 
static TypeHandle Of (double value, Region *region)
 
static TypeHandle Of (i::Object *value, Region *region)
 
static TypeHandle Of (i::Handle< i::Object > value, Region *region)
 
static TypeHandle NowOf (i::Object *value, Region *region)
 
static TypeHandle NowOf (i::Handle< i::Object > value, Region *region)
 
static TypeImplcast (typename Config::Base *object)
 
template<class OtherTypeImpl >
static TypeHandle Convert (typename OtherTypeImpl::TypeHandle type, Region *region)
 

Additional Inherited Members

- Public Types inherited from v8::internal::TypeImpl< Config >
enum  PrintDimension { BOTH_DIMS , SEMANTIC_DIM , REPRESENTATION_DIM }
 
typedef uint32_t bitset
 
typedef Config::template Handle< TypeImpl >::type TypeHandle
 
typedef Config::template Handle< ClassType >::type ClassHandle
 
typedef Config::template Handle< ConstantType >::type ConstantHandle
 
typedef Config::template Handle< RangeType >::type RangeHandle
 
typedef Config::template Handle< ContextType >::type ContextHandle
 
typedef Config::template Handle< ArrayType >::type ArrayHandle
 
typedef Config::template Handle< FunctionType >::type FunctionHandle
 
typedef Config::template Handle< UnionType >::type UnionHandle
 
typedef Config::Region Region
 
- Protected Member Functions inherited from v8::internal::TypeImpl< Config >::StructuralType
int Length ()
 
TypeHandle Get (int i)
 
void Set (int i, TypeHandle type)
 
void Shrink (int length)
 
template<class V >
i::Handle< VGetValue (int i)
 
template<class V >
void SetValue (int i, i::Handle< V > x)
 
- Protected Member Functions inherited from v8::internal::TypeImpl< Config >
TypeImplunhandle ()
 
bool IsNone ()
 
bool IsAny ()
 
bool IsBitset ()
 
bool IsUnion ()
 
bitset AsBitset ()
 
UnionTypeAsUnion ()
 
bitset BitsetGlb ()
 
bitset BitsetLub ()
 
bool SlowIs (TypeImpl *that)
 
RangeTypeGetRange ()
 
bool SimplyEquals (TypeImpl *that)
 
template<class TypeHandle >
bool SimplyEquals (TypeHandle that)
 
- Static Protected Member Functions inherited from v8::internal::TypeImpl< Config >::StructuralType
static TypeHandle New (Tag tag, int length, Region *region)
 
- Static Protected Member Functions inherited from v8::internal::TypeImpl< Config >
template<class T >
static Config::template Handle< T >::type handle (T *type)
 
static bool IsInteger (double x)
 
static bool IsInteger (i::Object *x)
 
static Limits Intersect (Limits lhs, Limits rhs)
 
static Limits Union (Limits lhs, Limits rhs)
 
static bool Overlap (RangeType *lhs, RangeType *rhs)
 
static bool Contains (RangeType *lhs, RangeType *rhs)
 
static bool Contains (RangeType *range, i::Object *val)
 
static int UpdateRange (RangeHandle type, UnionHandle result, int size, Region *region)
 
static int AddToUnion (TypeHandle type, UnionHandle result, int size, Region *region)
 
static int IntersectAux (TypeHandle type, TypeHandle other, UnionHandle result, int size, Region *region)
 
static TypeHandle NormalizeUnion (UnionHandle unioned, int size)
 

Detailed Description

template<class Config>
class v8::internal::TypeImpl< Config >::UnionType

Definition at line 692 of file types.h.

Member Function Documentation

◆ cast()

template<class Config >
static UnionType* v8::internal::TypeImpl< Config >::UnionType::cast ( TypeImpl type)
inlinestatic

Definition at line 699 of file types.h.

699  {
700  DCHECK(type->IsUnion());
701  return static_cast<UnionType*>(type);
702  }
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, and v8::internal::TypeImpl< Config >::IsUnion().

Referenced by v8::internal::TypeImpl< Config >::AsUnion().

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

◆ New()

template<class Config >
static UnionHandle v8::internal::TypeImpl< Config >::UnionType::New ( int  length,
Region region 
)
inlinestatic

Definition at line 694 of file types.h.

694  {
695  return Config::template cast<UnionType>(
697  }
static TypeHandle New(Tag tag, int length, Region *region)
Definition: types.h:677

References v8::internal::TypeImpl< Config >::StructuralType::kUnionTag, and v8::internal::TypeImpl< Config >::StructuralType::New().

Referenced by v8::internal::TypeImpl< Config >::Convert(), and v8::internal::TypeImpl< Config >::Union().

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

◆ Wellformed()

template<class Config >
bool v8::internal::TypeImpl< Config >::UnionType::Wellformed

Definition at line 573 of file types.cc.

573  {
574  DisallowHeapAllocation no_allocation;
575  // This checks the invariants of the union representation:
576  // 1. There are at least two elements.
577  // 2. At most one element is a bitset, and it must be the first one.
578  // 3. At most one element is a range, and it must be the second one
579  // (even when the first element is not a bitset).
580  // 4. No element is itself a union.
581  // 5. No element is a subtype of any other.
582  DCHECK(this->Length() >= 2); // (1)
583  for (int i = 0; i < this->Length(); ++i) {
584  if (i != 0) DCHECK(!this->Get(i)->IsBitset()); // (2)
585  if (i != 1) DCHECK(!this->Get(i)->IsRange()); // (3)
586  DCHECK(!this->Get(i)->IsUnion()); // (4)
587  for (int j = 0; j < this->Length(); ++j) {
588  if (i != j) DCHECK(!this->Get(i)->Is(this->Get(j))); // (5)
589  }
590  }
591  return true;
592 }
bool Is(TypeImpl *that)
Definition: types.h:390
PerThreadAssertScopeDebugOnly< HEAP_ALLOCATION_ASSERT, false > DisallowHeapAllocation
Definition: assert-scope.h:110

References DCHECK, v8::internal::TypeImpl< Config >::Is(), v8::internal::TypeImpl< Config >::IsBitset(), v8::internal::TypeImpl< Config >::IsRange(), and v8::internal::TypeImpl< Config >::IsUnion().

Referenced by v8::internal::TypeImpl< Config >::BitsetType::Glb().

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

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