Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QV4::Compiler::Codegen::Reference Struct Reference

#include <qv4codegen_p.h>

+ Collaboration diagram for QV4::Compiler::Codegen::Reference:

Public Types

enum  Type {
  Invalid , Accumulator , Super , SuperProperty ,
  StackSlot , ScopedLocal , Name , Member ,
  Subscript , Import , LastLValue = Import , Const
}
 

Public Member Functions

bool isLValue () const
 
 Reference (Codegen *cg, Type t=Invalid)
 
 Reference (const QString &name=QString())
 
 Reference (const Reference &)=default
 
 Reference (Reference &&)=default
 
Referenceoperator= (const Reference &)=default
 
Referenceoperator= (Reference &&)=default
 
bool operator== (const Reference &other) const
 
bool operator!= (const Reference &other) const
 
bool isValid () const
 
bool loadTriggersSideEffect () const
 
bool isConstant () const
 
bool isAccumulator () const
 
bool isSuper () const
 
bool isSuperProperty () const
 
bool isStackSlot () const
 
bool isRegister () const
 
RValue asRValue () const
 
Reference asLValue () const
 
Q_REQUIRED_RESULT Reference storeOnStack () const
 
void storeOnStack (int tempIndex) const
 
Q_REQUIRED_RESULT Reference storeRetainAccumulator () const
 
Reference storeConsumeAccumulator () const
 
Q_REQUIRED_RESULT Reference baseObject () const
 
bool storeWipesAccumulator () const
 
void loadInAccumulator () const
 
int nameAsIndex () const
 
Moth::StackSlot stackSlot () const
 
void tdzCheck () const
 

Static Public Member Functions

static Reference fromAccumulator (Codegen *cg)
 
static Reference fromSuper (Codegen *cg)
 
static Reference fromStackSlot (Codegen *cg, int tempIndex=-1, bool isLocal=false)
 
static Reference fromScopedLocal (Codegen *cg, int index, int scope)
 
static Reference fromImport (Codegen *cg, int index)
 
static Reference fromName (Codegen *cg, const QString &name)
 
static Reference fromMember (const Reference &baseRef, const QString &name, QQmlJS::SourceLocation sourceLocation=QQmlJS::SourceLocation(), Moth::BytecodeGenerator::Label jumpLabel=Moth::BytecodeGenerator::Label(), Moth::BytecodeGenerator::Label targetLabel=Moth::BytecodeGenerator::Label())
 
static Reference fromSuperProperty (const Reference &property)
 
static Reference fromSubscript (const Reference &baseRef, const Reference &subscript, Moth::BytecodeGenerator::Label targetLabel=Moth::BytecodeGenerator::Label())
 
static Reference fromConst (Codegen *cg, QV4::ReturnedValue constant)
 
static Reference fromThis (Codegen *cg)
 
static Q_REQUIRED_RESULT Reference storeConstOnStack (Codegen *cg, QV4::ReturnedValue constant)
 
static void storeConstOnStack (Codegen *cg, QV4::ReturnedValue constant, int stackSlot)
 

Public Attributes

enum QV4::Compiler::Codegen::Reference::Type type = Invalid
 
union { 
 
   Moth::StackSlot   theStackSlot 
 
   QV4::ReturnedValue   constant 
 
   struct { 
 
      int   index 
 
      int   scope 
 
   }  
 
   struct { 
 
      RValue   propertyBase 
 
      int   propertyNameIndex 
 
   }  
 
   struct { 
 
      Moth::StackSlot   elementBase 
 
      union { 
 
         RValue   elementSubscript 
 
         Moth::StackSlot   element 
 
      }  
 
   }  
 
   Moth::StackSlot   property 
 
};  
 
QString name
 
Codegencodegen = nullptr
 
quint32 isArgOrEval:1
 
quint32 isReadonly:1
 
quint32 isReferenceToConst:1
 
quint32 requiresTDZCheck:1
 
quint32 subscriptRequiresTDZCheck:1
 
quint32 stackSlotIsLocalOrArgument:1
 
quint32 isVolatile:1
 
quint32 global:1
 
quint32 qmlGlobal:1
 
quint32 throwsReferenceError:1
 
quint32 subscriptLoadedForCall:1
 
QQmlJS::SourceLocation sourceLocation = QQmlJS::SourceLocation()
 
