OpenCoverage

qv4arrayiterator.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4arrayiterator.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2using namespace QV4;-
3-
4const QV4::VTable ArrayIteratorObject::static_vtbl = { (std::is_same<ArrayIteratorObject::SuperClass, Object>::value) ? nullptr : &ArrayIteratorObject::SuperClass::static_vtbl, (sizeof(ArrayIteratorObject::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), (sizeof(ArrayIteratorObject::Data) + (ArrayIteratorObject::NInlineProperties*sizeof(QV4::Value)) + QV4::Chunk::SlotSize - 1)/QV4::Chunk::SlotSize*QV4::Chunk::SlotSize/sizeof(QV4::Value) - (sizeof(ArrayIteratorObject::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), ArrayIteratorObject::IsExecutionContext, ArrayIteratorObject::IsString, ArrayIteratorObject::IsObject, ArrayIteratorObject::IsFunctionObject, ArrayIteratorObject::IsErrorObject, ArrayIteratorObject::IsArrayData, ArrayIteratorObject::IsStringOrSymbol, ArrayIteratorObject::MyType, { 0, 0, 0, 0 }, "ArrayIteratorObject", ArrayIteratorObject::virtualDestroy, ArrayIteratorObject::Data::markObjects, ArrayIteratorObject::virtualIsEqualTo, ArrayIteratorObject::virtualGet, ArrayIteratorObject::virtualPut, ArrayIteratorObject::virtualDeleteProperty, ArrayIteratorObject::virtualHasProperty, ArrayIteratorObject::virtualGetOwnProperty, ArrayIteratorObject::virtualDefineOwnProperty, ArrayIteratorObject::virtualIsExtensible, ArrayIteratorObject::virtualPreventExtensions, ArrayIteratorObject::virtualGetPrototypeOf, ArrayIteratorObject::virtualSetPrototypeOf, ArrayIteratorObject::virtualGetLength, ArrayIteratorObject::virtualAdvanceIterator, ArrayIteratorObject::virtualInstanceOf, ArrayIteratorObject::virtualCall, ArrayIteratorObject::virtualCallAsConstructor, };-
5-
6void ArrayIteratorPrototype::init(ExecutionEngine *e)-
7{-
8 defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "next")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "next" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 98252 times by 153 tests: return qstring_literal_temp;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
qstring_literal_temp;
executed 98252 times by 153 tests: return qstring_literal_temp;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
}()), method_next, 0);
98252
9-
10 Scope scope(e);-
11 ScopedString val(scope, e->newString(QLatin1String("Array Iterator")));-
12 defineReadonlyConfigurableProperty(e->symbol_toStringTag(), val);-
13}
executed 99009 times by 153 tests: end of block
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
99009
14-
15ReturnedValue ArrayIteratorPrototype::method_next(const FunctionObject *b, const Value *that, const Value *, int)-
16{-
17 Scope scope(b);-
18 const ArrayIteratorObject *thisObject = that->as<ArrayIteratorObject>();-
19 if (!thisObject
!thisObjectDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 22863 times by 1 test
Evaluated by:
  • tst_ecmascripttests
)
4-22863
20 return
executed 4 times by 1 test: return scope.engine->throwTypeError(QLatin1String("Not an Array Iterator instance"));
Executed by:
  • tst_ecmascripttests
scope.engine->throwTypeError(QLatin1String("Not an Array Iterator instance"));
executed 4 times by 1 test: return scope.engine->throwTypeError(QLatin1String("Not an Array Iterator instance"));
Executed by:
  • tst_ecmascripttests
4
21-
22 ScopedObject a(scope, thisObject->d()->iteratedObject);-
23 if (!a
!aDescription
TRUEevaluated 1067 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 21799 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
1067-21799
24 QV4::Value undefined = Primitive::undefinedValue();-
25 return
executed 1067 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, undefined, true);
Executed by:
  • tst_ecmascripttests
IteratorPrototype::createIterResultObject(scope.engine, undefined, true);
executed 1067 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, undefined, true);
Executed by:
  • tst_ecmascripttests
1067
26 }-
27-
28 quint32 index = thisObject->d()->nextIndex;-
29 IteratorKind itemKind = thisObject->d()->iterationKind;-
30-
31 Scoped<TypedArray> ta(scope, a->as<TypedArray>());-
32 quint32 len = a->getLength();-
33-
34 if (index >= len
index >= lenDescription
TRUEevaluated 6738 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 15155 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
6738-15155
35 thisObject->d()->iteratedObject.set(scope.engine, nullptr);-
36 QV4::Value undefined = Primitive::undefinedValue();-
37 return
executed 6733 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, undefined, true);
Executed by:
  • tst_ecmascripttests
IteratorPrototype::createIterResultObject(scope.engine, undefined, true);
executed 6733 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, undefined, true);
Executed by:
  • tst_ecmascripttests
6733
38 }-
39-
40 thisObject->d()->nextIndex = index + 1;-
41 if (itemKind == KeyIteratorKind
itemKind == KeyIteratorKindDescription
TRUEevaluated 160 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 15005 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
160-15005
42 return
executed 160 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, Primitive::fromInt32(index), false);
Executed by:
  • tst_ecmascripttests
IteratorPrototype::createIterResultObject(scope.engine, Primitive::fromInt32(index), false);
executed 160 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, Primitive::fromInt32(index), false);
Executed by:
  • tst_ecmascripttests
160
43 }-
44-
45 ReturnedValue elementValue = a->get(index);-
46 do { if (scope.hasException()
scope.hasException()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 14970 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) { return
executed 4 times by 1 test: return QV4::Encode::undefined();
Executed by:
  • tst_ecmascripttests
QV4::Encode::undefined();
executed 4 times by 1 test: return QV4::Encode::undefined();
Executed by:
  • tst_ecmascripttests
} } while (false);
4-14970
47-
48 if (itemKind == ValueIteratorKind
itemKind == ValueIteratorKindDescription
TRUEevaluated 14843 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 156 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
156-14843
49 return
executed 14853 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, Value::fromReturnedValue(elementValue), false);
Executed by:
  • tst_ecmascripttests
IteratorPrototype::createIterResultObject(scope.engine, Value::fromReturnedValue(elementValue), false);
executed 14853 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, Value::fromReturnedValue(elementValue), false);
Executed by:
  • tst_ecmascripttests
14853
50 } else {-
51 ((itemKind == KeyValueIteratorKind) ? static_cast<void>(0) : qt_assert("itemKind == KeyValueIteratorKind", __FILE__, 95));-
52-
53 ScopedArrayObject resultArray(scope, scope.engine->newArrayObject());-
54 resultArray->arrayReserve(2);-
55 resultArray->arrayPut(0, Primitive::fromInt32(index));-
56 resultArray->arrayPut(1, Value::fromReturnedValue(elementValue));-
57 resultArray->setArrayLengthUnchecked(2);-
58-
59 return
executed 156 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, resultArray, false);
Executed by:
  • tst_ecmascripttests
IteratorPrototype::createIterResultObject(scope.engine, resultArray, false);
executed 156 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, resultArray, false);
Executed by:
  • tst_ecmascripttests
156
60 }-
61}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0