V8 Project
v8::internal::ToBooleanStub Class Reference

#include <code-stubs.h>

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

Classes

class  ResultModeBits
 
class  Types
 
class  TypesBits
 

Public Types

enum  Type {
  UNDEFINED , BOOLEAN , NULL_TYPE , SMI ,
  SPEC_OBJECT , STRING , SYMBOL , HEAP_NUMBER ,
  NUMBER_OF_TYPES
}
 
enum  ResultMode { RESULT_AS_SMI , RESULT_AS_ODDBALL , RESULT_AS_INVERSE_ODDBALL }
 
- Public Types inherited from v8::internal::HydrogenCodeStub
enum  InitializationState { UNINITIALIZED , INITIALIZED }
 

Public Member Functions

 STATIC_ASSERT (NUMBER_OF_TYPES<=8)
 
 ToBooleanStub (Isolate *isolate, ResultMode mode, Types types=Types())
 
 ToBooleanStub (Isolate *isolate, ExtraICState state)
 
bool UpdateStatus (Handle< Object > object)
 
Types types () const
 
ResultMode mode () const
 
virtual Code::Kind GetCodeKind () const
 
virtual void PrintState (OStream &os) const OVERRIDE
 
virtual bool SometimesSetsUpAFrame ()
 
virtual ExtraICState GetExtraICState () const
 
virtual InlineCacheState GetICState () const
 
- Public Member Functions inherited from v8::internal::HydrogenCodeStub
virtual Handle< CodeGenerateCode ()=0
 
bool IsUninitialized () const
 
Handle< CodeGenerateLightweightMissCode (ExternalReference miss)
 
template<class StateType >
void TraceTransition (StateType from, StateType to)
 

Static Public Member Functions

static Handle< CodeGetUninitialized (Isolate *isolate)
 
- Static Public Member Functions inherited from v8::internal::HydrogenCodeStub
template<class SubClass >
static Handle< CodeGetUninitialized (Isolate *isolate)
 

Private Member Functions

 ToBooleanStub (Isolate *isolate, InitializationState init_state)
 
 DEFINE_CALL_INTERFACE_DESCRIPTOR (ToBoolean)
 
 DEFINE_HYDROGEN_CODE_STUB (ToBoolean, HydrogenCodeStub)
 

Additional Inherited Members

- Protected Member Functions inherited from v8::internal::HydrogenCodeStub
 HydrogenCodeStub (Isolate *isolate, InitializationState state=INITIALIZED)
 
void set_sub_minor_key (uint32_t key)
 
uint32_t sub_minor_key () const
 
- Static Protected Attributes inherited from v8::internal::HydrogenCodeStub
static const int kSubMinorKeyBits = kStubMinorKeyBits - 1
 

Detailed Description

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

Member Enumeration Documentation

◆ ResultMode

Enumerator
RESULT_AS_SMI 
RESULT_AS_ODDBALL 
RESULT_AS_INVERSE_ODDBALL 

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

2213  {
2214  RESULT_AS_SMI, // For Smi(1) on truthy value, Smi(0) otherwise.
2215  RESULT_AS_ODDBALL, // For {true} on truthy value, {false} otherwise.
2216  RESULT_AS_INVERSE_ODDBALL // For {false} on truthy value, {true} otherwise.
2217  };

◆ Type

Enumerator
UNDEFINED 
BOOLEAN 
NULL_TYPE 
SMI 
SPEC_OBJECT 
STRING 
SYMBOL 
HEAP_NUMBER 
NUMBER_OF_TYPES 

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

Constructor & Destructor Documentation

◆ ToBooleanStub() [1/3]

v8::internal::ToBooleanStub::ToBooleanStub ( Isolate isolate,
ResultMode  mode,
Types  types = Types() 
)
inline

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

2238  : HydrogenCodeStub(isolate) {
2241  }
static U encode(T value)
Definition: utils.h:217
HydrogenCodeStub(Isolate *isolate, InitializationState state=INITIALIZED)
Definition: code-stubs.h:457
void set_sub_minor_key(uint32_t key)
Definition: code-stubs.h:463
ResultMode mode() const
Definition: code-stubs.h:2251

References v8::internal::BitFieldBase< T, shift, size, U >::encode(), mode(), v8::internal::HydrogenCodeStub::set_sub_minor_key(), v8::internal::ToBooleanStub::Types::ToByte(), and types().

Referenced by GetUninitialized().

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

◆ ToBooleanStub() [2/3]

v8::internal::ToBooleanStub::ToBooleanStub ( Isolate isolate,
ExtraICState  state 
)
inline

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

