OpenCoverage

qv4sparsearray.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4sparsearray.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8using namespace QV4;-
9-
10const SparseArrayNode *SparseArrayNode::nextNode() const-
11{-
12 const SparseArrayNode *n = this;-
13 if (n->right
n->rightDescription
TRUEevaluated 293 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 1253 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
) {
293-1253
14 n = n->right;-
15 while (n->left
n->leftDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 294 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
)
4-294
16 n = n->left;
executed 4 times by 1 test: n = n->left;
Executed by:
  • tst_ecmascripttests
4
17 }
executed 293 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
else {
293
18 const SparseArrayNode *y = n->parent();-
19 while (y
yDescription
TRUEevaluated 1747 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEnever evaluated
&& n == y->right
n == y->rightDescription
TRUEevaluated 494 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 1255 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
) {
0-1747
20 n = y;-
21 y = n->parent();-
22 }
executed 494 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
494
23 n = y;-
24 }
executed 1254 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
1254
25 return
executed 1548 times by 2 tests: return n;
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
n;
executed 1548 times by 2 tests: return n;
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
1548
26}-
27-
28const SparseArrayNode *SparseArrayNode::previousNode() const-
29{-
30 const SparseArrayNode *n = this;-
31 if (n->left
n->leftDescription
TRUEevaluated 182 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 180 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
180-182
32 n = n->left;-
33 while (n->right
n->rightDescription
TRUEevaluated 256 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 182 times by 1 test
Evaluated by:
  • tst_ecmascripttests
)
182-256
34 n = n->right;
executed 256 times by 1 test: n = n->right;
Executed by:
  • tst_ecmascripttests
256
35 }
executed 182 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
else {
182
36 const SparseArrayNode *y = n->parent();-
37 while (y
yDescription
TRUEevaluated 178 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_ecmascripttests
&& n == y->left
n == y->leftDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 174 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
4-178
38 n = y;-
39 y = n->parent();-
40 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
4
41 n = y;-
42 }
executed 180 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
180
43 return
executed 362 times by 1 test: return n;
Executed by:
  • tst_ecmascripttests
n;
executed 362 times by 1 test: return n;
Executed by:
  • tst_ecmascripttests
362
44}-
45-
46SparseArrayNode *SparseArrayNode::copy(SparseArray *d) const-
47{-
48 SparseArrayNode *n = d->createNode(size_left, nullptr, false);-
49 n->value = value;-
50 n->setColor(color());-
51 if (left
leftDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
52 n->left = left->copy(d);-
53 n->left->setParent(n);-
54 }
never executed: end of block
else {
0
55 n->left = nullptr;-
56 }
never executed: end of block
0
57 if (right
rightDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
58 n->right = right->copy(d);-
59 n->right->setParent(n);-
60 }
never executed: end of block
else {
0
61 n->right = nullptr;-
62 }
never executed: end of block
0
63 return
never executed: return n;
n;
never executed: return n;
0
64}-
65void SparseArray::rotateLeft(SparseArrayNode *x)-
66{-
67 SparseArrayNode *&root = header.left;-
68 SparseArrayNode *y = x->right;-
69 x->right = y->left;-
70 if (y->left != nullptr
y->left != nullptrDescription
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 1081 times by 1 test
Evaluated by:
  • tst_ecmascripttests
)
36-1081
71 y->left->setParent(x);
executed 36 times by 1 test: y->left->setParent(x);
Executed by:
  • tst_ecmascripttests
36
72 y->setParent(x->parent());-
73 if (x == root
x == rootDescription
TRUEevaluated 942 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 177 times by 1 test
Evaluated by:
  • tst_ecmascripttests
)
177-942
74 root = y;
executed 939 times by 1 test: root = y;
Executed by:
  • tst_ecmascripttests
939
75 else if (x == x->parent()->left
x == x->parent()->leftDescription
TRUEevaluated 23 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 154 times by 1 test
Evaluated by:
  • tst_ecmascripttests
)
23-154
76 x->parent()->left = y;
executed 23 times by 1 test: x->parent()->left = y;
Executed by:
  • tst_ecmascripttests
23
77 else-
78 x->parent()->right = y;
executed 154 times by 1 test: x->parent()->right = y;
Executed by:
  • tst_ecmascripttests
154
79 y->left = x;-
80 x->setParent(y);-
81 y->size_left += x->size_left;-
82}
executed 1119 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
1119
83void SparseArray::rotateRight(SparseArrayNode *x)-
84{-
85 SparseArrayNode *&root = header.left;-
86 SparseArrayNode *y = x->left;-
87 x->left = y->right;-
88 if (y->right != nullptr
y->right != nullptrDescription
TRUEnever evaluated
FALSEevaluated 179 times by 1 test
Evaluated by:
  • tst_ecmascripttests
)
0-179
89 y->right->setParent(x);
never executed: y->right->setParent(x);
0
90 y->setParent(x->parent());-
91 if (x == root
x == rootDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 160 times by 1 test
Evaluated by:
  • tst_ecmascripttests
)
20-160
92 root = y;
executed 20 times by 1 test: root = y;
Executed by:
  • tst_ecmascripttests
20
93 else if (x == x->parent()->right
x == x->parent()->rightDescription
TRUEevaluated 160 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
)
0-160
94 x->parent()->right = y;
executed 160 times by 1 test: x->parent()->right = y;
Executed by:
  • tst_ecmascripttests
160
95 else-
96 x->parent()->left = y;
never executed: x->parent()->left = y;
0
97 y->right = x;-
98 x->setParent(y);-
99 x->size_left -= y->size_left;-
100}
executed 180 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
180
101-
102-
103void SparseArray::rebalance(SparseArrayNode *x)-
104{-
105 SparseArrayNode *&root = header.left;-
106 x->setColor(SparseArrayNode::Red);-
107 while (x != root
x != rootDescription
TRUEevaluated 4389 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 3369 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
&& x->parent()->color() == SparseArrayNode::Red
x->parent()->c...ArrayNode::RedDescription
TRUEevaluated 1518 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 2878 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
) {
1518-4389
108 if (x->parent() == x->parent()->parent()->left
x->parent() ==...parent()->leftDescription
TRUEevaluated 50 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 1468 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
50-1468
109 SparseArrayNode *y = x->parent()->parent()->right;-
110 if (y
yDescription
TRUEevaluated 26 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_ecmascripttests
&& y->color() == SparseArrayNode::Red
y->color() == ...ArrayNode::RedDescription
TRUEevaluated 26 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEnever evaluated
) {
0-26
111 x->parent()->setColor(SparseArrayNode::Black);-
112 y->setColor(SparseArrayNode::Black);-
113 x->parent()->parent()->setColor(SparseArrayNode::Red);-
114 x = x->parent()->parent();-
115 }
executed 26 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
else {
26
116 if (x == x->parent()->right
x == x->parent()->rightDescription
TRUEevaluated 15 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
8-15
117 x = x->parent();-
118 rotateLeft(x);-
119 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
14
120 x->parent()->setColor(SparseArrayNode::Black);-
121 x->parent()->parent()->setColor(SparseArrayNode::Red);-
122 rotateRight (x->parent()->parent());-
123 }
executed 24 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
24
124 } else {-
125 SparseArrayNode *y = x->parent()->parent()->left;-
126 if (y
yDescription
TRUEevaluated 406 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 1059 times by 1 test
Evaluated by:
  • tst_ecmascripttests
&& y->color() == SparseArrayNode::Red
y->color() == ...ArrayNode::RedDescription
TRUEevaluated 370 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
36-1059
127 x->parent()->setColor(SparseArrayNode::Black);-
128 y->setColor(SparseArrayNode::Black);-
129 x->parent()->parent()->setColor(SparseArrayNode::Red);-
130 x = x->parent()->parent();-
131 }
executed 370 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
else {
370
132 if (x == x->parent()->left
x == x->parent()->leftDescription
TRUEevaluated 156 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 939 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
156-939
133 x = x->parent();-
134 rotateRight(x);-
135 }
executed 156 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
156
136 x->parent()->setColor(SparseArrayNode::Black);-
137 x->parent()->parent()->setColor(SparseArrayNode::Red);-
138 rotateLeft(x->parent()->parent());-
139 }
executed 1096 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
1096
140 }-
141 }-
142 root->setColor(SparseArrayNode::Black);-
143}
executed 6260 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
6260
144-
145void SparseArray::deleteNode(SparseArrayNode *z)-
146{-
147 SparseArrayNode *&root = header.left;-
148 SparseArrayNode *y = z;-
149 SparseArrayNode *x;-
150 SparseArrayNode *x_parent;-
151 if (y->left == nullptr
y->left == nullptrDescription
TRUEevaluated 447 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 152 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
) {
152-447
152 x = y->right;-
153 if (y == mostLeftNode
y == mostLeftNodeDescription
TRUEevaluated 231 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 216 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
216-231
154 if (x
xDescription
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 221 times by 1 test
Evaluated by:
  • tst_ecmascripttests
)
10-221
155 mostLeftNode = x;
executed 10 times by 2 tests: mostLeftNode = x;
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
10
156 else-
157 mostLeftNode = y->parent();
executed 221 times by 1 test: mostLeftNode = y->parent();
Executed by:
  • tst_ecmascripttests
221
158 }-
159 }
executed 448 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
else if (y->right == nullptr
y->right == nullptrDescription
TRUEevaluated 42 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 110 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
42-448
160 x = y->left;-
161 }
executed 42 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
else {
42
162 y = y->right;-
163 while (y->left != nullptr
y->left != nullptrDescription
TRUEnever evaluated
FALSEevaluated 112 times by 1 test
Evaluated by:
  • tst_ecmascripttests
)
0-112
164 y = y->left;
never executed: y = y->left;
0
165 x = y->right;-
166 }
executed 112 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
112
167 if (y != z
y != zDescription
TRUEevaluated 112 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 489 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
) {
112-489
168-
169-
170 z->size_left += y->size_left;-
171 SparseArrayNode *n = y->parent();-
172 while (n != z
n != zDescription
TRUEnever evaluated
FALSEevaluated 110 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
0-110
173 n->size_left -= y->size_left;-
174 n = n->parent();-
175 }
never executed: end of block
0
176 y->size_left = 0;-
177 z->value = y->value;-
178-
179 if (y != z->right
y != z->rightDescription
TRUEnever evaluated
FALSEevaluated 112 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
0-112
180 x_parent = y->parent();-
181 y->parent()->left = x;-
182 }
never executed: end of block
else {
0
183 x_parent = z;-
184 z->right = x;-
185 }
executed 112 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
112
186 if (x
xDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 102 times by 1 test
Evaluated by:
  • tst_ecmascripttests
)
8-102
187 x->setParent(x_parent);
executed 8 times by 1 test: x->setParent(x_parent);
Executed by:
  • tst_ecmascripttests
8
188 }
executed 110 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
else {
110
189 x_parent = y->parent();-
190 if (x
xDescription
TRUEevaluated 52 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 437 times by 1 test
Evaluated by:
  • tst_ecmascripttests
)
52-437
191 x->setParent(y->parent());
executed 52 times by 2 tests: x->setParent(y->parent());
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
52
192 if (root == y
root == yDescription
TRUEevaluated 197 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 292 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
)
197-292
193 root = x;
executed 197 times by 2 tests: root = x;
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
197
194 else if (y->parent()->left == y
y->parent()->left == yDescription
TRUEevaluated 60 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 232 times by 1 test
Evaluated by:
  • tst_ecmascripttests
)
60-232
195 y->parent()->left = x;
executed 60 times by 2 tests: y->parent()->left = x;
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
60
196 else-
197 y->parent()->right = x;
executed 232 times by 1 test: y->parent()->right = x;
Executed by:
  • tst_ecmascripttests
232
198 if (x
xDescription
TRUEevaluated 52 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 437 times by 1 test
Evaluated by:
  • tst_ecmascripttests
&& x == y->right
x == y->rightDescription
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 42 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
)
10-437
199 x->size_left += y->size_left;
executed 10 times by 2 tests: x->size_left += y->size_left;
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
10
200 y->size_left = 0;-
201 }
executed 490 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
490
202 if (y->color() != SparseArrayNode::Red
y->color() != ...ArrayNode::RedDescription
TRUEevaluated 286 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 314 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
286-314
203 while (x != root
x != rootDescription
TRUEevaluated 88 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 251 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
&& (x == nullptr
x == nullptrDescription
TRUEevaluated 62 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 26 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
|| x->color() == SparseArrayNode::Black
x->color() == ...rayNode::BlackDescription
TRUEnever evaluated
FALSEevaluated 26 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
)) {
0-251
204 if (x == x_parent->left
x == x_parent->leftDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
10-52
205 SparseArrayNode *w = x_parent->right;-
206 if (w->color() == SparseArrayNode::Red
w->color() == ...ArrayNode::RedDescription
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
0-10
207 w->setColor(SparseArrayNode::Black);-
208 x_parent->setColor(SparseArrayNode::Red);-
209 rotateLeft(x_parent);-
210 w = x_parent->right;-
211 }
never executed: end of block
0
212 if ((w->left == nullptr
w->left == nullptrDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
|| w->left->color() == SparseArrayNode::Black
w->left->color...rayNode::BlackDescription
TRUEnever evaluated
FALSEnever evaluated
) &&
0-10
213 (w->right == nullptr
w->right == nullptrDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_ecmascripttests
|| w->right->color() == SparseArrayNode::Black
w->right->colo...rayNode::BlackDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_ecmascripttests
)) {
0-6
214 w->setColor(SparseArrayNode::Red);-
215 x = x_parent;-
216 x_parent = x_parent->parent();-
217 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
else {
4
218 if (w->right == nullptr
w->right == nullptrDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_ecmascripttests
|| w->right->color() == SparseArrayNode::Black
w->right->colo...rayNode::BlackDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
0-6
219 if (w->left
w->leftDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
220 w->left->setColor(SparseArrayNode::Black);
never executed: w->left->setColor(SparseArrayNode::Black);
0
221 w->setColor(SparseArrayNode::Red);-
222 rotateRight(w);-
223 w = x_parent->right;-
224 }
never executed: end of block
0
225 w->setColor(x_parent->color());-
226 x_parent->setColor(SparseArrayNode::Black);-
227 if (w->right
w->rightDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
)
0-6
228 w->right->setColor(SparseArrayNode::Black);
executed 6 times by 1 test: w->right->setColor(SparseArrayNode::Black);
Executed by:
  • tst_ecmascripttests
6
229 rotateLeft(x_parent);-
230 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_ecmascripttests
6
231 }-
232 } else {-
233 SparseArrayNode *w = x_parent->left;-
234 if (w->color() == SparseArrayNode::Red
w->color() == ...ArrayNode::RedDescription
TRUEnever evaluated
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
0-52
235 w->setColor(SparseArrayNode::Black);-
236 x_parent->setColor(SparseArrayNode::Red);-
237 rotateRight(x_parent);-
238 w = x_parent->left;-
239 }
never executed: end of block
0
240 if ((w->right == nullptr
w->right == nullptrDescription
TRUEevaluated 52 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
|| w->right->color() == SparseArrayNode::Black
w->right->colo...rayNode::BlackDescription
TRUEnever evaluated
FALSEnever evaluated
) &&
0-52
241 (w->left == nullptr
w->left == nullptrDescription
TRUEevaluated 52 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
|| w->left->color() == SparseArrayNode::Black
w->left->color...rayNode::BlackDescription
TRUEnever evaluated
FALSEnever evaluated
)) {
0-52
242 w->setColor(SparseArrayNode::Red);-
243 x = x_parent;-
244 x_parent = x_parent->parent();-
245 }
executed 52 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
else {
52
246 if (w->left == nullptr
w->left == nullptrDescription
TRUEnever evaluated
FALSEnever evaluated
|| w->left->color() == SparseArrayNode::Black
w->left->color...rayNode::BlackDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
247 if (w->right
w->rightDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
248 w->right->setColor(SparseArrayNode::Black);
never executed: w->right->setColor(SparseArrayNode::Black);
0
249 w->setColor(SparseArrayNode::Red);-
250 rotateLeft(w);-
251 w = x_parent->left;-
252 }
never executed: end of block
0
253 w->setColor(x_parent->color());-
254 x_parent->setColor(SparseArrayNode::Black);-
255 if (w->left
w->leftDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
256 w->left->setColor(SparseArrayNode::Black);
never executed: w->left->setColor(SparseArrayNode::Black);
0
257 rotateRight(x_parent);-
258 break;
never executed: break;
0
259 }-
260 }-
261 }-
262 if (x
xDescription
TRUEevaluated 116 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 168 times by 1 test
Evaluated by:
  • tst_ecmascripttests
)
116-168
263 x->setColor(SparseArrayNode::Black);
executed 116 times by 2 tests: x->setColor(SparseArrayNode::Black);
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
116
264 }
executed 284 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
284
265 free(y);-
266 --numEntries;-
267}
executed 601 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
601
268-
269void SparseArray::recalcMostLeftNode()-
270{-
271 mostLeftNode = &header;-
272 while (mostLeftNode->left
mostLeftNode->leftDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
273 mostLeftNode = mostLeftNode->left;
never executed: mostLeftNode = mostLeftNode->left;
0
274}
never executed: end of block
0
275-
276static inline int qMapAlignmentThreshold()-
277{-
278-
279-
280-
281 return
executed 11918 times by 2 tests: return 2 * sizeof(void*);
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
2 * sizeof(void*);
executed 11918 times by 2 tests: return 2 * sizeof(void*);
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
11918
282}-
283-
284static inline void *qMapAllocate(int alloc, int alignment)-
285{-
286 return
executed 6243 times by 2 tests: return alignment > qMapAlignmentThreshold() ? qMallocAligned(alloc, alignment) : ::malloc(alloc);
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
alignment > qMapAlignmentThreshold()
executed 6243 times by 2 tests: return alignment > qMapAlignmentThreshold() ? qMallocAligned(alloc, alignment) : ::malloc(alloc);
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
6243
287 ? qMallocAligned(alloc, alignment)
executed 6243 times by 2 tests: return alignment > qMapAlignmentThreshold() ? qMallocAligned(alloc, alignment) : ::malloc(alloc);
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
6243
288 : ::malloc(alloc);
executed 6243 times by 2 tests: return alignment > qMapAlignmentThreshold() ? qMallocAligned(alloc, alignment) : ::malloc(alloc);
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
6243
289}-
290-
291static inline void qMapDeallocate(SparseArrayNode *node, int alignment)-
292{-
293 if (alignment > qMapAlignmentThreshold()
alignment > qM...entThreshold()Description
TRUEnever evaluated
FALSEevaluated 5673 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
)
0-5673
294 qFreeAligned(node);
never executed: qFreeAligned(node);
0
295 else-
296 ::
executed 5673 times by 2 tests: ::free(node);
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
free(node);
executed 5673 times by 2 tests: ::free(node);
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
5673
297}-
298-
299SparseArrayNode *SparseArray::createNode(uint sl, SparseArrayNode *parent, bool left)-
300{-
301 SparseArrayNode *node = static_cast<SparseArrayNode *>(qMapAllocate(sizeof(SparseArrayNode), alignof(SparseArrayNode)));-
302 do {if (!(node)
!(node)Description
TRUEnever evaluated
FALSEevaluated 6261 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
) qt_check_pointer(__FILE__,363);
never executed: qt_check_pointer(__FILE__,363);
} while (false);
0-6261
303-
304 node->p = (quintptr)parent;-
305 node->left = nullptr;-
306 node->right = nullptr;-
307 node->size_left = sl;-
308 node->value = -
309 (0x7fffffff * 2U + 1U)-
310 ;-
311 ++numEntries;-
312-
313 if (parent
parentDescription
TRUEevaluated 6265 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEnever evaluated
) {
0-6265
314 if (left
leftDescription
TRUEevaluated 3668 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 2596 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
) {
2596-3668
315 parent->left = node;-
316 if (parent == mostLeftNode
parent == mostLeftNodeDescription
TRUEevaluated 3445 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 220 times by 1 test
Evaluated by:
  • tst_ecmascripttests
)
220-3445
317 mostLeftNode = node;
executed 3441 times by 2 tests: mostLeftNode = node;
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
3441
318 }
executed 3670 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
else {
3670
319 parent->right = node;-
320 }
executed 2595 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
2595
321 node->setParent(parent);-
322 rebalance(node);-
323 }
executed 6254 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
6254
324 return
executed 6260 times by 2 tests: return node;
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
node;
executed 6260 times by 2 tests: return node;
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
6260
325}-
326-
327void SparseArray::freeTree(SparseArrayNode *root, int alignment)-
328{-
329 if (root->left
root->leftDescription
TRUEevaluated 1376 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 4298 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
)
1376-4298
330 freeTree(root->left, alignment);
executed 1376 times by 2 tests: freeTree(root->left, alignment);
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
1376
331 if (root->right
root->rightDescription
TRUEevaluated 1354 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 4319 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
)
1354-4319
332 freeTree(root->right, alignment);
executed 1354 times by 2 tests: freeTree(root->right, alignment);
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
1354
333 qMapDeallocate(root, alignment);-
334}
executed 5674 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
5674
335-
336SparseArray::SparseArray()-
337 : numEntries(0)-
338{-
339 freeList = Encode(-1);-
340 header.p = 0;-
341 header.left = nullptr;-
342 header.right = nullptr;-
343 mostLeftNode = &header;-
344}
executed 3171 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
3171
345-
346SparseArray::SparseArray(const SparseArray &other)-
347{-
348 header.p = 0;-
349 header.right = nullptr;-
350 if (other.header.left
other.header.leftDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
351 header.left = other.header.left->copy(this);-
352 header.left->setParent(&header);-
353 recalcMostLeftNode();-
354 }
never executed: end of block
0
355 freeList = other.freeList;-
356}
never executed: end of block
0
357-
358SparseArrayNode *SparseArray::insert(uint akey)-
359{-
360 SparseArrayNode *n = root();-
361 SparseArrayNode *y = end();-
362 bool left = true;-
363 uint s = akey;-
364 while (n
nDescription
TRUEevaluated 12552 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 6235 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
) {
6235-12552
365 y = n;-
366 if (s == n->size_left
s == n->size_leftDescription
TRUEevaluated 5093 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 7458 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
) {
5093-7458
367 return
executed 5095 times by 1 test: return n;
Executed by:
  • tst_ecmascripttests
n;
executed 5095 times by 1 test: return n;
Executed by:
  • tst_ecmascripttests
5095
368 } else if (s < n->size_left
s < n->size_leftDescription
TRUEevaluated 1693 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
FALSEevaluated 5768 times by 2 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
) {
1693-5768
369 left = true;-
370 n = n->left;-
371 }
executed 1693 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
else {
1693
372 left = false;-
373 s -= n->size_left;-
374 n = n->right;-
375 }
executed 5768 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
5768
376 }-
377-
378 return
executed 6247 times by 2 tests: return createNode(s, y, left);
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
createNode(s, y, left);
executed 6247 times by 2 tests: return createNode(s, y, left);
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
6247
379}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0