| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4serialize.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | - | |||||||||||||
| 8 | - | |||||||||||||
| 9 | - | |||||||||||||
| 10 | using namespace QV4; | - | ||||||||||||
| 11 | enum 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 | - | |||||||||||||
| 33 | static inline quint32 valueheader(Type type, quint32 size = 0) | - | ||||||||||||
| 34 | { | - | ||||||||||||
| 35 | return executed 11872 times by 5 tests: quint8(type) << 24 | (size & 0xFFFFFF);return quint8(type) << 24 | (size & 0xFFFFFF);Executed by:
executed 11872 times by 5 tests: return quint8(type) << 24 | (size & 0xFFFFFF);Executed by:
| 11872 | ||||||||||||
| 36 | } | - | ||||||||||||
| 37 | - | |||||||||||||
| 38 | static inline Type headertype(quint32 header) | - | ||||||||||||
| 39 | { | - | ||||||||||||
| 40 | return executed 11860 times by 5 tests: (Type)(header >> 24);return (Type)(header >> 24);Executed by:
executed 11860 times by 5 tests: return (Type)(header >> 24);Executed by:
| 11860 | ||||||||||||
| 41 | } | - | ||||||||||||
| 42 | - | |||||||||||||
| 43 | static inline quint32 headersize(quint32 header) | - | ||||||||||||
| 44 | { | - | ||||||||||||
| 45 | return executed 8682 times by 5 tests: header & 0xFFFFFF;return header & 0xFFFFFF;Executed by:
executed 8682 times by 5 tests: return header & 0xFFFFFF;Executed by:
| 8682 | ||||||||||||
| 46 | } | - | ||||||||||||
| 47 | - | |||||||||||||
| 48 | static 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 blockExecuted by:
| 12496 | ||||||||||||
| 52 | - | |||||||||||||
| 53 | static 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 blockExecuted by:
| 126 | ||||||||||||
| 57 | - | |||||||||||||
| 58 | static 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 blockExecuted by:
| 928 | ||||||||||||
| 62 | - | |||||||||||||
| 63 | static inline void reserve(QByteArray &data, int extra) | - | ||||||||||||
| 64 | { | - | ||||||||||||
| 65 | data.reserve(data.size() + extra); | - | ||||||||||||
| 66 | } executed 7564 times by 5 tests: end of blockExecuted by:
| 7564 | ||||||||||||
| 67 | - | |||||||||||||
| 68 | static 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: rv;return rv;Executed by:
executed 12484 times by 5 tests: return rv;Executed by:
| 12484 | ||||||||||||
| 73 | } | - | ||||||||||||
| 74 | - | |||||||||||||
| 75 | static 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: rv;return rv;Executed by:
executed 126 times by 3 tests: return rv;Executed by:
| 126 | ||||||||||||
| 80 | } | - | ||||||||||||
| 81 | - | |||||||||||||
| 82 | static 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: rv;return rv;Executed by:
executed 928 times by 2 tests: return rv;Executed by:
| 928 | ||||||||||||
| 87 | } | - | ||||||||||||
| 88 | - | |||||||||||||
| 89 | - | |||||||||||||
| 90 | - | |||||||||||||
| 91 | - | |||||||||||||
| 92 | - | |||||||||||||
| 93 | void Serialize::serialize(QByteArray &data, const QV4::Value &v, ExecutionEngine *engine) | - | ||||||||||||
| 94 | { | - | ||||||||||||
| 95 | QV4::Scope scope(engine); | - | ||||||||||||
| 96 | - | |||||||||||||
| 97 | if (v.isEmpty()
| 0-11872 | ||||||||||||
| 98 | ((!"Serialize: got empty value") ? static_cast<void>(0) : qt_assert("!\"Serialize: got empty value\"", __FILE__, 162)); | - | ||||||||||||
| 99 | } never executed: else if (v.isUndefined()end of block
| 0-11412 | ||||||||||||
| 100 | push(data, valueheader(WorkerUndefined)); | - | ||||||||||||
| 101 | } executed 460 times by 2 tests: else if (v.isNull()end of blockExecuted by:
| 56-11356 | ||||||||||||
| 102 | push(data, valueheader(WorkerNull)); | - | ||||||||||||
| 103 | } executed 56 times by 1 test: else if (v.isBoolean()end of blockExecuted by:
| 56-10370 | ||||||||||||
| 104 | push(data, valueheader(v.booleanValue() == true ? WorkerTrue : WorkerFalse)); | - | ||||||||||||
| 105 | } executed 986 times by 3 tests: else if (v.isString()end of blockExecuted by:
| 986-5888 | ||||||||||||
| 106 | const QString &qstr = v.toQString(); | - | ||||||||||||
| 107 | int length = qstr.length(); | - | ||||||||||||
| 108 | if (length > 0xFFFFFF
| 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: else if (v.as<FunctionObject>()end of blockExecuted by:
| 0-5888 | ||||||||||||
| 123 | - | |||||||||||||
| 124 | - | |||||||||||||
| 125 | push(data, valueheader(WorkerUndefined)); | - | ||||||||||||
| 126 | } never executed: else if (constend of block
| 0-3624 | ||||||||||||
| 127 | uint length = array->getLength(); | - | ||||||||||||
| 128 | if (length > 0xFFFFFF
| 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
| 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:
| 2046 | ||||||||||||
| 137 | } executed 858 times by 3 tests: else if (v.isInteger()end of blockExecuted by:
| 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: else if (v.isNumber()end of blockExecuted by:
| 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: else if (constend of blockExecuted by:
| 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: else if (constend of blockExecuted by:
| 4-2874 | ||||||||||||
| 154 | quint32 flags = re->flags(); | - | ||||||||||||
| 155 | QString pattern = re->source(); | - | ||||||||||||
| 156 | int length = pattern.length() + 1; | - | ||||||||||||
| 157 | if (length > 0xFFFFFF
| 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: else if (constend of blockExecuted by:
| 4-1940 | ||||||||||||
| 173 | - | |||||||||||||
| 174 | - | |||||||||||||
| 175 | - | |||||||||||||
| 176 | QQmlListModel *lm = qobject_cast<QQmlListModel *>(qobjectWrapper->object()); | - | ||||||||||||
| 177 | if (lm
| 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:
| 928 | ||||||||||||
| 183 | } | - | ||||||||||||
| 184 | - | |||||||||||||
| 185 | - | |||||||||||||
| 186 | - | |||||||||||||
| 187 | - | |||||||||||||
| 188 | push(data, valueheader(WorkerUndefined)); | - | ||||||||||||
| 189 | } executed 6 times by 1 test: else if (constend of blockExecuted by:
| 0-1940 | ||||||||||||
| 190 | - | |||||||||||||
| 191 | if (o->isListType()
| 68-1872 | ||||||||||||
| 192 | - | |||||||||||||
| 193 | uint seqLength = ScopedValue(scope, o->get(engine->id_length()))->toUInt32(); | - | ||||||||||||
| 194 | uint length = seqLength + 1; | - | ||||||||||||
| 195 | if (length > 0xFFFFFF
| 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
| 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:
| 188 | ||||||||||||
| 205 | - | |||||||||||||
| 206 | return; executed 68 times by 2 tests: return;Executed by:
| 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
| 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
| 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()
| 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 blockExecuted by:
| 3706 | ||||||||||||
| 232 | return; executed 1872 times by 4 tests: return;Executed by:
| 1872 | ||||||||||||
| 233 | } else { | - | ||||||||||||
| 234 | push(data, valueheader(WorkerUndefined)); | - | ||||||||||||
| 235 | } never executed: end of block | 0 | ||||||||||||
| 236 | } | - | ||||||||||||
| 237 | - | |||||||||||||
| 238 | ReturnedValue 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: WorkerUndefined:case WorkerUndefined:Executed by:
executed 466 times by 2 tests: case WorkerUndefined:Executed by:
| 466 | ||||||||||||
| 247 | return executed 466 times by 2 tests: QV4::Encode::undefined();return QV4::Encode::undefined();Executed by:
executed 466 times by 2 tests: return QV4::Encode::undefined();Executed by:
| 466 | ||||||||||||
| 248 | case executed 56 times by 1 test: WorkerNull:case WorkerNull:Executed by:
executed 56 times by 1 test: case WorkerNull:Executed by:
| 56 | ||||||||||||
| 249 | return executed 56 times by 1 test: QV4::Encode::null();return QV4::Encode::null();Executed by:
executed 56 times by 1 test: return QV4::Encode::null();Executed by:
| 56 | ||||||||||||
| 250 | case executed 966 times by 3 tests: WorkerTrue:case WorkerTrue:Executed by:
executed 966 times by 3 tests: case WorkerTrue:Executed by:
| 966 | ||||||||||||
| 251 | return executed 966 times by 3 tests: QV4::Encode(true);return QV4::Encode(true);Executed by:
executed 966 times by 3 tests: return QV4::Encode(true);Executed by:
| 966 | ||||||||||||
| 252 | case executed 16 times by 1 test: WorkerFalse:case WorkerFalse:Executed by:
executed 16 times by 1 test: case WorkerFalse:Executed by:
| 16 | ||||||||||||
| 253 | return executed 16 times by 1 test: QV4::Encode(false);return QV4::Encode(false);Executed by:
executed 16 times by 1 test: return QV4::Encode(false);Executed by:
| 16 | ||||||||||||
| 254 | case executed 5884 times by 5 tests: WorkerString:case WorkerString:Executed by:
executed 5884 times by 5 tests: case WorkerString:Executed by:
| 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: QV4::Encode(engine->newString(qstr));return QV4::Encode(engine->newString(qstr));Executed by:
executed 5884 times by 5 tests: return QV4::Encode(engine->newString(qstr));Executed by:
| 5884 | ||||||||||||
| 260 | } | - | ||||||||||||
| 261 | case never executed: WorkerFunction:case 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: WorkerArray:case WorkerArray:Executed by:
executed 858 times by 3 tests: case WorkerArray:Executed by:
| 858 | ||||||||||||
| 265 | { | - | ||||||||||||
| 266 | quint32 size = headersize(header); | - | ||||||||||||
| 267 | ScopedArrayObject a(scope, engine->newArrayObject()); | - | ||||||||||||
| 268 | ScopedValue v(scope); | - | ||||||||||||
| 269 | for (quint32 ii = 0; ii < size
| 858-2046 | ||||||||||||
| 270 | v = deserialize(data, engine); | - | ||||||||||||
| 271 | a->put(ii, v); | - | ||||||||||||
| 272 | } executed 2046 times by 3 tests: end of blockExecuted by:
| 2046 | ||||||||||||
| 273 | return executed 858 times by 3 tests: a.asReturnedValue();return a.asReturnedValue();Executed by:
executed 858 times by 3 tests: return a.asReturnedValue();Executed by:
| 858 | ||||||||||||
| 274 | } | - | ||||||||||||
| 275 | case executed 1868 times by 4 tests: WorkerObject:case WorkerObject:Executed by:
executed 1868 times by 4 tests: case WorkerObject:Executed by:
| 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
| 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 blockExecuted by:
| 3702 | ||||||||||||
| 288 | return executed 1868 times by 4 tests: o.asReturnedValue();return o.asReturnedValue();Executed by:
executed 1868 times by 4 tests: return o.asReturnedValue();Executed by:
| 1868 | ||||||||||||
| 289 | } | - | ||||||||||||
| 290 | case executed 620 times by 3 tests: WorkerInt32:case WorkerInt32:Executed by:
executed 620 times by 3 tests: case WorkerInt32:Executed by:
| 620 | ||||||||||||
| 291 | return executed 620 times by 3 tests: QV4::Encode((qint32)popUint32(data));return QV4::Encode((qint32)popUint32(data));Executed by:
executed 620 times by 3 tests: return QV4::Encode((qint32)popUint32(data));Executed by:
| 620 | ||||||||||||
| 292 | case never executed: WorkerUint32:case WorkerUint32:never executed: case WorkerUint32: | 0 | ||||||||||||
| 293 | return never executed: QV4::Encode(popUint32(data));return QV4::Encode(popUint32(data));never executed: return QV4::Encode(popUint32(data)); | 0 | ||||||||||||
| 294 | case executed 122 times by 3 tests: WorkerNumber:case WorkerNumber:Executed by:
executed 122 times by 3 tests: case WorkerNumber:Executed by:
| 122 | ||||||||||||
| 295 | return executed 122 times by 3 tests: QV4::Encode(popDouble(data));return QV4::Encode(popDouble(data));Executed by:
executed 122 times by 3 tests: return QV4::Encode(popDouble(data));Executed by:
| 122 | ||||||||||||
| 296 | case executed 4 times by 1 test: WorkerDate:case WorkerDate:Executed by:
executed 4 times by 1 test: case WorkerDate:Executed by:
| 4 | ||||||||||||
| 297 | return executed 4 times by 1 test: QV4::Encode(engine->newDateObject(QV4::Primitive::fromDouble(popDouble(data))));return QV4::Encode(engine->newDateObject(QV4::Primitive::fromDouble(popDouble(data))));Executed by:
executed 4 times by 1 test: return QV4::Encode(engine->newDateObject(QV4::Primitive::fromDouble(popDouble(data))));Executed by:
| 4 | ||||||||||||
| 298 | case executed 4 times by 1 test: WorkerRegexp:case WorkerRegexp:Executed by:
executed 4 times by 1 test: case WorkerRegexp:Executed by:
| 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: Encode(engine->newRegExpObject(pattern, flags));return Encode(engine->newRegExpObject(pattern, flags));Executed by:
executed 4 times by 1 test: return Encode(engine->newRegExpObject(pattern, flags));Executed by:
| 4 | ||||||||||||
| 305 | } | - | ||||||||||||
| 306 | - | |||||||||||||
| 307 | case executed 928 times by 2 tests: WorkerListModel:case WorkerListModel:Executed by:
executed 928 times by 2 tests: case WorkerListModel:Executed by:
| 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: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 928 times by 2 tests: }())));return qstring_literal_temp;Executed by:
| 928 | ||||||||||||
| 317 | rv->as<Object>()->defineReadonlyProperty(s, v); | - | ||||||||||||
| 318 | - | |||||||||||||
| 319 | agent->release(); | - | ||||||||||||
| 320 | agent->setEngine(engine); | - | ||||||||||||
| 321 | return executed 928 times by 2 tests: rv->asReturnedValue();return rv->asReturnedValue();Executed by:
executed 928 times by 2 tests: return rv->asReturnedValue();Executed by:
| 928 | ||||||||||||
| 322 | } | - | ||||||||||||
| 323 | - | |||||||||||||
| 324 | - | |||||||||||||
| 325 | case executed 68 times by 2 tests: WorkerSequence:case WorkerSequence:Executed by:
executed 68 times by 2 tests: case WorkerSequence:Executed by:
| 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
| 68-188 | ||||||||||||
| 336 | value = deserialize(data, engine); | - | ||||||||||||
| 337 | array->arrayPut(ii, value); | - | ||||||||||||
| 338 | } executed 188 times by 2 tests: end of blockExecuted by:
| 188 | ||||||||||||
| 339 | array->setArrayLengthUnchecked(seqLength); | - | ||||||||||||
| 340 | QVariant seqVariant = QV4::SequencePrototype::toVariant(array, sequenceType, &succeeded); | - | ||||||||||||
| 341 | return executed 68 times by 2 tests: QV4::SequencePrototype::fromVariant(engine, seqVariant, &succeeded);return QV4::SequencePrototype::fromVariant(engine, seqVariant, &succeeded);Executed by:
executed 68 times by 2 tests: return QV4::SequencePrototype::fromVariant(engine, seqVariant, &succeeded);Executed by:
| 68 | ||||||||||||
| 342 | } | - | ||||||||||||
| 343 | - | |||||||||||||
| 344 | } | - | ||||||||||||
| 345 | ((!"Unreachable") ? static_cast<void>(0) : qt_assert("!\"Unreachable\"", __FILE__, 409)); | - | ||||||||||||
| 346 | return never executed: QV4::Encode::undefined();return QV4::Encode::undefined();never executed: return QV4::Encode::undefined(); | 0 | ||||||||||||
| 347 | } | - | ||||||||||||
| 348 | - | |||||||||||||
| 349 | QByteArray 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: rv;return rv;Executed by:
executed 2158 times by 5 tests: return rv;Executed by:
| 2158 | ||||||||||||
| 354 | } | - | ||||||||||||
| 355 | - | |||||||||||||
| 356 | ReturnedValue Serialize::deserialize(const QByteArray &data, ExecutionEngine *engine) | - | ||||||||||||
| 357 | { | - | ||||||||||||
| 358 | const char *stream = data.constData(); | - | ||||||||||||
| 359 | return executed 2154 times by 5 tests: deserialize(stream, engine);return deserialize(stream, engine);Executed by:
executed 2154 times by 5 tests: return deserialize(stream, engine);Executed by:
| 2154 | ||||||||||||
| 360 | } | - | ||||||||||||
| 361 | - | |||||||||||||
| 362 | - | |||||||||||||
| Switch to Source code | Preprocessed file |