OpenCoverage

qv4arraydata.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4arraydata.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtQml module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39#include "qv4arraydata_p.h"-
40#include "qv4object_p.h"-
41#include "qv4functionobject_p.h"-
42#include <private/qv4mm_p.h>-
43#include "qv4runtime_p.h"-
44#include "qv4argumentsobject_p.h"-
45#include "qv4string_p.h"-
46#include "qv4jscall_p.h"-
47-
48using namespace QV4;-
49-
50DEFINE_MANAGED_VTABLE(ArrayData);-
51-
52const ArrayVTable SimpleArrayData::static_vtbl =-
53{-
54 DEFINE_MANAGED_VTABLE_INT(SimpleArrayData, nullptr),-
55 Heap::ArrayData::Simple,-
56 SimpleArrayData::reallocate,-
57 SimpleArrayData::get,-
58 SimpleArrayData::put,-
59 SimpleArrayData::putArray,-
60 SimpleArrayData::del,-
61 SimpleArrayData::setAttribute,-
62 SimpleArrayData::push_front,-
63 SimpleArrayData::pop_front,-
64 SimpleArrayData::truncate,-
65 SimpleArrayData::length-
66};-
67-
68const ArrayVTable SparseArrayData::static_vtbl =-
69{-
70 DEFINE_MANAGED_VTABLE_INT(SparseArrayData, nullptr),-
71 Heap::ArrayData::Sparse,-
72 SparseArrayData::reallocate,-
73 SparseArrayData::get,-
74 SparseArrayData::put,-
75 SparseArrayData::putArray,-
76 SparseArrayData::del,-
77 SparseArrayData::setAttribute,-
78 SparseArrayData::push_front,-
79 SparseArrayData::pop_front,-
80 SparseArrayData::truncate,-
81 SparseArrayData::length-
82};-
83-
84Q_STATIC_ASSERT(sizeof(Heap::ArrayData) == sizeof(Heap::SimpleArrayData));-
85Q_STATIC_ASSERT(sizeof(Heap::ArrayData) == sizeof(Heap::SparseArrayData));-
86-
87void Heap::ArrayData::markObjects(Heap::Base *base, MarkStack *stack)-
88{-
89 ArrayData *a = static_cast<ArrayData *>(base);-
90 a->values.mark(stack);-
91}
executed 13121 times by 11 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qquickanimationcontroller
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_quicktestmainwithsetup
  • tst_testfiltering
