summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-12-03 07:00:44 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-12-03 07:00:44 (GMT)
commitc901e373c8402d2542b708831deb4a5773624b1b (patch)
tree00deae96b0db3e864295ab51b171a2c6126b7e9f /src
parent3338430a0a421eab2cb61f446675303585b0b1dd (diff)
downloadQt-c901e373c8402d2542b708831deb4a5773624b1b.zip
Qt-c901e373c8402d2542b708831deb4a5773624b1b.tar.gz
Qt-c901e373c8402d2542b708831deb4a5773624b1b.tar.bz2
Avoid QString <-> QUrl conversions
Diffstat (limited to 'src')
-rw-r--r--src/declarative/qml/qmlcompileddata.cpp10
-rw-r--r--src/declarative/qml/qmlcompiler.cpp2
-rw-r--r--src/declarative/qml/qmlcompiler_p.h2
-rw-r--r--src/declarative/qml/qmlvme.cpp4
4 files changed, 15 insertions, 3 deletions
diff --git a/src/declarative/qml/qmlcompileddata.cpp b/src/declarative/qml/qmlcompileddata.cpp
index c4a0b59..c41ee3f 100644
--- a/src/declarative/qml/qmlcompileddata.cpp
+++ b/src/declarative/qml/qmlcompileddata.cpp
@@ -85,6 +85,16 @@ int QmlCompiledData::indexForByteArray(const QByteArray &data)
return idx;
}
+int QmlCompiledData::indexForUrl(const QUrl &data)
+{
+ int idx = urls.indexOf(data);
+ if (idx == -1) {
+ idx = urls.count();
+ urls << data;
+ }
+ return idx;
+}
+
int QmlCompiledData::indexForFloat(float *data, int count)
{
Q_ASSERT(count > 0);
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index c8e9fa3..578aa91 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -374,7 +374,7 @@ void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop,
instr.type = QmlInstruction::StoreUrl;
QUrl u = string.isEmpty() ? QUrl() : output->url.resolved(QUrl(string));
instr.storeUrl.propertyIndex = prop.propertyIndex();
- instr.storeUrl.value = output->indexForString(u.toString());
+ instr.storeUrl.value = output->indexForUrl(u);
}
break;
case QVariant::UInt:
diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h
index f7f72e7..298719f 100644
--- a/src/declarative/qml/qmlcompiler_p.h
+++ b/src/declarative/qml/qmlcompiler_p.h
@@ -118,6 +118,7 @@ public:
QList<QmlPropertyCache *> propertyCaches;
QList<QmlIntegerCache *> contextCaches;
QList<QmlParser::Object::ScriptBlock> scripts;
+ QList<QUrl> urls;
void dumpInstructions();
private:
@@ -134,6 +135,7 @@ private:
int indexForInt(int *, int);
int indexForLocation(const QmlParser::Location &);
int indexForLocation(const QmlParser::LocationSpan &);
+ int indexForUrl(const QUrl &);
};
class QMetaObjectBuilder;
diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp
index 6107ebf..89ca1be 100644
--- a/src/declarative/qml/qmlvme.cpp
+++ b/src/declarative/qml/qmlvme.cpp
@@ -144,6 +144,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
const QList<float> &floatData = comp->floatData;
const QList<QmlPropertyCache *> &propertyCaches = comp->propertyCaches;
const QList<QmlParser::Object::ScriptBlock> &scripts = comp->scripts;
+ const QList<QUrl> &urls = comp->urls;
QmlEnginePrivate::SimpleList<QmlAbstractBinding> bindValues;
QmlEnginePrivate::SimpleList<QmlParserStatus> parserStatus;
@@ -297,8 +298,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
case QmlInstruction::StoreUrl:
{
QObject *target = stack.top();
- QUrl u(primitives.at(instr.storeUrl.value));
- void *a[] = { &u, 0, &status, &flags };
+ void *a[] = { (void *)&urls.at(instr.storeUrl.value), 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeUrl.propertyIndex, a);
}