V8 Project
v8::internal::CompareNilICStub Class Reference

#include <code-stubs.h>

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

Classes

class  NilValueBits
 
class  State
 
class  TypesBits
 

Public Member Functions

TypeGetType (Zone *zone, Handle< Map > map=Handle< Map >())
 
TypeGetInputType (Zone *zone, Handle< Map > map)
 
 CompareNilICStub (Isolate *isolate, NilValue nil)
 
 CompareNilICStub (Isolate *isolate, ExtraICState ic_state, InitializationState init_state=INITIALIZED)
 
virtual InlineCacheState GetICState () const
 
virtual Code::Kind GetCodeKind () const
 
virtual ExtraICState GetExtraICState () const
 
void UpdateStatus (Handle< Object > object)
 
bool IsMonomorphic () const
 
NilValue nil_value () const
 
void ClearState ()
 
virtual void PrintState (OStream &os) const OVERRIDE
 
virtual void PrintBaseName (OStream &os) const OVERRIDE
 
- 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, NilValue nil)
 
- Static Public Member Functions inherited from v8::internal::HydrogenCodeStub
template<class SubClass >
static Handle< CodeGetUninitialized (Isolate *isolate)
 

Private Types

enum  CompareNilType {
  UNDEFINED , NULL_TYPE , MONOMORPHIC_MAP , GENERIC ,
  NUMBER_OF_TYPES
}
 

Private Member Functions

 CompareNilICStub (Isolate *isolate, NilValue nil, InitializationState init_state)
 
 STATIC_ASSERT (NUMBER_OF_TYPES<=6)
 
State state () const
 
 DEFINE_CALL_INTERFACE_DESCRIPTOR (CompareNil)
 
 DEFINE_HYDROGEN_CODE_STUB (CompareNilIC, HydrogenCodeStub)
 

Friends

class CompareNilIC
 
OStreamoperator<< (OStream &os, const State &s)
 

Additional Inherited Members

- Public Types inherited from v8::internal::HydrogenCodeStub
enum  InitializationState { UNINITIALIZED , INITIALIZED }
 
- 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 1314 of file code-stubs.h.

Member Enumeration Documentation

◆ CompareNilType

Enumerator
UNDEFINED 
NULL_TYPE 
MONOMORPHIC_MAP 
GENERIC 
NUMBER_OF_TYPES 

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

Constructor & Destructor Documentation

◆ CompareNilICStub() [1/3]

v8::internal::CompareNilICStub::CompareNilICStub ( Isolate isolate,
NilValue  nil 
)
inline

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

1319  : HydrogenCodeStub(isolate) {
1321  }
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

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

Referenced by GetUninitialized().

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

◆ CompareNilICStub() [2/3]

v8::internal::CompareNilICStub::CompareNilICStub ( Isolate isolate,
ExtraICState  ic_state,
InitializationState  init_state = INITIALIZED 
)
inline

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

1325  : HydrogenCodeStub(isolate, init_state) {
1326  set_sub_minor_key(ic_state);
1327  }

References v8::internal::HydrogenCodeStub::set_sub_minor_key().

+ Here is the call graph for this function:

◆ CompareNilICStub() [3/3]

v8::internal::CompareNilICStub::CompareNilICStub ( Isolate isolate,
NilValue  nil,
InitializationState  init_state 
)
inlineprivate

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

1365  : HydrogenCodeStub(isolate, init_state) {
1367  }

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

+ Here is the call graph for this function:

Member Function Documentation

◆ ClearState()

void v8::internal::CompareNilICStub::ClearState ( )
inline

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

1355  {
1357  }
static U update(U previous, T value)
Definition: utils.h:223
uint32_t sub_minor_key() const
Definition: code-stubs.h:467

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

Referenced by v8::internal::CompareNilIC::Clear().

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

◆ DEFINE_CALL_INTERFACE_DESCRIPTOR()

v8::internal::CompareNilICStub::DEFINE_CALL_INTERFACE_DESCRIPTOR ( CompareNil  )
private

◆ DEFINE_HYDROGEN_CODE_STUB()