QSharedPointer< Moth::BytecodeGenerator::LabeloptionalChainJumpLabel
 
QSharedPointer< Moth::BytecodeGenerator::LabeloptionalChainTargetLabel
 

Detailed Description

Definition at line 156 of file qv4codegen_p.h.

Member Enumeration Documentation

◆ Type

Enumerator
Invalid 
Accumulator 
Super 
SuperProperty 
StackSlot 
ScopedLocal 
Name 
Member 
Subscript 
Import 
LastLValue 
Const 

Definition at line 157 of file qv4codegen_p.h.

Constructor & Destructor Documentation

◆ Reference() [1/4]

QV4::Compiler::Codegen::Reference::Reference ( Codegen cg,
Type  t = Invalid 
)
inline

Definition at line 174 of file qv4codegen_p.h.

◆ Reference() [2/4]

QV4::Compiler::Codegen::Reference::Reference ( const QString name = QString())
inline

Definition at line 180 of file qv4codegen_p.h.

◆ Reference() [3/4]

QV4::Compiler::Codegen::Reference::Reference ( const Reference )
default

◆ Reference() [4/4]

QV4::Compiler::Codegen::Reference::Reference ( Reference &&  )
default

Member Function Documentation

◆ asLValue()

Codegen::Reference Codegen::Reference::asLValue ( ) const

Definition at line 4367 of file qv4codegen.cpp.

References elementSubscript, Invalid, propertyBase, QStringLiteral, and QV4::Compiler::Codegen::RValue::storeOnStack().

Referenced by QV4::Compiler::Codegen::referenceForPropertyName(), QV4::Compiler::Codegen::targetForPatternElement(), QV4::Compiler::Codegen::unop(), QV4::Compiler::Codegen::visit(), and QV4::Compiler::Codegen::visit().

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

◆ asRValue()

Codegen::RValue Codegen::Reference::asRValue ( ) const

Definition at line 4350 of file qv4codegen.cpp.

References QQmlJS::AST::Const, constant(), QV4::Compiler::Codegen::RValue::fromAccumulator(), QV4::Compiler::Codegen::RValue::fromConst(), QV4::Compiler::Codegen::RValue::fromStackSlot(), and Invalid.

Referenced by fromMember(), and fromSubscript().

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

◆ baseObject()

◆ fromAccumulator()

◆ fromConst()

◆ fromImport()

static Reference QV4::Compiler::Codegen::Reference::fromImport ( Codegen cg,
int  index 
)
inlinestatic

Definition at line 246 of file qv4codegen_p.h.

Referenced by QV4::Compiler::Codegen::referenceForName().

+ Here is the caller graph for this function:

◆ fromMember()

static Reference QV4::Compiler::Codegen::Reference::fromMember ( const Reference baseRef,
const QString name,
QQmlJS::SourceLocation  sourceLocation = QQmlJS::SourceLocation(),
Moth::BytecodeGenerator::Label  jumpLabel = Moth::BytecodeGenerator::Label(),
Moth::BytecodeGenerator::Label  targetLabel = Moth::BytecodeGenerator::Label() 
)
inlinestatic

Definition at line 257 of file qv4codegen_p.h.

References asRValue(), codegen, isValid(), Q_ASSERT, QV4::Compiler::Codegen::registerString(), and requiresTDZCheck.

Referenced by QV4::Compiler::Codegen::referenceForPropertyName(), QV4::Compiler::Codegen::visit(), and QV4::Compiler::Codegen::visit().

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

◆ fromName()

static Reference QV4::Compiler::Codegen::Reference::fromName ( Codegen cg,
const QString name 
)
inlinestatic

Definition at line 251 of file qv4codegen_p.h.

Referenced by QV4::Compiler::ControlFlowCatch::~ControlFlowCatch(), and QV4::Compiler::Codegen::referenceForName().

+ Here is the caller graph for this function:

◆ fromScopedLocal()

static Reference QV4::Compiler::Codegen::Reference::fromScopedLocal ( Codegen cg,
int  index,
int  scope 
)
inlinestatic

Definition at line 240 of file qv4codegen_p.h.

Referenced by QV4::Compiler::Codegen::referenceForName(), and QV4::Compiler::Codegen::visit().

+ Here is the caller graph for this function:

◆ fromStackSlot()

static Reference QV4::Compiler::Codegen::Reference::fromStackSlot ( Codegen cg,
int  tempIndex = -1,
bool  isLocal = false 
)
inlinestatic

◆ fromSubscript()

static Reference QV4::Compiler::Codegen::Reference::fromSubscript ( const Reference baseRef,
const Reference subscript,
Moth::BytecodeGenerator::Label  targetLabel = Moth::BytecodeGenerator::Label() 
)
inlinestatic

Definition at line 279 of file qv4codegen_p.h.

References asRValue(), codegen, isStackSlot(), Q_ASSERT, requiresTDZCheck, and stackSlot().

Referenced by QV4::Compiler::Codegen::referenceForPropertyName(), QV4::Compiler::Codegen::visit(), and QV4::Compiler::Codegen::visit().

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

◆ fromSuper()

static Reference QV4::Compiler::Codegen::Reference::fromSuper ( Codegen cg)
inlinestatic

Definition at line 229 of file qv4codegen_p.h.

Referenced by QV4::Compiler::Codegen::visit().

+ Here is the caller graph for this function:

◆ fromSuperProperty()

static Reference QV4::Compiler::Codegen::Reference::fromSuperProperty ( const Reference property)
inlinestatic

Definition at line 272 of file qv4codegen_p.h.

References property, and Q_ASSERT.

Referenced by QV4::Compiler::Codegen::visit(), and QV4::Compiler::Codegen::visit().

+ Here is the caller graph for this function:

◆ fromThis()

static Reference QV4::Compiler::Codegen::Reference::fromThis ( Codegen cg)
inlinestatic

Definition at line 295 of file qv4codegen_p.h.

Referenced by QV4::Compiler::Codegen::visit().

+ Here is the caller graph for this function:

◆ isAccumulator()

bool QV4::Compiler::Codegen::Reference::isAccumulator ( ) const
inline

Definition at line 218 of file qv4codegen_p.h.

◆ isConstant()

bool QV4::Compiler::Codegen::Reference::isConstant ( ) const
inline

Definition at line 217 of file qv4codegen_p.h.

Referenced by QV4::Compiler::Codegen::unop().

+ Here is the caller graph for this function:

◆ isLValue()

bool QV4::Compiler::Codegen::Reference::isLValue ( ) const
inline

Definition at line 172 of file qv4codegen_p.h.

Referenced by QV4::Compiler::Codegen::targetForPatternElement(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), and QV4::Compiler::Codegen::visit().

+ Here is the caller graph for this function:

◆ isRegister()

bool QV4::Compiler::Codegen::Reference::isRegister ( ) const
inline

Definition at line 222 of file qv4codegen_p.h.

◆ isStackSlot()

bool QV4::Compiler::Codegen::Reference::isStackSlot ( ) const
inline

Definition at line 221 of file qv4codegen_p.h.

Referenced by fromSubscript(), QV4::Compiler::Codegen::handleCall(), QV4::Compiler::Codegen::initializeAndDestructureBindingElement(), and QV4::Compiler::Codegen::visit().

+ Here is the caller graph for this function:

◆ isSuper()

bool QV4::Compiler::Codegen::Reference::isSuper ( ) const
inline

Definition at line 219 of file qv4codegen_p.h.

◆ isSuperProperty()

bool QV4::Compiler::Codegen::Reference::isSuperProperty ( ) const
inline

Definition at line 220 of file qv4codegen_p.h.

◆ isValid()

bool QV4::Compiler::Codegen::Reference::isValid ( ) const
inline

Definition at line 205 of file qv4codegen_p.h.

References Invalid.

Referenced by fromMember(), and QV4::Compiler::Codegen::initializeAndDestructureBindingElement().

+ Here is the caller graph for this function:

◆ loadInAccumulator()

void Codegen::Reference::loadInAccumulator ( ) const

Definition at line 4596 of file qv4codegen.cpp.

References QQmlJS::AST::Const, constant(), d, fromConst(), QV4::StaticValue::fromReturnedValue(), global, i, Invalid, jump(), load(), loadInAccumulator(), QV4::Compiler::JSUnitGenerator::LookupForStorage, QV4::Encode::null(), property, qInf(), qQNaN(), QStringLiteral, QT_WARNING_DISABLE_GCC, QT_WARNING_POP, QT_WARNING_PUSH, QV4::StaticValue::toInt32(), and QV4::Encode::undefined().

