diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-01-09 10:29:38 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-01-09 10:29:38 (GMT) |
commit | a657665e31e9fdabfc4e3913b4656046efe8b78d (patch) | |
tree | b6729687025cb47f70a3cfe9510d56237a3e0621 | |
parent | 41f7ccb2dd21dcd4b0f2aa172bb813095cb2ade3 (diff) | |
download | Qt-a657665e31e9fdabfc4e3913b4656046efe8b78d.zip Qt-a657665e31e9fdabfc4e3913b4656046efe8b78d.tar.gz Qt-a657665e31e9fdabfc4e3913b4656046efe8b78d.tar.bz2 |
Optimization: Passing QScriptEngine to QScriptValue is much faster
-rw-r--r-- | src/declarative/qml/qmlobjectscriptclass.cpp | 14 | ||||
-rw-r--r-- | tests/benchmarks/declarative/script/tst_script.cpp | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp index f372561..cb665d1 100644 --- a/src/declarative/qml/qmlobjectscriptclass.cpp +++ b/src/declarative/qml/qmlobjectscriptclass.cpp @@ -256,37 +256,37 @@ QScriptValue QmlObjectScriptClass::property(QObject *obj, const Identifier &name qreal rv = 0; void *args[] = { &rv, 0 }; QMetaObject::metacall(obj, QMetaObject::ReadProperty, lastData->coreIndex, args); - return QScriptValue(rv); + return QScriptValue(scriptEngine, rv); } else if (lastData->propType == QMetaType::Int) { int rv = 0; void *args[] = { &rv, 0 }; QMetaObject::metacall(obj, QMetaObject::ReadProperty, lastData->coreIndex, args); - return QScriptValue(rv); + return QScriptValue(scriptEngine, rv); } else if (lastData->propType == QMetaType::Bool) { bool rv = false; void *args[] = { &rv, 0 }; QMetaObject::metacall(obj, QMetaObject::ReadProperty, lastData->coreIndex, args); - return QScriptValue(rv); + return QScriptValue(scriptEngine, rv); } else if (lastData->propType == QMetaType::QString) { QString rv; void *args[] = { &rv, 0 }; QMetaObject::metacall(obj, QMetaObject::ReadProperty, lastData->coreIndex, args); - return QScriptValue(rv); + return QScriptValue(scriptEngine, rv); } else if (lastData->propType == QMetaType::UInt) { uint rv = 0; void *args[] = { &rv, 0 }; QMetaObject::metacall(obj, QMetaObject::ReadProperty, lastData->coreIndex, args); - return QScriptValue(rv); + return QScriptValue(scriptEngine, rv); } else if (lastData->propType == QMetaType::Float) { float rv = 0; void *args[] = { &rv, 0 }; QMetaObject::metacall(obj, QMetaObject::ReadProperty, lastData->coreIndex, args); - return QScriptValue(rv); + return QScriptValue(scriptEngine, rv); } else if (lastData->propType == QMetaType::Double) { double rv = 0; void *args[] = { &rv, 0 }; QMetaObject::metacall(obj, QMetaObject::ReadProperty, lastData->coreIndex, args); - return QScriptValue(rv); + return QScriptValue(scriptEngine, rv); } else { QVariant var = obj->metaObject()->property(lastData->coreIndex).read(obj); return enginePriv->scriptValueFromVariant(var); diff --git a/tests/benchmarks/declarative/script/tst_script.cpp b/tests/benchmarks/declarative/script/tst_script.cpp index 3c0805a..f417d0c 100644 --- a/tests/benchmarks/declarative/script/tst_script.cpp +++ b/tests/benchmarks/declarative/script/tst_script.cpp @@ -157,10 +157,10 @@ void tst_script::property_js() } } -static QScriptValue property_getter_method(QScriptContext *, QScriptEngine *) +static QScriptValue property_getter_method(QScriptContext *, QScriptEngine *engine) { static int x = 0; - return QScriptValue(x++); + return QScriptValue(engine,x++); } void tst_script::property_getter() |