v8::internal::CompareNilICStub::DEFINE_HYDROGEN_CODE_STUB ( CompareNilIC  ,
HydrogenCodeStub   
)
private

◆ GetCodeKind()

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

Reimplemented from v8::internal::HydrogenCodeStub.

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

1345 { return Code::COMPARE_NIL_IC; }

◆ GetExtraICState()

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

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

1347 { return sub_minor_key(); }

References v8::internal::HydrogenCodeStub::sub_minor_key().

Referenced by v8::internal::PropertyICCompiler::ComputeCompareNil().

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

◆ GetICState()

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

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

1334  {
1335  State state = this->state();
1336  if (state.Contains(GENERIC)) {
1337  return MEGAMORPHIC;
1338  } else if (state.Contains(MONOMORPHIC_MAP)) {
1339  return MONOMORPHIC;
1340  } else {
1341  return PREMONOMORPHIC;
1342  }
1343  }
bool Contains(E element) const
Definition: utils.h:851
@ PREMONOMORPHIC
Definition: globals.h:448

References v8::internal::EnumSet< E, T >::Contains(), GENERIC, v8::internal::MEGAMORPHIC, v8::internal::MONOMORPHIC, MONOMORPHIC_MAP, v8::internal::PREMONOMORPHIC, and state().

+ Here is the call graph for this function:

◆ GetInputType()

Type * v8::internal::CompareNilICStub::GetInputType ( Zone zone,
Handle< Map map 
)

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

534  {
535  Type* output_type = GetType(zone, map);
536  Type* nil_type =
537  nil_value() == kNullValue ? Type::Null(zone) : Type::Undefined(zone);
538  return Type::Union(output_type, nil_type, zone);
539 }
Type * GetType(Zone *zone, Handle< Map > map=Handle< Map >())
Definition: code-stubs.cc:513
static TypeHandle Union(TypeHandle type1, TypeHandle type2, Region *reg)
Definition: types.cc:737
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 map
TypeImpl< ZoneTypeConfig > Type
@ kNullValue
Definition: v8.h:97
Handle< Primitive > Null(Isolate *isolate)
Definition: v8.h:6845
Handle< Primitive > Undefined(Isolate *isolate)
Definition: v8.h:6836

References GetType(), v8::internal::kNullValue, map, nil_value(), v8::Null(), v8::Undefined(), and v8::internal::TypeImpl< ZoneTypeConfig >::Union().

Referenced by v8::internal::TypeFeedbackOracle::CompareType().

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

◆ GetType()

Type * v8::internal::CompareNilICStub::GetType ( Zone zone,
Handle< Map map = Handle<Map>() 
)

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

513  {
514  State state = this->state();
515  if (state.Contains(CompareNilICStub::GENERIC)) return Type::Any(zone);
516 
517  Type* result = Type::None(zone);
519  result = Type::Union(result, Type::Undefined(zone), zone);
520  }
522  result = Type::Union(result, Type::Null(zone), zone);
523  }
525  Type* type =
526  map.is_null() ? Type::Detectable(zone) : Type::Class(map, zone);
527  result = Type::Union(result, type, zone);
528  }
529 
530  return result;
531 }
@ None
Definition: v8.h:2211

References v8::internal::TypeImpl< ZoneTypeConfig >::Class(), v8::internal::EnumSet< E, T >::Contains(), GENERIC, map, MONOMORPHIC_MAP, v8::None, v8::Null(), NULL_TYPE, state(), v8::Undefined(), UNDEFINED, and v8::internal::TypeImpl< ZoneTypeConfig >::Union().

Referenced by v8::internal::CodeStubGraphBuilder< Stub >::BuildCodeInitializedStub(), v8::internal::TypeFeedbackOracle::CompareType(), and GetInputType().

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

◆ GetUninitialized()

static Handle<Code> v8::internal::CompareNilICStub::GetUninitialized ( Isolate isolate,
NilValue  nil 
)
inlinestatic

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

1330  {
1331  return CompareNilICStub(isolate, nil, UNINITIALIZED).GetCode();
1332  }
CompareNilICStub(Isolate *isolate, NilValue nil)
Definition: code-stubs.h:1319

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

+ Here is the call graph for this function:

◆ IsMonomorphic()

bool v8::internal::CompareNilICStub::IsMonomorphic ( ) const
inline

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

1351 { return state().Contains(MONOMORPHIC_MAP); }

References v8::internal::EnumSet< E, T >::Contains(), MONOMORPHIC_MAP, and state().

Referenced by v8::internal::CompareNilIC::CompareNil(), and UpdateStatus().

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

◆ nil_value()

NilValue v8::internal::CompareNilICStub::nil_value ( ) const
inline

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

1353 { return NilValueBits::decode(sub_minor_key()); }
static T decode(U value)
Definition: utils.h:228

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

Referenced by v8::internal::CompareNilIC::CompareNil(), GetInputType(), and PrintBaseName().

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

◆ PrintBaseName()

void v8::internal::CompareNilICStub::PrintBaseName ( OStream os) const
virtual

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

470  { // NOLINT
471  CodeStub::PrintBaseName(os);
472  os << ((nil_value() == kNullValue) ? "(NullValue)" : "(UndefinedValue)");
473 }

References v8::internal::kNullValue, and nil_value().

+ Here is the call graph for this function:

◆ PrintState()

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

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

476  { // NOLINT
477  os << state();
478 }

References state().

+ Here is the call graph for this function:

◆ state()

State v8::internal::CompareNilICStub::state ( ) const
inlineprivate

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

1389 { return State(TypesBits::decode(sub_minor_key())); }

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

Referenced by GetICState(), GetType(), IsMonomorphic(), PrintState(), and UpdateStatus().

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

◆ STATIC_ASSERT()

v8::internal::CompareNilICStub::STATIC_ASSERT ( NUMBER_OF_TYPES<=  6)
private

◆ UpdateStatus()

void v8::internal::CompareNilICStub::UpdateStatus ( Handle< Object object)

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

433  {
434  State state = this->state();
435  DCHECK(!state.Contains(GENERIC));
436  State old_state = state;
437  if (object->IsNull()) {
439  } else if (object->IsUndefined()) {
441  } else if (object->IsUndetectableObject() ||
442  object->IsOddball() ||
443  !object->IsHeapObject()) {
444  state.RemoveAll();
445  state.Add(GENERIC);
446  } else if (IsMonomorphic()) {
447  state.RemoveAll();
448  state.Add(GENERIC);
449  } else {
451  }
452  TraceTransition(old_state, state);
454 }
T ToIntegral() const
Definition: utils.h:861
void Add(E element)
Definition: utils.h:855
void TraceTransition(StateType from, StateType to)
Definition: code-stubs.cc:458
#define DCHECK(condition)
Definition: logging.h:205

References v8::internal::EnumSet< E, T >::Add(), v8::internal::EnumSet< E, T >::Contains(), DCHECK, GENERIC, IsMonomorphic(), MONOMORPHIC_MAP, NULL_TYPE, v8::internal::EnumSet< E, T >::RemoveAll(), v8::internal::HydrogenCodeStub::set_sub_minor_key(), state(), v8::internal::HydrogenCodeStub::sub_minor_key(), v8::internal::EnumSet< E, T >::ToIntegral(), v8::internal::HydrogenCodeStub::TraceTransition(), UNDEFINED, and v8::internal::BitFieldBase< T, shift, size, U >::update().

Referenced by v8::internal::CompareNilIC::CompareNil().

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

Friends And Related Function Documentation

◆ CompareNilIC

friend class CompareNilIC
friend

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

◆ operator<<

OStream& operator<< ( OStream os,
const State s 
)
friend

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

501  {
502  os << "(";
503  SimpleListPrinter p(os);
504  if (s.IsEmpty()) p.Add("None");
505  if (s.Contains(CompareNilICStub::UNDEFINED)) p.Add("Undefined");
506  if (s.Contains(CompareNilICStub::NULL_TYPE)) p.Add("Null");
507  if (s.Contains(CompareNilICStub::MONOMORPHIC_MAP)) p.Add("MonomorphicMap");
508  if (s.Contains(CompareNilICStub::GENERIC)) p.Add("Generic");
509  return os << ")";
510 }

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