| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4arraydata.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | using namespace QV4; | - | ||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | const QV4::VTable ArrayData::static_vtbl = { 0, (sizeof(ArrayData::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), (sizeof(ArrayData::Data) + (ArrayData::NInlineProperties*sizeof(QV4::Value)) + QV4::Chunk::SlotSize - 1)/QV4::Chunk::SlotSize*QV4::Chunk::SlotSize/sizeof(QV4::Value) - (sizeof(ArrayData::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), ArrayData::IsExecutionContext, ArrayData::IsString, ArrayData::IsObject, ArrayData::IsFunctionObject, ArrayData::IsErrorObject, ArrayData::IsArrayData, ArrayData::IsStringOrSymbol, ArrayData::MyType, { 0, 0, 0, 0 }, "ArrayData", ArrayData::virtualDestroy, ArrayData::Data::markObjects, ArrayData::virtualIsEqualTo, ArrayData::virtualGet, ArrayData::virtualPut, ArrayData::virtualDeleteProperty, ArrayData::virtualHasProperty, ArrayData::virtualGetOwnProperty, ArrayData::virtualDefineOwnProperty, ArrayData::virtualIsExtensible, ArrayData::virtualPreventExtensions, ArrayData::virtualGetPrototypeOf, ArrayData::virtualSetPrototypeOf, ArrayData::virtualGetLength, ArrayData::virtualAdvanceIterator, ArrayData::virtualInstanceOf, ArrayData::virtualCall, ArrayData::virtualCallAsConstructor, }; | - | ||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | const ArrayVTable SimpleArrayData::static_vtbl = | - | ||||||||||||||||||
| 8 | { | - | ||||||||||||||||||
| 9 | { nullptr, (sizeof(SimpleArrayData::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), (sizeof(SimpleArrayData::Data) + (SimpleArrayData::NInlineProperties*sizeof(QV4::Value)) + QV4::Chunk::SlotSize - 1)/QV4::Chunk::SlotSize*QV4::Chunk::SlotSize/sizeof(QV4::Value) - (sizeof(SimpleArrayData::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), SimpleArrayData::IsExecutionContext, SimpleArrayData::IsString, SimpleArrayData::IsObject, SimpleArrayData::IsFunctionObject, SimpleArrayData::IsErrorObject, SimpleArrayData::IsArrayData, SimpleArrayData::IsStringOrSymbol, SimpleArrayData::MyType, { 0, 0, 0, 0 }, "SimpleArrayData", SimpleArrayData::virtualDestroy, SimpleArrayData::Data::markObjects, SimpleArrayData::virtualIsEqualTo, SimpleArrayData::virtualGet, SimpleArrayData::virtualPut, SimpleArrayData::virtualDeleteProperty, SimpleArrayData::virtualHasProperty, SimpleArrayData::virtualGetOwnProperty, SimpleArrayData::virtualDefineOwnProperty, SimpleArrayData::virtualIsExtensible, SimpleArrayData::virtualPreventExtensions, SimpleArrayData::virtualGetPrototypeOf, SimpleArrayData::virtualSetPrototypeOf, SimpleArrayData::virtualGetLength, SimpleArrayData::virtualAdvanceIterator, SimpleArrayData::virtualInstanceOf, SimpleArrayData::virtualCall, SimpleArrayData::virtualCallAsConstructor, }, | - | ||||||||||||||||||
| 10 | Heap::ArrayData::Simple, | - | ||||||||||||||||||
| 11 | SimpleArrayData::reallocate, | - | ||||||||||||||||||
| 12 | SimpleArrayData::get, | - | ||||||||||||||||||
| 13 | SimpleArrayData::put, | - | ||||||||||||||||||
| 14 | SimpleArrayData::putArray, | - | ||||||||||||||||||
| 15 | SimpleArrayData::del, | - | ||||||||||||||||||
| 16 | SimpleArrayData::setAttribute, | - | ||||||||||||||||||
| 17 | SimpleArrayData::push_front, | - | ||||||||||||||||||
| 18 | SimpleArrayData::pop_front, | - | ||||||||||||||||||
| 19 | SimpleArrayData::truncate, | - | ||||||||||||||||||
| 20 | SimpleArrayData::length | - | ||||||||||||||||||
| 21 | }; | - | ||||||||||||||||||
| 22 | - | |||||||||||||||||||
| 23 | const ArrayVTable SparseArrayData::static_vtbl = | - | ||||||||||||||||||
| 24 | { | - | ||||||||||||||||||
| 25 | { nullptr, (sizeof(SparseArrayData::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), (sizeof(SparseArrayData::Data) + (SparseArrayData::NInlineProperties*sizeof(QV4::Value)) + QV4::Chunk::SlotSize - 1)/QV4::Chunk::SlotSize*QV4::Chunk::SlotSize/sizeof(QV4::Value) - (sizeof(SparseArrayData::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), SparseArrayData::IsExecutionContext, SparseArrayData::IsString, SparseArrayData::IsObject, SparseArrayData::IsFunctionObject, SparseArrayData::IsErrorObject, SparseArrayData::IsArrayData, SparseArrayData::IsStringOrSymbol, SparseArrayData::MyType, { 0, 0, 0, 0 }, "SparseArrayData", SparseArrayData::virtualDestroy, SparseArrayData::Data::markObjects, SparseArrayData::virtualIsEqualTo, SparseArrayData::virtualGet, SparseArrayData::virtualPut, SparseArrayData::virtualDeleteProperty, SparseArrayData::virtualHasProperty, SparseArrayData::virtualGetOwnProperty, SparseArrayData::virtualDefineOwnProperty, SparseArrayData::virtualIsExtensible, SparseArrayData::virtualPreventExtensions, SparseArrayData::virtualGetPrototypeOf, SparseArrayData::virtualSetPrototypeOf, SparseArrayData::virtualGetLength, SparseArrayData::virtualAdvanceIterator, SparseArrayData::virtualInstanceOf, SparseArrayData::virtualCall, SparseArrayData::virtualCallAsConstructor, }, | - | ||||||||||||||||||
| 26 | Heap::ArrayData::Sparse, | - | ||||||||||||||||||
| 27 | SparseArrayData::reallocate, | - | ||||||||||||||||||
| 28 | SparseArrayData::get, | - | ||||||||||||||||||
| 29 | SparseArrayData::put, | - | ||||||||||||||||||
| 30 | SparseArrayData::putArray, | - | ||||||||||||||||||
| 31 | SparseArrayData::del, | - | ||||||||||||||||||
| 32 | SparseArrayData::setAttribute, | - | ||||||||||||||||||
| 33 | SparseArrayData::push_front, | - | ||||||||||||||||||
| 34 | SparseArrayData::pop_front, | - | ||||||||||||||||||
| 35 | SparseArrayData::truncate, | - | ||||||||||||||||||
| 36 | SparseArrayData::length | - | ||||||||||||||||||
| 37 | }; | - | ||||||||||||||||||
| 38 | - | |||||||||||||||||||
| 39 | static_assert(bool(sizeof(Heap::ArrayData) == sizeof(Heap::SimpleArrayData)), "sizeof(Heap::ArrayData) == sizeof(Heap::SimpleArrayData)"); | - | ||||||||||||||||||
| 40 | static_assert(bool(sizeof(Heap::ArrayData) == sizeof(Heap::SparseArrayData)), "sizeof(Heap::ArrayData) == sizeof(Heap::SparseArrayData)"); | - | ||||||||||||||||||
| 41 | - | |||||||||||||||||||
| 42 | void Heap::ArrayData::markObjects(Heap::Base *base, MarkStack *stack) | - | ||||||||||||||||||
| 43 | { | - | ||||||||||||||||||
| 44 | ArrayData *a = static_cast<ArrayData *>(base); | - | ||||||||||||||||||
| 45 | a->values.mark(stack); | - | ||||||||||||||||||
| 46 | } executed 13121 times by 11 tests: end of blockExecuted by:
| 13121 | ||||||||||||||||||
| 47 | - | |||||||||||||||||||
| 48 | - | |||||||||||||||||||
| 49 | void ArrayData::realloc(Object *o, Type newType, uint requested, bool enforceAttributes) | - | ||||||||||||||||||
| 50 | { | - | ||||||||||||||||||
| 51 | Scope scope(o->engine()); | - | ||||||||||||||||||
| 52 | Scoped<ArrayData> d(scope, o->arrayData()); | - | ||||||||||||||||||
| 53 | - | |||||||||||||||||||
| 54 | uint alloc = 8; | - | ||||||||||||||||||
| 55 | uint toCopy = 0; | - | ||||||||||||||||||
| 56 | uint offset = 0; | - | ||||||||||||||||||
| 57 | - | |||||||||||||||||||
| 58 | if (d
| 22063-71822 | ||||||||||||||||||
| 59 | bool hasAttrs = d->attrs(); | - | ||||||||||||||||||
| 60 | enforceAttributes |= hasAttrs; | - | ||||||||||||||||||
| 61 | - | |||||||||||||||||||
| 62 | if (requested <= d->alloc()
| 823-13353 | ||||||||||||||||||
| 63 | return; executed 7193 times by 7 tests: return;Executed by:
| 7193 | ||||||||||||||||||
| 64 | if (alloc < d->alloc()
| 2280-12598 | ||||||||||||||||||
| 65 | alloc = d->alloc(); executed 2280 times by 7 tests: alloc = d->alloc();Executed by:
| 2280 | ||||||||||||||||||
| 66 | - | |||||||||||||||||||
| 67 | if (d->type() < Heap::ArrayData::Sparse
| 5211-9663 | ||||||||||||||||||
| 68 | offset = d->d()->offset; | - | ||||||||||||||||||
| 69 | toCopy = d->d()->values.size; | - | ||||||||||||||||||
| 70 | } executed 9668 times by 12 tests: else {end of blockExecuted by:
| 9668 | ||||||||||||||||||
| 71 | toCopy = d->alloc(); | - | ||||||||||||||||||
| 72 | } executed 5211 times by 1 test: end of blockExecuted by:
| 5211 | ||||||||||||||||||
| 73 | if (d->type() > newType
| 2631-12250 | ||||||||||||||||||
| 74 | newType = d->type(); executed 2631 times by 1 test: newType = d->type();Executed by:
| 2631 | ||||||||||||||||||
| 75 | } executed 14875 times by 12 tests: end of blockExecuted by:
| 14875 | ||||||||||||||||||
| 76 | if (enforceAttributes
| 822-80174 | ||||||||||||||||||
| 77 | newType = Heap::ArrayData::Complex; executed 818 times by 1 test: newType = Heap::ArrayData::Complex;Executed by:
| 818 | ||||||||||||||||||
| 78 | - | |||||||||||||||||||
| 79 | while (alloc < requested
| 10480-86694 | ||||||||||||||||||
| 80 | alloc *= 2; executed 10482 times by 13 tests: alloc *= 2;Executed by:
| 10482 | ||||||||||||||||||
| 81 | size_t size = sizeof(Heap::ArrayData) + (alloc - 1)*sizeof(Value); | - | ||||||||||||||||||
| 82 | if (enforceAttributes
| 6516-80185 | ||||||||||||||||||
| 83 | size += alloc*sizeof(PropertyAttributes); executed 6521 times by 1 test: size += alloc*sizeof(PropertyAttributes);Executed by:
| 6521 | ||||||||||||||||||
| 84 | - | |||||||||||||||||||
| 85 | Scoped<ArrayData> newData(scope); | - | ||||||||||||||||||
| 86 | if (newType < Heap::ArrayData::Sparse
| 8394-78286 | ||||||||||||||||||
| 87 | Heap::SimpleArrayData *n = scope.engine->memoryManager->allocManaged<SimpleArrayData>(size); | - | ||||||||||||||||||
| 88 | n->init(); | - | ||||||||||||||||||
| 89 | n->offset = 0; | - | ||||||||||||||||||
| 90 | n->values.size = d
| 6951-71343 | ||||||||||||||||||
| 91 | newData = n; | - | ||||||||||||||||||
| 92 | } executed 78312 times by 51 tests: else {end of blockExecuted by:
| 78312 | ||||||||||||||||||
| 93 | Heap::SparseArrayData *n = scope.engine->memoryManager->allocManaged<SparseArrayData>(size); | - | ||||||||||||||||||
| 94 | n->init(); | - | ||||||||||||||||||
| 95 | newData = n; | - | ||||||||||||||||||
| 96 | } executed 8404 times by 2 tests: end of blockExecuted by:
| 8404 | ||||||||||||||||||
| 97 | newData->setAlloc(alloc); | - | ||||||||||||||||||
| 98 | newData->setType(newType); | - | ||||||||||||||||||
| 99 | newData->setAttrs(enforceAttributes ? reinterpret_cast<PropertyAttributes *>(newData->d()->values.values + alloc) : nullptr); | - | ||||||||||||||||||
| 100 | o->setArrayData(newData); | - | ||||||||||||||||||
| 101 | - | |||||||||||||||||||
| 102 | if (d
| 14888-71885 | ||||||||||||||||||
| 103 | if (enforceAttributes
| 6079-8807 | ||||||||||||||||||
| 104 | if (d->attrs()
| 2649-3434 | ||||||||||||||||||
| 105 | memcpy(newData->attrs(), d->attrs(), sizeof(PropertyAttributes)*toCopy); executed 2649 times by 1 test: memcpy(newData->attrs(), d->attrs(), sizeof(PropertyAttributes)*toCopy);Executed by:
| 2649 | ||||||||||||||||||
| 106 | else | - | ||||||||||||||||||
| 107 | for (uint i = 0; i < toCopy
| 3426-25822 | ||||||||||||||||||
| 108 | newData->attrs()[i] = Attr_Data; executed 25820 times by 1 test: newData->attrs()[i] = Attr_Data;Executed by:
| 25820 | ||||||||||||||||||
| 109 | } executed 6072 times by 1 test: end of blockExecuted by:
| 6072 | ||||||||||||||||||
| 110 | - | |||||||||||||||||||
| 111 | if (toCopy > d->d()->values.alloc - offset
| 24-14861 | ||||||||||||||||||
| 112 | uint copyFromStart = toCopy - (d->d()->values.alloc - offset); | - | ||||||||||||||||||
| 113 | - | |||||||||||||||||||
| 114 | memcpy(newData->d()->values.values + toCopy - copyFromStart, d->d()->values.values, sizeof(Value)*copyFromStart); | - | ||||||||||||||||||
| 115 | toCopy -= copyFromStart; | - | ||||||||||||||||||
| 116 | } executed 24 times by 1 test: end of blockExecuted by:
| 24 | ||||||||||||||||||
| 117 | - | |||||||||||||||||||
| 118 | memcpy(newData->d()->values.values, d->d()->values.values + offset, sizeof(Value)*toCopy); | - | ||||||||||||||||||
| 119 | } executed 14871 times by 12 tests: end of blockExecuted by:
| 14871 | ||||||||||||||||||
| 120 | - | |||||||||||||||||||
| 121 | if (newType != Heap::ArrayData::Sparse
| 8403-78282 | ||||||||||||||||||
| 122 | return; executed 78280 times by 51 tests: return;Executed by:
| 78280 | ||||||||||||||||||
| 123 | - | |||||||||||||||||||
| 124 | Heap::SparseArrayData *sparse = static_cast<Heap::SparseArrayData *>(newData->d()); | - | ||||||||||||||||||
| 125 | - | |||||||||||||||||||
| 126 | Value *lastFree; | - | ||||||||||||||||||
| 127 | if (d && d->type() == Heap::ArrayData::Sparse
| 2718-5213 | ||||||||||||||||||
| 128 | Heap::SparseArrayData *old = static_cast<Heap::SparseArrayData *>(d->d()); | - | ||||||||||||||||||
| 129 | sparse->sparse = old->sparse; | - | ||||||||||||||||||
| 130 | old->sparse = nullptr; | - | ||||||||||||||||||
| 131 | lastFree = &sparse->sparse->freeList; | - | ||||||||||||||||||
| 132 | } executed 5215 times by 1 test: else {end of blockExecuted by:
| 5215 | ||||||||||||||||||
| 133 | sparse->sparse = new SparseArray; | - | ||||||||||||||||||
| 134 | lastFree = &sparse->sparse->freeList; | - | ||||||||||||||||||
| 135 | *lastFree = Encode(0); | - | ||||||||||||||||||
| 136 | for (uint i = 0; i < toCopy
| 3183-21077 | ||||||||||||||||||
| 137 | if (!sparse->values[i].isEmpty()
| 2563-18514 | ||||||||||||||||||
| 138 | SparseArrayNode *n = sparse->sparse->insert(i); | - | ||||||||||||||||||
| 139 | n->value = i; | - | ||||||||||||||||||
| 140 | } executed 2565 times by 1 test: else {end of blockExecuted by:
| 2565 | ||||||||||||||||||
| 141 | *lastFree = Encode(i); | - | ||||||||||||||||||
| 142 | sparse->values.values[i].setEmpty(); | - | ||||||||||||||||||
| 143 | lastFree = &sparse->values.values[i]; | - | ||||||||||||||||||
| 144 | } executed 18516 times by 1 test: end of blockExecuted by:
| 18516 | ||||||||||||||||||
| 145 | } | - | ||||||||||||||||||
| 146 | } executed 3183 times by 2 tests: end of blockExecuted by:
| 3183 | ||||||||||||||||||
| 147 | - | |||||||||||||||||||
| 148 | if (toCopy < sparse->values.alloc
| 2609-5790 | ||||||||||||||||||
| 149 | for (uint i = toCopy; i < sparse->values.alloc
| 5801-4237763 | ||||||||||||||||||
| 150 | *lastFree = Encode(i); | - | ||||||||||||||||||
| 151 | sparse->values.values[i].setEmpty(); | - | ||||||||||||||||||
| 152 | lastFree = &sparse->values.values[i]; | - | ||||||||||||||||||
| 153 | } executed 4237749 times by 2 tests: end of blockExecuted by:
| 4237749 | ||||||||||||||||||
| 154 | } executed 5804 times by 2 tests: end of blockExecuted by:
| 5804 | ||||||||||||||||||
| 155 | *lastFree = Encode(-1); | - | ||||||||||||||||||
| 156 | - | |||||||||||||||||||
| 157 | ((sparse->sparse->freeList.isInteger()) ? static_cast<void>(0) : qt_assert("sparse->sparse->freeList.isInteger()", __FILE__, 202)); | - | ||||||||||||||||||
| 158 | - | |||||||||||||||||||
| 159 | } executed 8406 times by 2 tests: end of blockExecuted by:
| 8406 | ||||||||||||||||||
| 160 | - | |||||||||||||||||||
| 161 | Heap::ArrayData *SimpleArrayData::reallocate(Object *o, uint n, bool enforceAttributes) | - | ||||||||||||||||||
| 162 | { | - | ||||||||||||||||||
| 163 | realloc(o, Heap::ArrayData::Simple, n, enforceAttributes); | - | ||||||||||||||||||
| 164 | return executed 5858 times by 8 tests: o->arrayData();return o->arrayData();Executed by:
executed 5858 times by 8 tests: return o->arrayData();Executed by:
| 5858 | ||||||||||||||||||
| 165 | } | - | ||||||||||||||||||
| 166 | - | |||||||||||||||||||
| 167 | void ArrayData::ensureAttributes(Object *o) | - | ||||||||||||||||||
| 168 | { | - | ||||||||||||||||||
| 169 | if (o->arrayData()
| 0-5987 | ||||||||||||||||||
| 170 | return; executed 2572 times by 1 test: return;Executed by:
| 2572 | ||||||||||||||||||
| 171 | - | |||||||||||||||||||
| 172 | ArrayData::realloc(o, Heap::ArrayData::Simple, 0, true); | - | ||||||||||||||||||
| 173 | } executed 3415 times by 1 test: end of blockExecuted by:
| 3415 | ||||||||||||||||||
| 174 | - | |||||||||||||||||||
| 175 | ReturnedValue SimpleArrayData::get(const Heap::ArrayData *d, uint index) | - | ||||||||||||||||||
| 176 | { | - | ||||||||||||||||||
| 177 | const Heap::SimpleArrayData *dd = static_cast<const Heap::SimpleArrayData *>(d); | - | ||||||||||||||||||
| 178 | if (index >= dd->values.size
| 8454-70340 | ||||||||||||||||||
| 179 | return executed 70338 times by 16 tests: Primitive::emptyValue().asReturnedValue();return Primitive::emptyValue().asReturnedValue();Executed by:
executed 70338 times by 16 tests: return Primitive::emptyValue().asReturnedValue();Executed by:
| 70338 | ||||||||||||||||||
| 180 | return executed 8454 times by 1 test: dd->data(index).asReturnedValue();return dd->data(index).asReturnedValue();Executed by:
executed 8454 times by 1 test: return dd->data(index).asReturnedValue();Executed by:
| 8454 | ||||||||||||||||||
| 181 | } | - | ||||||||||||||||||
| 182 | - | |||||||||||||||||||
| 183 | bool SimpleArrayData::put(Object *o, uint index, const Value &value) | - | ||||||||||||||||||
| 184 | { | - | ||||||||||||||||||
| 185 | Heap::SimpleArrayData *dd = o->d()->arrayData.cast<Heap::SimpleArrayData>(); | - | ||||||||||||||||||
| 186 | ((index >= dd->values.size || !dd->attrs || !dd->attrs[index].isAccessor()) ? static_cast<void>(0) : qt_assert("index >= dd->values.size || !dd->attrs || !dd->attrs[index].isAccessor()", __FILE__, 231)); | - | ||||||||||||||||||
| 187 | - | |||||||||||||||||||
| 188 | dd->setData(o->engine(), index, value); | - | ||||||||||||||||||
| 189 | if (index >= dd->values.size
| 0-21288 | ||||||||||||||||||
| 190 | if (dd->attrs
| 0-21308 | ||||||||||||||||||
| 191 | dd->attrs[index] = Attr_Data; never executed: dd->attrs[index] = Attr_Data; | 0 | ||||||||||||||||||
| 192 | dd->values.size = index + 1; | - | ||||||||||||||||||
| 193 | } executed 21292 times by 19 tests: end of blockExecuted by:
| 21292 | ||||||||||||||||||
| 194 | return executed 21301 times by 19 tests: true;return true;Executed by:
executed 21301 times by 19 tests: return true;Executed by:
| 21301 | ||||||||||||||||||
| 195 | } | - | ||||||||||||||||||
| 196 | - | |||||||||||||||||||
| 197 | bool SimpleArrayData::del(Object *o, uint index) | - | ||||||||||||||||||
| 198 | { | - | ||||||||||||||||||
| 199 | Heap::SimpleArrayData *dd = o->d()->arrayData.cast<Heap::SimpleArrayData>(); | - | ||||||||||||||||||
| 200 | if (index >= dd->values.size
| 16-1626 | ||||||||||||||||||
| 201 | return executed 16 times by 1 test: true;return true;Executed by:
executed 16 times by 1 test: return true;Executed by:
| 16 | ||||||||||||||||||
| 202 | - | |||||||||||||||||||
| 203 | if (!dd->attrs
| 82-1202 | ||||||||||||||||||
| 204 | dd->setData(o->engine(), index, Primitive::emptyValue()); | - | ||||||||||||||||||
| 205 | if (dd->attrs
| 82-1205 | ||||||||||||||||||
| 206 | dd->attrs[index] = Attr_Data; executed 82 times by 1 test: dd->attrs[index] = Attr_Data;Executed by:
| 82 | ||||||||||||||||||
| 207 | return executed 1285 times by 7 tests: true;return true;Executed by:
executed 1285 times by 7 tests: return true;Executed by:
| 1285 | ||||||||||||||||||
| 208 | } | - | ||||||||||||||||||
| 209 | if (dd->data(index).isEmpty()
| 0-342 | ||||||||||||||||||
| 210 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||
| 211 | return executed 342 times by 1 test: false;return false;Executed by:
executed 342 times by 1 test: return false;Executed by:
| 342 | ||||||||||||||||||
| 212 | } | - | ||||||||||||||||||
| 213 | - | |||||||||||||||||||
| 214 | void SimpleArrayData::setAttribute(Object *o, uint index, PropertyAttributes attrs) | - | ||||||||||||||||||
| 215 | { | - | ||||||||||||||||||
| 216 | o->arrayData()->attrs[index] = attrs; | - | ||||||||||||||||||
| 217 | } executed 866 times by 1 test: end of blockExecuted by:
| 866 | ||||||||||||||||||
| 218 | - | |||||||||||||||||||
| 219 | void SimpleArrayData::push_front(Object *o, const Value *values, uint n) | - | ||||||||||||||||||
| 220 | { | - | ||||||||||||||||||
| 221 | Heap::SimpleArrayData *dd = o->d()->arrayData.cast<Heap::SimpleArrayData>(); | - | ||||||||||||||||||
| 222 | ((!dd->attrs) ? static_cast<void>(0) : qt_assert("!dd->attrs", __FILE__, 267)); | - | ||||||||||||||||||
| 223 | if (dd->values.size + n > dd->values.alloc
| 16-20060 | ||||||||||||||||||
| 224 | realloc(o, Heap::ArrayData::Simple, dd->values.size + n, false); | - | ||||||||||||||||||
| 225 | ((o->d()->arrayData->type == Heap::ArrayData::Simple) ? static_cast<void>(0) : qt_assert("o->d()->arrayData->type == Heap::ArrayData::Simple", __FILE__, 270)); | - | ||||||||||||||||||
| 226 | dd = o->d()->arrayData.cast<Heap::SimpleArrayData>(); | - | ||||||||||||||||||
| 227 | } executed 16 times by 3 tests: end of blockExecuted by:
| 16 | ||||||||||||||||||
| 228 | if (n <= dd->offset
| 54-20022 | ||||||||||||||||||
| 229 | dd->offset -= n; | - | ||||||||||||||||||
| 230 | } executed 20022 times by 2 tests: else {end of blockExecuted by:
| 20022 | ||||||||||||||||||
| 231 | - | |||||||||||||||||||
| 232 | dd->offset = dd->values.alloc - | - | ||||||||||||||||||
| 233 | (n - dd->offset); | - | ||||||||||||||||||
| 234 | } executed 54 times by 4 tests: end of blockExecuted by:
| 54 | ||||||||||||||||||
| 235 | dd->values.size += n; | - | ||||||||||||||||||
| 236 | for (uint i = 0; i < n
| 20052-20076 | ||||||||||||||||||
| 237 | dd->setData(o->engine(), i, values[i]); executed 20052 times by 4 tests: dd->setData(o->engine(), i, values[i]);Executed by:
| 20052 | ||||||||||||||||||
| 238 | } executed 20076 times by 4 tests: end of blockExecuted by:
| 20076 | ||||||||||||||||||
| 239 | - | |||||||||||||||||||
| 240 | ReturnedValue SimpleArrayData::pop_front(Object *o) | - | ||||||||||||||||||
| 241 | { | - | ||||||||||||||||||
| 242 | Heap::SimpleArrayData *dd = o->d()->arrayData.cast<Heap::SimpleArrayData>(); | - | ||||||||||||||||||
| 243 | ((!dd->attrs) ? static_cast<void>(0) : qt_assert("!dd->attrs", __FILE__, 288)); | - | ||||||||||||||||||
| 244 | if (!dd->values.size
| 8-122 | ||||||||||||||||||
| 245 | return executed 8 times by 1 test: Encode::undefined();return Encode::undefined();Executed by:
executed 8 times by 1 test: return Encode::undefined();Executed by:
| 8 | ||||||||||||||||||
| 246 | - | |||||||||||||||||||
| 247 | ReturnedValue v = dd->data(0).isEmpty()
| 8-114 | ||||||||||||||||||
| 248 | dd->offset = (dd->offset + 1) % dd->values.alloc; | - | ||||||||||||||||||
| 249 | --dd->values.size; | - | ||||||||||||||||||
| 250 | return executed 122 times by 2 tests: v;return v;Executed by:
executed 122 times by 2 tests: return v;Executed by:
| 122 | ||||||||||||||||||
| 251 | } | - | ||||||||||||||||||
| 252 | - | |||||||||||||||||||
| 253 | uint SimpleArrayData::truncate(Object *o, uint newLen) | - | ||||||||||||||||||
| 254 | { | - | ||||||||||||||||||
| 255 | Heap::SimpleArrayData *dd = o->d()->arrayData.cast<Heap::SimpleArrayData>(); | - | ||||||||||||||||||
| 256 | if (dd->values.size < newLen
| 0-485 | ||||||||||||||||||
| 257 | return never executed: newLen;return newLen;never executed: return newLen; | 0 | ||||||||||||||||||
| 258 | - | |||||||||||||||||||
| 259 | if (!dd->attrs
| 68-417 | ||||||||||||||||||
| 260 | dd->values.size = newLen; | - | ||||||||||||||||||
| 261 | return executed 417 times by 7 tests: newLen;return newLen;Executed by:
executed 417 times by 7 tests: return newLen;Executed by:
| 417 | ||||||||||||||||||
| 262 | } | - | ||||||||||||||||||
| 263 | - | |||||||||||||||||||
| 264 | while (dd->values.size > newLen
| 4-92 | ||||||||||||||||||
| 265 | if (!dd->data(dd->values.size - 1).isEmpty()
| 0-92 | ||||||||||||||||||
| 266 | return executed 64 times by 1 test: dd->values.size;return dd->values.size;Executed by:
executed 64 times by 1 test: return dd->values.size;Executed by:
| 64 | ||||||||||||||||||
| 267 | --dd->values.size; | - | ||||||||||||||||||
| 268 | } executed 28 times by 1 test: end of blockExecuted by:
| 28 | ||||||||||||||||||
| 269 | return executed 4 times by 1 test: dd->values.size;return dd->values.size;Executed by:
executed 4 times by 1 test: return dd->values.size;Executed by:
| 4 | ||||||||||||||||||
| 270 | } | - | ||||||||||||||||||
| 271 | - | |||||||||||||||||||
| 272 | uint SimpleArrayData::length(const Heap::ArrayData *d) | - | ||||||||||||||||||
| 273 | { | - | ||||||||||||||||||
| 274 | return executed 270031 times by 17 tests: d->values.size;return d->values.size;Executed by:
executed 270031 times by 17 tests: return d->values.size;Executed by:
| 270031 | ||||||||||||||||||
| 275 | } | - | ||||||||||||||||||
| 276 | - | |||||||||||||||||||
| 277 | bool SimpleArrayData::putArray(Object *o, uint index, const Value *values, uint n) | - | ||||||||||||||||||
| 278 | { | - | ||||||||||||||||||
| 279 | Heap::SimpleArrayData *dd = o->d()->arrayData.cast<Heap::SimpleArrayData>(); | - | ||||||||||||||||||
| 280 | if (index + n > dd->values.alloc
| 5216-136023 | ||||||||||||||||||
| 281 | reallocate(o, index + n + 1, false); | - | ||||||||||||||||||
| 282 | dd = o->d()->arrayData.cast<Heap::SimpleArrayData>(); | - | ||||||||||||||||||
| 283 | } executed 5216 times by 8 tests: end of blockExecuted by:
| 5216 | ||||||||||||||||||
| 284 | QV4::ExecutionEngine *e = o->engine(); | - | ||||||||||||||||||
| 285 | for (uint i = dd->values.size; i < index
| 0-141239 | ||||||||||||||||||
| 286 | dd->setData(e, i, Primitive::emptyValue()); never executed: dd->setData(e, i, Primitive::emptyValue()); | 0 | ||||||||||||||||||
| 287 | for (uint i = 0; i < n
| 133485-141266 | ||||||||||||||||||
| 288 | dd->setData(e, index + i, values[i]); executed 133489 times by 17 tests: dd->setData(e, index + i, values[i]);Executed by:
| 133489 | ||||||||||||||||||
| 289 | dd->values.size = qMax(dd->values.size, index + n); | - | ||||||||||||||||||
| 290 | return executed 141253 times by 18 tests: true;return true;Executed by:
executed 141253 times by 18 tests: return true;Executed by:
| 141253 | ||||||||||||||||||
| 291 | } | - | ||||||||||||||||||
| 292 | - | |||||||||||||||||||
| 293 | void SparseArrayData::free(Heap::ArrayData *d, uint idx) | - | ||||||||||||||||||
| 294 | { | - | ||||||||||||||||||
| 295 | ((d && d->type == Heap::ArrayData::Sparse) ? static_cast<void>(0) : qt_assert("d && d->type == Heap::ArrayData::Sparse", __FILE__, 340)); | - | ||||||||||||||||||
| 296 | Value *v = d->values.values + idx; | - | ||||||||||||||||||
| 297 | if (d->attrs
| 8-885 | ||||||||||||||||||
| 298 | - | |||||||||||||||||||
| 299 | v[1] = d->sparse->freeList; | - | ||||||||||||||||||
| 300 | v[0] = Encode(idx + 1); | - | ||||||||||||||||||
| 301 | } executed 186 times by 1 test: else {end of blockExecuted by:
| 186 | ||||||||||||||||||
| 302 | *v = d->sparse->freeList; | - | ||||||||||||||||||
| 303 | } executed 707 times by 1 test: end of blockExecuted by:
| 707 | ||||||||||||||||||
| 304 | d->sparse->freeList = Encode(idx); | - | ||||||||||||||||||
| 305 | if (d->attrs
| 8-887 | ||||||||||||||||||
| 306 | d->attrs[idx].clear(); executed 887 times by 1 test: d->attrs[idx].clear();Executed by:
| 887 | ||||||||||||||||||
| 307 | } executed 895 times by 1 test: end of blockExecuted by:
| 895 | ||||||||||||||||||
| 308 | - | |||||||||||||||||||
| 309 | Heap::ArrayData *SparseArrayData::reallocate(Object *o, uint n, bool enforceAttributes) | - | ||||||||||||||||||
| 310 | { | - | ||||||||||||||||||
| 311 | realloc(o, Heap::ArrayData::Sparse, n, enforceAttributes); | - | ||||||||||||||||||
| 312 | return executed 2629 times by 1 test: o->arrayData();return o->arrayData();Executed by:
executed 2629 times by 1 test: return o->arrayData();Executed by:
| 2629 | ||||||||||||||||||
| 313 | } | - | ||||||||||||||||||
| 314 | - | |||||||||||||||||||
| 315 | - | |||||||||||||||||||
| 316 | uint SparseArrayData::allocate(Object *o, bool doubleSlot) | - | ||||||||||||||||||
| 317 | { | - | ||||||||||||||||||
| 318 | ((o->d()->arrayData->type == Heap::ArrayData::Sparse) ? static_cast<void>(0) : qt_assert("o->d()->arrayData->type == Heap::ArrayData::Sparse", __FILE__, 363)); | - | ||||||||||||||||||
| 319 | Heap::SimpleArrayData *dd = o->d()->arrayData.cast<Heap::SimpleArrayData>(); | - | ||||||||||||||||||
| 320 | if (doubleSlot
| 835-3548 | ||||||||||||||||||
| 321 | Value *last = &dd->sparse->freeList; | - | ||||||||||||||||||
| 322 | while (1) { | - | ||||||||||||||||||
| 323 | if (last->int_32() == -1
| 1504-2579 | ||||||||||||||||||
| 324 | reallocate(o, dd->values.alloc + 2, true); | - | ||||||||||||||||||
| 325 | dd = o->d()->arrayData.cast<Heap::SimpleArrayData>(); | - | ||||||||||||||||||
| 326 | last = &dd->sparse->freeList; | - | ||||||||||||||||||
| 327 | ((last->int_32() != -1) ? static_cast<void>(0) : qt_assert("last->int_32() != -1", __FILE__, 372)); | - | ||||||||||||||||||
| 328 | } executed 2594 times by 1 test: end of blockExecuted by:
| 2594 | ||||||||||||||||||
| 329 | - | |||||||||||||||||||
| 330 | ((dd->values[static_cast<uint>(last->int_32())].int_32() != last->int_32()) ? static_cast<void>(0) : qt_assert("dd->values[static_cast<uint>(last->int_32())].int_32() != last->int_32()", __FILE__, 375)); | - | ||||||||||||||||||
| 331 | if (dd->values[static_cast<uint>(last->int_32())].int_32() == last->int_32() + 1
| 536-3557 | ||||||||||||||||||
| 332 | - | |||||||||||||||||||
| 333 | uint idx = static_cast<uint>(last->int_32()); | - | ||||||||||||||||||
| 334 | *last = Encode(dd->values[static_cast<uint>(last->int_32()) + 1].int_32()); | - | ||||||||||||||||||
| 335 | dd->attrs[idx] = Attr_Accessor; | - | ||||||||||||||||||
| 336 | return executed 3549 times by 1 test: idx;return idx;Executed by:
executed 3549 times by 1 test: return idx;Executed by:
| 3549 | ||||||||||||||||||
| 337 | } | - | ||||||||||||||||||
| 338 | last = &dd->values.values[last->int_32()]; | - | ||||||||||||||||||
| 339 | } executed 536 times by 1 test: end of blockExecuted by:
| 536 | ||||||||||||||||||
| 340 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 341 | if (dd->sparse->freeList.int_32() == -1
| 8-827 | ||||||||||||||||||
| 342 | reallocate(o, dd->values.alloc + 1, false); | - | ||||||||||||||||||
| 343 | dd = o->d()->arrayData.cast<Heap::SimpleArrayData>(); | - | ||||||||||||||||||
| 344 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 345 | ((dd->sparse->freeList.int_32() != -1) ? static_cast<void>(0) : qt_assert("dd->sparse->freeList.int_32() != -1", __FILE__, 390)); | - | ||||||||||||||||||
| 346 | uint idx = static_cast<uint>(dd->sparse->freeList.int_32()); | - | ||||||||||||||||||
| 347 | dd->sparse->freeList = dd->values[idx]; | - | ||||||||||||||||||
| 348 | ((dd->sparse->freeList.isInteger()) ? static_cast<void>(0) : qt_assert("dd->sparse->freeList.isInteger()", __FILE__, 393)); | - | ||||||||||||||||||
| 349 | if (dd->attrs
| 232-604 | ||||||||||||||||||
| 350 | dd->attrs[idx] = Attr_Data; executed 604 times by 1 test: dd->attrs[idx] = Attr_Data;Executed by:
| 604 | ||||||||||||||||||
| 351 | return executed 836 times by 2 tests: idx;return idx;Executed by:
executed 836 times by 2 tests: return idx;Executed by:
| 836 | ||||||||||||||||||
| 352 | } | - | ||||||||||||||||||
| 353 | } | - | ||||||||||||||||||
| 354 | - | |||||||||||||||||||
| 355 | ReturnedValue SparseArrayData::get(const Heap::ArrayData *d, uint index) | - | ||||||||||||||||||
| 356 | { | - | ||||||||||||||||||
| 357 | const Heap::SparseArrayData *s = static_cast<const Heap::SparseArrayData *>(d); | - | ||||||||||||||||||
| 358 | index = s->mappedIndex(index); | - | ||||||||||||||||||
| 359 | if (index ==
| 94-295 | ||||||||||||||||||
| 360 | (0x7fffffff * 2U + 1U)
| 94-295 | ||||||||||||||||||
| 361 | ) | - | ||||||||||||||||||
| 362 | return executed 94 times by 1 test: Primitive::emptyValue().asReturnedValue();return Primitive::emptyValue().asReturnedValue();Executed by:
executed 94 times by 1 test: return Primitive::emptyValue().asReturnedValue();Executed by:
| 94 | ||||||||||||||||||
| 363 | return executed 296 times by 1 test: s->values[index].asReturnedValue();return s->values[index].asReturnedValue();Executed by:
executed 296 times by 1 test: return s->values[index].asReturnedValue();Executed by:
| 296 | ||||||||||||||||||
| 364 | } | - | ||||||||||||||||||
| 365 | - | |||||||||||||||||||
| 366 | bool SparseArrayData::put(Object *o, uint index, const Value &value) | - | ||||||||||||||||||
| 367 | { | - | ||||||||||||||||||
| 368 | if (value.isEmpty()
| 0-334 | ||||||||||||||||||
| 369 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||
| 370 | - | |||||||||||||||||||
| 371 | Heap::SparseArrayData *s = o->d()->arrayData.cast<Heap::SparseArrayData>(); | - | ||||||||||||||||||
| 372 | SparseArrayNode *n = s->sparse->insert(index); | - | ||||||||||||||||||
| 373 | ((n->value == | - | ||||||||||||||||||
| 374 | (0x7fffffff * 2U + 1U) | - | ||||||||||||||||||
| 375 | || !s->attrs || !s->attrs[n->value].isAccessor()) ? static_cast<void>(0) : qt_assert("n->value == UINT_MAX || !s->attrs || !s->attrs[n->value].isAccessor()", __FILE__, 416)); | - | ||||||||||||||||||
| 376 | if (n->value ==
| 0-334 | ||||||||||||||||||
| 377 | (0x7fffffff * 2U + 1U)
| 0-334 | ||||||||||||||||||
| 378 | ) | - | ||||||||||||||||||
| 379 | n->value = allocate(o); executed 334 times by 1 test: n->value = allocate(o);Executed by:
| 334 | ||||||||||||||||||
| 380 | s = o->d()->arrayData.cast<Heap::SparseArrayData>(); | - | ||||||||||||||||||
| 381 | s->setArrayData(o->engine(), n->value, value); | - | ||||||||||||||||||
| 382 | if (s->attrs
| 0-334 | ||||||||||||||||||
| 383 | s->attrs[n->value] = Attr_Data; executed 334 times by 1 test: s->attrs[n->value] = Attr_Data;Executed by:
| 334 | ||||||||||||||||||
| 384 | return executed 334 times by 1 test: true;return true;Executed by:
executed 334 times by 1 test: return true;Executed by:
| 334 | ||||||||||||||||||
| 385 | } | - | ||||||||||||||||||
| 386 | - | |||||||||||||||||||
| 387 | bool SparseArrayData::del(Object *o, uint index) | - | ||||||||||||||||||
| 388 | { | - | ||||||||||||||||||
| 389 | Heap::SparseArrayData *dd = o->d()->arrayData.cast<Heap::SparseArrayData>(); | - | ||||||||||||||||||
| 390 | - | |||||||||||||||||||
| 391 | SparseArrayNode *n = dd->sparse->findNode(index); | - | ||||||||||||||||||
| 392 | if (!n
| 4-764 | ||||||||||||||||||
| 393 | return executed 4 times by 1 test: true;return true;Executed by:
executed 4 times by 1 test: return true;Executed by:
| 4 | ||||||||||||||||||
| 394 | - | |||||||||||||||||||
| 395 | uint pidx = n->value; | - | ||||||||||||||||||
| 396 | ((!dd->values[pidx].isEmpty()) ? static_cast<void>(0) : qt_assert("!dd->values[pidx].isEmpty()", __FILE__, 435)); | - | ||||||||||||||||||
| 397 | - | |||||||||||||||||||
| 398 | bool isAccessor = false; | - | ||||||||||||||||||
| 399 | if (dd->attrs
| 4-759 | ||||||||||||||||||
| 400 | if (!dd->attrs[pidx].isConfigurable()
| 362-400 | ||||||||||||||||||
| 401 | return executed 359 times by 1 test: false;return false;Executed by:
executed 359 times by 1 test: return false;Executed by:
| 359 | ||||||||||||||||||
| 402 | - | |||||||||||||||||||
| 403 | isAccessor = dd->attrs[pidx].isAccessor(); | - | ||||||||||||||||||
| 404 | dd->attrs[pidx] = Attr_Data; | - | ||||||||||||||||||
| 405 | } executed 403 times by 1 test: end of blockExecuted by:
| 403 | ||||||||||||||||||
| 406 | - | |||||||||||||||||||
| 407 | if (isAccessor
| 154-253 | ||||||||||||||||||
| 408 | - | |||||||||||||||||||
| 409 | dd->values.values[pidx + 1] = dd->sparse->freeList; | - | ||||||||||||||||||
| 410 | dd->values.values[pidx] = Encode(pidx + 1); | - | ||||||||||||||||||
| 411 | } executed 252 times by 1 test: else {end of blockExecuted by:
| 252 | ||||||||||||||||||
| 412 | ((dd->type == Heap::ArrayData::Sparse) ? static_cast<void>(0) : qt_assert("dd->type == Heap::ArrayData::Sparse", __FILE__, 451)); | - | ||||||||||||||||||
| 413 | dd->values.values[pidx] = dd->sparse->freeList; | - | ||||||||||||||||||
| 414 | } executed 154 times by 2 tests: end of blockExecuted by:
| 154 | ||||||||||||||||||
| 415 | - | |||||||||||||||||||
| 416 | dd->sparse->freeList = Encode(pidx); | - | ||||||||||||||||||
| 417 | dd->sparse->erase(n); | - | ||||||||||||||||||
| 418 | return executed 405 times by 2 tests: true;return true;Executed by:
executed 405 times by 2 tests: return true;Executed by:
| 405 | ||||||||||||||||||
| 419 | } | - | ||||||||||||||||||
| 420 | - | |||||||||||||||||||
| 421 | void SparseArrayData::setAttribute(Object *o, uint index, PropertyAttributes attrs) | - | ||||||||||||||||||
| 422 | { | - | ||||||||||||||||||
| 423 | Heap::SparseArrayData *d = o->d()->arrayData.cast<Heap::SparseArrayData>(); | - | ||||||||||||||||||
| 424 | SparseArrayNode *n = d->sparse->insert(index); | - | ||||||||||||||||||
| 425 | if (n->value ==
| 2037-3034 | ||||||||||||||||||
| 426 | (0x7fffffff * 2U + 1U)
| 2037-3034 | ||||||||||||||||||
| 427 | ) { | - | ||||||||||||||||||
| 428 | n->value = allocate(o, attrs.isAccessor()); | - | ||||||||||||||||||
| 429 | d = o->d()->arrayData.cast<Heap::SparseArrayData>(); | - | ||||||||||||||||||
| 430 | } executed 3038 times by 1 test: end of blockExecuted by:
| 3038 | ||||||||||||||||||
| 431 | else if (attrs.isAccessor() != d->attrs[n->value].isAccessor()
| 699-1332 | ||||||||||||||||||
| 432 | - | |||||||||||||||||||
| 433 | free(o->arrayData(), n->value); | - | ||||||||||||||||||
| 434 | n->value = allocate(o, attrs.isAccessor()); | - | ||||||||||||||||||
| 435 | d = o->d()->arrayData.cast<Heap::SparseArrayData>(); | - | ||||||||||||||||||
| 436 | } executed 700 times by 1 test: end of blockExecuted by:
| 700 | ||||||||||||||||||
| 437 | d->attrs[n->value] = attrs; | - | ||||||||||||||||||
| 438 | } executed 5071 times by 1 test: end of blockExecuted by:
| 5071 | ||||||||||||||||||
| 439 | - | |||||||||||||||||||
| 440 | void SparseArrayData::push_front(Object *o, const Value *values, uint n) | - | ||||||||||||||||||
| 441 | { | - | ||||||||||||||||||
| 442 | Heap::SparseArrayData *d = o->d()->arrayData.cast<Heap::SparseArrayData>(); | - | ||||||||||||||||||
| 443 | ((!d->attrs) ? static_cast<void>(0) : qt_assert("!d->attrs", __FILE__, 480)); | - | ||||||||||||||||||
| 444 | for (int i = static_cast<int>(n) - 1; i >= 0
| 0 | ||||||||||||||||||
| 445 | uint idx = allocate(o); | - | ||||||||||||||||||
| 446 | d = o->d()->arrayData.cast<Heap::SparseArrayData>(); | - | ||||||||||||||||||
| 447 | d->setArrayData(o->engine(), idx, values[i]); | - | ||||||||||||||||||
| 448 | d->sparse->push_front(idx); | - | ||||||||||||||||||
| 449 | } never executed: end of block | 0 | ||||||||||||||||||
| 450 | } never executed: end of block | 0 | ||||||||||||||||||
| 451 | - | |||||||||||||||||||
| 452 | ReturnedValue SparseArrayData::pop_front(Object *o) | - | ||||||||||||||||||
| 453 | { | - | ||||||||||||||||||
| 454 | Heap::SparseArrayData *d = o->d()->arrayData.cast<Heap::SparseArrayData>(); | - | ||||||||||||||||||
| 455 | ((!d->attrs) ? static_cast<void>(0) : qt_assert("!d->attrs", __FILE__, 492)); | - | ||||||||||||||||||
| 456 | uint idx = d->sparse->pop_front(); | - | ||||||||||||||||||
| 457 | ReturnedValue v; | - | ||||||||||||||||||
| 458 | if (idx !=
| 0 | ||||||||||||||||||
| 459 | (0x7fffffff * 2U + 1U)
| 0 | ||||||||||||||||||
| 460 | ) { | - | ||||||||||||||||||
| 461 | v = d->values[idx].asReturnedValue(); | - | ||||||||||||||||||
| 462 | free(o->arrayData(), idx); | - | ||||||||||||||||||
| 463 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 464 | v = Encode::undefined(); | - | ||||||||||||||||||
| 465 | } never executed: end of block | 0 | ||||||||||||||||||
| 466 | return never executed: v;return v;never executed: return v; | 0 | ||||||||||||||||||
| 467 | } | - | ||||||||||||||||||
| 468 | - | |||||||||||||||||||
| 469 | uint SparseArrayData::truncate(Object *o, uint newLen) | - | ||||||||||||||||||
| 470 | { | - | ||||||||||||||||||
| 471 | Heap::SparseArrayData *d = o->d()->arrayData.cast<Heap::SparseArrayData>(); | - | ||||||||||||||||||
| 472 | SparseArrayNode *begin = d->sparse->lowerBound(newLen); | - | ||||||||||||||||||
| 473 | if (begin != d->sparse->end()
| 0-158 | ||||||||||||||||||
| 474 | SparseArrayNode *it = d->sparse->end()->previousNode(); | - | ||||||||||||||||||
| 475 | while (1) { | - | ||||||||||||||||||
| 476 | if (d->attrs
| 8-232 | ||||||||||||||||||
| 477 | if (!d->attrs[it->value].isConfigurable()
| 46-186 | ||||||||||||||||||
| 478 | newLen = it->key() + 1; | - | ||||||||||||||||||
| 479 | break; executed 46 times by 1 test: break;Executed by:
| 46 | ||||||||||||||||||
| 480 | } | - | ||||||||||||||||||
| 481 | } executed 186 times by 1 test: end of blockExecuted by:
| 186 | ||||||||||||||||||
| 482 | free(o->arrayData(), it->value); | - | ||||||||||||||||||
| 483 | bool brk = (it == begin); | - | ||||||||||||||||||
| 484 | SparseArrayNode *prev = it->previousNode(); | - | ||||||||||||||||||
| 485 | d->sparse->erase(it); | - | ||||||||||||||||||
| 486 | if (brk
| 82-112 | ||||||||||||||||||
| 487 | break; executed 112 times by 1 test: break;Executed by:
| 112 | ||||||||||||||||||
| 488 | it = prev; | - | ||||||||||||||||||
| 489 | } executed 82 times by 1 test: end of blockExecuted by:
| 82 | ||||||||||||||||||
| 490 | } executed 158 times by 1 test: end of blockExecuted by:
| 158 | ||||||||||||||||||
| 491 | return executed 158 times by 1 test: newLen;return newLen;Executed by:
executed 158 times by 1 test: return newLen;Executed by:
| 158 | ||||||||||||||||||
| 492 | } | - | ||||||||||||||||||
| 493 | - | |||||||||||||||||||
| 494 | uint SparseArrayData::length(const Heap::ArrayData *d) | - | ||||||||||||||||||
| 495 | { | - | ||||||||||||||||||
| 496 | const Heap::SparseArrayData *dd = static_cast<const Heap::SparseArrayData *>(d); | - | ||||||||||||||||||
| 497 | if (!dd->sparse
| 0-10 | ||||||||||||||||||
| 498 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 499 | SparseArrayNode *n = dd->sparse->end(); | - | ||||||||||||||||||
| 500 | n = n->previousNode(); | - | ||||||||||||||||||
| 501 | return executed 10 times by 1 test: n ? n->key() + 1 : 0;return n ? n->key() + 1 : 0;Executed by:
executed 10 times by 1 test: return n ? n->key() + 1 : 0;Executed by:
| 10 | ||||||||||||||||||
| 502 | } | - | ||||||||||||||||||
| 503 | - | |||||||||||||||||||
| 504 | bool SparseArrayData::putArray(Object *o, uint index, const Value *values, uint n) | - | ||||||||||||||||||
| 505 | { | - | ||||||||||||||||||
| 506 | for (uint i = 0; i < n
| 334-450 | ||||||||||||||||||
| 507 | put(o, index + i, values[i]); executed 334 times by 1 test: put(o, index + i, values[i]);Executed by:
| 334 | ||||||||||||||||||
| 508 | return executed 450 times by 1 test: true;return true;Executed by:
executed 450 times by 1 test: return true;Executed by:
| 450 | ||||||||||||||||||
| 509 | } | - | ||||||||||||||||||
| 510 | - | |||||||||||||||||||
| 511 | - | |||||||||||||||||||
| 512 | uint ArrayData::append(Object *obj, ArrayObject *otherObj, uint n) | - | ||||||||||||||||||
| 513 | { | - | ||||||||||||||||||
| 514 | ((!obj->d()->arrayData || !obj->d()->arrayData->attrs) ? static_cast<void>(0) : qt_assert("!obj->d()->arrayData || !obj->d()->arrayData->attrs", __FILE__, 549)); | - | ||||||||||||||||||
| 515 | - | |||||||||||||||||||
| 516 | if (!n
| 8-58 | ||||||||||||||||||
| 517 | return executed 8 times by 1 test: obj->getLength();return obj->getLength();Executed by:
executed 8 times by 1 test: return obj->getLength();Executed by:
| 8 | ||||||||||||||||||
| 518 | - | |||||||||||||||||||
| 519 | Scope scope(obj->engine()); | - | ||||||||||||||||||
| 520 | Scoped<ArrayData> other(scope, otherObj->arrayData()); | - | ||||||||||||||||||
| 521 | - | |||||||||||||||||||
| 522 | if (other && other->isSparse()
| 0-58 | ||||||||||||||||||
| 523 | obj->initSparseArray(); never executed: obj->initSparseArray(); | 0 | ||||||||||||||||||
| 524 | else | - | ||||||||||||||||||
| 525 | obj->arrayCreate(); executed 58 times by 2 tests: obj->arrayCreate();Executed by:
| 58 | ||||||||||||||||||
| 526 | - | |||||||||||||||||||
| 527 | uint oldSize = obj->getLength(); | - | ||||||||||||||||||
| 528 | - | |||||||||||||||||||
| 529 | if (!other
| 0-58 | ||||||||||||||||||
| 530 | ScopedValue v(scope); | - | ||||||||||||||||||
| 531 | for (uint i = 0; i < n
| 0 | ||||||||||||||||||
| 532 | obj->arraySet(oldSize + i, (v = otherObj->get(i))); never executed: obj->arraySet(oldSize + i, (v = otherObj->get(i))); | 0 | ||||||||||||||||||
| 533 | } never executed: else if (other && other->isSparse()end of block
| 0-58 | ||||||||||||||||||
| 534 | Heap::SparseArrayData *os = static_cast<Heap::SparseArrayData *>(other->d()); | - | ||||||||||||||||||
| 535 | if (other->hasAttributes()
| 0 | ||||||||||||||||||
| 536 | ScopedValue v(scope); | - | ||||||||||||||||||
| 537 | for (const SparseArrayNode *it = os->sparse->begin(); | - | ||||||||||||||||||
| 538 | it != os->sparse->end()
| 0 | ||||||||||||||||||
| 539 | v = otherObj->getValue(os->values[it->value], other->d()->attrs[it->value]); | - | ||||||||||||||||||
| 540 | obj->arraySet(oldSize + it->key(), v); | - | ||||||||||||||||||
| 541 | } never executed: end of block | 0 | ||||||||||||||||||
| 542 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 543 | for (const SparseArrayNode *it = other->d()->sparse->begin(); | - | ||||||||||||||||||
| 544 | it != os->sparse->end()
| 0 | ||||||||||||||||||
| 545 | obj->arraySet(oldSize + it->key(), os->values[it->value]); never executed: obj->arraySet(oldSize + it->key(), os->values[it->value]); | 0 | ||||||||||||||||||
| 546 | } never executed: end of block | 0 | ||||||||||||||||||
| 547 | } else { | - | ||||||||||||||||||
| 548 | Heap::SimpleArrayData *os = static_cast<Heap::SimpleArrayData *>(other->d()); | - | ||||||||||||||||||
| 549 | uint toCopy = n; | - | ||||||||||||||||||
| 550 | uint chunk = toCopy; | - | ||||||||||||||||||
| 551 | if (chunk > os->values.alloc - os->offset
| 0-58 | ||||||||||||||||||
| 552 | chunk = os->values.alloc - os->offset; never executed: chunk = os->values.alloc - os->offset; | 0 | ||||||||||||||||||
| 553 | obj->arrayPut(oldSize, os->values.data() + os->offset, chunk); | - | ||||||||||||||||||
| 554 | toCopy -= chunk; | - | ||||||||||||||||||
| 555 | if (toCopy
| 0-58 | ||||||||||||||||||
| 556 | obj->arrayPut(oldSize + chunk, os->values.data(), toCopy); never executed: obj->arrayPut(oldSize + chunk, os->values.data(), toCopy); | 0 | ||||||||||||||||||
| 557 | } executed 58 times by 2 tests: end of blockExecuted by:
| 58 | ||||||||||||||||||
| 558 | - | |||||||||||||||||||
| 559 | return executed 58 times by 2 tests: oldSize + n;return oldSize + n;Executed by:
executed 58 times by 2 tests: return oldSize + n;Executed by:
| 58 | ||||||||||||||||||
| 560 | } | - | ||||||||||||||||||
| 561 | - | |||||||||||||||||||
| 562 | void ArrayData::insert(Object *o, uint index, const Value *v, bool isAccessor) | - | ||||||||||||||||||
| 563 | { | - | ||||||||||||||||||
| 564 | if (!isAccessor
| 348-49578 | ||||||||||||||||||
| 565 | Heap::SimpleArrayData *d = o->d()->arrayData.cast<Heap::SimpleArrayData>(); | - | ||||||||||||||||||
| 566 | if (index < 0x1000
| 0-49283 | ||||||||||||||||||
| 567 | if (index >= d->values.alloc
| 794-48445 | ||||||||||||||||||
| 568 | o->arrayReserve(index + 1); | - | ||||||||||||||||||
| 569 | d = o->d()->arrayData.cast<Heap::SimpleArrayData>(); | - | ||||||||||||||||||
| 570 | } executed 790 times by 7 tests: end of blockExecuted by:
| 790 | ||||||||||||||||||
| 571 | if (index >= d->values.size
| 148-49088 | ||||||||||||||||||
| 572 | - | |||||||||||||||||||
| 573 | for (uint i = d->values.size; i < index
| 49132-68222 | ||||||||||||||||||
| 574 | d->setData(o->engine(), i, Primitive::emptyValue()); executed 68216 times by 6 tests: d->setData(o->engine(), i, Primitive::emptyValue());Executed by:
| 68216 | ||||||||||||||||||
| 575 | d->values.size = index + 1; | - | ||||||||||||||||||
| 576 | } executed 49106 times by 31 tests: end of blockExecuted by:
| 49106 | ||||||||||||||||||
| 577 | d->setData(o->engine(), index, *v); | - | ||||||||||||||||||
| 578 | return; executed 49260 times by 31 tests: return;Executed by:
| 49260 | ||||||||||||||||||
| 579 | } | - | ||||||||||||||||||
| 580 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 581 | - | |||||||||||||||||||
| 582 | o->initSparseArray(); | - | ||||||||||||||||||
| 583 | Heap::SparseArrayData *s = o->d()->arrayData.cast<Heap::SparseArrayData>(); | - | ||||||||||||||||||
| 584 | SparseArrayNode *n = s->sparse->insert(index); | - | ||||||||||||||||||
| 585 | if (n->value ==
| 308-3047 | ||||||||||||||||||
| 586 | (0x7fffffff * 2U + 1U)
| 308-3047 | ||||||||||||||||||
| 587 | ) | - | ||||||||||||||||||
| 588 | n->value = SparseArrayData::allocate(o, isAccessor); executed 308 times by 2 tests: n->value = SparseArrayData::allocate(o, isAccessor);Executed by:
| 308 | ||||||||||||||||||
| 589 | s = o->d()->arrayData.cast<Heap::SparseArrayData>(); | - | ||||||||||||||||||
| 590 | s->setArrayData(o->engine(), n->value, *v); | - | ||||||||||||||||||
| 591 | if (isAccessor
| 356-3003 | ||||||||||||||||||
| 592 | 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:
| 2992 | ||||||||||||||||||
| 593 | } executed 3347 times by 2 tests: end of blockExecuted by:
| 3347 | ||||||||||||||||||
| 594 | - | |||||||||||||||||||
| 595 | - | |||||||||||||||||||
| 596 | class ArrayElementLessThan | - | ||||||||||||||||||
| 597 | { | - | ||||||||||||||||||
| 598 | public: | - | ||||||||||||||||||
| 599 | inline ArrayElementLessThan(ExecutionEngine *engine, const Value &comparefn) | - | ||||||||||||||||||
| 600 | : m_engine(engine), m_comparefn(comparefn) {} executed 176 times by 6 tests: end of blockExecuted by:
| 176 | ||||||||||||||||||
| 601 | - | |||||||||||||||||||
| 602 | bool operator()(Value v1, Value v2) const; | - | ||||||||||||||||||
| 603 | - | |||||||||||||||||||
| 604 | private: | - | ||||||||||||||||||
| 605 | ExecutionEngine *m_engine; | - | ||||||||||||||||||
| 606 | const Value &m_comparefn; | - | ||||||||||||||||||
| 607 | }; | - | ||||||||||||||||||
| 608 | - | |||||||||||||||||||
| 609 | - | |||||||||||||||||||
| 610 | bool ArrayElementLessThan::operator()(Value v1, Value v2) const | - | ||||||||||||||||||
| 611 | { | - | ||||||||||||||||||
| 612 | Scope scope(m_engine); | - | ||||||||||||||||||
| 613 | - | |||||||||||||||||||
| 614 | if (v1.isUndefined()
| 0-9020 | ||||||||||||||||||
| 615 | return executed 64 times by 1 test: false;return false;Executed by:
executed 64 times by 1 test: return false;Executed by:
| 64 | ||||||||||||||||||
| 616 | if (v2.isUndefined()
| 0-8972 | ||||||||||||||||||
| 617 | return executed 48 times by 1 test: true;return true;Executed by:
executed 48 times by 1 test: return true;Executed by:
| 48 | ||||||||||||||||||
| 618 | ScopedFunctionObject o(scope, m_comparefn); | - | ||||||||||||||||||
| 619 | if (o
| 3248-5724 | ||||||||||||||||||
| 620 | Scope scope(o->engine()); | - | ||||||||||||||||||
| 621 | ScopedValue result(scope); | - | ||||||||||||||||||
| 622 | JSCallData jsCallData(scope, 2); | - | ||||||||||||||||||
| 623 | jsCallData->args[0] = v1; | - | ||||||||||||||||||
| 624 | jsCallData->args[1] = v2; | - | ||||||||||||||||||
| 625 | result = o->call(jsCallData); | - | ||||||||||||||||||
| 626 | - | |||||||||||||||||||
| 627 | return executed 5724 times by 3 tests: result->toNumber() < 0;return result->toNumber() < 0;Executed by:
executed 5724 times by 3 tests: return result->toNumber() < 0;Executed by:
| 5724 | ||||||||||||||||||
| 628 | } | - | ||||||||||||||||||
| 629 | ScopedString p1s(scope, v1.toString(scope.engine)); | - | ||||||||||||||||||
| 630 | ScopedString p2s(scope, v2.toString(scope.engine)); | - | ||||||||||||||||||
| 631 | return executed 3248 times by 4 tests: p1s->toQString() < p2s->toQString();return p1s->toQString() < p2s->toQString();Executed by:
executed 3248 times by 4 tests: return p1s->toQString() < p2s->toQString();Executed by:
| 3248 | ||||||||||||||||||
| 632 | } | - | ||||||||||||||||||
| 633 | - | |||||||||||||||||||
| 634 | template <typename RandomAccessIterator, typename T, typename LessThan> | - | ||||||||||||||||||
| 635 | void sortHelper(RandomAccessIterator start, RandomAccessIterator end, const T &t, LessThan lessThan) | - | ||||||||||||||||||
| 636 | { | - | ||||||||||||||||||
| 637 | top: | - | ||||||||||||||||||
| 638 | int span = int(end - start); | - | ||||||||||||||||||
| 639 | if (span < 2
| 254-990 | ||||||||||||||||||
| 640 | return; executed 254 times by 5 tests: return;Executed by:
| 254 | ||||||||||||||||||
| 641 | - | |||||||||||||||||||
| 642 | --end; | - | ||||||||||||||||||
| 643 | RandomAccessIterator low = start, high = end - 1; | - | ||||||||||||||||||
| 644 | RandomAccessIterator pivot = start + span / 2; | - | ||||||||||||||||||
| 645 | - | |||||||||||||||||||
| 646 | if (lessThan(*end, *start)
| 424-566 | ||||||||||||||||||
| 647 | qSwap(*end, *start); executed 424 times by 5 tests: qSwap(*end, *start);Executed by:
| 424 | ||||||||||||||||||
| 648 | if (span == 2
| 274-716 | ||||||||||||||||||
| 649 | return; executed 274 times by 3 tests: return;Executed by:
| 274 | ||||||||||||||||||
| 650 | - | |||||||||||||||||||
| 651 | if (lessThan(*pivot, *start)
| 254-462 | ||||||||||||||||||
| 652 | qSwap(*pivot, *start); executed 254 times by 5 tests: qSwap(*pivot, *start);Executed by:
| 254 | ||||||||||||||||||
| 653 | if (lessThan(*end, *pivot)
| 196-520 | ||||||||||||||||||
| 654 | qSwap(*end, *pivot); executed 196 times by 4 tests: qSwap(*end, *pivot);Executed by:
| 196 | ||||||||||||||||||
| 655 | if (span == 3
| 182-534 | ||||||||||||||||||
| 656 | return; executed 182 times by 5 tests: return;Executed by:
| 182 | ||||||||||||||||||
| 657 | - | |||||||||||||||||||
| 658 | qSwap(*pivot, *end); | - | ||||||||||||||||||
| 659 | - | |||||||||||||||||||
| 660 | while (low < high
| 146-1072 | ||||||||||||||||||
| 661 | while (low < high
| 154-4636 | ||||||||||||||||||
| 662 | ++ executed 3718 times by 4 tests: low;++low;Executed by:
executed 3718 times by 4 tests: ++low;Executed by:
| 3718 | ||||||||||||||||||
| 663 | - | |||||||||||||||||||
| 664 | while (high > low
| 388-1492 | ||||||||||||||||||
| 665 | -- executed 808 times by 3 tests: high;--high;Executed by:
executed 808 times by 3 tests: --high;Executed by:
| 808 | ||||||||||||||||||
| 666 | - | |||||||||||||||||||
| 667 | if (low < high
| 388-684 | ||||||||||||||||||
| 668 | qSwap(*low, *high); | - | ||||||||||||||||||
| 669 | ++low; | - | ||||||||||||||||||
| 670 | --high; | - | ||||||||||||||||||
| 671 | } executed 684 times by 3 tests: else {end of blockExecuted by:
| 684 | ||||||||||||||||||
| 672 | break; executed 388 times by 4 tests: break;Executed by:
| 388 | ||||||||||||||||||
| 673 | } | - | ||||||||||||||||||
| 674 | } | - | ||||||||||||||||||
| 675 | - | |||||||||||||||||||
| 676 | if (lessThan(*low, *end)
| 114-420 | ||||||||||||||||||
| 677 | ++ executed 114 times by 2 tests: low;++low;Executed by:
executed 114 times by 2 tests: ++low;Executed by:
| 114 | ||||||||||||||||||
| 678 | - | |||||||||||||||||||
| 679 | qSwap(*end, *low); | - | ||||||||||||||||||
| 680 | sortHelper(start, low, t, lessThan); | - | ||||||||||||||||||
| 681 | - | |||||||||||||||||||
| 682 | start = low + 1; | - | ||||||||||||||||||
| 683 | ++end; | - | ||||||||||||||||||
| 684 | goto executed 534 times by 4 tests: top;goto top;Executed by:
executed 534 times by 4 tests: goto top;Executed by:
| 534 | ||||||||||||||||||
| 685 | } | - | ||||||||||||||||||
| 686 | - | |||||||||||||||||||
| 687 | - | |||||||||||||||||||
| 688 | void ArrayData::sort(ExecutionEngine *engine, Object *thisObject, const Value &comparefn, uint len) | - | ||||||||||||||||||
| 689 | { | - | ||||||||||||||||||
| 690 | if (!len
| 10-184 | ||||||||||||||||||
| 691 | return; executed 10 times by 2 tests: return;Executed by:
| 10 | ||||||||||||||||||
| 692 | - | |||||||||||||||||||
| 693 | Scope scope(engine); | - | ||||||||||||||||||
| 694 | Scoped<ArrayData> arrayData(scope, thisObject->arrayData()); | - | ||||||||||||||||||
| 695 | - | |||||||||||||||||||
| 696 | if (!arrayData
| 0-184 | ||||||||||||||||||
| 697 | return; executed 4 times by 1 test: return;Executed by:
| 4 | ||||||||||||||||||
| 698 | - | |||||||||||||||||||
| 699 | if (!comparefn.isUndefined()
| 4-112 | ||||||||||||||||||
| 700 | engine->throwTypeError(); | - | ||||||||||||||||||
| 701 | return; executed 4 times by 1 test: return;Executed by:
| 4 | ||||||||||||||||||
| 702 | } | - | ||||||||||||||||||
| 703 | - | |||||||||||||||||||
| 704 | - | |||||||||||||||||||
| 705 | - | |||||||||||||||||||
| 706 | - | |||||||||||||||||||
| 707 | if (arrayData->type() == Heap::ArrayData::Sparse
| 0-176 | ||||||||||||||||||
| 708 | - | |||||||||||||||||||
| 709 | - | |||||||||||||||||||
| 710 | Scoped<SparseArrayData> sparse(scope, static_cast<Heap::SparseArrayData *>(arrayData->d())); | - | ||||||||||||||||||
| 711 | - | |||||||||||||||||||
| 712 | if (!sparse->sparse()->nEntries()
| 0 | ||||||||||||||||||
| 713 | return; never executed: return; | 0 | ||||||||||||||||||
| 714 | - | |||||||||||||||||||
| 715 | thisObject->setArrayData(nullptr); | - | ||||||||||||||||||
| 716 | ArrayData::realloc(thisObject, Heap::ArrayData::Simple, sparse->sparse()->nEntries(), sparse->attrs() ? true : false); | - | ||||||||||||||||||
| 717 | Heap::SimpleArrayData *d = thisObject->d()->arrayData.cast<Heap::SimpleArrayData>(); | - | ||||||||||||||||||
| 718 | - | |||||||||||||||||||
| 719 | SparseArrayNode *n = sparse->sparse()->begin(); | - | ||||||||||||||||||
| 720 | uint i = 0; | - | ||||||||||||||||||
| 721 | if (sparse->attrs()
| 0 | ||||||||||||||||||
| 722 | while (n != sparse->sparse()->end()
| 0 | ||||||||||||||||||
| 723 | if (n->value >= len
| 0 | ||||||||||||||||||
| 724 | break; never executed: break; | 0 | ||||||||||||||||||
| 725 | - | |||||||||||||||||||
| 726 | PropertyAttributes a = sparse->attrs()
| 0 | ||||||||||||||||||
| 727 | d->setData(engine, i, Value::fromReturnedValue(thisObject->getValue(sparse->arrayData()[n->value], a))); | - | ||||||||||||||||||
| 728 | d->attrs[i] = a.isAccessor()
| 0 | ||||||||||||||||||
| 729 | - | |||||||||||||||||||
| 730 | n = n->nextNode(); | - | ||||||||||||||||||
| 731 | ++i; | - | ||||||||||||||||||
| 732 | } never executed: end of block | 0 | ||||||||||||||||||
| 733 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 734 | while (n != sparse->sparse()->end()
| 0 | ||||||||||||||||||
| 735 | if (n->value >= len
| 0 | ||||||||||||||||||
| 736 | break; never executed: break; | 0 | ||||||||||||||||||
| 737 | d->setData(engine, i, sparse->arrayData()[n->value]); | - | ||||||||||||||||||
| 738 | n = n->nextNode(); | - | ||||||||||||||||||
| 739 | ++i; | - | ||||||||||||||||||
| 740 | } never executed: end of block | 0 | ||||||||||||||||||
| 741 | } never executed: end of block | 0 | ||||||||||||||||||
| 742 | d->values.size = i; | - | ||||||||||||||||||
| 743 | if (len > i
| 0 | ||||||||||||||||||
| 744 | len = i; never executed: len = i; | 0 | ||||||||||||||||||
| 745 | if (n != sparse->sparse()->end()
| 0 | ||||||||||||||||||
| 746 | - | |||||||||||||||||||
| 747 | thisObject->initSparseArray(); | - | ||||||||||||||||||
| 748 | while (n != sparse->sparse()->end()
| 0 | ||||||||||||||||||
| 749 | PropertyAttributes a = sparse->attrs()
| 0 | ||||||||||||||||||
| 750 | thisObject->arraySet(n->value, reinterpret_cast<const Property *>(sparse->arrayData() + n->value), a); | - | ||||||||||||||||||
| 751 | - | |||||||||||||||||||
| 752 | n = n->nextNode(); | - | ||||||||||||||||||
| 753 | } never executed: end of block | 0 | ||||||||||||||||||
| 754 | - | |||||||||||||||||||
| 755 | } never executed: end of block | 0 | ||||||||||||||||||
| 756 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 757 | Heap::SimpleArrayData *d = thisObject->d()->arrayData.cast<Heap::SimpleArrayData>(); | - | ||||||||||||||||||
| 758 | if (len > d->values.size
| 8-168 | ||||||||||||||||||
| 759 | len = d->values.size; executed 8 times by 1 test: len = d->values.size;Executed by:
| 8 | ||||||||||||||||||
| 760 | - | |||||||||||||||||||
| 761 | - | |||||||||||||||||||
| 762 | for (uint i = 0; i < len
| 176-1784 | ||||||||||||||||||
| 763 | if (d->data(i).isEmpty()
| 12-1772 | ||||||||||||||||||
| 764 | while (--
| 0-12 | ||||||||||||||||||
| 765 | if (!d->data(len).isEmpty()
| 0-12 | ||||||||||||||||||
| 766 | break; executed 12 times by 1 test: break;Executed by:
| 12 | ||||||||||||||||||
| 767 | ((!d->attrs || !d->attrs[len].isAccessor()) ? static_cast<void>(0) : qt_assert("!d->attrs || !d->attrs[len].isAccessor()", __FILE__, 800)); | - | ||||||||||||||||||
| 768 | d->setData(engine, i, d->data(len)); | - | ||||||||||||||||||
| 769 | d->setData(engine, len, Primitive::emptyValue()); | - | ||||||||||||||||||
| 770 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 771 | } executed 1784 times by 6 tests: end of blockExecuted by:
| 1784 | ||||||||||||||||||
| 772 | - | |||||||||||||||||||
| 773 | if (!len
| 0-176 | ||||||||||||||||||
| 774 | return; never executed: return; | 0 | ||||||||||||||||||
| 775 | } executed 176 times by 6 tests: end of blockExecuted by:
| 176 | ||||||||||||||||||
| 776 | - | |||||||||||||||||||
| 777 | - | |||||||||||||||||||
| 778 | ArrayElementLessThan lessThan(engine, static_cast<const FunctionObject &>(comparefn)); | - | ||||||||||||||||||
| 779 | - | |||||||||||||||||||
| 780 | Value *begin = thisObject->arrayData()->values.values; | - | ||||||||||||||||||
| 781 | sortHelper(begin, begin + len, *begin, lessThan); | - | ||||||||||||||||||
| 782 | - | |||||||||||||||||||
| 783 | - | |||||||||||||||||||
| 784 | - | |||||||||||||||||||
| 785 | - | |||||||||||||||||||
| 786 | - | |||||||||||||||||||
| 787 | } executed 176 times by 6 tests: end of blockExecuted by:
| 176 | ||||||||||||||||||
| Switch to Source code | Preprocessed file |