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

#include <qv4compiler_p.h>

+ Collaboration diagram for QV4::Compiler::JSUnitGenerator:

Classes

struct  MemberInfo
 

Public Types

enum  LookupMode { LookupForStorage , LookupForCall }
 
enum  GeneratorOption { GenerateWithStringTable , GenerateWithoutStringTable }
 

Public Member Functions

 JSUnitGenerator (Module *module)
 
int registerString (const QString &str)
 
int getStringId (const QString &string) const
 
QString stringForIndex (int index) const
 
int registerGetterLookup (const QString &name, LookupMode mode)
 
int registerGetterLookup (int nameIndex, LookupMode mode)
 
int registerSetterLookup (const QString &name)
 
int registerSetterLookup (int nameIndex)
 
int registerGlobalGetterLookup (int nameIndex, LookupMode mode)
 
int registerQmlContextPropertyGetterLookup (int nameIndex, LookupMode mode)
 
int lookupNameIndex (int index) const
 
QString lookupName (int index) const
 
int registerRegExp (QQmlJS::AST::RegExpLiteral *regexp)
 
int registerConstant (ReturnedValue v)
 
ReturnedValue constant (int idx) const
 
int registerJSClass (const QStringList &members)
 
int jsClassSize (int jsClassId) const
 
QString jsClassMember (int jsClassId, int member) const
 
int registerTranslation (const CompiledData::TranslationData &translation)
 
QV4::CompiledData::UnitgenerateUnit (GeneratorOption option=GenerateWithStringTable)
 
void writeFunction (char *f, Context *irFunction) const
 
void writeClass (char *f, const Class &c)
 
void writeTemplateObject (char *f, const TemplateObject &o)
 
void writeBlock (char *f, Context *irBlock) const
 

Static Public Member Functions

static void generateUnitChecksum (CompiledData::Unit *unit)
 

Public Attributes

StringTableGenerator stringTable
 
QString codeGeneratorName
 

Detailed Description

Definition at line 72 of file qv4compiler_p.h.

Member Enumeration Documentation

◆ GeneratorOption

Enumerator
GenerateWithStringTable 
GenerateWithoutStringTable 

Definition at line 108 of file qv4compiler_p.h.

◆ LookupMode

Enumerator
LookupForStorage 
LookupForCall 

Definition at line 73 of file qv4compiler_p.h.

Constructor & Destructor Documentation

◆ JSUnitGenerator()

QV4::Compiler::JSUnitGenerator::JSUnitGenerator ( Module module)

Definition at line 113 of file qv4compiler.cpp.

References registerString().

+ Here is the call graph for this function:

Member Function Documentation

◆ constant()

QV4::ReturnedValue QV4::Compiler::JSUnitGenerator::constant ( int  idx) const

Definition at line 195 of file qv4compiler.cpp.

Referenced by QQmlJSCodeGenerator::generate_LoadConst(), QQmlJSTypePropagator::generate_LoadConst(), QQmlJSCodeGenerator::generate_MoveConst(), and QQmlJSTypePropagator::generate_MoveConst().

+ Here is the caller graph for this function:

◆ generateUnit()

QV4::CompiledData::Unit * QV4::Compiler::JSUnitGenerator::generateUnit ( GeneratorOption  option = GenerateWithStringTable)

Definition at line 252 of file qv4compiler.cpp.