Referenced by QV4::Compiler::ControlFlowFinally::~ControlFlowFinally(), QV4::Compiler::Codegen::defineFunction(), QV4::Compiler::Codegen::emitReturn(), QV4::Compiler::Codegen::initializeAndDestructureBindingElement(), QV4::Compiler::Codegen::loadClosure(), QV4::Compiler::Codegen::RValue::loadInAccumulator(), loadInAccumulator(), QV4::Compiler::Codegen::unop(), QV4::Compiler::Codegen::variableDeclaration(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), and QV4::Compiler::Codegen::visit().

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

◆ loadTriggersSideEffect()

bool QV4::Compiler::Codegen::Reference::loadTriggersSideEffect ( ) const
inline

Definition at line 206 of file qv4codegen_p.h.

◆ nameAsIndex()

int QV4::Compiler::Codegen::Reference::nameAsIndex ( ) const
inline

Definition at line 323 of file qv4codegen_p.h.

References Q_ASSERT.

Referenced by QV4::Compiler::Codegen::visit(), and QV4::Compiler::Codegen::visit().

+ Here is the caller graph for this function:

◆ operator!=()

bool QV4::Compiler::Codegen::Reference::operator!= ( const Reference other) const
inline

Definition at line 202 of file qv4codegen_p.h.

References other().

+ Here is the call graph for this function:

◆ operator=() [1/2]

Reference & QV4::Compiler::Codegen::Reference::operator= ( const Reference )
default

◆ operator=() [2/2]

Reference & QV4::Compiler::Codegen::Reference::operator= ( Reference &&  )
default

◆ operator==()

bool Codegen::Reference::operator== ( const Reference other) const

Definition at line 4318 of file qv4codegen.cpp.

References QQmlJS::AST::Const, constant(), Invalid, and other().

+ Here is the call graph for this function:

◆ stackSlot()

Moth::StackSlot QV4::Compiler::Codegen::Reference::stackSlot ( ) const
inline

◆ storeConstOnStack() [1/2]

static Q_REQUIRED_RESULT Reference QV4::Compiler::Codegen::Reference::storeConstOnStack ( Codegen cg,
QV4::ReturnedValue  constant 
)
inlinestatic

Definition at line 307 of file qv4codegen_p.h.

References constant(), and storeOnStack().

Referenced by QV4::Compiler::Codegen::destructureElementList(), QV4::Compiler::Codegen::RValue::storeOnStack(), and QV4::Compiler::Codegen::visit().

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

◆ storeConstOnStack() [2/2]

static void QV4::Compiler::Codegen::Reference::storeConstOnStack ( Codegen cg,
QV4::ReturnedValue  constant,
int  stackSlot 
)
inlinestatic

Definition at line 310 of file qv4codegen_p.h.

References constant().

+ Here is the call graph for this function:

◆ storeConsumeAccumulator()

Codegen::Reference Codegen::Reference::storeConsumeAccumulator ( ) const

◆ storeOnStack() [1/2]

◆ storeOnStack() [2/2]

void Codegen::Reference::storeOnStack ( int  tempIndex) const

Definition at line 4426 of file qv4codegen.cpp.

◆ storeRetainAccumulator()

Codegen::Reference Codegen::Reference::storeRetainAccumulator ( ) const

Definition at line 4480 of file qv4codegen.cpp.

References fromStackSlot().

Referenced by QV4::Compiler::Codegen::unop(), QV4::Compiler::Codegen::visit(), and QV4::Compiler::Codegen::visit().

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

◆ storeWipesAccumulator()

bool Codegen::Reference::storeWipesAccumulator ( ) const

Definition at line 4495 of file qv4codegen.cpp.

References QQmlJS::AST::Const, and Invalid.

◆ tdzCheck()

void QV4::Compiler::Codegen::Reference::tdzCheck ( ) const
inline

Definition at line 334 of file qv4codegen_p.h.

Member Data Documentation

◆ [union]

◆ codegen

Codegen* QV4::Compiler::Codegen::Reference::codegen = nullptr

Definition at line 363 of file qv4codegen_p.h.

Referenced by fromMember(), and fromSubscript().

◆ constant

QV4::ReturnedValue QV4::Compiler::Codegen::Reference::constant

Definition at line 344 of file qv4codegen_p.h.

Referenced by QV4::Compiler::Codegen::unop().

◆ element

