aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativeinstruction.cpp
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2011-09-20 11:38:26 +0200
committerQt by Nokia <qt-info@nokia.com>2011-09-22 09:42:43 +0200
commitdefa339b371204788504d41bea737d05a5d53285 (patch)
tree81978150129ac7b9420fa170e3e89638569f6089 /src/declarative/qml/qdeclarativeinstruction.cpp
parent7edf2597d15d2f913d9d59815f45170888de7f78 (diff)
Make the QML/VME interpreter threaded
This gets rid of the two-level dispatch in the interpreter loop, which gives a nice performance boost when many VME instructions must be interpreted (e.g., 40% faster for 100 StoreInteger instructions). The threading is implemented in a similar way to the V4 interpreter. The way the compiler generates instructions has been refactored, chiefly to get rid of the QDeclarativeInstruction::setType() calls (when using threading, we don't store the instruction type at all, only the address). As a nice bonus, the way instructions are defined now (creating the specific instruction's data type, rather than a generic (union) type) is more compact and less error-prone. Change-Id: If5cbd36b2526fd61b74854712711b06cd7e1ed7d Reviewed-on: http://codereview.qt-project.org/5246 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'src/declarative/qml/qdeclarativeinstruction.cpp')
-rw-r--r--src/declarative/qml/qdeclarativeinstruction.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/declarative/qml/qdeclarativeinstruction.cpp b/src/declarative/qml/qdeclarativeinstruction.cpp
index f5bd6e915a..3093ddc8ac 100644
--- a/src/declarative/qml/qdeclarativeinstruction.cpp
+++ b/src/declarative/qml/qdeclarativeinstruction.cpp
@@ -53,7 +53,7 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx)
Q_UNUSED(instr)
Q_UNUSED(idx)
#else
- switch(instr->type()) {
+ switch (instructionType(instr)) {
case QDeclarativeInstruction::Init:
qWarning().nospace() << idx << "\t\t" << "INIT\t\t\t" << instr->init.bindingsSize << "\t" << instr->init.parserStatusSize << "\t" << instr->init.contextCache << "\t" << instr->init.compiledBinding;
break;
@@ -226,16 +226,16 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx)
qWarning().nospace() << idx << "\t\t" << "DEFER" << "\t\t\t" << instr->defer.deferCount;
break;
default:
- qWarning().nospace() << idx << "\t\t" << "XXX UNKNOWN INSTRUCTION" << "\t" << instr->type();
+ qWarning().nospace() << idx << "\t\t" << "XXX UNKNOWN INSTRUCTION" << "\t" << instructionType(instr);
break;
}
#endif // QT_NO_DEBUG_STREAM
}
-int QDeclarativeInstruction::size() const
+int QDeclarativeInstruction::size(Type type)
{
#define QML_RETURN_INSTR_SIZE(I, FMT) case I: return QDeclarativeInstructionMeta<(int)I>::Size;
- switch (common.instructionType) {
+ switch (type) {
FOR_EACH_QML_INSTR(QML_RETURN_INSTR_SIZE)
default: return 0;
}