V8 Project
v8::internal::ToBooleanStub::Types Class Reference

#include <code-stubs.h>

+ Inheritance diagram for v8::internal::ToBooleanStub::Types:
+ Collaboration diagram for v8::internal::ToBooleanStub::Types:

Public Member Functions

 Types ()
 
 Types (byte bits)
 
byte ToByte () const
 
bool UpdateStatus (Handle< Object > object)
 
bool NeedsMap () const
 
bool CanBeUndetectable () const
 
bool IsGeneric () const
 
- Public Member Functions inherited from v8::internal::EnumSet< Type, byte >
 EnumSet (byte bits=0)
 
bool IsEmpty () const
 
bool Contains (Type element) const
 
bool ContainsAnyOf (const EnumSet &set) const
 
void Add (Type element)
 
void Add (const EnumSet &set)
 
void Remove (Type element)
 
void Remove (const EnumSet &set)
 
void RemoveAll ()
 
void Intersect (const EnumSet &set)
 
byte ToIntegral () const
 
bool operator== (const EnumSet &set)
 
bool operator!= (const EnumSet &set)
 
EnumSet< Type, byteoperator| (const EnumSet &set) const
 

Static Public Member Functions

static Types Generic ()
 

Detailed Description

Definition at line 2223 of file code-stubs.h.

Constructor & Destructor Documentation

◆ Types() [1/2]

v8::internal::ToBooleanStub::Types::Types ( )
inline

Definition at line 2225 of file code-stubs.h.

2225 : EnumSet<Type, byte>(0) {}

Referenced by Generic().

+ Here is the caller graph for this function:

◆ Types() [2/2]

v8::internal::ToBooleanStub::Types::Types ( byte  bits)
inlineexplicit

Definition at line 2226 of file code-stubs.h.

2226 : EnumSet<Type, byte>(bits) {}

Member Function Documentation

◆ CanBeUndetectable()

bool v8::internal::ToBooleanStub::Types::CanBeUndetectable ( ) const

◆ Generic()

static Types v8::internal::ToBooleanStub::Types::Generic ( )
inlinestatic

Definition at line 2234 of file code-stubs.h.

References v8::internal::ToBooleanStub::NUMBER_OF_TYPES, and Types().

Referenced by IsGeneric().

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

◆ IsGeneric()

bool v8::internal::ToBooleanStub::Types::IsGeneric ( ) const
inline

Definition at line 2232 of file code-stubs.h.

2232 { return ToIntegral() == Generic().ToIntegral(); }

References Generic(), v8::internal::EnumSet< E, T >::ToIntegral(), and v8::internal::EnumSet< Type, byte >::ToIntegral().

+ Here is the call graph for this function:

◆ NeedsMap()

◆ ToByte()

byte v8::internal::ToBooleanStub::Types::ToByte ( ) const
inline

Definition at line 2228 of file code-stubs.h.

2228 { return ToIntegral(); }

References v8::internal::EnumSet< Type, byte >::ToIntegral().

Referenced by v8::internal::ToBooleanStub::ToBooleanStub(), and v8::internal::ToBooleanStub::UpdateStatus().

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

◆ UpdateStatus()

bool v8::internal::ToBooleanStub::Types::UpdateStatus ( Handle< Object object)

Definition at line 867 of file code-stubs.cc.

867  {
868  if (object->IsUndefined()) {
869  Add(UNDEFINED);
870  return false;
871  } else if (object->IsBoolean()) {
872  Add(BOOLEAN);
873  return object->IsTrue();
874  } else if (object->IsNull()) {
875  Add(NULL_TYPE);
876  return false;
877  } else if (object->IsSmi()) {
878  Add(SMI);
879  return Smi::cast(*object)->value() != 0;
880  } else if (object->IsSpecObject()) {
881  Add(SPEC_OBJECT);
882  return !object->IsUndetectableObject();
883  } else if (object->IsString()) {
884  Add(STRING);
885  return !object->IsUndetectableObject() &&
886  String::cast(*object)->length() != 0;
887  } else if (object->IsSymbol()) {
888  Add(SYMBOL);
889  return true;
890  } else if (object->IsHeapNumber()) {
891  DCHECK(!object->IsUndetectableObject());
892  Add(HEAP_NUMBER);
893  double value = HeapNumber::cast(*object)->value();
894  return value != 0 && !std::isnan(value);
895  } else {
896  // We should never see an internal object at runtime here!
897  UNREACHABLE();
898  return true;
899  }
900 }
void Add(Type element)
Definition: utils.h:855
#define UNREACHABLE()
Definition: logging.h:30
#define DCHECK(condition)
Definition: logging.h:205
int isnan(double x)

References v8::internal::EnumSet< Type, byte >::Add(), v8::internal::ToBooleanStub::BOOLEAN, DCHECK, v8::internal::ToBooleanStub::HEAP_NUMBER, v8::internal::ToBooleanStub::NULL_TYPE, v8::internal::ToBooleanStub::SMI, v8::internal::ToBooleanStub::SPEC_OBJECT, v8::internal::ToBooleanStub::STRING, v8::internal::ToBooleanStub::SYMBOL, v8::internal::ToBooleanStub::UNDEFINED, and UNREACHABLE.

Referenced by v8::internal::ToBooleanStub::UpdateStatus().

+ 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: