Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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(), bool isOptional=false, std::vector< Moth::BytecodeGenerator::Jump > *optionalChainJumpsToPatch=nullptr)
 
static Reference fromSuperProperty (const Reference &property)
 
static Reference fromSubscript (const Reference &baseRef, const Reference &subscript)
 
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
 
quint32 isOptional: 1
 
quint32 hasSavedCallBaseSlot: 1
 
QQmlJS::SourceLocation sourceLocation = QQmlJS::SourceLocation()
 
std::vector< Moth::BytecodeGenerator::Jump > * optionalChainJumpsToPatch = nullptr
 
int savedCallBaseSlot = -1
 
int savedCallPropertyNameIndex = -1
 

Detailed Description

Definition at line 157 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 158 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 175 of file qv4codegen_p.h.

◆ Reference() [2/4]

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

Definition at line 181 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 4397 of file qv4codegen.cpp.

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

Referenced by 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 4380 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 QV4::Invalid.

+ Here is the call graph for this function:

◆ baseObject()

Codegen::Reference Codegen::Reference::baseObject ( ) const

Definition at line 4431 of file qv4codegen.cpp.

References fromAccumulator(), fromConst(), fromStackSlot(), Member, Subscript, SuperProperty, QV4::CallData::This, and QV4::Encode::undefined().

+ Here is the call graph for this function:

◆ fromAccumulator()

◆ fromConst()

◆ fromImport()

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

Definition at line 249 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(),
bool isOptional = false,
std::vector< Moth::BytecodeGenerator::Jump > * optionalChainJumpsToPatch = nullptr )
inlinestatic

Definition at line 260 of file qv4codegen_p.h.

References Q_ASSERT.

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

+ 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 254 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 243 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 )
inlinestatic

Definition at line 282 of file qv4codegen_p.h.

References Q_ASSERT.

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

+ Here is the caller graph for this function:

◆ fromSuper()

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

Definition at line 232 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 275 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 297 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 221 of file qv4codegen_p.h.

◆ isConstant()

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

Definition at line 220 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 173 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 225 of file qv4codegen_p.h.

◆ isStackSlot()

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

Definition at line 224 of file qv4codegen_p.h.

Referenced by QV4::Compiler::Codegen::handleCall(), QV4::Compiler::Codegen::pushArgs(), 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 222 of file qv4codegen_p.h.

◆ isSuperProperty()

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

Definition at line 223 of file qv4codegen_p.h.

◆ isValid()

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

Definition at line 208 of file qv4codegen_p.h.

References Invalid.

◆ loadInAccumulator()

◆ loadTriggersSideEffect()

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

Definition at line 209 of file qv4codegen_p.h.

◆ nameAsIndex()

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

Definition at line 325 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 205 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 4348 of file qv4codegen.cpp.

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

+ Here is the call graph for this function:

◆ stackSlot()

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

Definition at line 330 of file qv4codegen_p.h.

References Q_UNLIKELY.

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

+ Here is the caller graph for this function:

◆ storeConstOnStack() [1/2]

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

Definition at line 309 of file qv4codegen_p.h.

References constant().

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 312 of file qv4codegen_p.h.

References constant().

+ Here is the call graph for this function:

◆ storeConsumeAccumulator()

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

Definition at line 4425 of file qv4codegen.cpp.

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

+ Here is the caller graph for this function:

◆ storeOnStack() [1/2]

◆ storeOnStack() [2/2]

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

Definition at line 4456 of file qv4codegen.cpp.

◆ storeRetainAccumulator()

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

Definition at line 4510 of file qv4codegen.cpp.

References fromStackSlot().

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

+ 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 4525 of file qv4codegen.cpp.

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

◆ tdzCheck()

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

Definition at line 336 of file qv4codegen_p.h.

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

+ Here is the caller graph for this function:

Member Data Documentation

◆ [union]

◆ codegen

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

Definition at line 365 of file qv4codegen_p.h.

◆ constant

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

Definition at line 346 of file qv4codegen_p.h.

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

◆ element

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

Definition at line 359 of file qv4codegen_p.h.

◆ elementBase

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

Definition at line 356 of file qv4codegen_p.h.

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

◆ elementSubscript

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

Definition at line 358 of file qv4codegen_p.h.

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

◆ global

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

Definition at line 374 of file qv4codegen_p.h.

◆ hasSavedCallBaseSlot

quint32 QV4::Compiler::Codegen::Reference::hasSavedCallBaseSlot

Definition at line 379 of file qv4codegen_p.h.

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

◆ index

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

Definition at line 348 of file qv4codegen_p.h.

◆ isArgOrEval

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

Definition at line 367 of file qv4codegen_p.h.

◆ isOptional

quint32 QV4::Compiler::Codegen::Reference::isOptional

Definition at line 378 of file qv4codegen_p.h.

◆ isReadonly

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

Definition at line 368 of file qv4codegen_p.h.

◆ isReferenceToConst

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

Definition at line 369 of file qv4codegen_p.h.

◆ isVolatile

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

Definition at line 373 of file qv4codegen_p.h.

◆ name

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

◆ optionalChainJumpsToPatch

std::vector<Moth::BytecodeGenerator::Jump>* QV4::Compiler::Codegen::Reference::optionalChainJumpsToPatch = nullptr

Definition at line 381 of file qv4codegen_p.h.

◆ property

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

Definition at line 362 of file qv4codegen_p.h.

◆ propertyBase

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

Definition at line 352 of file qv4codegen_p.h.

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

◆ propertyNameIndex

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

Definition at line 353 of file qv4codegen_p.h.

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

◆ qmlGlobal

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

Definition at line 375 of file qv4codegen_p.h.

◆ requiresTDZCheck

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

Definition at line 370 of file qv4codegen_p.h.

◆ savedCallBaseSlot

int QV4::Compiler::Codegen::Reference::savedCallBaseSlot = -1

Definition at line 382 of file qv4codegen_p.h.

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

◆ savedCallPropertyNameIndex

int QV4::Compiler::Codegen::Reference::savedCallPropertyNameIndex = -1

Definition at line 383 of file qv4codegen_p.h.

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

◆ scope

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

Definition at line 349 of file qv4codegen_p.h.

◆ sourceLocation

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

Definition at line 380 of file qv4codegen_p.h.

◆ stackSlotIsLocalOrArgument

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

Definition at line 372 of file qv4codegen_p.h.

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

◆ subscriptLoadedForCall

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

Definition at line 377 of file qv4codegen_p.h.

◆ subscriptRequiresTDZCheck

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

Definition at line 371 of file qv4codegen_p.h.

◆ theStackSlot

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

Definition at line 345 of file qv4codegen_p.h.

◆ throwsReferenceError

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

Definition at line 376 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: