diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-08-06 14:59:34 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-08-15 08:28:43 +0200 |
commit | 82fc19625263b26343ef6c1de5c5c13ae1c9ab25 (patch) | |
tree | d560318566581469dec5c117cac9d8dd77816b53 /src/qml/compiler/qv4compiler.cpp | |
parent | ddb134af9903512408b7e52455f1787e4b6b62ea (diff) |
Cleanup
Merge QV4::CompiledData::QmlUnit into QV4::CompiledData::Unit. For pure JS
units it means a slight increase of memory usage by a few bytes, but overall it
makes the code a lot simpler.
Change-Id: Ib48927749720b056f004aac0fe22cb8ec729e3f6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4compiler.cpp')
-rw-r--r-- | src/qml/compiler/qv4compiler.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp index 144ef8a79e..ee0e96784f 100644 --- a/src/qml/compiler/qv4compiler.cpp +++ b/src/qml/compiler/qv4compiler.cpp @@ -89,13 +89,10 @@ void QV4::Compiler::StringTableGenerator::serialize(uint *stringTable, char *dat } } -QV4::Compiler::JSUnitGenerator::JSUnitGenerator(QV4::IR::Module *module, int headerSize) +QV4::Compiler::JSUnitGenerator::JSUnitGenerator(QV4::IR::Module *module) : irModule(module) , jsClassDataSize(0) { - if (headerSize == -1) - headerSize = sizeof(QV4::CompiledData::Unit); - this->headerSize = headerSize; // Make sure the empty string always gets index 0 registerString(QString()); } @@ -212,7 +209,7 @@ QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit() registerString(*f->locals.at(i)); } - int unitSize = QV4::CompiledData::Unit::calculateSize(headerSize, irModule->functions.size(), regexps.size(), + int unitSize = QV4::CompiledData::Unit::calculateSize(irModule->functions.size(), regexps.size(), constants.size(), lookups.size(), jsClasses.count()); uint functionDataSize = 0; @@ -236,7 +233,7 @@ QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit() unit->version = 1; unit->unitSize = totalSize; unit->functionTableSize = irModule->functions.size(); - unit->offsetToFunctionTable = headerSize; + unit->offsetToFunctionTable = sizeof(*unit); unit->lookupTableSize = lookups.count(); unit->offsetToLookupTable = unit->offsetToFunctionTable + unit->functionTableSize * sizeof(uint); unit->regexpTableSize = regexps.size(); @@ -249,6 +246,11 @@ QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit() unit->offsetToStringTable = unitSize + functionDataSize + jsClassDataSize; unit->indexOfRootFunction = -1; unit->sourceFileIndex = getStringId(irModule->fileName); + unit->nImports = 0; + unit->offsetToImports = 0; + unit->nObjects = 0; + unit->offsetToObjects = 0; + unit->indexOfRootObject = 0; uint *functionTable = (uint *)(data + unit->offsetToFunctionTable); for (int i = 0; i < irModule->functions.size(); ++i) |