diff options
author | Erik Verbruggen <erik.verbruggen@theqtcompany.com> | 2016-04-21 15:30:50 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-04-22 14:29:53 +0000 |
commit | 2e6f7f362e62c3285e7d395aca607502c8e8160e (patch) | |
tree | 3bc28378fd5d9d1aa3ed9d05b3a4ee7a12537583 | |
parent | f656fc588bab4104d531cb46836168da6736a518 (diff) |
V4: 'Cache' enumeration end instead of calling a method.
Saves ~2600 instructions on Linux/x86_64 for a normal instantiation of
QV4::Heap::QtObject.
Change-Id: I20c9311a96fd76911536153ddd1605500c6ac451
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
-rw-r--r-- | src/qml/qml/v8/qqmlbuiltinfunctions.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index f4e980eefb..b90fd7eb17 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -89,9 +89,9 @@ Heap::QtObject::QtObject(QQmlEngine *qmlEngine) const QMetaObject *qtMetaObject = StaticQtMetaObject::get(); ScopedString str(scope); ScopedValue v(scope); - for (int ii = 0; ii < qtMetaObject->enumeratorCount(); ++ii) { + for (int ii = 0, eii = qtMetaObject->enumeratorCount(); ii < eii; ++ii) { QMetaEnum enumerator = qtMetaObject->enumerator(ii); - for (int jj = 0; jj < enumerator.keyCount(); ++jj) { + for (int jj = 0, ejj = enumerator.keyCount(); jj < ejj; ++jj) { o->put((str = scope.engine->newString(QString::fromUtf8(enumerator.key(jj)))), (v = QV4::Primitive::fromInt32(enumerator.value(jj)))); } } |