diff options
author | Simon Hausmann <[email protected]> | 2014-03-27 17:07:06 +0100 |
---|---|---|
committer | The Qt Project <[email protected]> | 2014-03-28 15:07:03 +0100 |
commit | 0ed744c1ef955cdb94cbd89c58283663da490d7d (patch) | |
tree | e07da64307bb70331ed0a9cbfa78ecd960b57b14 /src/qml/compiler/qv4compileddata_p.h | |
parent | 6bbd173a9cb36021ed284522ac628400469eab2f (diff) |
Various cleanups
* Encapsulate the string pooling for the V4 data generation into a StringGenerator class.
* Move type reference collection into the IR::Document, where it belongs (as it writes
into the typeReferences there)
* const fixes
* Remove unused methods and members
* Store unit and qml unit sizes right in the generated data structure. That makes copying
easier (like we do when generating the QML data based on the JS fields)
Change-Id: I053146ab0b00cc90ac7f72f867415962d1be121b
Reviewed-by: Lars Knoll <[email protected]>
Diffstat (limited to 'src/qml/compiler/qv4compileddata_p.h')
-rw-r--r-- | src/qml/compiler/qv4compileddata_p.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h index 474d4c88bc..d6d2419d74 100644 --- a/src/qml/compiler/qv4compileddata_p.h +++ b/src/qml/compiler/qv4compileddata_p.h @@ -50,6 +50,10 @@ QT_BEGIN_NAMESPACE +namespace QmlIR { +struct Document; +} + namespace QV4 { namespace IR { struct Function; @@ -163,6 +167,7 @@ struct Unit char magic[8]; qint16 architecture; qint16 version; + quint32 unitSize; // Size of the Unit and any depending data. Does _not_ include size of data needed by QmlUnit. enum { IsJavascript = 0x1, @@ -198,8 +203,10 @@ struct Unit return QString(qstr.constData(), qstr.length()); } + const uint *functionOffsetTable() const { return reinterpret_cast<const uint*>((reinterpret_cast<const char *>(this)) + offsetToFunctionTable); } + const Function *functionAt(int idx) const { - const uint *offsetTable = reinterpret_cast<const uint*>((reinterpret_cast<const char *>(this)) + offsetToFunctionTable); + const uint *offsetTable = functionOffsetTable(); const uint offset = offsetTable[idx]; return reinterpret_cast<const Function*>(reinterpret_cast<const char *>(this) + offset); } @@ -524,6 +531,7 @@ struct Import struct QmlUnit { Unit header; + quint32 qmlUnitSize; // size including header and all surrounding data. quint32 nImports; quint32 offsetToImports; quint32 nObjects; @@ -578,16 +586,15 @@ struct Q_QML_EXPORT CompilationUnit QV4::Value *runtimeRegularExpressions; QV4::InternalClass **runtimeClasses; QVector<QV4::Function *> runtimeFunctions; -// QVector<QV4::Function *> runtimeFunctionsSortedByAddress; + + // Called only when building QML, when we build the header for JS first and append QML data + virtual QV4::CompiledData::Unit *createUnitData(QmlIR::Document *irDocument); QV4::Function *linkToEngine(QV4::ExecutionEngine *engine); void unlink(); virtual QV4::ExecutableAllocator::ChunkOfPages *chunkForFunction(int /*functionIndex*/) { return 0; } - // ### runtime data - // pointer to qml data for QML unit - void markObjects(QV4::ExecutionEngine *e); protected: |