References QV4::CompiledData::Unit::blockTableSize, QV4::CompiledData::Unit::classTableSize, QV4::CompiledData::ExportEntry::exportName, function, QV4::CompiledData::Unit::functionTableSize, i, QV4::CompiledData::ExportEntry::importName, QV4::CompiledData::ImportEntry::importName, QV4::CompiledData::Unit::indexOfRootFunction, QV4::CompiledData::ExportEntry::localName, QV4::CompiledData::ImportEntry::localName, QV4::CompiledData::ExportEntry::location, QV4::CompiledData::ImportEntry::location, QV4::CompiledData::ExportEntry::moduleRequest, QV4::CompiledData::ImportEntry::moduleRequest, QV4::CompiledData::Unit::offsetToBlockTable, QV4::CompiledData::Unit::offsetToClassTable, QV4::CompiledData::Unit::offsetToConstantTable, QV4::CompiledData::Unit::offsetToFunctionTable, QV4::CompiledData::Unit::offsetToImportEntryTable, QV4::CompiledData::Unit::offsetToIndirectExportEntryTable, QV4::CompiledData::Unit::offsetToJSClassTable, QV4::CompiledData::Unit::offsetToLocalExportEntryTable, QV4::CompiledData::Unit::offsetToLookupTable, QV4::CompiledData::Unit::offsetToModuleRequestTable, QV4::CompiledData::Unit::offsetToRegexpTable, QV4::CompiledData::Unit::offsetToStarExportEntryTable, QV4::CompiledData::Unit::offsetToTemplateObjectTable, QV4::CompiledData::Unit::offsetToTranslationTable, Q_ALLOCA_VAR, request, QV4::CompiledData::Unit::templateObjectTableSize, and QV4::CompiledData::Unit::unitSize.

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

+ Here is the caller graph for this function:

◆ generateUnitChecksum()

void QV4::Compiler::JSUnitGenerator::generateUnitChecksum ( CompiledData::Unit unit)
static

Definition at line 94 of file qv4compiler.cpp.

References checksum(), hash, QCryptographicHash::Md5, QV4::CompiledData::Unit::md5Checksum, Q_ASSERT, and QV4::CompiledData::Unit::unitSize.

Referenced by QmlIR::QmlUnitGenerator::generate().

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

◆ getStringId()

int QV4::Compiler::JSUnitGenerator::getStringId ( const QString string) const
inline

Definition at line 85 of file qv4compiler_p.h.

◆ jsClassMember()

QString QV4::Compiler::JSUnitGenerator::jsClassMember ( int  jsClassId,
int  member 
) const

Definition at line 235 of file qv4compiler.cpp.

References jsClassMembersOffset, members(), QV4::CompiledData::JSClass::nMembers, and Q_ASSERT.

Referenced by QQmlJSCodeGenerator::generate_DefineObjectLiteral().

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

◆ jsClassSize()

int QV4::Compiler::JSUnitGenerator::jsClassSize ( int  jsClassId) const

Definition at line 227 of file qv4compiler.cpp.

References QV4::CompiledData::JSClass::nMembers.

Referenced by QQmlJSCodeGenerator::generate_DefineObjectLiteral(), and QQmlJSTypePropagator::generate_DefineObjectLiteral().

+ Here is the caller graph for this function:

◆ lookupName()

◆ lookupNameIndex()

int QV4::Compiler::JSUnitGenerator::lookupNameIndex ( int  index) const
inline

◆ registerConstant()

int QV4::Compiler::JSUnitGenerator::registerConstant ( QV4::ReturnedValue  v)

Definition at line 186 of file qv4compiler.cpp.

Referenced by QV4::Compiler::Codegen::registerConstant(), QQmlTypeCompiler::registerConstant(), and QmlIR::IRBuilder::setBindingValue().

+ Here is the caller graph for this function:

◆ registerGetterLookup() [1/2]

int QV4::Compiler::JSUnitGenerator::registerGetterLookup ( const QString name,
LookupMode  mode 
)

Definition at line 120 of file qv4compiler.cpp.

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

+ Here is the caller graph for this function:

◆ registerGetterLookup() [2/2]

int QV4::Compiler::JSUnitGenerator::registerGetterLookup ( int  nameIndex,
LookupMode  mode 
)

Definition at line 132 of file qv4compiler.cpp.

References lookupMode(), and QV4::CompiledData::Lookup::Type_Getter.

+ Here is the call graph for this function:

◆ registerGlobalGetterLookup()

int QV4::Compiler::JSUnitGenerator::registerGlobalGetterLookup ( int  nameIndex,
LookupMode  mode 
)

Definition at line 152 of file qv4compiler.cpp.

References lookupMode(), and QV4::CompiledData::Lookup::Type_GlobalGetter.

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

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

◆ registerJSClass()

