aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4isel_p.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-02-15 04:39:33 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-24 20:41:48 +0100
commit90a7249e70b37f97907a28ccc6016064231eb861 (patch)
tree96cb93cc7c4357c7c526063948a49a52e4654df9 /src/qml/compiler/qv4isel_p.cpp
parentc78d1052c2509646c8cf13b460a8d098de836ad0 (diff)
Determine whether or not an object literal requires a sparse array at compile time
Change-Id: Ieb7f6ee97a4f251f1e2369850ebb9e2931f84ac1 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4isel_p.cpp')
-rw-r--r--src/qml/compiler/qv4isel_p.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4isel_p.cpp b/src/qml/compiler/qv4isel_p.cpp
index 2a73b55ed2..f0092b70fc 100644
--- a/src/qml/compiler/qv4isel_p.cpp
+++ b/src/qml/compiler/qv4isel_p.cpp
@@ -367,8 +367,21 @@ void IRDecoder::callBuiltin(IR::Call *call, IR::Temp *result)
}
IR::ExprList *arrayEntries = args;
+ bool needSparseArray = false;
+ for (IR::ExprList *it = arrayEntries; it; it = it->next) {
+ uint index = it->expr->asConst()->value;
+ if (index > 16) {
+ needSparseArray = true;
+ break;
+ }
+ it = it->next;
+ bool isData = it->expr->asConst()->value;
+ it = it->next;
+ if (!isData)
+ it = it->next;
+ }
- callBuiltinDefineObjectLiteral(result, keyValuePairsCount, keyValuePairs, arrayEntries);
+ callBuiltinDefineObjectLiteral(result, keyValuePairsCount, keyValuePairs, arrayEntries, needSparseArray);
} return;
case IR::Name::builtin_setup_argument_object: