aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4runtime.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-09-08 14:58:16 +0200
committerLars Knoll <lars.knoll@theqtcompany.com>2015-09-25 08:38:56 +0000
commitc72f973a35c0ba0a70a00f5c4d6bed8b0edbc21d (patch)
tree124f0a232e9389bc5a6320a03c8e2bac6b63ab9b /src/qml/jsruntime/qv4runtime.cpp
parent3f12ee31a4dae822fd8e9d3a6791157d8503c653 (diff)
Speed up creation of Array literals
Gives around 10% speedup on the v8 splay benchmark. Change-Id: I47f64e7b73bde59ac3bdd2c94fc199ecfbbf290e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime.cpp')
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index d122f06d05..0d7a1851b8 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -1209,15 +1209,7 @@ void Runtime::declareVar(ExecutionEngine *engine, bool deletable, int nameIndex)
ReturnedValue Runtime::arrayLiteral(ExecutionEngine *engine, Value *values, uint length)
{
- Scope scope(engine);
- ScopedArrayObject a(scope, engine->newArrayObject());
-
- if (length) {
- a->arrayReserve(length);
- a->arrayPut(0, values, length);
- a->setArrayLengthUnchecked(length);
- }
- return a.asReturnedValue();
+ return engine->newArrayObject(values, length)->asReturnedValue();
}
ReturnedValue Runtime::objectLiteral(ExecutionEngine *engine, const QV4::Value *args, int classId, int arrayValueCount, int arrayGetterSetterCountAndFlags)