From defa339b371204788504d41bea737d05a5d53285 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 20 Sep 2011 11:38:26 +0200 Subject: 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 Reviewed-by: Roberto Raggi Reviewed-by: Aaron Kennedy --- src/declarative/qml/qdeclarativeinstruction.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/declarative/qml/qdeclarativeinstruction.cpp') 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; } -- cgit v1.2.3