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::Moth::BytecodeGenerator Class Reference

#include <qv4bytecodegenerator_p.h>

+ Collaboration diagram for QV4::Moth::BytecodeGenerator:

Classes

struct  ExceptionHandler
 
struct  Jump
 
struct  Label
 

Public Member Functions

 BytecodeGenerator (int line, bool debug, bool storeSourceLocation=false)
 
Label label ()
 
Label newLabel ()
 
ExceptionHandler newExceptionHandler ()
 
template<int InstrT>
void addInstruction (const InstrData< InstrT > &data)
 
Q_REQUIRED_RESULT Jump jump ()
 
Q_REQUIRED_RESULT Jump jumpTrue ()
 
Q_REQUIRED_RESULT Jump jumpFalse ()
 
Q_REQUIRED_RESULT Jump jumpNotUndefined ()
 
Q_REQUIRED_RESULT Jump jumpNoException ()
 
Q_REQUIRED_RESULT Jump jumpOptionalLookup (int index)
 
Q_REQUIRED_RESULT Jump jumpOptionalProperty (int name)
 
void jumpStrictEqual (const StackSlot &lhs, const Label &target)
 
void jumpStrictNotEqual (const StackSlot &lhs, const Label &target)
 
void checkException ()
 
void setUnwindHandler (ExceptionHandler *handler)
 
void unwindToLabel (int level, const Label &target)
 
void setLocation (const QQmlJS::SourceLocation &loc)
 
void incrementStatement ()
 
ExceptionHandlerexceptionHandler () const
 
int newRegister ()
 
int newRegisterArray (int n)
 
int registerCount () const
 
int currentRegister () const
 
void finalize (Compiler::Context *context)
 
template<int InstrT>
Jump addJumpInstruction (const InstrData< InstrT > &data)
 
void addCJumpInstruction (bool jumpOnFalse, const Label *trueLabel, const Label *falseLabel)
 
void clearLastInstruction ()
 
void addLoopStart (const Label &start)
 

Public Attributes

int currentReg = 0
 

Friends

struct Jump
 
struct Label
 
struct ExceptionHandler
 

Detailed Description

Definition at line 38 of file qv4bytecodegenerator_p.h.

Constructor & Destructor Documentation

◆ BytecodeGenerator()

QV4::Moth::BytecodeGenerator::BytecodeGenerator ( int line,
bool debug,
bool storeSourceLocation = false )
inline

Definition at line 40 of file qv4bytecodegenerator_p.h.

Member Function Documentation

◆ addCJumpInstruction()

void QV4::Moth::BytecodeGenerator::addCJumpInstruction ( bool jumpOnFalse,
const Label * trueLabel,
const Label * falseLabel )
inline

Definition at line 253 of file qv4bytecodegenerator_p.h.

References addJumpInstruction(), and QV4::Moth::BytecodeGenerator::Jump::link().

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

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

◆ addInstruction()

template<int InstrT>
void QV4::Moth::BytecodeGenerator::addInstruction ( const InstrData< InstrT > & data)
inline

Definition at line 133 of file qv4bytecodegenerator_p.h.

Referenced by QV4::Compiler::ControlFlowWith::ControlFlowWith(), QV4::Compiler::ControlFlowFinally::~ControlFlowFinally(), QV4::Compiler::ControlFlowWith::~ControlFlowWith(), QV4::Compiler::Codegen::binopHelper(), checkException(), QV4::Compiler::Codegen::createTemplateObject(), QV4::Compiler::Codegen::defineFunction(), QV4::Compiler::Codegen::destructureElementList(), QV4::Compiler::Codegen::destructurePropertyList(), QV4::Compiler::Context::emitBlockFooter(), QV4::Compiler::Context::emitBlockHeader(), QV4::Compiler::Codegen::emitReturn(), QV4::Compiler::ControlFlowUnwind::emitUnwindHandler(), QV4::Compiler::Codegen::handleCall(), QV4::Compiler::Codegen::initializeAndDestructureBindingElement(), QV4::Compiler::Codegen::jumpBinop(), jumpStrictEqual(), jumpStrictNotEqual(), QV4::Compiler::Codegen::loadClosure(), setUnwindHandler(), QV4::Compiler::Codegen::unop(), 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(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), and QV4::Compiler::Codegen::visit().