13121
92-
93-
94void ArrayData::realloc(Object *o, Type newType, uint requested, bool enforceAttributes)-
95{-
96 Scope scope(o->engine());-
97 Scoped<ArrayData> d(scope, o->arrayData());-
98-
99 uint alloc = 8;-
100 uint toCopy = 0;-
101 uint offset = 0;-
102-
103 if (d) {
dDescription
TRUEevaluated 22063 times by 16 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qqmlxmlhttprequest
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickworkerscript
  • tst_qv4debugger
FALSEevaluated 71822 times by 51 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlcomponent
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlmetaobject
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • tst_qqmlsettings
  • ...
22063-71822
104 bool hasAttrs = d->attrs();-
105 enforceAttributes |= hasAttrs;-
106-
107 if (requested <= d->alloc() && newType == d->type() && hasAttrs == enforceAttributes)
requested <= d->alloc()Description
TRUEevaluated 13353 times by 7 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qqmlxmlhttprequest
  • tst_qquickworkerscript
FALSEevaluated 8704 times by 12 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qv4debugger
newType == d->type()Description
TRUEevaluated 8014 times by 7 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qqmlxmlhttprequest
  • tst_qquickworkerscript
FALSEevaluated 5342 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
hasAttrs == enforceAttributesDescription
TRUEevaluated 7193 times by 7 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qqmlxmlhttprequest
  • tst_qquickworkerscript
FALSEevaluated 823 times by 1 test
Evaluated by:
  • tst_ecmascripttests
823-13353
108 return;
executed 7193 times by 7 tests: return;
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qqmlxmlhttprequest
  • tst_qquickworkerscript
7193
109 if (alloc < d->alloc())
alloc < d->alloc()Description
TRUEevaluated 2280 times by 7 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquickpositioners
  • tst_qv4debugger
FALSEevaluated 12598 times by 12 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qv4debugger
2280-12598
110 alloc = d->alloc();
executed 2280 times by 7 tests: alloc = d->alloc();
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquickpositioners
  • tst_qv4debugger
2280
111-
112 if (d->type() < Heap::ArrayData::Sparse) {
d->type() < He...ayData::SparseDescription
TRUEevaluated 9663 times by 12 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qv4debugger
FALSEevaluated 5211 times by 1 test
Evaluated by:
  • tst_ecmascripttests
5211-9663
113 offset = d->d()->offset;-
114 toCopy = d->d()->values.size;-
115 } else {
executed 9668 times by 12 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qv4debugger
9668
116 toCopy = d->alloc();-
117 }
executed 5211 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
5211
118 if (d->type() > newType)
d->type() > newTypeDescription
TRUEevaluated 2631 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 12250 times by 12 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qv4debugger
2631-12250
119 newType = d->type();
executed 2631 times by 1 test: newType = d->type();
Executed by:
  • tst_ecmascripttests
2631
120 }
executed 14875 times by 12 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qv4debugger
14875
121 if (enforceAttributes && newType == Heap::ArrayData::Simple)
enforceAttributesDescription
TRUEevaluated 6517 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 80174 times by 51 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlcomponent
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlmetaobject
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • tst_qqmlsettings
  • ...
newType == Hea...ayData::SimpleDescription
TRUEevaluated 822 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 5699 times by 1 test
Evaluated by:
  • tst_ecmascripttests
822-80174
122 newType = Heap::ArrayData::Complex;
executed 818 times by 1 test: newType = Heap::ArrayData::Complex;
Executed by:
  • tst_ecmascripttests
818
123-
124 while (alloc < requested)
alloc < requestedDescription
TRUEevaluated 10480 times by 13 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickcustomaffector
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qv4debugger
FALSEevaluated 86694 times by 51 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlcomponent
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlmetaobject
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • tst_qqmlsettings
  • ...
10480-86694
125 alloc *= 2;
executed 10482 times by 13 tests: alloc *= 2;
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickcustomaffector
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qv4debugger
10482
126 size_t size = sizeof(Heap::ArrayData) + (alloc - 1)*sizeof(Value);-
127 if (enforceAttributes)
enforceAttributesDescription
TRUEevaluated 6516 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 80185 times by 51 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlcomponent
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlmetaobject
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • tst_qqmlsettings
  • ...
6516-80185
128 size += alloc*sizeof(PropertyAttributes);
executed 6521 times by 1 test: size += alloc*sizeof(PropertyAttributes);
Executed by:
  • tst_ecmascripttests
6521
129-
130 Scoped<ArrayData> newData(scope);-
131 if (newType < Heap::ArrayData::Sparse) {
newType < Heap...ayData::SparseDescription
TRUEevaluated 78286 times by 51 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlcomponent
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlmetaobject
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • tst_qqmlsettings
  • ...
FALSEevaluated 8394 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
8394-78286
132 Heap::SimpleArrayData *n = scope.engine->memoryManager->allocManaged<SimpleArrayData>(size);-
133 n->init();-
134 n->offset = 0;-
135 n->values.size = d ? d->d()->values.size : 0;
dDescription
TRUEevaluated 6951 times by 12 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qv4debugger
FALSEevaluated 71343 times by 51 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlcomponent
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlmetaobject
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • tst_qqmlsettings
  • ...
6951-71343
136 newData = n;-
137 } else {
executed 78312 times by 51 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlcomponent
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlmetaobject
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • tst_qqmlsettings
  • ...
78312
138 Heap::SparseArrayData *n = scope.engine->memoryManager->allocManaged<SparseArrayData>(size);-
139 n->init();-
140 newData = n;-
141 }
executed 8404 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
8404
142 newData->setAlloc(alloc);-
143 newData->setType(newType);-
144 newData->setAttrs(enforceAttributes ? reinterpret_cast<PropertyAttributes *>(newData->d()->values.values + alloc) : nullptr);-
145 o->setArrayData(newData);-
146-
147 if (d) {
dDescription
TRUEevaluated 14888 times by 12 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qv4debugger
FALSEevaluated 71885 times by 51 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlcomponent
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlmetaobject
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • tst_qqmlsettings
  • ...
14888-71885
148 if (enforceAttributes) {
enforceAttributesDescription
TRUEevaluated 6079 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 8807 times by 12 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qv4debugger
6079-8807
149 if (d->attrs())
d->attrs()Description
TRUEevaluated 2649 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 3434 times by 1 test
Evaluated by:
  • tst_ecmascripttests
2649-3434
150 memcpy(newData->attrs(), d->attrs(), sizeof(PropertyAttributes)*toCopy);
executed 2649 times by 1 test: memcpy(newData->attrs(), d->attrs(), sizeof(PropertyAttributes)*toCopy);
Executed by:
  • tst_ecmascripttests
2649
151 else-
152 for (uint i = 0; i < toCopy; ++i)
i < toCopyDescription
TRUEevaluated 25822 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 3426 times by 1 test
Evaluated by:
  • tst_ecmascripttests
3426-25822
153 newData->attrs()[i] = Attr_Data;
executed 25820 times by 1 test: newData->attrs()[i] = Attr_Data;
Executed by:
  • tst_ecmascripttests
25820
154 }
executed 6072 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
6072
155-
156 if (toCopy > d->d()->values.alloc - offset) {
toCopy > d->d(...alloc - offsetDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEevaluated 14861 times by 12 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qv4debugger
24-14861
157 uint copyFromStart = toCopy - (d->d()->values.alloc - offset);-
158 // no write barrier required here-
159 memcpy(newData->d()->values.values + toCopy - copyFromStart, d->d()->values.values, sizeof(Value)*copyFromStart);-
160 toCopy -= copyFromStart;-
161 }
executed 24 times by 1 test: end of block
Executed by:
  • tst_qqmlecmascript
24
162 // no write barrier required here-
163 memcpy(newData->d()->values.values, d->d()->values.values + offset, sizeof(Value)*toCopy);-
164 }
executed 14871 times by 12 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qv4debugger
14871
165-
166 if (newType != Heap::ArrayData::Sparse)
newType != Hea...ayData::SparseDescription
TRUEevaluated 78282 times by 51 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlcomponent
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlmetaobject
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • tst_qqmlsettings
  • ...
FALSEevaluated 8403 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
8403-78282
167 return;
executed 78280 times by 51 tests: return;
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlcomponent
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlmetaobject
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • tst_qqmlsettings
  • ...
78280
168-
169 Heap::SparseArrayData *sparse = static_cast<Heap::SparseArrayData *>(newData->d());-
170-
171 Value *lastFree;-
172 if (d && d->type() == Heap::ArrayData::Sparse) {
d->type() == H...ayData::SparseDescription
TRUEevaluated 5213 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 2718 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
2718-5213
173 Heap::SparseArrayData *old = static_cast<Heap::SparseArrayData *>(d->d());-
174 sparse->sparse = old->sparse;-
175 old->sparse = nullptr;-
176 lastFree = &sparse->sparse->freeList;-
177 } else {
executed 5215 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
5215
178 sparse->sparse = new SparseArray;-
179 lastFree = &sparse->sparse->freeList;-
180 *lastFree = Encode(0);-
181 for (uint i = 0; i < toCopy; ++i) {
i < toCopyDescription
TRUEevaluated 21077 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 3183 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
3183-21077
182 if (!sparse->values[i].isEmpty()) {
!sparse->values[i].isEmpty()Description
TRUEevaluated 2563 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 18514 times by 1 test
Evaluated by:
  • tst_ecmascripttests
2563-18514
183 SparseArrayNode *n = sparse->sparse->insert(i);-
184 n->value = i;-
185 } else {
executed 2565 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
2565
186 *lastFree = Encode(i);-
187 sparse->values.values[i].setEmpty();-
188 lastFree = &sparse->values.values[i];-
189 }
executed 18516 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
18516
190 }-
191 }
executed 3183 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
3183
192-
193 if (toCopy < sparse->values.alloc) {
toCopy < sparse->values.allocDescription
TRUEevaluated 5790 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 2609 times by 1 test
Evaluated by:
  • tst_ecmascripttests
2609-5790
194 for (uint i = toCopy; i < sparse->values.alloc; ++i) {
i < sparse->values.allocDescription
TRUEevaluated 4237763 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 5801 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
5801-4237763
195 *lastFree = Encode(i);-
196 sparse->values.values[i].setEmpty();-
197 lastFree = &sparse->values.values[i];-
198 }
executed 4237749 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
4237749
199 }
executed 5804 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
5804
200 *lastFree = Encode(-1);-
201-
202 Q_ASSERT(sparse->sparse->freeList.isInteger());-
203 // ### Could explicitly free the old data-
204}
executed 8406 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
8406
205-
206Heap::ArrayData *SimpleArrayData::reallocate(Object *o, uint n, bool enforceAttributes)-
207{-
208 realloc(o, Heap::ArrayData::Simple, n, enforceAttributes);-
209 return o->arrayData();
executed 5858 times by 8 tests: return o->arrayData();
Executed by:
  • tst_ecmascripttests
  • tst_qjsonbinding
  • tst_qqmlecmascript
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpositioners
  • tst_qquickrepeater
5858
210}-
211-
212void ArrayData::ensureAttributes(Object *o)-
213{-
214 if (o->arrayData() && o->arrayData()->attrs)
o->arrayData()Description
TRUEevaluated 5987 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
o->arrayData()->attrsDescription
TRUEevaluated 2572 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 3423 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-5987
215 return;
executed 2572 times by 1 test: return;
Executed by:
  • tst_ecmascripttests
2572
216-
217 ArrayData::realloc(o, Heap::ArrayData::Simple, 0, true);-
218}
executed 3415 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
3415
219-
220ReturnedValue SimpleArrayData::get(const Heap::ArrayData *d, uint index)-
221{-
222 const Heap::SimpleArrayData *dd = static_cast<const Heap::SimpleArrayData *>(d);-
223 if (index >= dd->values.size)
index >= dd->values.sizeDescription
TRUEevaluated 70340 times by 16 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qqmlapplicationengine
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickanimations
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickscreen
  • tst_qquickvisualdatamodel
FALSEevaluated 8454 times by 1 test
Evaluated by:
  • tst_ecmascripttests
8454-70340
224 return Primitive::emptyValue().asReturnedValue();
executed 70338 times by 16 tests: return Primitive::emptyValue().asReturnedValue();
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qqmlapplicationengine
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickanimations
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickscreen
  • tst_qquickvisualdatamodel
70338
225 return dd->data(index).asReturnedValue();
executed 8454 times by 1 test: return dd->data(index).asReturnedValue();
Executed by:
  • tst_ecmascripttests
8454
226}-
227-
228bool SimpleArrayData::put(Object *o, uint index, const Value &value)-
229{-
230 Heap::SimpleArrayData *dd = o->d()->arrayData.cast<Heap::SimpleArrayData>();-
231 Q_ASSERT(index >= dd->values.size || !dd->attrs || !dd->attrs[index].isAccessor());-
232 // ### honour attributes-
233 dd->setData(o->engine(), index, value);-
234 if (index >= dd->values.size) {
index >= dd->values.sizeDescription
TRUEevaluated 21288 times by 19 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qqmllocale
  • tst_qqmlmetaobject
  • tst_qqmlsettings
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_qquickmultipointtoucharea
  • tst_qquickworkerscript
  • tst_quicktestmainwithsetup
  • tst_testfiltering
FALSEnever evaluated
0-21288
235 if (dd->attrs)
dd->attrsDescription
TRUEnever evaluated
FALSEevaluated 21308 times by 19 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qqmllocale
  • tst_qqmlmetaobject
  • tst_qqmlsettings
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_qquickmultipointtoucharea
  • tst_qquickworkerscript
  • tst_quicktestmainwithsetup
  • tst_testfiltering
0-21308
236 dd->attrs[index] = Attr_Data;
never executed: dd->attrs[index] = Attr_Data;
0
237 dd->values.size = index + 1;-
238 }
executed 21292 times by 19 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qqmllocale
  • tst_qqmlmetaobject
  • tst_qqmlsettings
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_qquickmultipointtoucharea
  • tst_qquickworkerscript
  • tst_quicktestmainwithsetup
  • tst_testfiltering
21292
239 return true;
executed 21301 times by 19 tests: return true;
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qqmllocale
  • tst_qqmlmetaobject
  • tst_qqmlsettings
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_qquickmultipointtoucharea
  • tst_qquickworkerscript
  • tst_quicktestmainwithsetup
  • tst_testfiltering
21301
240}-
241-
242bool SimpleArrayData::del(Object *o, uint index)-
243{-
244 Heap::SimpleArrayData *dd = o->d()->arrayData.cast<Heap::SimpleArrayData>();-
245 if (index >= dd->values.size)
index >= dd->values.sizeDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 1626 times by 7 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qquickanimationcontroller
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
16-1626
246 return true;
executed 16 times by 1 test: return true;
Executed by:
  • tst_ecmascripttests
16
247-
248 if (!dd->attrs || dd->attrs[index].isConfigurable()) {
!dd->attrsDescription
TRUEevaluated 1202 times by 7 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qquickanimationcontroller
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
FALSEevaluated 425 times by 1 test
Evaluated by:
  • tst_ecmascripttests
dd->attrs[inde...Configurable()Description
TRUEevaluated 82 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 351 times by 1 test
Evaluated by:
  • tst_ecmascripttests
82-1202
249 dd->setData(o->engine(), index, Primitive::emptyValue());-
250 if (dd->attrs)
dd->attrsDescription
TRUEevaluated 82 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 1205 times by 7 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qquickanimationcontroller
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
82-1205
251 dd->attrs[index] = Attr_Data;
executed 82 times by 1 test: dd->attrs[index] = Attr_Data;
Executed by:
  • tst_ecmascripttests
82
252 return true;
executed 1285 times by 7 tests: return true;
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qquickanimationcontroller
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
1285
253 }-
254 if (dd->data(index).isEmpty())
dd->data(index).isEmpty()Description
TRUEnever evaluated
FALSEevaluated 342 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-342
255 return true;
never executed: return true;
0
256 return false;
executed 342 times by 1 test: return false;
Executed by:
  • tst_ecmascripttests
342
257}-
258-
259void SimpleArrayData::setAttribute(Object *o, uint index, PropertyAttributes attrs)-
260{-
261 o->arrayData()->attrs[index] = attrs;-
262}
executed 866 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
866
263-
264void SimpleArrayData::push_front(Object *o, const Value *values, uint n)-
265{-
266 Heap::SimpleArrayData *dd = o->d()->arrayData.cast<Heap::SimpleArrayData>();-
267 Q_ASSERT(!dd->attrs);-
268 if (dd->values.size + n > dd->values.alloc) {
dd->values.siz...->values.allocDescription
TRUEevaluated 16 times by 3 tests
Evaluated by:
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qqmlecmascript
FALSEevaluated 20060 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
16-20060
269 realloc(o, Heap::ArrayData::Simple, dd->values.size + n, false);-
270 Q_ASSERT(o->d()->arrayData->type == Heap::ArrayData::Simple);-
271 dd = o->d()->arrayData.cast<Heap::SimpleArrayData>();-
272 }
executed 16 times by 3 tests: end of block
Executed by:
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qqmlecmascript
16
273 if (n <= dd->offset) {
n <= dd->offsetDescription
TRUEevaluated 20022 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 54 times by 4 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qqmlecmascript
54-20022
274 dd->offset -= n; // there is enough space left in front-
275 } else {
executed 20022 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
20022
276 // we need to wrap around, so:-
277 dd->offset = dd->values.alloc - // start at the back, but subtract:-
278 (n - dd->offset); // the number of items we can put in the free space at the start of the allocated array-
279 }
executed 54 times by 4 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qqmlecmascript
54
280 dd->values.size += n;-
281 for (uint i = 0; i < n; ++i)
i < nDescription
TRUEevaluated 20052 times by 4 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qqmlecmascript
FALSEevaluated 20076 times by 4 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qqmlecmascript
20052-20076
282 dd->setData(o->engine(), i, values[i]);
executed 20052 times by 4 tests: dd->setData(o->engine(), i, values[i]);
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qqmlecmascript
20052
283}
executed 20076 times by 4 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qqmlecmascript
20076
284-
285ReturnedValue SimpleArrayData::pop_front(Object *o)-
286{-
287 Heap::SimpleArrayData *dd = o->d()->arrayData.cast<Heap::SimpleArrayData>();-
288 Q_ASSERT(!dd->attrs);-
289 if (!dd->values.size)
!dd->values.sizeDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 122 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
8-122
290 return Encode::undefined();
executed 8 times by 1 test: return Encode::undefined();
Executed by:
  • tst_ecmascripttests
8
291-
292 ReturnedValue v = dd->data(0).isEmpty() ? Encode::undefined() : dd->data(0).asReturnedValue();
dd->data(0).isEmpty()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 114 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
8-114
293 dd->offset = (dd->offset + 1) % dd->values.alloc;-
294 --dd->values.size;-
295 return v;
executed 122 times by 2 tests: return v;
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
122
296}-
297-
298uint SimpleArrayData::truncate(Object *o, uint newLen)-
299{-
300 Heap::SimpleArrayData *dd = o->d()->arrayData.cast<Heap::SimpleArrayData>();-
301 if (dd->values.size < newLen)
dd->values.size < newLenDescription
TRUEnever evaluated
FALSEevaluated 485 times by 7 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
0-485
302 return newLen;
never executed: return newLen;
0
303-
304 if (!dd->attrs) {
!dd->attrsDescription
TRUEevaluated 417 times by 7 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
FALSEevaluated 68 times by 1 test
Evaluated by:
  • tst_ecmascripttests
68-417
305 dd->values.size = newLen;-
306 return newLen;
executed 417 times by 7 tests: return newLen;
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
417
307 }-
308-
309 while (dd->values.size > newLen) {
dd->values.size > newLenDescription
TRUEevaluated 92 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-92
310 if (!dd->data(dd->values.size - 1).isEmpty() && !dd->attrs[dd->values.size - 1].isConfigurable())
!dd->data(dd->...- 1).isEmpty()Description
TRUEevaluated 92 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
!dd->attrs[dd-...Configurable()Description
TRUEevaluated 64 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-92
311 return dd->values.size;
executed 64 times by 1 test: return dd->values.size;
Executed by:
  • tst_ecmascripttests
64
312 --dd->values.size;-
313 }
executed 28 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
28
314 return dd->values.size;
executed 4 times by 1 test: return dd->values.size;
Executed by:
  • tst_ecmascripttests
4
315}-
316-
317uint SimpleArrayData::length(const Heap::ArrayData *d)-
318{-
319 return d->values.size;
executed 270031 times by 17 tests: return d->values.size;
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlitemmodels
  • tst_qquickanimationcontroller
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickscreen
  • tst_quicktestmainwithsetup
  • tst_testfiltering
270031
320}-
321-
322bool SimpleArrayData::putArray(Object *o, uint index, const Value *values, uint n)-
323{-
324 Heap::SimpleArrayData *dd = o->d()->arrayData.cast<Heap::SimpleArrayData>();-
325 if (index + n > dd->values.alloc) {
index + n > dd->values.allocDescription
TRUEevaluated 5216 times by 8 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsonbinding
  • tst_qqmlecmascript
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpositioners
  • tst_qquickrepeater
FALSEevaluated 136023 times by 17 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qquickanimationcontroller
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickscreen
  • tst_quicktestmainwithsetup
  • tst_testfiltering
5216-136023
326 reallocate(o, index + n + 1, false);-
327 dd = o->d()->arrayData.cast<Heap::SimpleArrayData>();-
328 }
executed 5216 times by 8 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qjsonbinding
  • tst_qqmlecmascript
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpositioners
  • tst_qquickrepeater
5216
329 QV4::ExecutionEngine *e = o->engine();-
330 for (uint i = dd->values.size; i < index; ++i)
i < indexDescription
TRUEnever evaluated
FALSEevaluated 141239 times by 18 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qquickanimationcontroller
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickscreen
  • tst_quicktestmainwithsetup
  • tst_testfiltering
0-141239
331 dd->setData(e, i, Primitive::emptyValue());
never executed: dd->setData(e, i, Primitive::emptyValue());
0
332 for (uint i = 0; i < n; ++i)
i < nDescription
TRUEevaluated 133485 times by 17 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlitemmodels
  • tst_qquickanimationcontroller
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickscreen
  • tst_quicktestmainwithsetup
  • tst_testfiltering
FALSEevaluated 141266 times by 18 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qquickanimationcontroller
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickscreen
  • tst_quicktestmainwithsetup
  • tst_testfiltering
133485-141266
333 dd->setData(e, index + i, values[i]);
executed 133489 times by 17 tests: dd->setData(e, index + i, values[i]);
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlitemmodels
  • tst_qquickanimationcontroller
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickscreen
  • tst_quicktestmainwithsetup
  • tst_testfiltering
133489
334 dd->values.size = qMax(dd->values.size, index + n);-
335 return true;
executed 141253 times by 18 tests: return true;
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qquickanimationcontroller
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickscreen
  • tst_quicktestmainwithsetup
  • tst_testfiltering
141253
336}-
337-
338void SparseArrayData::free(Heap::ArrayData *d, uint idx)-
339{-
340 Q_ASSERT(d && d->type == Heap::ArrayData::Sparse);-
341 Value *v = d->values.values + idx;-
342 if (d->attrs && d->attrs[idx].isAccessor()) {
d->attrsDescription
TRUEevaluated 885 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
d->attrs[idx].isAccessor()Description
TRUEevaluated 188 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 700 times by 1 test
Evaluated by:
  • tst_ecmascripttests
8-885
343 // double slot, free both. Order is important, so we have a double slot for allocation again afterwards.-
344 v[1] = d->sparse->freeList;-
345 v[0] = Encode(idx + 1);-
346 } else {
executed 186 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
186
347 *v = d->sparse->freeList;-
348 }
executed 707 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
707
349 d->sparse->freeList = Encode(idx);-
350 if (d->attrs)
d->attrsDescription
TRUEevaluated 887 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
8-887
351 d->attrs[idx].clear();
executed 887 times by 1 test: d->attrs[idx].clear();
Executed by:
  • tst_ecmascripttests
887
352}
executed 895 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
895
353-
354Heap::ArrayData *SparseArrayData::reallocate(Object *o, uint n, bool enforceAttributes)-
355{-
356 realloc(o, Heap::ArrayData::Sparse, n, enforceAttributes);-
357 return o->arrayData();
executed 2629 times by 1 test: return o->arrayData();
Executed by:
  • tst_ecmascripttests
2629
358}-
359-
360// double slots are required for accessor properties-
361uint SparseArrayData::allocate(Object *o, bool doubleSlot)-
362{-
363 Q_ASSERT(o->d()->arrayData->type == Heap::ArrayData::Sparse);-
364 Heap::SimpleArrayData *dd = o->d()->arrayData.cast<Heap::SimpleArrayData>();-
365 if (doubleSlot) {
doubleSlotDescription
TRUEevaluated 3548 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 835 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
835-3548
366 Value *last = &dd->sparse->freeList;-
367 while (1) {-
368 if (last->int_32() == -1) {
last->int_32() == -1Description
TRUEevaluated 2579 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 1504 times by 1 test
Evaluated by:
  • tst_ecmascripttests
1504-2579
369 reallocate(o, dd->values.alloc + 2, true);-
370 dd = o->d()->arrayData.cast<Heap::SimpleArrayData>();-
371 last = &dd->sparse->freeList;-
372 Q_ASSERT(last->int_32() != -1);-
373 }
executed 2594 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
2594
374-
375 Q_ASSERT(dd->values[static_cast<uint>(last->int_32())].int_32() != last->int_32());-
376 if (dd->values[static_cast<uint>(last->int_32())].int_32() == last->int_32() + 1) {
dd->values[sta...->int_32() + 1Description
TRUEevaluated 3557 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 536 times by 1 test
Evaluated by:
  • tst_ecmascripttests
536-3557
377 // found two slots in a row-
378 uint idx = static_cast<uint>(last->int_32());-
379 *last = Encode(dd->values[static_cast<uint>(last->int_32()) + 1].int_32());-
380 dd->attrs[idx] = Attr_Accessor;-
381 return idx;
executed 3549 times by 1 test: return idx;
Executed by:
  • tst_ecmascripttests
3549
382 }-
383 last = &dd->values.values[last->int_32()];-
384 }
executed 536 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
536
385 } else {
never executed: end of block
0
386 if (dd->sparse->freeList.int_32() == -1) {
dd->sparse->fr...int_32() == -1Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 827 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
8-827
387 reallocate(o, dd->values.alloc + 1, false);-
388 dd = o->d()->arrayData.cast<Heap::SimpleArrayData>();-
389 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
8
390 Q_ASSERT(dd->sparse->freeList.int_32() != -1);-
391 uint idx = static_cast<uint>(dd->sparse->freeList.int_32());-
392 dd->sparse->freeList = dd->values[idx];-
393 Q_ASSERT(dd->sparse->freeList.isInteger());-
394 if (dd->attrs)
dd->attrsDescription
TRUEevaluated 604 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 232 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
232-604
395 dd->attrs[idx] = Attr_Data;
executed 604 times by 1 test: dd->attrs[idx] = Attr_Data;
Executed by:
  • tst_ecmascripttests
604
396 return idx;
executed 836 times by 2 tests: return idx;
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
836
397 }-
398}-
399-
400ReturnedValue SparseArrayData::get(const Heap::ArrayData *d, uint index)-
401{-
402 const Heap::SparseArrayData *s = static_cast<const Heap::SparseArrayData *>(d);-
403 index = s->mappedIndex(index);-
404 if (index == UINT_MAX)
index == (0x7f...fff * 2U + 1U)Description
TRUEevaluated 94 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 295 times by 1 test
Evaluated by:
  • tst_ecmascripttests
94-295
405 return Primitive::emptyValue().asReturnedValue();
executed 94 times by 1 test: return Primitive::emptyValue().asReturnedValue();
Executed by:
  • tst_ecmascripttests
94
406 return s->values[index].asReturnedValue();
executed 296 times by 1 test: return s->values[index].asReturnedValue();
Executed by:
  • tst_ecmascripttests
296
407}-
408-
409bool SparseArrayData::put(Object *o, uint index, const Value &value)-
410{-
411 if (value.isEmpty())
value.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 334 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-334
412 return true;
never executed: return true;
0
413-
414 Heap::SparseArrayData *s = o->d()->arrayData.cast<Heap::SparseArrayData>();-
415 SparseArrayNode *n = s->sparse->insert(index);-
416 Q_ASSERT(n->value == UINT_MAX || !s->attrs || !s->attrs[n->value].isAccessor());-
417 if (n->value == UINT_MAX)
n->value == (0...fff * 2U + 1U)Description
TRUEevaluated 334 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
0-334
418 n->value = allocate(o);
executed 334 times by 1 test: n->value = allocate(o);
Executed by:
  • tst_ecmascripttests
334
419 s = o->d()->arrayData.cast<Heap::SparseArrayData>();-
420 s->setArrayData(o->engine(), n->value, value);-
421 if (s->attrs)
s->attrsDescription
TRUEevaluated 334 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
0-334
422 s->attrs[n->value] = Attr_Data;
executed 334 times by 1 test: s->attrs[n->value] = Attr_Data;
Executed by:
  • tst_ecmascripttests
334
423 return true;
executed 334 times by 1 test: return true;
Executed by:
  • tst_ecmascripttests
334
424}-
425-
426bool SparseArrayData::del(Object *o, uint index)-
427{-
428 Heap::SparseArrayData *dd = o->d()->arrayData.cast<Heap::SparseArrayData>();-
429-
430 SparseArrayNode *n = dd->sparse->findNode(index);-
431 if (!n)
!nDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 764 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
4-764
432 return true;
executed 4 times by 1 test: return true;
Executed by:
  • tst_ecmascripttests
4
433-
434 uint pidx = n->value;-
435 Q_ASSERT(!dd->values[pidx].isEmpty());-
436-
437 bool isAccessor = false;-
438 if (dd->attrs) {
dd->attrsDescription
TRUEevaluated 759 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
4-759
439 if (!dd->attrs[pidx].isConfigurable())
!dd->attrs[pid...Configurable()Description
TRUEevaluated 362 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 400 times by 1 test
Evaluated by:
  • tst_ecmascripttests
362-400
440 return false;
executed 359 times by 1 test: return false;
Executed by:
  • tst_ecmascripttests
359
441-
442 isAccessor = dd->attrs[pidx].isAccessor();-
443 dd->attrs[pidx] = Attr_Data;-
444 }
executed 403 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
403
445-
446 if (isAccessor) {
isAccessorDescription
TRUEevaluated 253 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 154 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
154-253
447 // free up both indices-
448 dd->values.values[pidx + 1] = dd->sparse->freeList;-
449 dd->values.values[pidx] = Encode(pidx + 1);-
450 } else {
executed 252 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
252
451 Q_ASSERT(dd->type == Heap::ArrayData::Sparse);-
452 dd->values.values[pidx] = dd->sparse->freeList;-
453 }
executed 154 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
154
454-
455 dd->sparse->freeList = Encode(pidx);-
456 dd->sparse->erase(n);-
457 return true;
executed 405 times by 2 tests: return true;
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
405
458}-
459-
460void SparseArrayData::setAttribute(Object *o, uint index, PropertyAttributes attrs)-
461{-
462 Heap::SparseArrayData *d = o->d()->arrayData.cast<Heap::SparseArrayData>();-
463 SparseArrayNode *n = d->sparse->insert(index);-
464 if (n->value == UINT_MAX) {
n->value == (0...fff * 2U + 1U)Description
TRUEevaluated 3034 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 2037 times by 1 test
Evaluated by:
  • tst_ecmascripttests
2037-3034
465 n->value = allocate(o, attrs.isAccessor());-
466 d = o->d()->arrayData.cast<Heap::SparseArrayData>();-
467 }
executed 3038 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
3038
468 else if (attrs.isAccessor() != d->attrs[n->value].isAccessor()) {
attrs.isAccess...].isAccessor()Description
TRUEevaluated 699 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 1332 times by 1 test
Evaluated by:
  • tst_ecmascripttests
699-1332
469 // need to convert the slot-
470 free(o->arrayData(), n->value);-
471 n->value = allocate(o, attrs.isAccessor());-
472 d = o->d()->arrayData.cast<Heap::SparseArrayData>();-
473 }
executed 700 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
700
474 d->attrs[n->value] = attrs;-
475}
executed 5071 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
5071
476-
477void SparseArrayData::push_front(Object *o, const Value *values, uint n)-
478{-
479 Heap::SparseArrayData *d = o->d()->arrayData.cast<Heap::SparseArrayData>();-
480 Q_ASSERT(!d->attrs);-
481 for (int i = static_cast<int>(n) - 1; i >= 0; --i) {
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
482 uint idx = allocate(o);-
483 d = o->d()->arrayData.cast<Heap::SparseArrayData>();-
484 d->setArrayData(o->engine(), idx, values[i]);-
485 d->sparse->push_front(idx);-
486 }
never executed: end of block
0
487}
never executed: end of block
0
488-
489ReturnedValue SparseArrayData::pop_front(Object *o)-
490{-
491 Heap::SparseArrayData *d = o->d()->arrayData.cast<Heap::SparseArrayData>();-
492 Q_ASSERT(!d->attrs);-
493 uint idx = d->sparse->pop_front();-
494 ReturnedValue v;-
495 if (idx != UINT_MAX) {
idx != (0x7fffffff * 2U + 1U)Description
TRUEnever evaluated
FALSEnever evaluated
0
496 v = d->values[idx].asReturnedValue();-
497 free(o->arrayData(), idx);-
498 } else {
never executed: end of block
0
499 v = Encode::undefined();-
500 }
never executed: end of block
0
501 return v;
never executed: return v;
0
502}-
503-
504uint SparseArrayData::truncate(Object *o, uint newLen)-
505{-
506 Heap::SparseArrayData *d = o->d()->arrayData.cast<Heap::SparseArrayData>();-
507 SparseArrayNode *begin = d->sparse->lowerBound(newLen);-
508 if (begin != d->sparse->end()) {
begin != d->sparse->end()Description
TRUEevaluated 158 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
0-158
509 SparseArrayNode *it = d->sparse->end()->previousNode();-
510 while (1) {-
511 if (d->attrs) {
d->attrsDescription
TRUEevaluated 232 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
8-232
512 if (!d->attrs[it->value].isConfigurable()) {
!d->attrs[it->...Configurable()Description
TRUEevaluated 46 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 186 times by 1 test
Evaluated by:
  • tst_ecmascripttests
46-186
513 newLen = it->key() + 1;-
514 break;
executed 46 times by 1 test: break;
Executed by:
  • tst_ecmascripttests
46
515 }-
516 }
executed 186 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
186
517 free(o->arrayData(), it->value);-
518 bool brk = (it == begin);-
519 SparseArrayNode *prev = it->previousNode();-
520 d->sparse->erase(it);-
521 if (brk)
brkDescription
TRUEevaluated 112 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 82 times by 1 test
Evaluated by:
  • tst_ecmascripttests
82-112
522 break;
executed 112 times by 1 test: break;
Executed by:
  • tst_ecmascripttests
112
523 it = prev;-
524 }
executed 82 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
82
525 }
executed 158 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
158
526 return newLen;
executed 158 times by 1 test: return newLen;
Executed by:
  • tst_ecmascripttests
158
527}-
528-
529uint SparseArrayData::length(const Heap::ArrayData *d)-
530{-
531 const Heap::SparseArrayData *dd = static_cast<const Heap::SparseArrayData *>(d);-
532 if (!dd->sparse)
!dd->sparseDescription
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-10
533 return 0;
never executed: return 0;
0
534 SparseArrayNode *n = dd->sparse->end();-
535 n = n->previousNode();-
536 return n ? n->key() + 1 : 0;
executed 10 times by 1 test: return n ? n->key() + 1 : 0;
Executed by:
  • tst_ecmascripttests
10
537}-
538-
539bool SparseArrayData::putArray(Object *o, uint index, const Value *values, uint n)-
540{-
541 for (uint i = 0; i < n; ++i)
i < nDescription
TRUEevaluated 334 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 450 times by 1 test
Evaluated by:
  • tst_ecmascripttests
334-450
542 put(o, index + i, values[i]);
executed 334 times by 1 test: put(o, index + i, values[i]);
Executed by:
  • tst_ecmascripttests
334
543 return true;
executed 450 times by 1 test: return true;
Executed by:
  • tst_ecmascripttests
450
544}-
545-
546-
547uint ArrayData::append(Object *obj, ArrayObject *otherObj, uint n)-
548{-
549 Q_ASSERT(!obj->d()->arrayData || !obj->d()->arrayData->attrs);-
550-
551 if (!n)
!nDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 58 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
8-58
552 return obj->getLength();
executed 8 times by 1 test: return obj->getLength();
Executed by:
  • tst_ecmascripttests
8
553-
554 Scope scope(obj->engine());-
555 Scoped<ArrayData> other(scope, otherObj->arrayData());-
556-
557 if (other && other->isSparse())
other->isSparse()Description
TRUEnever evaluated
FALSEevaluated 58 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
0-58
558 obj->initSparseArray();
never executed: obj->initSparseArray();
0
559 else-
560 obj->arrayCreate();
executed 58 times by 2 tests: obj->arrayCreate();
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
58
561-
562 uint oldSize = obj->getLength();-
563-
564 if (!other || ArgumentsObject::isNonStrictArgumentsObject(otherObj)) {
!otherDescription
TRUEnever evaluated
FALSEevaluated 58 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
ArgumentsObjec...ject(otherObj)Description
TRUEnever evaluated
FALSEevaluated 58 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
0-58
565 ScopedValue v(scope);-
566 for (uint i = 0; i < n; ++i)
i < nDescription
TRUEnever evaluated
FALSEnever evaluated
0
567 obj->arraySet(oldSize + i, (v = otherObj->get(i)));
never executed: obj->arraySet(oldSize + i, (v = otherObj->get(i)));
0
568 } else if (other && other->isSparse()) {
never executed: end of block
other->isSparse()Description
TRUEnever evaluated
FALSEevaluated 58 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
0-58
569 Heap::SparseArrayData *os = static_cast<Heap::SparseArrayData *>(other->d());-
570 if (other->hasAttributes()) {
other->hasAttributes()Description
TRUEnever evaluated
FALSEnever evaluated
0
571 ScopedValue v(scope);-
572 for (const SparseArrayNode *it = os->sparse->begin();-
573 it != os->sparse->end(); it = it->nextNode()) {
it != os->sparse->end()Description
TRUEnever evaluated
FALSEnever evaluated
0
574 v = otherObj->getValue(os->values[it->value], other->d()->attrs[it->value]);-
575 obj->arraySet(oldSize + it->key(), v);-
576 }
never executed: end of block
0
577 } else {
never executed: end of block
0
578 for (const SparseArrayNode *it = other->d()->sparse->begin();-
579 it != os->sparse->end(); it = it->nextNode())
it != os->sparse->end()Description
TRUEnever evaluated
FALSEnever evaluated
0
580 obj->arraySet(oldSize + it->key(), os->values[it->value]);
never executed: obj->arraySet(oldSize + it->key(), os->values[it->value]);
0
581 }
never executed: end of block
0
582 } else {-
583 Heap::SimpleArrayData *os = static_cast<Heap::SimpleArrayData *>(other->d());-
584 uint toCopy = n;-
585 uint chunk = toCopy;-
586 if (chunk > os->values.alloc - os->offset)
chunk > os->va...c - os->offsetDescription
TRUEnever evaluated
FALSEevaluated 58 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
0-58
587 chunk = os->values.alloc - os->offset;
never executed: chunk = os->values.alloc - os->offset;
0
588 obj->arrayPut(oldSize, os->values.data() + os->offset, chunk);-
589 toCopy -= chunk;-
590 if (toCopy)
toCopyDescription
TRUEnever evaluated
FALSEevaluated 58 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
0-58
591 obj->arrayPut(oldSize + chunk, os->values.data(), toCopy);
never executed: obj->arrayPut(oldSize + chunk, os->values.data(), toCopy);
0
592 }
executed 58 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
58
593-
594 return oldSize + n;
executed 58 times by 2 tests: return oldSize + n;
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
58
595}-
596-
597void ArrayData::insert(Object *o, uint index, const Value *v, bool isAccessor)-
598{-
599 if (!isAccessor && o->d()->arrayData->type != Heap::ArrayData::Sparse) {
!isAccessorDescription
TRUEevaluated 49578 times by 31 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmllistmodelworkerscript
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickcustomaffector
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpathview
  • ...
FALSEevaluated 2988 times by 1 test
Evaluated by:
  • tst_ecmascripttests
o->d()->arrayD...ayData::SparseDescription
TRUEevaluated 49280 times by 31 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmllistmodelworkerscript
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickcustomaffector
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpathview
  • ...
FALSEevaluated 348 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
348-49578
600 Heap::SimpleArrayData *d = o->d()->arrayData.cast<Heap::SimpleArrayData>();-
601 if (index < 0x1000 || index < d->values.size + (d->values.size >> 2)) {
index < 0x1000Description
TRUEevaluated 49283 times by 31 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmllistmodelworkerscript
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickcustomaffector
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpathview
  • ...
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
index < d->val...ues.size >> 2)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-49283
602 if (index >= d->values.alloc) {
index >= d->values.allocDescription
TRUEevaluated 794 times by 7 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickgridview
  • tst_qv4debugger
FALSEevaluated 48445 times by 31 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmllistmodelworkerscript
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickcustomaffector
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpathview
  • ...
794-48445
603 o->arrayReserve(index + 1);-
604 d = o->d()->arrayData.cast<Heap::SimpleArrayData>();-
605 }
executed 790 times by 7 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickgridview
  • tst_qv4debugger
790
606 if (index >= d->values.size) {
index >= d->values.sizeDescription
TRUEevaluated 49088 times by 31 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmllistmodelworkerscript
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickcustomaffector
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpathview
  • ...
FALSEevaluated 148 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
148-49088
607 // mark possible hole in the array-
608 for (uint i = d->values.size; i < index; ++i)
i < indexDescription
TRUEevaluated 68222 times by 6 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickgridview
FALSEevaluated 49132 times by 31 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmllistmodelworkerscript
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickcustomaffector
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpathview
  • ...
49132-68222
609 d->setData(o->engine(), i, Primitive::emptyValue());
executed 68216 times by 6 tests: d->setData(o->engine(), i, Primitive::emptyValue());
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlxmlhttprequest
  • tst_qquickgridview
68216
610 d->values.size = index + 1;-
611 }
executed 49106 times by 31 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmllistmodelworkerscript
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickcustomaffector
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpathview
  • ...
49106
612 d->setData(o->engine(), index, *v);-
613 return;
executed 49260 times by 31 tests: return;
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmllistmodelworkerscript
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickcustomaffector
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpathview
  • ...
49260
614 }-
615 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
8
616-
617 o->initSparseArray();-
618 Heap::SparseArrayData *s = o->d()->arrayData.cast<Heap::SparseArrayData>();-
619 SparseArrayNode *n = s->sparse->insert(index);-
620 if (n->value == UINT_MAX)
n->value == (0...fff * 2U + 1U)Description
TRUEevaluated 308 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 3047 times by 1 test
Evaluated by:
  • tst_ecmascripttests
308-3047
621 n->value = SparseArrayData::allocate(o, isAccessor);
executed 308 times by 2 tests: n->value = SparseArrayData::allocate(o, isAccessor);
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
308
622 s = o->d()->arrayData.cast<Heap::SparseArrayData>();-
623 s->setArrayData(o->engine(), n->value, *v);-
624 if (isAccessor)
isAccessorDescription
TRUEevaluated 3003 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 356 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
356-3003
625 s->setArrayData(o->engine(), n->value + Object::SetterOffset, v[Object::SetterOffset]);
executed 2992 times by 1 test: s->setArrayData(o->engine(), n->value + Object::SetterOffset, v[Object::SetterOffset]);
Executed by:
  • tst_ecmascripttests
2992
626}
executed 3347 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
3347
627-
628-
629class ArrayElementLessThan-
630{-
631public:-
632 inline ArrayElementLessThan(ExecutionEngine *engine, const Value &comparefn)-
633 : m_engine(engine), m_comparefn(comparefn) {}
executed 176 times by 6 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_testfiltering
176
634-
635 bool operator()(Value v1, Value v2) const;-
636-
637private:-
638 ExecutionEngine *m_engine;-
639 const Value &m_comparefn;-
640};-
641-
642-
643bool ArrayElementLessThan::operator()(Value v1, Value v2) const-
644{-
645 Scope scope(m_engine);-
646-
647 if (v1.isUndefined() || v1.isEmpty())
v1.isUndefined()Description
TRUEevaluated 64 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 9020 times by 5 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
  • tst_testfiltering
v1.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 9020 times by 5 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
  • tst_testfiltering
0-9020
648 return false;
executed 64 times by 1 test: return false;
Executed by:
  • tst_ecmascripttests
64
649 if (v2.isUndefined() || v2.isEmpty())
v2.isUndefined()Description
TRUEevaluated 48 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 8972 times by 5 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
  • tst_testfiltering
v2.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 8972 times by 5 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
  • tst_testfiltering
0-8972
650 return true;
executed 48 times by 1 test: return true;
Executed by:
  • tst_ecmascripttests
48
651 ScopedFunctionObject o(scope, m_comparefn);-
652 if (o) {
oDescription
TRUEevaluated 5724 times by 3 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
FALSEevaluated 3248 times by 4 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
  • tst_qquicklayouts
  • tst_testfiltering
3248-5724
653 Scope scope(o->engine());-
654 ScopedValue result(scope);-
655 JSCallData jsCallData(scope, 2);-
656 jsCallData->args[0] = v1;-
657 jsCallData->args[1] = v2;-
658 result = o->call(jsCallData);-
659-
660 return result->toNumber() < 0;
executed 5724 times by 3 tests: return result->toNumber() < 0;
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
5724
661 }-
662 ScopedString p1s(scope, v1.toString(scope.engine));-
663 ScopedString p2s(scope, v2.toString(scope.engine));-
664 return p1s->toQString() < p2s->toQString();
executed 3248 times by 4 tests: return p1s->toQString() < p2s->toQString();
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
  • tst_qquicklayouts
  • tst_testfiltering
3248
665}-
666-
667template <typename RandomAccessIterator, typename T, typename LessThan>-
668void sortHelper(RandomAccessIterator start, RandomAccessIterator end, const T &t, LessThan lessThan)-
669{-
670top:-
671 int span = int(end - start);-
672 if (span < 2)
span < 2Description
TRUEevaluated 254 times by 5 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
FALSEevaluated 990 times by 5 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
  • tst_testfiltering
254-990
673 return;
executed 254 times by 5 tests: return;
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
254
674-
675 --end;-
676 RandomAccessIterator low = start, high = end - 1;-
677 RandomAccessIterator pivot = start + span / 2;-
678-
679 if (lessThan(*end, *start))
lessThan(*end, *start)Description
TRUEevaluated 424 times by 5 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
  • tst_testfiltering
FALSEevaluated 566 times by 3 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
  • tst_qquicklayouts
424-566
680 qSwap(*end, *start);
executed 424 times by 5 tests: qSwap(*end, *start);
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
  • tst_testfiltering
424
681 if (span == 2)
span == 2Description
TRUEevaluated 274 times by 3 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
  • tst_qquicklayouts
FALSEevaluated 716 times by 5 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
  • tst_testfiltering
274-716
682 return;
executed 274 times by 3 tests: return;
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
  • tst_qquicklayouts
274
683-
684 if (lessThan(*pivot, *start))
lessThan(*pivot, *start)Description
TRUEevaluated 254 times by 5 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
  • tst_testfiltering
FALSEevaluated 462 times by 3 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
  • tst_qquicklayouts
254-462
685 qSwap(*pivot, *start);
executed 254 times by 5 tests: qSwap(*pivot, *start);
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
  • tst_testfiltering
254
686 if (lessThan(*end, *pivot))
lessThan(*end, *pivot)Description
TRUEevaluated 196 times by 4 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
FALSEevaluated 520 times by 4 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
  • tst_qquicklayouts
  • tst_testfiltering
196-520
687 qSwap(*end, *pivot);
executed 196 times by 4 tests: qSwap(*end, *pivot);
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
196
688 if (span == 3)
span == 3Description
TRUEevaluated 182 times by 5 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
  • tst_testfiltering
FALSEevaluated 534 times by 4 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
182-534
689 return;
executed 182 times by 5 tests: return;
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
  • tst_testfiltering
182
690-
691 qSwap(*pivot, *end);-
692-
693 while (low < high) {
low < highDescription
TRUEevaluated 1072 times by 4 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
FALSEevaluated 146 times by 3 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
  • tst_qquicklayouts
146-1072
694 while (low < high && lessThan(*low, *end))
low < highDescription
TRUEevaluated 4636 times by 4 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
FALSEevaluated 154 times by 4 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
lessThan(*low, *end)Description
TRUEevaluated 3718 times by 4 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
FALSEevaluated 918 times by 3 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
  • tst_qquicklayouts
154-4636
695 ++low;
executed 3718 times by 4 tests: ++low;
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
3718
696-
697 while (high > low && lessThan(*end, *high))
high > lowDescription
TRUEevaluated 1492 times by 3 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
  • tst_qquicklayouts
FALSEevaluated 388 times by 4 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
lessThan(*end, *high)Description
TRUEevaluated 808 times by 3 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
  • tst_qquicklayouts
FALSEevaluated 684 times by 3 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
  • tst_qquicklayouts
388-1492
698 --high;
executed 808 times by 3 tests: --high;
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
  • tst_qquicklayouts
808
699-
700 if (low < high) {
low < highDescription
TRUEevaluated 684 times by 3 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
  • tst_qquicklayouts
FALSEevaluated 388 times by 4 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
388-684
701 qSwap(*low, *high);-
702 ++low;-
703 --high;-
704 } else {
executed 684 times by 3 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
  • tst_qquicklayouts
684
705 break;
executed 388 times by 4 tests: break;
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
388
706 }-
707 }-
708-
709 if (lessThan(*low, *end))
lessThan(*low, *end)Description
TRUEevaluated 114 times by 2 tests
Evaluated by:
  • tst_qjsengine
  • tst_qqmlecmascript
FALSEevaluated 420 times by 3 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
  • tst_qquicklayouts
114-420
710 ++low;
executed 114 times by 2 tests: ++low;
Executed by:
  • tst_qjsengine
  • tst_qqmlecmascript
114
711-
712 qSwap(*end, *low);-
713 sortHelper(start, low, t, lessThan);-
714-
715 start = low + 1;-
716 ++end;-
717 goto top;
executed 534 times by 4 tests: goto top;
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquicklayouts
534
718}-
719-
720-
721void ArrayData::sort(ExecutionEngine *engine, Object *thisObject, const Value &comparefn, uint len)-
722{-
723 if (!len)
!lenDescription
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_quicktestmainwithsetup
FALSEevaluated 184 times by 6 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_testfiltering
10-184
724 return;
executed 10 times by 2 tests: return;
Executed by:
  • tst_ecmascripttests
  • tst_quicktestmainwithsetup
10
725-
726 Scope scope(engine);-
727 Scoped<ArrayData> arrayData(scope, thisObject->arrayData());-
728-
729 if (!arrayData || !arrayData->length())
!arrayDataDescription
TRUEnever evaluated
FALSEevaluated 184 times by 6 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_testfiltering
!arrayData->length()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 180 times by 6 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_testfiltering
0-184
730 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_ecmascripttests
4
731-
732 if (!comparefn.isUndefined() && !comparefn.isFunctionObject()) {
!comparefn.isUndefined()Description
TRUEevaluated 68 times by 3 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
FALSEevaluated 112 times by 5 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_testfiltering
!comparefn.isFunctionObject()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 64 times by 3 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
4-112
733 engine->throwTypeError();-
734 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_ecmascripttests
4
735 }-
736-
737 // The spec says the sorting goes through a series of get,put and delete operations.-
738 // this implies that the attributes don't get sorted around.-
739-
740 if (arrayData->type() == Heap::ArrayData::Sparse) {
arrayData->typ...ayData::SparseDescription
TRUEnever evaluated
FALSEevaluated 176 times by 6 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_testfiltering
0-176
741 // since we sort anyway, we can simply iterate over the entries in the sparse-
742 // array and append them one by one to a regular one.-
743 Scoped<SparseArrayData> sparse(scope, static_cast<Heap::SparseArrayData *>(arrayData->d()));-
744-
745 if (!sparse->sparse()->nEntries())
!sparse->sparse()->nEntries()Description
TRUEnever evaluated
FALSEnever evaluated
0
746 return;
never executed: return;
0
747-
748 thisObject->setArrayData(nullptr);-
749 ArrayData::realloc(thisObject, Heap::ArrayData::Simple, sparse->sparse()->nEntries(), sparse->attrs() ? true : false);-
750 Heap::SimpleArrayData *d = thisObject->d()->arrayData.cast<Heap::SimpleArrayData>();-
751-
752 SparseArrayNode *n = sparse->sparse()->begin();-
753 uint i = 0;-
754 if (sparse->attrs()) {
sparse->attrs()Description
TRUEnever evaluated
FALSEnever evaluated
0
755 while (n != sparse->sparse()->end()) {
n != sparse->sparse()->end()Description
TRUEnever evaluated
FALSEnever evaluated
0
756 if (n->value >= len)
n->value >= lenDescription
TRUEnever evaluated
FALSEnever evaluated
0
757 break;
never executed: break;
0
758-
759 PropertyAttributes a = sparse->attrs() ? sparse->attrs()[n->value] : Attr_Data;
sparse->attrs()Description
TRUEnever evaluated
FALSEnever evaluated
0
760 d->setData(engine, i, Value::fromReturnedValue(thisObject->getValue(sparse->arrayData()[n->value], a)));-
761 d->attrs[i] = a.isAccessor() ? Attr_Data : a;
a.isAccessor()Description
TRUEnever evaluated
FALSEnever evaluated
0
762-
763 n = n->nextNode();-
764 ++i;-
765 }
never executed: end of block
0
766 } else {
never executed: end of block
0
767 while (n != sparse->sparse()->end()) {
n != sparse->sparse()->end()Description
TRUEnever evaluated
FALSEnever evaluated
0
768 if (n->value >= len)
n->value >= lenDescription
TRUEnever evaluated
FALSEnever evaluated
0
769 break;
never executed: break;
0
770 d->setData(engine, i, sparse->arrayData()[n->value]);-
771 n = n->nextNode();-
772 ++i;-
773 }
never executed: end of block
0
774 }
never executed: end of block
0
775 d->values.size = i;-
776 if (len > i)
len > iDescription
TRUEnever evaluated
FALSEnever evaluated
0
777 len = i;
never executed: len = i;
0
778 if (n != sparse->sparse()->end()) {
n != sparse->sparse()->end()Description
TRUEnever evaluated
FALSEnever evaluated
0
779 // have some entries outside the sort range that we need to ignore when sorting-
780 thisObject->initSparseArray();-
781 while (n != sparse->sparse()->end()) {
n != sparse->sparse()->end()Description
TRUEnever evaluated
FALSEnever evaluated
0
782 PropertyAttributes a = sparse->attrs() ? sparse->attrs()[n->value] : Attr_Data;
sparse->attrs()Description
TRUEnever evaluated
FALSEnever evaluated
0
783 thisObject->arraySet(n->value, reinterpret_cast<const Property *>(sparse->arrayData() + n->value), a);-
784-
785 n = n->nextNode();-
786 }
never executed: end of block
0
787-
788 }
never executed: end of block
0
789 } else {
never executed: end of block
0
790 Heap::SimpleArrayData *d = thisObject->d()->arrayData.cast<Heap::SimpleArrayData>();-
791 if (len > d->values.size)
len > d->values.sizeDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 168 times by 6 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_testfiltering
8-168
792 len = d->values.size;
executed 8 times by 1 test: len = d->values.size;
Executed by:
  • tst_ecmascripttests
8
793-
794 // sort empty values to the end-
795 for (uint i = 0; i < len; i++) {
i < lenDescription
TRUEevaluated 1784 times by 6 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_testfiltering
FALSEevaluated 176 times by 6 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_testfiltering
176-1784
796 if (d->data(i).isEmpty()) {
d->data(i).isEmpty()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 1772 times by 6 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_testfiltering
12-1772
797 while (--len > i)
--len > iDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
0-12
798 if (!d->data(len).isEmpty())
!d->data(len).isEmpty()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
0-12
799 break;
executed 12 times by 1 test: break;
Executed by:
  • tst_ecmascripttests
12
800 Q_ASSERT(!d->attrs || !d->attrs[len].isAccessor());-
801 d->setData(engine, i, d->data(len));-
802 d->setData(engine, len, Primitive::emptyValue());-
803 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
12
804 }
executed 1784 times by 6 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_testfiltering
1784
805-
806 if (!len)
!lenDescription
TRUEnever evaluated
FALSEevaluated 176 times by 6 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_testfiltering
0-176
807 return;
never executed: return;
0
808 }
executed 176 times by 6 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_testfiltering
176
809-
810-
811 ArrayElementLessThan lessThan(engine, static_cast<const FunctionObject &>(comparefn));-
812-
813 Value *begin = thisObject->arrayData()->values.values;-
814 sortHelper(begin, begin + len, *begin, lessThan);-
815-
816#ifdef CHECK_SPARSE_ARRAYS-
817 thisObject->initSparseArray();-
818#endif-
819-
820}
executed 176 times by 6 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_testfiltering
176
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0