int QV4::Compiler::JSUnitGenerator::registerJSClass ( const QStringList members)

Definition at line 204 of file qv4compiler.cpp.

References QV4::CompiledData::JSClass::calculateSize(), jsClassMembersOffset, members(), QV4::CompiledData::JSClass::nMembers, QV4::CompiledData::JSClassMember::set(), and QCborArray::size().

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

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

◆ registerQmlContextPropertyGetterLookup()

int QV4::Compiler::JSUnitGenerator::registerQmlContextPropertyGetterLookup ( int  nameIndex,
LookupMode  mode 
)

Definition at line 159 of file qv4compiler.cpp.

References lookupMode(), and QV4::CompiledData::Lookup::Type_QmlContextPropertyGetter.

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

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

◆ registerRegExp()

int QV4::Compiler::JSUnitGenerator::registerRegExp ( QQmlJS::AST::RegExpLiteral regexp)

Definition at line 168 of file qv4compiler.cpp.

References QQmlJS::AST::RegExpLiteral::flags, QQmlJS::AST::RegExpLiteral::pattern, QV4::CompiledData::RegExp::RegExp_Global, QQmlJS::Lexer::RegExp_Global, QV4::CompiledData::RegExp::RegExp_IgnoreCase, QQmlJS::Lexer::RegExp_IgnoreCase, QV4::CompiledData::RegExp::RegExp_Multiline, QQmlJS::Lexer::RegExp_Multiline, QV4::CompiledData::RegExp::RegExp_Sticky, QQmlJS::Lexer::RegExp_Sticky, QV4::CompiledData::RegExp::RegExp_Unicode, QQmlJS::Lexer::RegExp_Unicode, and QStringView::toString().

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

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

◆ registerSetterLookup() [1/2]

int QV4::Compiler::JSUnitGenerator::registerSetterLookup ( const QString name)

Definition at line 139 of file qv4compiler.cpp.

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

+ Here is the caller graph for this function:

◆ registerSetterLookup() [2/2]

int QV4::Compiler::JSUnitGenerator::registerSetterLookup ( int  nameIndex)

◆ registerString()

int QV4::Compiler::JSUnitGenerator::registerString ( const QString str)
inline

Definition at line 84 of file qv4compiler_p.h.

References str.

Referenced by JSUnitGenerator(), QmlIR::ScriptDirectivesCollector::importFile(), QmlIR::ScriptDirectivesCollector::importModule(), QV4::Compiler::Codegen::registerString(), QmlIR::Document::registerString(), QQmlTypeCompiler::registerString(), and QmlIR::IRBuilder::tryGeneratingTranslationBinding().

+ Here is the caller graph for this function:

◆ registerTranslation()

int QV4::Compiler::JSUnitGenerator::registerTranslation ( const CompiledData::TranslationData translation)

Definition at line 246 of file qv4compiler.cpp.

Referenced by QmlIR::IRBuilder::tryGeneratingTranslationBinding().

+ Here is the caller graph for this function:

◆ stringForIndex()

◆ writeBlock()

void QV4::Compiler::JSUnitGenerator::writeBlock ( char *  f,
Context irBlock 
) const

◆ writeClass()

◆ writeFunction()

void QV4::Compiler::JSUnitGenerator::writeFunction ( char *  f,
Context irFunction 
) const

◆ writeTemplateObject()

void QV4::Compiler::JSUnitGenerator::writeTemplateObject ( char *  f,
const TemplateObject o 
)

Definition at line 574 of file qv4compiler.cpp.

References i, qDebug, qEnvironmentVariableIsSet(), QV4::CompiledData::TemplateObject::rawStringIndexAt(), QV4::CompiledData::TemplateObject::size, and QV4::CompiledData::TemplateObject::stringIndexAt().

+ Here is the call graph for this function:

Member Data Documentation

◆ codeGeneratorName

QString QV4::Compiler::JSUnitGenerator::codeGeneratorName

Definition at line 120 of file qv4compiler_p.h.

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

◆ stringTable

StringTableGenerator QV4::Compiler::JSUnitGenerator::stringTable

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