summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-24 11:07:11 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-08-24 11:09:50 (GMT)
commit293fc4d4b4eb4caa5f50efe23252fe7d93b28df4 (patch)
tree5aace719430a8891e422d974328d1e8af3973189
parent05254db72eaba7e3394f2c788b259ec29a26d640 (diff)
downloadQt-293fc4d4b4eb4caa5f50efe23252fe7d93b28df4.zip
Qt-293fc4d4b4eb4caa5f50efe23252fe7d93b28df4.tar.gz
Qt-293fc4d4b4eb4caa5f50efe23252fe7d93b28df4.tar.bz2
use QVarLengthArray instead of QVector for holding JS arguments
It's faster. Reviewed-by: Olivier Goffart
-rw-r--r--src/script/api/qscriptvalue.cpp7
-rw-r--r--src/script/bridge/qscriptqobject.cpp3
2 files changed, 4 insertions, 6 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp
index 93d6be8..922b068 100644
--- a/src/script/api/qscriptvalue.cpp
+++ b/src/script/api/qscriptvalue.cpp
@@ -63,6 +63,7 @@
#include <QtCore/qdatetime.h>
#include <QtCore/qregexp.h>
#include <QtCore/qvariant.h>
+#include <QtCore/qvarlengtharray.h>
#include <QtCore/qnumeric.h>
#include "utils/qscriptdate_p.h"
@@ -1943,8 +1944,7 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject,
if (!jscThisObject || !jscThisObject.isObject())
jscThisObject = d->engine->globalObject();
- QVector<JSC::JSValue> argsVector;
- argsVector.resize(args.size());
+ QVarLengthArray<JSC::JSValue, 8> argsVector(args.size());
for (int i = 0; i < args.size(); ++i) {
const QScriptValue &arg = args.at(i);
if (!arg.isValid()) {
@@ -2077,8 +2077,7 @@ QScriptValue QScriptValue::construct(const QScriptValueList &args)
return QScriptValue();
JSC::ExecState *exec = d->engine->currentFrame;
- QVector<JSC::JSValue> argsVector;
- argsVector.resize(args.size());
+ QVarLengthArray<JSC::JSValue, 8> argsVector(args.size());
for (int i = 0; i < args.size(); ++i) {
if (!args.at(i).isValid())
argsVector[i] = JSC::jsUndefined();
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index d45a6d8..34e6504 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -2022,8 +2022,7 @@ void QObjectConnectionManager::execute(int slotIndex, void **argv)
int argc = parameterTypes.count();
JSC::ExecState *exec = engine->currentFrame;
- QVector<JSC::JSValue> argsVector;
- argsVector.resize(argc);
+ QVarLengthArray<JSC::JSValue, 8> argsVector(argc);
for (int i = 0; i < argc; ++i) {
// ### optimize -- no need to convert via QScriptValue
QScriptValue actual;