diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2011-05-05 14:16:27 +1000 |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2011-05-05 15:26:04 +1000 |
commit | 21521c2d28e7c00e859fd2a28263b716d550c0fc (patch) | |
tree | 9f24a0951cc45b6c6ade30578658e4136fd6fc5e /src | |
parent | cb661b8fd32b20b4a90b13fa49e2a21f41b2e87d (diff) |
Inline static data for basic types into the QML instruction
The following types are now entirely inline:
QPoint, QPointF
QSize, QSizeF
QRect, QRectF
QVector3D,
QTime, QDateTime
CustomTypeData
Reviewed-by: Martin Jones
Change-Id: I7024d136c77f8fb23ef6a6abb23ddfe0f9f8a1ca
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/qml/qdeclarativecompileddata.cpp | 64 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativecompiler.cpp | 110 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativecompiler_p.h | 13 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeinstruction.cpp | 20 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeinstruction_p.h | 103 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativevme.cpp | 68 |
6 files changed, 173 insertions, 205 deletions
diff --git a/src/declarative/qml/qdeclarativecompileddata.cpp b/src/declarative/qml/qdeclarativecompileddata.cpp index 1f5d11141d..4c7f270048 100644 --- a/src/declarative/qml/qdeclarativecompileddata.cpp +++ b/src/declarative/qml/qdeclarativecompileddata.cpp @@ -97,70 +97,6 @@ int QDeclarativeCompiledData::indexForUrl(const QUrl &data) return idx; } -int QDeclarativeCompiledData::indexForFloat(float *data, int count) -{ - Q_ASSERT(count > 0); - - for (int ii = 0; ii <= floatData.count() - count; ++ii) { - bool found = true; - for (int jj = 0; jj < count; ++jj) { - if (floatData.at(ii + jj) != data[jj]) { - found = false; - break; - } - } - - if (found) - return ii; - } - - int idx = floatData.count(); - for (int ii = 0; ii < count; ++ii) - floatData << data[ii]; - - return idx; -} - -int QDeclarativeCompiledData::indexForInt(int *data, int count) -{ - Q_ASSERT(count > 0); - - for (int ii = 0; ii <= intData.count() - count; ++ii) { - bool found = true; - for (int jj = 0; jj < count; ++jj) { - if (intData.at(ii + jj) != data[jj]) { - found = false; - break; - } - } - - if (found) - return ii; - } - - int idx = intData.count(); - for (int ii = 0; ii < count; ++ii) - intData << data[ii]; - - return idx; -} - -int QDeclarativeCompiledData::indexForLocation(const QDeclarativeParser::Location &l) -{ - // ### FIXME - int rv = locations.count(); - locations << l; - return rv; -} - -int QDeclarativeCompiledData::indexForLocation(const QDeclarativeParser::LocationSpan &l) -{ - // ### FIXME - int rv = locations.count(); - locations << l.start << l.end; - return rv; -} - QDeclarativeCompiledData::QDeclarativeCompiledData(QDeclarativeEngine *engine) : QDeclarativeCleanup(engine), importCache(0), root(0), rootPropertyCache(0) { diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index d8aa938943..31a9f668ef 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -441,74 +441,84 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop, case QVariant::Time: { QTime time = QDeclarativeStringConverters::timeFromString(string); - int data[] = { time.hour(), time.minute(), - time.second(), time.msec() }; - int index = output->indexForInt(data, 4); instr.setType(QDeclarativeInstruction::StoreTime); instr.storeTime.propertyIndex = prop.propertyIndex(); - instr.storeTime.valueIndex = index; + instr.storeTime.time = *(QDeclarativeInstruction::instr_storeTime::QTime *)&time; } break; case QVariant::DateTime: { QDateTime dateTime = QDeclarativeStringConverters::dateTimeFromString(string); - int data[] = { dateTime.date().toJulianDay(), - dateTime.time().hour(), - dateTime.time().minute(), - dateTime.time().second(), - dateTime.time().msec() }; - int index = output->indexForInt(data, 5); + QTime time = dateTime.time(); instr.setType(QDeclarativeInstruction::StoreDateTime); instr.storeDateTime.propertyIndex = prop.propertyIndex(); - instr.storeDateTime.valueIndex = index; + instr.storeDateTime.date = dateTime.date().toJulianDay(); + instr.storeDateTime.time = *(QDeclarativeInstruction::instr_storeTime::QTime *)&time; } break; #endif // QT_NO_DATESTRING case QVariant::Point: + { + bool ok; + QPoint point = QDeclarativeStringConverters::pointFFromString(string, &ok).toPoint(); + instr.setType(QDeclarativeInstruction::StorePoint); + instr.storePoint.propertyIndex = prop.propertyIndex(); + instr.storePoint.point.xp = point.x(); + instr.storePoint.point.yp = point.y(); + } + break; case QVariant::PointF: { bool ok; - QPointF point = - QDeclarativeStringConverters::pointFFromString(string, &ok); - float data[] = { float(point.x()), float(point.y()) }; - int index = output->indexForFloat(data, 2); - if (type == QVariant::PointF) - instr.setType(QDeclarativeInstruction::StorePointF); - else - instr.setType(QDeclarativeInstruction::StorePoint); - instr.storeRealPair.propertyIndex = prop.propertyIndex(); - instr.storeRealPair.valueIndex = index; + QPointF point = QDeclarativeStringConverters::pointFFromString(string, &ok); + instr.setType(QDeclarativeInstruction::StorePointF); + instr.storePointF.propertyIndex = prop.propertyIndex(); + instr.storePointF.point.xp = point.x(); + instr.storePointF.point.yp = point.y(); } break; case QVariant::Size: + { + bool ok; + QSize size = QDeclarativeStringConverters::sizeFFromString(string, &ok).toSize(); + instr.setType(QDeclarativeInstruction::StoreSize); + instr.storeSize.propertyIndex = prop.propertyIndex(); + instr.storeSize.size.wd = size.width(); + instr.storeSize.size.ht = size.height(); + } + break; case QVariant::SizeF: { bool ok; QSizeF size = QDeclarativeStringConverters::sizeFFromString(string, &ok); - float data[] = { float(size.width()), float(size.height()) }; - int index = output->indexForFloat(data, 2); - if (type == QVariant::SizeF) - instr.setType(QDeclarativeInstruction::StoreSizeF); - else - instr.setType(QDeclarativeInstruction::StoreSize); - instr.storeRealPair.propertyIndex = prop.propertyIndex(); - instr.storeRealPair.valueIndex = index; + instr.setType(QDeclarativeInstruction::StoreSizeF); + instr.storeSizeF.propertyIndex = prop.propertyIndex(); + instr.storeSizeF.size.wd = size.width(); + instr.storeSizeF.size.ht = size.height(); } break; case QVariant::Rect: + { + bool ok; + QRect rect = QDeclarativeStringConverters::rectFFromString(string, &ok).toRect(); + instr.setType(QDeclarativeInstruction::StoreRect); + instr.storeRect.propertyIndex = prop.propertyIndex(); + instr.storeRect.rect.x1 = rect.left(); + instr.storeRect.rect.y1 = rect.top(); + instr.storeRect.rect.x2 = rect.right(); + instr.storeRect.rect.y2 = rect.bottom(); + } + break; case QVariant::RectF: { bool ok; QRectF rect = QDeclarativeStringConverters::rectFFromString(string, &ok); - float data[] = { float(rect.x()), float(rect.y()), - float(rect.width()), float(rect.height()) }; - int index = output->indexForFloat(data, 4); - if (type == QVariant::RectF) - instr.setType(QDeclarativeInstruction::StoreRectF); - else - instr.setType(QDeclarativeInstruction::StoreRect); - instr.storeRect.propertyIndex = prop.propertyIndex(); - instr.storeRect.valueIndex = index; + instr.setType(QDeclarativeInstruction::StoreRectF); + instr.storeRectF.propertyIndex = prop.propertyIndex(); + instr.storeRectF.rect.xp = rect.left(); + instr.storeRectF.rect.yp = rect.top(); + instr.storeRectF.rect.w = rect.width(); + instr.storeRectF.rect.h = rect.height(); } break; case QVariant::Bool: @@ -522,28 +532,21 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop, case QVariant::Vector3D: { bool ok; - QVector3D vector = - QDeclarativeStringConverters::vector3DFromString(string, &ok); - float data[] = { float(vector.x()), float(vector.y()), float(vector.z()) }; - int index = output->indexForFloat(data, 3); + QVector3D vector = QDeclarativeStringConverters::vector3DFromString(string, &ok); instr.setType(QDeclarativeInstruction::StoreVector3D); - instr.storeRealPair.propertyIndex = prop.propertyIndex(); - instr.storeRealPair.valueIndex = index; + instr.storeVector3D.propertyIndex = prop.propertyIndex(); + instr.storeVector3D.vector.xp = vector.x(); + instr.storeVector3D.vector.yp = vector.y(); + instr.storeVector3D.vector.zp = vector.z(); } break; default: { int t = prop.userType(); - int index = output->customTypeData.count(); instr.setType(QDeclarativeInstruction::AssignCustomType); instr.assignCustomType.propertyIndex = prop.propertyIndex(); - instr.assignCustomType.valueIndex = index; - instr.assignCustomType.line = v->location.start.line; - - QDeclarativeCompiledData::CustomTypeData data; - data.index = output->indexForString(string); - data.type = t; - output->customTypeData << data; + instr.assignCustomType.primitive = output->indexForString(string); + instr.assignCustomType.type = t; } break; } @@ -557,9 +560,6 @@ void QDeclarativeCompiler::reset(QDeclarativeCompiledData *data) { data->types.clear(); data->primitives.clear(); - data->floatData.clear(); - data->intData.clear(); - data->customTypeData.clear(); data->datas.clear(); data->bytecode.clear(); } diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h index 3697d3ace2..417a1fafb1 100644 --- a/src/declarative/qml/qdeclarativecompiler_p.h +++ b/src/declarative/qml/qdeclarativecompiler_p.h @@ -102,21 +102,12 @@ public: QDeclarativePropertyCache *createPropertyCache(QDeclarativeEngine *); }; QList<TypeReference> types; - struct CustomTypeData - { - int index; - int type; - }; const QMetaObject *root; QAbstractDynamicMetaObject rootData; QDeclarativePropertyCache *rootPropertyCache; QList<QString> primitives; - QList<float> floatData; - QList<int> intData; - QList<CustomTypeData> customTypeData; QList<QByteArray> datas; - QList<QDeclarativeParser::Location> locations; QByteArray bytecode; QList<QScriptProgram *> cachedPrograms; QList<QScriptValue *> cachedClosures; @@ -144,10 +135,6 @@ private: int indexForString(const QString &); int indexForByteArray(const QByteArray &); - int indexForFloat(float *, int); - int indexForInt(int *, int); - int indexForLocation(const QDeclarativeParser::Location &); - int indexForLocation(const QDeclarativeParser::LocationSpan &); int indexForUrl(const QUrl &); }; diff --git a/src/declarative/qml/qdeclarativeinstruction.cpp b/src/declarative/qml/qdeclarativeinstruction.cpp index 202e6461e4..f664913693 100644 --- a/src/declarative/qml/qdeclarativeinstruction.cpp +++ b/src/declarative/qml/qdeclarativeinstruction.cpp @@ -106,31 +106,31 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx) qWarning().nospace() << idx << "\t\t" << "STORE_DATE\t\t" << instr->storeDate.propertyIndex << "\t" << instr->storeDate.value; break; case QDeclarativeInstruction::StoreTime: - qWarning().nospace() << idx << "\t\t" << "STORE_TIME\t\t" << instr->storeTime.propertyIndex << "\t" << instr->storeTime.valueIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_TIME\t\t" << instr->storeTime.propertyIndex; break; case QDeclarativeInstruction::StoreDateTime: - qWarning().nospace() << idx << "\t\t" << "STORE_DATETIME\t\t" << instr->storeDateTime.propertyIndex << "\t" << instr->storeDateTime.valueIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_DATETIME\t\t" << instr->storeDateTime.propertyIndex; break; case QDeclarativeInstruction::StorePoint: - qWarning().nospace() << idx << "\t\t" << "STORE_POINT\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_POINT\t\t" << instr->storePoint.propertyIndex << "\t" << instr->storePoint.point.xp << "\t" << instr->storePoint.point.yp; break; case QDeclarativeInstruction::StorePointF: - qWarning().nospace() << idx << "\t\t" << "STORE_POINTF\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_POINTF\t\t" << instr->storePointF.propertyIndex << "\t" << instr->storePointF.point.xp << "\t" << instr->storePointF.point.yp; break; case QDeclarativeInstruction::StoreSize: - qWarning().nospace() << idx << "\t\t" << "STORE_SIZE\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_SIZE\t\t" << instr->storeSize.propertyIndex << "\t" << instr->storeSize.size.wd << "\t" << instr->storeSize.size.ht; break; case QDeclarativeInstruction::StoreSizeF: - qWarning().nospace() << idx << "\t\t" << "STORE_SIZEF\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_SIZEF\t\t" << instr->storeSizeF.propertyIndex << "\t" << instr->storeSizeF.size.wd << "\t" << instr->storeSizeF.size.ht; break; case QDeclarativeInstruction::StoreRect: - qWarning().nospace() << idx << "\t\t" << "STORE_RECT\t\t" << instr->storeRect.propertyIndex << "\t" << instr->storeRect.valueIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_RECT\t\t" << instr->storeRect.propertyIndex << "\t" << instr->storeRect.rect.x1 << "\t" << instr->storeRect.rect.y1 << "\t" << instr->storeRect.rect.x2 << "\t" << instr->storeRect.rect.y2; break; case QDeclarativeInstruction::StoreRectF: - qWarning().nospace() << idx << "\t\t" << "STORE_RECTF\t\t" << instr->storeRect.propertyIndex << "\t" << instr->storeRect.valueIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_RECTF\t\t" << instr->storeRectF.propertyIndex << "\t" << instr->storeRectF.rect.xp << "\t" << instr->storeRectF.rect.yp << "\t" << instr->storeRectF.rect.w << "\t" << instr->storeRectF.rect.h; break; case QDeclarativeInstruction::StoreVector3D: - qWarning().nospace() << idx << "\t\t" << "STORE_VECTOR3D\t\t" << instr->storeVector3D.propertyIndex << "\t" << instr->storeVector3D.valueIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_VECTOR3D\t\t" << instr->storeVector3D.propertyIndex << "\t" << instr->storeVector3D.vector.xp << "\t" << instr->storeVector3D.vector.yp << "\t" << instr->storeVector3D.vector.zp; break; case QDeclarativeInstruction::StoreVariant: qWarning().nospace() << idx << "\t\t" << "STORE_VARIANT\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value); @@ -166,7 +166,7 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx) qWarning().nospace() << idx << "\t\t" << "ASSIGN_SIGNAL_OBJECT\t" << instr->assignSignalObject.signal << "\t\t\t" << datas.at(instr->assignSignalObject.signal); break; case QDeclarativeInstruction::AssignCustomType: - qWarning().nospace() << idx << "\t\t" << "ASSIGN_CUSTOMTYPE\t" << instr->assignCustomType.propertyIndex << "\t" << instr->assignCustomType.valueIndex; + qWarning().nospace() << idx << "\t\t" << "ASSIGN_CUSTOMTYPE\t" << instr->assignCustomType.propertyIndex << "\t" << instr->assignCustomType.primitive << "\t" << instr->assignCustomType.type; break; case QDeclarativeInstruction::StoreBinding: qWarning().nospace() << idx << "\t\t" << "STORE_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context; diff --git a/src/declarative/qml/qdeclarativeinstruction_p.h b/src/declarative/qml/qdeclarativeinstruction_p.h index b436ce531f..cbf34a8baf 100644 --- a/src/declarative/qml/qdeclarativeinstruction_p.h +++ b/src/declarative/qml/qdeclarativeinstruction_p.h @@ -81,12 +81,12 @@ QT_BEGIN_NAMESPACE F(StoreDate, storeDate) \ F(StoreTime, storeTime) \ F(StoreDateTime, storeDateTime) \ - F(StorePoint, storeRealPair) \ - F(StorePointF, storeRealPair) \ - F(StoreSize, storeRealPair) \ - F(StoreSizeF, storeRealPair) \ + F(StorePoint, storePoint) \ + F(StorePointF, storePointF) \ + F(StoreSize, storeSize) \ + F(StoreSizeF, storeSizeF) \ F(StoreRect, storeRect) \ - F(StoreRectF, storeRect) \ + F(StoreRectF, storeRectF) \ F(StoreVector3D, storeVector3D) \ F(StoreObject, storeObject) \ F(AssignCustomType, assignCustomType) \ @@ -268,27 +268,45 @@ union QDeclarativeInstruction struct instr_storeTime { QML_INSTR_HEADER int propertyIndex; - int valueIndex; + struct QTime { + int mds; +#if defined(Q_OS_WINCE) + int startTick; +#endif + } time; }; struct instr_storeDateTime { QML_INSTR_HEADER int propertyIndex; - int valueIndex; - }; - struct instr_storeRealPair { - QML_INSTR_HEADER - int propertyIndex; - int valueIndex; + int date; + instr_storeTime::QTime time; }; struct instr_storeRect { QML_INSTR_HEADER int propertyIndex; - int valueIndex; + struct QRect { +#if defined(Q_OS_MAC) + int y1; + int x1; + int y2; + int x2; +#else + int x1; + int y1; + int x2; + int y2; +#endif + } rect; }; - struct instr_storeVector3D { + struct instr_storeRectF { QML_INSTR_HEADER int propertyIndex; - int valueIndex; + struct QRectF { + qreal xp; + qreal yp; + qreal w; + qreal h; + } rect; }; struct instr_storeObject { QML_INSTR_HEADER @@ -298,7 +316,8 @@ union QDeclarativeInstruction struct instr_assignCustomType { QML_INSTR_HEADER int propertyIndex; - int valueIndex; + int primitive; + int type; ushort line; }; struct instr_storeSignal { @@ -335,6 +354,52 @@ union QDeclarativeInstruction QML_INSTR_HEADER ushort line; }; + struct instr_storePoint { + QML_INSTR_HEADER + int propertyIndex; + struct QPoint { +#if defined(Q_OS_MAC) + int yp; + int xp; +#else + int xp; + int yp; +#endif + } point; + }; + struct instr_storePointF { + QML_INSTR_HEADER + int propertyIndex; + struct QPointF { + qreal xp; + qreal yp; + } point; + }; + struct instr_storeSize { + QML_INSTR_HEADER + int propertyIndex; + struct QSize { + int wd; + int ht; + } size; + }; + struct instr_storeSizeF { + QML_INSTR_HEADER + int propertyIndex; + struct QSizeF { + qreal wd; + qreal ht; + } size; + }; + struct instr_storeVector3D { + QML_INSTR_HEADER + int propertyIndex; + struct QVector3D { + float xp; + float yp; + float zp; + } vector; + }; instr_common common; instr_init init; @@ -362,8 +427,12 @@ union QDeclarativeInstruction instr_storeDate storeDate; instr_storeTime storeTime; instr_storeDateTime storeDateTime; - instr_storeRealPair storeRealPair; + instr_storePoint storePoint; + instr_storePointF storePointF; + instr_storeSize storeSize; + instr_storeSizeF storeSizeF; instr_storeRect storeRect; + instr_storeRectF storeRectF; instr_storeVector3D storeVector3D; instr_storeObject storeObject; instr_assignCustomType assignCustomType; diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index 03abae73a7..13539a0f1f 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -161,9 +161,6 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, const QList<QDeclarativeCompiledData::TypeReference> &types = comp->types; const QList<QString> &primitives = comp->primitives; const QList<QByteArray> &datas = comp->datas; - const QList<QDeclarativeCompiledData::CustomTypeData> &customTypeData = comp->customTypeData; - const QList<int> &intData = comp->intData; - const QList<float> &floatData = comp->floatData; const QList<QDeclarativePropertyCache *> &propertyCaches = comp->propertyCaches; const QList<QDeclarativeScriptData *> &scripts = comp->scripts; const QList<QUrl> &urls = comp->urls; @@ -475,12 +472,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QObject *target = stack.top(); CLEAN_PROPERTY(target, instr.propertyIndex); - QTime t; - t.setHMS(intData.at(instr.valueIndex), - intData.at(instr.valueIndex+1), - intData.at(instr.valueIndex+2), - intData.at(instr.valueIndex+3)); - void *a[] = { &t, 0, &status, &flags }; + QTime *t = (QTime *)&instr.time; + void *a[] = { t, 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, instr.propertyIndex, a); QML_END_INSTR(StoreTime) @@ -489,12 +482,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QObject *target = stack.top(); CLEAN_PROPERTY(target, instr.propertyIndex); - QTime t; - t.setHMS(intData.at(instr.valueIndex+1), - intData.at(instr.valueIndex+2), - intData.at(instr.valueIndex+3), - intData.at(instr.valueIndex+4)); - QDateTime dt(QDate::fromJulianDay(intData.at(instr.valueIndex)), t); + QTime *t = (QTime *)&instr.time; + QDateTime dt(QDate::fromJulianDay(instr.date), *t); void *a[] = { &dt, 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, instr.propertyIndex, a); @@ -504,9 +493,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QObject *target = stack.top(); CLEAN_PROPERTY(target, instr.propertyIndex); - QPoint p = QPointF(floatData.at(instr.valueIndex), - floatData.at(instr.valueIndex+1)).toPoint(); - void *a[] = { &p, 0, &status, &flags }; + QPoint *p = (QPoint *)&instr.point; + void *a[] = { p, 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, instr.propertyIndex, a); QML_END_INSTR(StorePoint) @@ -515,9 +503,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QObject *target = stack.top(); CLEAN_PROPERTY(target, instr.propertyIndex); - QPointF p(floatData.at(instr.valueIndex), - floatData.at(instr.valueIndex+1)); - void *a[] = { &p, 0, &status, &flags }; + QPointF *p = (QPointF *)&instr.point; + void *a[] = { p, 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, instr.propertyIndex, a); QML_END_INSTR(StorePointF) @@ -526,9 +513,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QObject *target = stack.top(); CLEAN_PROPERTY(target, instr.propertyIndex); - QSize p = QSizeF(floatData.at(instr.valueIndex), - floatData.at(instr.valueIndex+1)).toSize(); - void *a[] = { &p, 0, &status, &flags }; + QSize *s = (QSize *)&instr.size; + void *a[] = { s, 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, instr.propertyIndex, a); QML_END_INSTR(StoreSize) @@ -537,9 +523,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QObject *target = stack.top(); CLEAN_PROPERTY(target, instr.propertyIndex); - QSizeF s(floatData.at(instr.valueIndex), - floatData.at(instr.valueIndex+1)); - void *a[] = { &s, 0, &status, &flags }; + QSizeF *s = (QSizeF *)&instr.size; + void *a[] = { s, 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, instr.propertyIndex, a); QML_END_INSTR(StoreSizeF) @@ -548,11 +533,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QObject *target = stack.top(); CLEAN_PROPERTY(target, instr.propertyIndex); - QRect r = QRectF(floatData.at(instr.valueIndex), - floatData.at(instr.valueIndex+1), - floatData.at(instr.valueIndex+2), - floatData.at(instr.valueIndex+3)).toRect(); - void *a[] = { &r, 0, &status, &flags }; + QRect *r = (QRect *)&instr.rect; + void *a[] = { r, 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, instr.propertyIndex, a); QML_END_INSTR(StoreRect) @@ -561,11 +543,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QObject *target = stack.top(); CLEAN_PROPERTY(target, instr.propertyIndex); - QRectF r(floatData.at(instr.valueIndex), - floatData.at(instr.valueIndex+1), - floatData.at(instr.valueIndex+2), - floatData.at(instr.valueIndex+3)); - void *a[] = { &r, 0, &status, &flags }; + QRectF *r = (QRectF *)&instr.rect; + void *a[] = { r, 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, instr.propertyIndex, a); QML_END_INSTR(StoreRectF) @@ -574,10 +553,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QObject *target = stack.top(); CLEAN_PROPERTY(target, instr.propertyIndex); - QVector3D p(floatData.at(instr.valueIndex), - floatData.at(instr.valueIndex+1), - floatData.at(instr.valueIndex+2)); - void *a[] = { &p, 0, &status, &flags }; + QVector3D *v = (QVector3D *)&instr.vector; + void *a[] = { v, 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, instr.propertyIndex, a); QML_END_INSTR(StoreVector3D) @@ -596,15 +573,14 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QObject *target = stack.top(); CLEAN_PROPERTY(target, instr.propertyIndex); - QDeclarativeCompiledData::CustomTypeData data = customTypeData.at(instr.valueIndex); - const QString &primitive = primitives.at(data.index); - QDeclarativeMetaType::StringConverter converter = - QDeclarativeMetaType::customStringConverter(data.type); + const QString &primitive = primitives.at(instr.primitive); + int type = instr.type; + QDeclarativeMetaType::StringConverter converter = QDeclarativeMetaType::customStringConverter(type); QVariant v = (*converter)(primitive); QMetaProperty prop = target->metaObject()->property(instr.propertyIndex); - if (v.isNull() || ((int)prop.type() != data.type && prop.userType() != data.type)) + if (v.isNull() || ((int)prop.type() != type && prop.userType() != type)) VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign value %1 to property %2").arg(primitive).arg(QString::fromUtf8(prop.name())), instr.line); void *a[] = { (void *)v.data(), 0, &status, &flags }; |