Moth::StackSlot QV4::Compiler::Codegen::Reference::element

Definition at line 357 of file qv4codegen_p.h.

◆ elementBase

Moth::StackSlot QV4::Compiler::Codegen::Reference::elementBase

Definition at line 354 of file qv4codegen_p.h.

Referenced by QV4::Compiler::Codegen::visit().

◆ elementSubscript

RValue QV4::Compiler::Codegen::Reference::elementSubscript

Definition at line 356 of file qv4codegen_p.h.

Referenced by asLValue(), and QV4::Compiler::Codegen::visit().

◆ global

quint32 QV4::Compiler::Codegen::Reference::global

Definition at line 372 of file qv4codegen_p.h.

◆ index

int QV4::Compiler::Codegen::Reference::index

Definition at line 346 of file qv4codegen_p.h.

◆ isArgOrEval

quint32 QV4::Compiler::Codegen::Reference::isArgOrEval

Definition at line 365 of file qv4codegen_p.h.

◆ isReadonly

quint32 QV4::Compiler::Codegen::Reference::isReadonly

Definition at line 366 of file qv4codegen_p.h.

◆ isReferenceToConst

quint32 QV4::Compiler::Codegen::Reference::isReferenceToConst

◆ isVolatile

quint32 QV4::Compiler::Codegen::Reference::isVolatile

Definition at line 371 of file qv4codegen_p.h.

◆ name

QString QV4::Compiler::Codegen::Reference::name

◆ optionalChainJumpLabel

QSharedPointer<Moth::BytecodeGenerator::Label> QV4::Compiler::Codegen::Reference::optionalChainJumpLabel

Definition at line 377 of file qv4codegen_p.h.

Referenced by QV4::Compiler::Codegen::visit().

◆ optionalChainTargetLabel

QSharedPointer<Moth::BytecodeGenerator::Label> QV4::Compiler::Codegen::Reference::optionalChainTargetLabel

Definition at line 378 of file qv4codegen_p.h.

◆ property

Moth::StackSlot QV4::Compiler::Codegen::Reference::property

Definition at line 360 of file qv4codegen_p.h.

◆ propertyBase

RValue QV4::Compiler::Codegen::Reference::propertyBase

Definition at line 350 of file qv4codegen_p.h.

Referenced by asLValue(), and QV4::Compiler::Codegen::visit().

◆ propertyNameIndex

int QV4::Compiler::Codegen::Reference::propertyNameIndex

Definition at line 351 of file qv4codegen_p.h.

Referenced by QV4::Compiler::Codegen::visit().

◆ qmlGlobal

quint32 QV4::Compiler::Codegen::Reference::qmlGlobal

Definition at line 373 of file qv4codegen_p.h.

◆ requiresTDZCheck

quint32 QV4::Compiler::Codegen::Reference::requiresTDZCheck

Definition at line 368 of file qv4codegen_p.h.

Referenced by fromMember(), and fromSubscript().

◆ scope

int QV4::Compiler::Codegen::Reference::scope

Definition at line 347 of file qv4codegen_p.h.

◆ sourceLocation

QQmlJS::SourceLocation QV4::Compiler::Codegen::Reference::sourceLocation = QQmlJS::SourceLocation()

Definition at line 376 of file qv4codegen_p.h.

◆ stackSlotIsLocalOrArgument

quint32 QV4::Compiler::Codegen::Reference::stackSlotIsLocalOrArgument

Definition at line 370 of file qv4codegen_p.h.

Referenced by QV4::Compiler::Codegen::visit().

◆ subscriptLoadedForCall

quint32 QV4::Compiler::Codegen::Reference::subscriptLoadedForCall

Definition at line 375 of file qv4codegen_p.h.

◆ subscriptRequiresTDZCheck

quint32 QV4::Compiler::Codegen::Reference::subscriptRequiresTDZCheck

Definition at line 369 of file qv4codegen_p.h.

◆ theStackSlot

Moth::StackSlot QV4::Compiler::Codegen::Reference::theStackSlot

Definition at line 343 of file qv4codegen_p.h.

◆ throwsReferenceError

quint32 QV4::Compiler::Codegen::Reference::throwsReferenceError

Definition at line 374 of file qv4codegen_p.h.

◆ type

enum QV4::Compiler::Codegen::Reference::Type QV4::Compiler::Codegen::Reference::type = Invalid

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