+ Here is the caller graph for this function:

◆ addJumpInstruction()

template<int InstrT>
Jump QV4::Moth::BytecodeGenerator::addJumpInstruction ( const InstrData< InstrT > & data)
inline

◆ addLoopStart()

void QV4::Moth::BytecodeGenerator::addLoopStart ( const Label & start)
inline

Definition at line 266 of file qv4bytecodegenerator_p.h.

Referenced by 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:

◆ checkException()

void QV4::Moth::BytecodeGenerator::checkException ( )
inline

Definition at line 201 of file qv4bytecodegenerator_p.h.

References addInstruction().

Referenced by QV4::Compiler::Codegen::destructureElementList(), 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:

◆ clearLastInstruction()

void QV4::Moth::BytecodeGenerator::clearLastInstruction ( )
inline

Definition at line 261 of file qv4bytecodegenerator_p.h.

Referenced by QV4::Moth::BytecodeGenerator::Label::link().

+ Here is the caller graph for this function:

◆ currentRegister()

int QV4::Moth::BytecodeGenerator::currentRegister ( ) const
inline

Definition at line 241 of file qv4bytecodegenerator_p.h.

References currentReg.

Referenced by QV4::Compiler::Context::setupFunctionIndices().

+ Here is the caller graph for this function:

◆ exceptionHandler()

ExceptionHandler * QV4::Moth::BytecodeGenerator::exceptionHandler ( ) const
inline

Definition at line 234 of file qv4bytecodegenerator_p.h.

◆ finalize()

void BytecodeGenerator::finalize ( Compiler::Context * context)

Definition at line 131 of file qv4bytecodegenerator.cpp.

References QString::append(), QV4::CompiledData::CodeOffsetToLineAndStatement::codeOffset, context, i, line, Q_UNUSED, and QString::size().

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

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

◆ incrementStatement()

void BytecodeGenerator::incrementStatement ( )

Definition at line 18 of file qv4bytecodegenerator.cpp.

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

+ Here is the caller graph for this function:

◆ jump()

Q_REQUIRED_RESULT Jump QV4::Moth::BytecodeGenerator::jump ( )
inline

Definition at line 140 of file qv4bytecodegenerator_p.h.

References addJumpInstruction(), QT_WARNING_DISABLE_GCC, QT_WARNING_POP, and QT_WARNING_PUSH.

Referenced by unwindToLabel(), 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:

◆ jumpFalse()

Q_REQUIRED_RESULT Jump QV4::Moth::BytecodeGenerator::jumpFalse ( )
inline

Definition at line 154 of file qv4bytecodegenerator_p.h.

References addJumpInstruction().

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

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

◆ jumpNoException()

Q_REQUIRED_RESULT Jump QV4::Moth::BytecodeGenerator::jumpNoException ( )
inline

Definition at line 165 of file qv4bytecodegenerator_p.h.

References addJumpInstruction().

Referenced by QV4::Compiler::ControlFlowCatch::~ControlFlowCatch().

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

◆ jumpNotUndefined()

Q_REQUIRED_RESULT Jump QV4::Moth::BytecodeGenerator::jumpNotUndefined ( )
inline

Definition at line 159 of file qv4bytecodegenerator_p.h.

References addJumpInstruction().

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

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

◆ jumpOptionalLookup()

Q_REQUIRED_RESULT Jump QV4::Moth::BytecodeGenerator::jumpOptionalLookup ( int index)
inline

Definition at line 171 of file qv4bytecodegenerator_p.h.

References addJumpInstruction(), and QV4::Moth::BytecodeGenerator::Jump::index.

+ Here is the call graph for this function:

◆ jumpOptionalProperty()

Q_REQUIRED_RESULT Jump QV4::Moth::BytecodeGenerator::jumpOptionalProperty ( int name)
inline

Definition at line 178 of file qv4bytecodegenerator_p.h.

References addJumpInstruction().

+ Here is the call graph for this function:

◆ jumpStrictEqual()

void QV4::Moth::BytecodeGenerator::jumpStrictEqual ( const StackSlot & lhs,
const Label & target )
inline

