From 49cf23bd2a14e2ca7236b261d7960588f07f5a0b Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Mon, 6 Jan 2020 16:25:17 +0100 Subject: QV4: Array.includes: Support large arrays Creating new ScopedValues in the loop was quite wasteful, and would trigger a crash. We now simply reuse the ScopedValue. Fixes: QTBUG-81104 Change-Id: Ie1efd144886861a21c8f6827d7fd23699a1e0dcc Reviewed-by: Ulf Hermann --- src/qml/jsruntime/qv4arrayobject.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/qml/jsruntime/qv4arrayobject.cpp') diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp index af1a2d1de0..7b38bf34b1 100644 --- a/src/qml/jsruntime/qv4arrayobject.cpp +++ b/src/qml/jsruntime/qv4arrayobject.cpp @@ -1050,8 +1050,9 @@ ReturnedValue ArrayPrototype::method_includes(const FunctionObject *b, const Val } } + ScopedValue val(scope); while (k < len) { - ScopedValue val(scope, instance->get(k)); + val = instance->get(k); if (val->sameValueZero(argv[0])) { return Encode(true); } -- cgit v1.2.3