diff options
author | Simon Hausmann <[email protected]> | 2013-10-23 16:24:58 +0200 |
---|---|---|
committer | The Qt Project <[email protected]> | 2013-10-29 21:56:07 +0100 |
commit | ba6fc15d729304c136447242de2410fbf4f020cd (patch) | |
tree | 3ad8a9575de295c9102eae125f64246bec854852 /src/qml/compiler/qv4compileddata_p.h | |
parent | c32265bfc562db23b7c894306ec61fd22111a7b1 (diff) |
Speed up id object lookups
We can resolve lookups for objects referenced by id at QML compile time
and use a run-time helper to extract the id object out of the QML context
data by index instead of name.
Dependencies to id objects are also tracked at compile time and registered
separately before entering the generated function code.
The lookup of id objects is encoded in the IR as special member lookups.
Members will also then in the future be used to for property lookups in context
and scope properties, as well as any other property lookups in QObjects where
we can determine the meta-object.
Change-Id: I36cf3ceb11b51a983da6cad5b61c3bf574acc20a
Reviewed-by: Lars Knoll <[email protected]>
Diffstat (limited to 'src/qml/compiler/qv4compileddata_p.h')
-rw-r--r-- | src/qml/compiler/qv4compileddata_p.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h index eda9751980..60a697e53e 100644 --- a/src/qml/compiler/qv4compileddata_p.h +++ b/src/qml/compiler/qv4compileddata_p.h @@ -232,6 +232,12 @@ struct Function quint32 nInnerFunctions; quint32 innerFunctionsOffset; Location location; + + // Qml Extensions Begin + quint32 nDependingIdObjects; + quint32 dependingIdObjectsOffset; + // Qml Extensions End + // quint32 formalsIndex[nFormals] // quint32 localsIndex[nLocals] // quint32 offsetForInnerFunctions[nInnerFunctions] @@ -240,9 +246,12 @@ struct Function const quint32 *formalsTable() const { return reinterpret_cast<const quint32 *>(reinterpret_cast<const char *>(this) + formalsOffset); } const quint32 *localsTable() const { return reinterpret_cast<const quint32 *>(reinterpret_cast<const char *>(this) + localsOffset); } const quint32 *lineNumberMapping() const { return reinterpret_cast<const quint32 *>(reinterpret_cast<const char *>(this) + lineNumberMappingOffset); } + const quint32 *qmlIdObjectDependencyTable() const { return reinterpret_cast<const quint32 *>(reinterpret_cast<const char *>(this) + dependingIdObjectsOffset); } + + inline bool hasQmlDependencies() const { return nDependingIdObjects; } - static int calculateSize(int nFormals, int nLocals, int nInnerfunctions, int lineNumberMappings) { - return (sizeof(Function) + (nFormals + nLocals + nInnerfunctions + 2 * lineNumberMappings) * sizeof(quint32) + 7) & ~0x7; + static int calculateSize(int nFormals, int nLocals, int nInnerfunctions, int lineNumberMappings, int nIdObjectDependencies) { + return (sizeof(Function) + (nFormals + nLocals + nInnerfunctions + 2 * lineNumberMappings + nIdObjectDependencies) * sizeof(quint32) + 7) & ~0x7; } }; |