2244  : HydrogenCodeStub(isolate) {
2245  set_sub_minor_key(TypesBits::encode(static_cast<byte>(state)) |
2247  }

References v8::internal::BitFieldBase< T, shift, size, U >::encode(), RESULT_AS_SMI, and v8::internal::HydrogenCodeStub::set_sub_minor_key().

+ Here is the call graph for this function:

◆ ToBooleanStub() [3/3]

v8::internal::ToBooleanStub::ToBooleanStub ( Isolate isolate,
InitializationState  init_state 
)
inlineprivate

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

2274  : HydrogenCodeStub(isolate, init_state) {
2276  }

References v8::internal::BitFieldBase< T, shift, size, U >::encode(), RESULT_AS_SMI, and v8::internal::HydrogenCodeStub::set_sub_minor_key().

+ Here is the call graph for this function:

Member Function Documentation

◆ DEFINE_CALL_INTERFACE_DESCRIPTOR()

v8::internal::ToBooleanStub::DEFINE_CALL_INTERFACE_DESCRIPTOR ( ToBoolean  )
private

◆ DEFINE_HYDROGEN_CODE_STUB()

v8::internal::ToBooleanStub::DEFINE_HYDROGEN_CODE_STUB ( ToBoolean  ,
HydrogenCodeStub   
)
private

◆ GetCodeKind()

virtual Code::Kind v8::internal::ToBooleanStub::GetCodeKind ( ) const
inlinevirtual

Reimplemented from v8::internal::HydrogenCodeStub.

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

2253 { return Code::TO_BOOLEAN_IC; }

◆ GetExtraICState()

virtual ExtraICState v8::internal::ToBooleanStub::GetExtraICState ( ) const
inlinevirtual

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

2262 { return types().ToIntegral(); }
T ToIntegral() const
Definition: utils.h:861

References v8::internal::EnumSet< E, T >::ToIntegral(), and types().

+ Here is the call graph for this function:

◆ GetICState()

virtual InlineCacheState v8::internal::ToBooleanStub::GetICState ( ) const
inlinevirtual

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

2264  {
2265  if (types().IsEmpty()) {
2267  } else {
2268  return MONOMORPHIC;
2269  }
2270  }
@ UNINITIALIZED
Definition: globals.h:446

References v8::internal::MONOMORPHIC, types(), and v8::internal::UNINITIALIZED.

+ Here is the call graph for this function:

◆ GetUninitialized()

static Handle<Code> v8::internal::ToBooleanStub::GetUninitialized ( Isolate isolate)
inlinestatic

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

2258  {
2259  return ToBooleanStub(isolate, UNINITIALIZED).GetCode();
2260  }
ToBooleanStub(Isolate *isolate, ResultMode mode, Types types=Types())
Definition: code-stubs.h:2237

References ToBooleanStub(), and v8::internal::HydrogenCodeStub::UNINITIALIZED.

+ Here is the call graph for this function:

◆ mode()

ResultMode v8::internal::ToBooleanStub::mode ( ) const
inline

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

static T decode(U value)
Definition: utils.h:228
uint32_t sub_minor_key() const
Definition: code-stubs.h:467

References v8::internal::BitFieldBase< T, shift, size, U >::decode(), and v8::internal::HydrogenCodeStub::sub_minor_key().

Referenced by v8::internal::CodeStubGraphBuilder< Stub >::BuildCodeInitializedStub(), and ToBooleanStub().

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

◆ PrintState()

void v8::internal::ToBooleanStub::PrintState ( OStream os) const
virtual

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

846  { // NOLINT
847  os << types();
848 }

References types().

+ Here is the call graph for this function:

◆ SometimesSetsUpAFrame()

virtual bool v8::internal::ToBooleanStub::SometimesSetsUpAFrame ( )
inlinevirtual

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

2256 { return false; }

◆ STATIC_ASSERT()

v8::internal::ToBooleanStub::STATIC_ASSERT ( NUMBER_OF_TYPES<=  8)

◆ types()

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

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

2250 { return Types(TypesBits::decode(sub_minor_key())); }

References v8::internal::BitFieldBase< T, shift, size, U >::decode(), and v8::internal::HydrogenCodeStub::sub_minor_key().

Referenced by v8::internal::CodeStubGraphBuilder< Stub >::BuildCodeInitializedStub(), GetExtraICState(), GetICState(), PrintState(), ToBooleanStub(), and UpdateStatus().

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

◆ UpdateStatus()

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

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

836  {
837  Types new_types = types();
838  Types old_types = new_types;
839  bool to_boolean_value = new_types.UpdateStatus(object);
840  TraceTransition(old_types, new_types);
841  set_sub_minor_key(TypesBits::update(sub_minor_key(), new_types.ToByte()));
842  return to_boolean_value;
843 }
static U update(U previous, T value)
Definition: utils.h:223
void TraceTransition(StateType from, StateType to)
Definition: code-stubs.cc:458

References v8::internal::HydrogenCodeStub::set_sub_minor_key(), v8::internal::HydrogenCodeStub::sub_minor_key(), v8::internal::ToBooleanStub::Types::ToByte(), v8::internal::HydrogenCodeStub::TraceTransition(), types(), v8::internal::BitFieldBase< T, shift, size, U >::update(), and v8::internal::ToBooleanStub::Types::UpdateStatus().

Referenced by v8::internal::ToBooleanIC::ToBoolean().

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