Definition at line 185 of file qv4bytecodegenerator_p.h.

References addInstruction(), addJumpInstruction(), and QV4::Moth::BytecodeGenerator::Jump::link().

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

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

◆ jumpStrictNotEqual()

void QV4::Moth::BytecodeGenerator::jumpStrictNotEqual ( const StackSlot & lhs,
const Label & target )
inline

Definition at line 193 of file qv4bytecodegenerator_p.h.

References addInstruction(), addJumpInstruction(), and QV4::Moth::BytecodeGenerator::Jump::link().

+ Here is the call graph for this function:

◆ jumpTrue()

Q_REQUIRED_RESULT Jump QV4::Moth::BytecodeGenerator::jumpTrue ( )
inline

Definition at line 149 of file qv4bytecodegenerator_p.h.

References addJumpInstruction().

Referenced by QV4::Compiler::Codegen::condition(), 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:

◆ label()

Label QV4::Moth::BytecodeGenerator::label ( )
inline

Definition at line 120 of file qv4bytecodegenerator_p.h.

References Label, and QV4::Moth::BytecodeGenerator::Label::LinkNow.

Referenced by QV4::Moth::BytecodeGenerator::Jump::link(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), and QV4::Compiler::Codegen::visit().

+ Here is the caller graph for this function:

◆ newExceptionHandler()

ExceptionHandler QV4::Moth::BytecodeGenerator::newExceptionHandler ( )
inline

Definition at line 128 of file qv4bytecodegenerator_p.h.

References ExceptionHandler.

Referenced by QV4::Compiler::ControlFlowUnwind::setupUnwindHandler().

+ Here is the caller graph for this function:

◆ newLabel()

◆ newRegister()

◆ newRegisterArray()

int BytecodeGenerator::newRegisterArray ( int n)

Definition at line 31 of file qv4bytecodegenerator.cpp.

References currentReg.

Referenced by QV4::Compiler::Codegen::defineFunction(), QV4::Compiler::Codegen::pushArgs(), QV4::Compiler::Codegen::pushTemplateArgs(), QV4::Compiler::Context::setupFunctionIndices(), and QV4::Compiler::Codegen::visit().

+ Here is the caller graph for this function:

◆ registerCount()

int QV4::Moth::BytecodeGenerator::registerCount ( ) const
inline

Definition at line 240 of file qv4bytecodegenerator_p.h.

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

+ Here is the caller graph for this function:

◆ setLocation()

void BytecodeGenerator::setLocation ( const QQmlJS::SourceLocation & loc)

Definition at line 12 of file qv4bytecodegenerator.cpp.

References QQmlJS::SourceLocation::startLine.

Referenced by QV4::Compiler::Codegen::binopHelper(), QV4::Compiler::Codegen::condition(), QV4::Compiler::Codegen::defineFunction(), QV4::Compiler::Codegen::handleCall(), setJumpOutLocation(), QV4::Compiler::Codegen::statement(), QV4::Compiler::Codegen::visit(), and QV4::Compiler::Codegen::visit().

+ Here is the caller graph for this function:

◆ setUnwindHandler()

◆ unwindToLabel()

void QV4::Moth::BytecodeGenerator::unwindToLabel ( int level,
const Label & target )
inline

Definition at line 218 of file qv4bytecodegenerator_p.h.

References addJumpInstruction(), jump(), and QV4::Moth::BytecodeGenerator::Jump::link().

Referenced by QV4::Compiler::Codegen::emitReturn(), 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:

Friends And Related Symbol Documentation

◆ ExceptionHandler

friend struct ExceptionHandler
friend

Definition at line 274 of file qv4bytecodegenerator_p.h.

Referenced by newExceptionHandler().

◆ Jump

friend struct Jump
friend

Definition at line 272 of file qv4bytecodegenerator_p.h.

Referenced by addJumpInstruction().

◆ Label

Member Data Documentation

◆ currentReg

int QV4::Moth::BytecodeGenerator::currentReg = 0

Definition at line 298 of file qv4bytecodegenerator_p.h.

Referenced by currentRegister(), newRegister(), and newRegisterArray().


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