From 668eca2b9343cf5d79dc1faa6c251595e2e84918 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Sun, 13 Oct 2013 22:08:59 +0200 Subject: Avoid creating array attributes if possible Holes in arrays should be represented by an empty value, not by creating/setting array attributes. Reason is that the creation is irreversable, and slows down execution. This speeds up crypto.js by 10% Change-Id: I2e5472575479a5f2dbe53f59ecb8ed3aeab1be7a Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4arrayobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qml/jsruntime/qv4arrayobject.cpp') diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp index 92fa196331..3913b9ffe7 100644 --- a/src/qml/jsruntime/qv4arrayobject.cpp +++ b/src/qml/jsruntime/qv4arrayobject.cpp @@ -350,7 +350,7 @@ ReturnedValue ArrayPrototype::method_shift(SimpleCallContext *ctx) Property *front = 0; uint pidx = instance->propertyIndexFromArrayIndex(0); - if (pidx < UINT_MAX && (!instance->arrayAttributes || !instance->arrayAttributes[0].isGeneric())) + if (pidx < UINT_MAX && !instance->arrayData[pidx].value.isEmpty()) front = instance->arrayData + pidx; ScopedValue result(scope, front ? instance->getValue(front, instance->arrayAttributes ? instance->arrayAttributes[pidx] : Attr_Data) : Encode::undefined()); -- cgit v1.2.3