OpenCoverage

qv4serialize.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4serialize.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10using namespace QV4;-
11enum Type {-
12 WorkerUndefined,-
13 WorkerNull,-
14 WorkerTrue,-
15 WorkerFalse,-
16 WorkerString,-
17 WorkerFunction,-
18 WorkerArray,-
19 WorkerObject,-
20 WorkerInt32,-
21 WorkerUint32,-
22 WorkerNumber,-
23 WorkerDate,-
24 WorkerRegexp,-
25-
26 WorkerListModel,-
27-
28-
29 WorkerSequence-
30-
31};-
32-
33static inline quint32 valueheader(Type type, quint32 size = 0)-
34{-
35 return
executed 11872 times by 5 tests: return quint8(type) << 24 | (size & 0xFFFFFF);
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
quint8(type) << 24 | (size & 0xFFFFFF);
executed 11872 times by 5 tests: return quint8(type) << 24 | (size & 0xFFFFFF);
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
11872
36}-
37-
38static inline Type headertype(quint32 header)-
39{-
40 return
executed 11860 times by 5 tests: return (Type)(header >> 24);
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
(Type)(header >> 24);
executed 11860 times by 5 tests: return (Type)(header >> 24);
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
11860
41}-
42-
43static inline quint32 headersize(quint32 header)-
44{-
45 return
executed 8682 times by 5 tests: return header & 0xFFFFFF;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
header & 0xFFFFFF;
executed 8682 times by 5 tests: return header & 0xFFFFFF;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
8682
46}-
47-
48static inline void push(QByteArray &data, quint32 value)-
49{-
50 data.append((const char *)&value, sizeof(quint32));-
51}
executed 12496 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
12496
52-
53static inline void push(QByteArray &data, double value)-
54{-
55 data.append((const char *)&value, sizeof(double));-
56}
executed 126 times by 3 tests: end of block
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
126
57-
58static inline void push(QByteArray &data, void *ptr)-
59{-
60 data.append((const char *)&ptr, sizeof(void *));-
61}
executed 928 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmllistmodelworkerscript
928
62-
63static inline void reserve(QByteArray &data, int extra)-
64{-
65 data.reserve(data.size() + extra);-
66}
executed 7564 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
7564
67-
68static inline quint32 popUint32(const char *&data)-
69{-
70 quint32 rv = *((const quint32 *)data);-
71 data += sizeof(quint32);-
72 return
executed 12484 times by 5 tests: return rv;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
rv;
executed 12484 times by 5 tests: return rv;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
12484
73}-
74-
75static inline double popDouble(const char *&data)-
76{-
77 double rv = *((const double *)data);-
78 data += sizeof(double);-
79 return
executed 126 times by 3 tests: return rv;
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
rv;
executed 126 times by 3 tests: return rv;
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
126
80}-
81-
82static inline void *popPtr(const char *&data)-
83{-
84 void *rv = *((void *const *)data);-
85 data += sizeof(void *);-
86 return
executed 928 times by 2 tests: return rv;
Executed by:
  • tst_examples
  • tst_qqmllistmodelworkerscript
rv;
executed 928 times by 2 tests: return rv;
Executed by:
  • tst_examples
  • tst_qqmllistmodelworkerscript
928
87}-
88-
89-
90-
91-
92-
93void Serialize::serialize(QByteArray &data, const QV4::Value &v, ExecutionEngine *engine)-
94{-
95 QV4::Scope scope(engine);-
96-
97 if (v.isEmpty()
v.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 11872 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
0-11872
98 ((!"Serialize: got empty value") ? static_cast<void>(0) : qt_assert("!\"Serialize: got empty value\"", __FILE__, 162));-
99 }
never executed: end of block
else if (v.isUndefined()
v.isUndefined()Description
TRUEevaluated 460 times by 2 tests
Evaluated by:
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 11412 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
0-11412
100 push(data, valueheader(WorkerUndefined));-
101 }
executed 460 times by 2 tests: end of block
Executed by:
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
else if (v.isNull()
v.isNull()Description
TRUEevaluated 56 times by 1 test
Evaluated by:
  • tst_qqmllistmodelworkerscript
FALSEevaluated 11356 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
56-11356
102 push(data, valueheader(WorkerNull));-
103 }
executed 56 times by 1 test: end of block
Executed by:
  • tst_qqmllistmodelworkerscript
else if (v.isBoolean()
v.isBoolean()Description
TRUEevaluated 986 times by 3 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 10370 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
56-10370
104 push(data, valueheader(v.booleanValue() == true ? WorkerTrue : WorkerFalse));-
105 }
executed 986 times by 3 tests: end of block
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
else if (v.isString()
v.isString()Description
TRUEevaluated 5888 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 4482 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
986-5888
106 const QString &qstr = v.toQString();-
107 int length = qstr.length();-
108 if (length > 0xFFFFFF
length > 0xFFFFFFDescription
TRUEnever evaluated
FALSEevaluated 5888 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
0-5888
109 push(data, valueheader(WorkerUndefined));-
110 return;
never executed: return;
0
111 }-
112 int utf16size = (((length * sizeof(quint16)) + 3) & ~3);-
113-
114 reserve(data, utf16size + sizeof(quint32));-
115 push(data, valueheader(WorkerString, length));-
116-
117 int offset = data.size();-
118 data.resize(data.size() + utf16size);-
119 char *buffer = data.data() + offset;-
120-
121 memcpy(buffer, qstr.constData(), length*sizeof(QChar));-
122 }
executed 5888 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
else if (v.as<FunctionObject>()
v.as<FunctionObject>()Description
TRUEnever evaluated
FALSEevaluated 4482 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
0-5888
123-
124-
125 push(data, valueheader(WorkerUndefined));-
126 }
never executed: end of block
else if (const
const QV4::Arr...ArrayObject>()Description
TRUEevaluated 858 times by 3 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 3624 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
QV4::ArrayObject *array = v.as<ArrayObject>()
const QV4::Arr...ArrayObject>()Description
TRUEevaluated 858 times by 3 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 3624 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
0-3624
127 uint length = array->getLength();-
128 if (length > 0xFFFFFF
length > 0xFFFFFFDescription
TRUEnever evaluated
FALSEevaluated 858 times by 3 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
0-858
129 push(data, valueheader(WorkerUndefined));-
130 return;
never executed: return;
0
131 }-
132 reserve(data, sizeof(quint32) + length * sizeof(quint32));-
133 push(data, valueheader(WorkerArray, length));-
134 ScopedValue val(scope);-
135 for (uint ii = 0; ii < length
ii < lengthDescription
TRUEevaluated 2046 times by 3 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 858 times by 3 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
; ++ii)
858-2046
136 serialize(data, (val = array->get(ii)), engine);
executed 2046 times by 3 tests: serialize(data, (val = array->get(ii)), engine);
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
2046
137 }
executed 858 times by 3 tests: end of block
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
else if (v.isInteger()
v.isInteger()Description
TRUEevaluated 620 times by 3 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 3004 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
620-3004
138 reserve(data, 2 * sizeof(quint32));-
139 push(data, valueheader(WorkerInt32));-
140 push(data, (quint32)v.integerValue());-
141-
142-
143-
144-
145 }
executed 620 times by 3 tests: end of block
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
else if (v.isNumber()
v.isNumber()Description
TRUEevaluated 122 times by 3 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 2882 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
122-2882
146 reserve(data, sizeof(quint32) + sizeof(double));-
147 push(data, valueheader(WorkerNumber));-
148 push(data, v.asDouble());-
149 }
executed 122 times by 3 tests: end of block
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
else if (const
const QV4::Dat...<DateObject>()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickworkerscript
FALSEevaluated 2878 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
QV4::DateObject *d = v.as<DateObject>()
const QV4::Dat...<DateObject>()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickworkerscript
FALSEevaluated 2878 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
4-2878
150 reserve(data, sizeof(quint32) + sizeof(double));-
151 push(data, valueheader(WorkerDate));-
152 push(data, d->date());-
153 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickworkerscript
else if (const
const RegExpOb...egExpObject>()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickworkerscript
FALSEevaluated 2874 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
RegExpObject *re = v.as<RegExpObject>()
const RegExpOb...egExpObject>()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickworkerscript
FALSEevaluated 2874 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
4-2874
154 quint32 flags = re->flags();-
155 QString pattern = re->source();-
156 int length = pattern.length() + 1;-
157 if (length > 0xFFFFFF
length > 0xFFFFFFDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickworkerscript
) {
0-4
158 push(data, valueheader(WorkerUndefined));-
159 return;
never executed: return;
0
160 }-
161 int utf16size = (((length * sizeof(quint16)) + 3) & ~3);-
162-
163 reserve(data, sizeof(quint32) + utf16size);-
164 push(data, valueheader(WorkerRegexp, flags));-
165 push(data, (quint32)length);-
166-
167 int offset = data.size();-
168 data.resize(data.size() + utf16size);-
169 char *buffer = data.data() + offset;-
170-
171 memcpy(buffer, pattern.constData(), length*sizeof(QChar));-
172 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickworkerscript
else if (const
const QObjectW...jectWrapper>()Description
TRUEevaluated 934 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 1940 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
QObjectWrapper *qobjectWrapper = v.as<QV4::QObjectWrapper>()
const QObjectW...jectWrapper>()Description
TRUEevaluated 934 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 1940 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
4-1940
173-
174-
175-
176 QQmlListModel *lm = qobject_cast<QQmlListModel *>(qobjectWrapper->object());-
177 if (lm
lmDescription
TRUEevaluated 928 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmllistmodelworkerscript
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickworkerscript
&& lm->agent()
lm->agent()Description
TRUEevaluated 928 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmllistmodelworkerscript
FALSEnever evaluated
) {
0-928
178 QQmlListModelWorkerAgent *agent = lm->agent();-
179 agent->addref();-
180 push(data, valueheader(WorkerListModel));-
181 push(data, (void *)agent);-
182 return;
executed 928 times by 2 tests: return;
Executed by:
  • tst_examples
  • tst_qqmllistmodelworkerscript
928
183 }-
184-
185-
186-
187-
188 push(data, valueheader(WorkerUndefined));-
189 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquickworkerscript
else if (const
const Object *...v.as<Object>()Description
TRUEevaluated 1940 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEnever evaluated
Object *o = v.as<Object>()
const Object *...v.as<Object>()Description
TRUEevaluated 1940 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEnever evaluated
) {
0-1940
190-
191 if (o->isListType()
o->isListType()Description
TRUEevaluated 68 times by 2 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
FALSEevaluated 1872 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
68-1872
192-
193 uint seqLength = ScopedValue(scope, o->get(engine->id_length()))->toUInt32();-
194 uint length = seqLength + 1;-
195 if (length > 0xFFFFFF
length > 0xFFFFFFDescription
TRUEnever evaluated
FALSEevaluated 68 times by 2 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
) {
0-68
196 push(data, valueheader(WorkerUndefined));-
197 return;
never executed: return;
0
198 }-
199 reserve(data, sizeof(quint32) + length * sizeof(quint32));-
200 push(data, valueheader(WorkerSequence, length));-
201 serialize(data, QV4::Primitive::fromInt32(QV4::SequencePrototype::metaTypeForSequence(o)), engine);-
202 ScopedValue val(scope);-
203 for (uint ii = 0; ii < seqLength
ii < seqLengthDescription
TRUEevaluated 188 times by 2 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
FALSEevaluated 68 times by 2 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
; ++ii)
68-188
204 serialize(data, (val = o->get(ii)), engine);
executed 188 times by 2 tests: serialize(data, (val = o->get(ii)), engine);
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
188
205-
206 return;
executed 68 times by 2 tests: return;
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
68
207 }-
208-
209-
210-
211 QV4::ScopedValue val(scope, v);-
212 QV4::ScopedArrayObject properties(scope, QV4::ObjectPrototype::getOwnPropertyNames(engine, val));-
213 quint32 length = properties->getLength();-
214 if (length > 0xFFFFFF
length > 0xFFFFFFDescription
TRUEnever evaluated
FALSEevaluated 1872 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
0-1872
215 push(data, valueheader(WorkerUndefined));-
216 return;
never executed: return;
0
217 }-
218 push(data, valueheader(WorkerObject, length));-
219-
220 QV4::ScopedValue s(scope);-
221 for (quint32 ii = 0; ii < length
ii < lengthDescription
TRUEevaluated 3706 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 1872 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
; ++ii) {
1872-3706
222 s = properties->get(ii);-
223 serialize(data, s, engine);-
224-
225 QV4::String *str = s->as<String>();-
226 val = o->get(str);-
227 if (scope.hasException()
scope.hasException()Description
TRUEnever evaluated
FALSEevaluated 3706 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
)
0-3706
228 scope.engine->catchException();
never executed: scope.engine->catchException();
0
229-
230 serialize(data, val, engine);-
231 }
executed 3706 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
3706
232 return;
executed 1872 times by 4 tests: return;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1872
233 } else {-
234 push(data, valueheader(WorkerUndefined));-
235 }
never executed: end of block
0
236}-
237-
238ReturnedValue Serialize::deserialize(const char *&data, ExecutionEngine *engine)-
239{-
240 quint32 header = popUint32(data);-
241 Type type = headertype(header);-
242-
243 Scope scope(engine);-
244-
245 switch (type) {-
246 case
executed 466 times by 2 tests: case WorkerUndefined:
Executed by:
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
WorkerUndefined:
executed 466 times by 2 tests: case WorkerUndefined:
Executed by:
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
466
247 return
executed 466 times by 2 tests: return QV4::Encode::undefined();
Executed by:
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
QV4::Encode::undefined();
executed 466 times by 2 tests: return QV4::Encode::undefined();
Executed by:
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
466
248 case
executed 56 times by 1 test: case WorkerNull:
Executed by:
  • tst_qqmllistmodelworkerscript
WorkerNull:
executed 56 times by 1 test: case WorkerNull:
Executed by:
  • tst_qqmllistmodelworkerscript
56
249 return
executed 56 times by 1 test: return QV4::Encode::null();
Executed by:
  • tst_qqmllistmodelworkerscript
QV4::Encode::null();
executed 56 times by 1 test: return QV4::Encode::null();
Executed by:
  • tst_qqmllistmodelworkerscript
56
250 case
executed 966 times by 3 tests: case WorkerTrue:
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
WorkerTrue:
executed 966 times by 3 tests: case WorkerTrue:
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
966
251 return
executed 966 times by 3 tests: return QV4::Encode(true);
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
QV4::Encode(true);
executed 966 times by 3 tests: return QV4::Encode(true);
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
966
252 case
executed 16 times by 1 test: case WorkerFalse:
Executed by:
  • tst_qqmlecmascript
WorkerFalse:
executed 16 times by 1 test: case WorkerFalse:
Executed by:
  • tst_qqmlecmascript
16
253 return
executed 16 times by 1 test: return QV4::Encode(false);
Executed by:
  • tst_qqmlecmascript
QV4::Encode(false);
executed 16 times by 1 test: return QV4::Encode(false);
Executed by:
  • tst_qqmlecmascript
16
254 case
executed 5884 times by 5 tests: case WorkerString:
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
WorkerString:
executed 5884 times by 5 tests: case WorkerString:
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
5884
255 {-
256 quint32 size = headersize(header);-
257 QString qstr((const QChar *)data, size);-
258 data += (((size * sizeof(quint16)) + 3) & ~3);-
259 return
executed 5884 times by 5 tests: return QV4::Encode(engine->newString(qstr));
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
QV4::Encode(engine->newString(qstr));
executed 5884 times by 5 tests: return QV4::Encode(engine->newString(qstr));
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
5884
260 }-
261 case
never executed: case WorkerFunction:
WorkerFunction:
never executed: case WorkerFunction:
0
262 ((!"Unreachable") ? static_cast<void>(0) : qt_assert("!\"Unreachable\"", __FILE__, 326));-
263 break;
never executed: break;
0
264 case
executed 858 times by 3 tests: case WorkerArray:
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
WorkerArray:
executed 858 times by 3 tests: case WorkerArray:
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
858
265 {-
266 quint32 size = headersize(header);-
267 ScopedArrayObject a(scope, engine->newArrayObject());-
268 ScopedValue v(scope);-
269 for (quint32 ii = 0; ii < size
ii < sizeDescription
TRUEevaluated 2046 times by 3 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 858 times by 3 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
; ++ii) {
858-2046
270 v = deserialize(data, engine);-
271 a->put(ii, v);-
272 }
executed 2046 times by 3 tests: end of block
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
2046
273 return
executed 858 times by 3 tests: return a.asReturnedValue();
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
a.asReturnedValue();
executed 858 times by 3 tests: return a.asReturnedValue();
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
858
274 }-
275 case
executed 1868 times by 4 tests: case WorkerObject:
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
WorkerObject:
executed 1868 times by 4 tests: case WorkerObject:
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1868
276 {-
277 quint32 size = headersize(header);-
278 ScopedObject o(scope, engine->newObject());-
279 ScopedValue name(scope);-
280 ScopedString n(scope);-
281 ScopedValue value(scope);-
282 for (quint32 ii = 0; ii < size
ii < sizeDescription
TRUEevaluated 3702 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 1868 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
; ++ii) {
1868-3702
283 name = deserialize(data, engine);-
284 value = deserialize(data, engine);-
285 n = name->asReturnedValue();-
286 o->put(n, value);-
287 }
executed 3702 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
3702
288 return
executed 1868 times by 4 tests: return o.asReturnedValue();
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
o.asReturnedValue();
executed 1868 times by 4 tests: return o.asReturnedValue();
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1868
289 }-
290 case
executed 620 times by 3 tests: case WorkerInt32:
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
WorkerInt32:
executed 620 times by 3 tests: case WorkerInt32:
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
620
291 return
executed 620 times by 3 tests: return QV4::Encode((qint32)popUint32(data));
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
QV4::Encode((qint32)popUint32(data));
executed 620 times by 3 tests: return QV4::Encode((qint32)popUint32(data));
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
620
292 case
never executed: case WorkerUint32:
WorkerUint32:
never executed: case WorkerUint32:
0
293 return
never executed: return QV4::Encode(popUint32(data));
QV4::Encode(popUint32(data));
never executed: return QV4::Encode(popUint32(data));
0
294 case
executed 122 times by 3 tests: case WorkerNumber:
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
WorkerNumber:
executed 122 times by 3 tests: case WorkerNumber:
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
122
295 return
executed 122 times by 3 tests: return QV4::Encode(popDouble(data));
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
QV4::Encode(popDouble(data));
executed 122 times by 3 tests: return QV4::Encode(popDouble(data));
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
122
296 case
executed 4 times by 1 test: case WorkerDate:
Executed by:
  • tst_qquickworkerscript
WorkerDate:
executed 4 times by 1 test: case WorkerDate:
Executed by:
  • tst_qquickworkerscript
4
297 return
executed 4 times by 1 test: return QV4::Encode(engine->newDateObject(QV4::Primitive::fromDouble(popDouble(data))));
Executed by:
  • tst_qquickworkerscript
QV4::Encode(engine->newDateObject(QV4::Primitive::fromDouble(popDouble(data))));
executed 4 times by 1 test: return QV4::Encode(engine->newDateObject(QV4::Primitive::fromDouble(popDouble(data))));
Executed by:
  • tst_qquickworkerscript
4
298 case
executed 4 times by 1 test: case WorkerRegexp:
Executed by:
  • tst_qquickworkerscript
WorkerRegexp:
executed 4 times by 1 test: case WorkerRegexp:
Executed by:
  • tst_qquickworkerscript
4
299 {-
300 quint32 flags = headersize(header);-
301 quint32 length = popUint32(data);-
302 QString pattern = QString((const QChar *)data, length - 1);-
303 data += (((length * sizeof(quint16)) + 3) & ~3);-
304 return
executed 4 times by 1 test: return Encode(engine->newRegExpObject(pattern, flags));
Executed by:
  • tst_qquickworkerscript
Encode(engine->newRegExpObject(pattern, flags));
executed 4 times by 1 test: return Encode(engine->newRegExpObject(pattern, flags));
Executed by:
  • tst_qquickworkerscript
4
305 }-
306-
307 case
executed 928 times by 2 tests: case WorkerListModel:
Executed by:
  • tst_examples
  • tst_qqmllistmodelworkerscript
WorkerListModel:
executed 928 times by 2 tests: case WorkerListModel:
Executed by:
  • tst_examples
  • tst_qqmllistmodelworkerscript
928
308 {-
309 void *ptr = popPtr(data);-
310 QQmlListModelWorkerAgent *agent = (QQmlListModelWorkerAgent *)ptr;-
311 QV4::ScopedValue rv(scope, QV4::QObjectWrapper::wrap(engine, agent));-
312-
313 QQmlListModelWorkerAgent::VariantRef ref(agent);-
314 QVariant var = qVariantFromValue(ref);-
315 QV4::ScopedValue v(scope, scope.engine->fromVariant(var));-
316 QV4::ScopedString s(scope, engine->newString(([]() noexcept -> QString { enum { Size = sizeof(u"" "__qml:hidden:ref")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "__qml:hidden:ref" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 928 times by 2 tests: return qstring_literal_temp;
Executed by:
  • tst_examples
  • tst_qqmllistmodelworkerscript
qstring_literal_temp;
executed 928 times by 2 tests: return qstring_literal_temp;
Executed by:
  • tst_examples
  • tst_qqmllistmodelworkerscript
}())));
928
317 rv->as<Object>()->defineReadonlyProperty(s, v);-
318-
319 agent->release();-
320 agent->setEngine(engine);-
321 return
executed 928 times by 2 tests: return rv->asReturnedValue();
Executed by:
  • tst_examples
  • tst_qqmllistmodelworkerscript
rv->asReturnedValue();
executed 928 times by 2 tests: return rv->asReturnedValue();
Executed by:
  • tst_examples
  • tst_qqmllistmodelworkerscript
928
322 }-
323-
324-
325 case
executed 68 times by 2 tests: case WorkerSequence:
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
WorkerSequence:
executed 68 times by 2 tests: case WorkerSequence:
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
68
326 {-
327 ScopedValue value(scope);-
328 bool succeeded = false;-
329 quint32 length = headersize(header);-
330 quint32 seqLength = length - 1;-
331 value = deserialize(data, engine);-
332 int sequenceType = value->integerValue();-
333 ScopedArrayObject array(scope, engine->newArrayObject());-
334 array->arrayReserve(seqLength);-
335 for (quint32 ii = 0; ii < seqLength
ii < seqLengthDescription
TRUEevaluated 188 times by 2 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
FALSEevaluated 68 times by 2 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
; ++ii) {
68-188
336 value = deserialize(data, engine);-
337 array->arrayPut(ii, value);-
338 }
executed 188 times by 2 tests: end of block
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
188
339 array->setArrayLengthUnchecked(seqLength);-
340 QVariant seqVariant = QV4::SequencePrototype::toVariant(array, sequenceType, &succeeded);-
341 return
executed 68 times by 2 tests: return QV4::SequencePrototype::fromVariant(engine, seqVariant, &succeeded);
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
QV4::SequencePrototype::fromVariant(engine, seqVariant, &succeeded);
executed 68 times by 2 tests: return QV4::SequencePrototype::fromVariant(engine, seqVariant, &succeeded);
Executed by:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
68
342 }-
343-
344 }-
345 ((!"Unreachable") ? static_cast<void>(0) : qt_assert("!\"Unreachable\"", __FILE__, 409));-
346 return
never executed: return QV4::Encode::undefined();
QV4::Encode::undefined();
never executed: return QV4::Encode::undefined();
0
347}-
348-
349QByteArray Serialize::serialize(const QV4::Value &value, ExecutionEngine *engine)-
350{-
351 QByteArray rv;-
352 serialize(rv, value, engine);-
353 return
executed 2158 times by 5 tests: return rv;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
rv;
executed 2158 times by 5 tests: return rv;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
2158
354}-
355-
356ReturnedValue Serialize::deserialize(const QByteArray &data, ExecutionEngine *engine)-
357{-
358 const char *stream = data.constData();-
359 return
executed 2154 times by 5 tests: return deserialize(stream, engine);
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
deserialize(stream, engine);
executed 2154 times by 5 tests: return deserialize(stream, engine);
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
2154
360}-
361-
362-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0