Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4runtime.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | - | |||||||||||||||||||
5 | - | |||||||||||||||||||
6 | - | |||||||||||||||||||
7 | - | |||||||||||||||||||
8 | - | |||||||||||||||||||
9 | - | |||||||||||||||||||
10 | - | |||||||||||||||||||
11 | - | |||||||||||||||||||
12 | - | |||||||||||||||||||
13 | - | |||||||||||||||||||
14 | - | |||||||||||||||||||
15 | namespace QV4 { | - | ||||||||||||||||||
16 | Runtime::Runtime() | - | ||||||||||||||||||
17 | { | - | ||||||||||||||||||
18 | - | |||||||||||||||||||
19 | runtimeMethods[callGlobalLookup] = reinterpret_cast<void*>(&method_callGlobalLookup); runtimeMethods[callName] = reinterpret_cast<void*>(&method_callName); runtimeMethods[callProperty] = reinterpret_cast<void*>(&method_callProperty); runtimeMethods[callPropertyLookup] = reinterpret_cast<void*>(&method_callPropertyLookup); runtimeMethods[callElement] = reinterpret_cast<void*>(&method_callElement); runtimeMethods[callValue] = reinterpret_cast<void*>(&method_callValue); runtimeMethods[callPossiblyDirectEval] = reinterpret_cast<void*>(&method_callPossiblyDirectEval); runtimeMethods[callWithSpread] = reinterpret_cast<void*>(&method_callWithSpread); runtimeMethods[construct] = reinterpret_cast<void*>(&method_construct); runtimeMethods[constructWithSpread] = reinterpret_cast<void*>(&method_constructWithSpread); runtimeMethods[storeNameStrict] = reinterpret_cast<void*>(&method_storeNameStrict); runtimeMethods[storeNameSloppy] = reinterpret_cast<void*>(&method_storeNameSloppy); runtimeMethods[storeProperty] = reinterpret_cast<void*>(&method_storeProperty); runtimeMethods[storeElement] = reinterpret_cast<void*>(&method_storeElement); runtimeMethods[loadProperty] = reinterpret_cast<void*>(&method_loadProperty); runtimeMethods[loadName] = reinterpret_cast<void*>(&method_loadName); runtimeMethods[loadElement] = reinterpret_cast<void*>(&method_loadElement); runtimeMethods[loadSuperProperty] = reinterpret_cast<void*>(&method_loadSuperProperty); runtimeMethods[storeSuperProperty] = reinterpret_cast<void*>(&method_storeSuperProperty); runtimeMethods[typeofValue] = reinterpret_cast<void*>(&method_typeofValue); runtimeMethods[typeofName] = reinterpret_cast<void*>(&method_typeofName); runtimeMethods[deleteProperty] = reinterpret_cast<void*>(&method_deleteProperty); runtimeMethods[deleteName] = reinterpret_cast<void*>(&method_deleteName); runtimeMethods[throwException] = reinterpret_cast<void*>(&method_throwException); runtimeMethods[createWithContext] = reinterpret_cast<void*>(&method_createWithContext); runtimeMethods[createCatchContext] = reinterpret_cast<void*>(&method_createCatchContext); runtimeMethods[createBlockContext] = reinterpret_cast<void*>(&method_createBlockContext); runtimeMethods[createScriptContext] = reinterpret_cast<void*>(&method_createScriptContext); runtimeMethods[cloneBlockContext] = reinterpret_cast<void*>(&method_cloneBlockContext); runtimeMethods[popScriptContext] = reinterpret_cast<void*>(&method_popScriptContext); runtimeMethods[closure] = reinterpret_cast<void*>(&method_closure); runtimeMethods[declareVar] = reinterpret_cast<void*>(&method_declareVar); runtimeMethods[createMappedArgumentsObject] = reinterpret_cast<void*>(&method_createMappedArgumentsObject); runtimeMethods[createUnmappedArgumentsObject] = reinterpret_cast<void*>(&method_createUnmappedArgumentsObject); runtimeMethods[createRestParameter] = reinterpret_cast<void*>(&method_createRestParameter); runtimeMethods[arrayLiteral] = reinterpret_cast<void*>(&method_arrayLiteral); runtimeMethods[objectLiteral] = reinterpret_cast<void*>(&method_objectLiteral); runtimeMethods[createClass] = reinterpret_cast<void*>(&method_createClass); runtimeMethods[getIterator] = reinterpret_cast<void*>(&method_getIterator); runtimeMethods[iteratorNext] = reinterpret_cast<void*>(&method_iteratorNext); runtimeMethods[iteratorClose] = reinterpret_cast<void*>(&method_iteratorClose); runtimeMethods[destructureRestElement] = reinterpret_cast<void*>(&method_destructureRestElement); runtimeMethods[uMinus] = reinterpret_cast<void*>(&method_uMinus); runtimeMethods[instanceof] = reinterpret_cast<void*>(&method_instanceof); runtimeMethods[in] = reinterpret_cast<void*>(&method_in); runtimeMethods[add] = reinterpret_cast<void*>(&method_add); runtimeMethods[sub] = reinterpret_cast<void*>(&method_sub); runtimeMethods[mul] = reinterpret_cast<void*>(&method_mul); runtimeMethods[div] = reinterpret_cast<void*>(&method_div); runtimeMethods[mod] = reinterpret_cast<void*>(&method_mod); runtimeMethods[shl] = reinterpret_cast<void*>(&method_shl); runtimeMethods[shr] = reinterpret_cast<void*>(&method_shr); runtimeMethods[ushr] = reinterpret_cast<void*>(&method_ushr); runtimeMethods[greaterThan] = reinterpret_cast<void*>(&method_greaterThan); runtimeMethods[lessThan] = reinterpret_cast<void*>(&method_lessThan); runtimeMethods[greaterEqual] = reinterpret_cast<void*>(&method_greaterEqual); runtimeMethods[lessEqual] = reinterpret_cast<void*>(&method_lessEqual); runtimeMethods[equal] = reinterpret_cast<void*>(&method_equal); runtimeMethods[notEqual] = reinterpret_cast<void*>(&method_notEqual); runtimeMethods[strictEqual] = reinterpret_cast<void*>(&method_strictEqual); runtimeMethods[strictNotEqual] = reinterpret_cast<void*>(&method_strictNotEqual); runtimeMethods[compareGreaterThan] = reinterpret_cast<void*>(&method_compareGreaterThan); runtimeMethods[compareLessThan] = reinterpret_cast<void*>(&method_compareLessThan); runtimeMethods[compareGreaterEqual] = reinterpret_cast<void*>(&method_compareGreaterEqual); runtimeMethods[compareLessEqual] = reinterpret_cast<void*>(&method_compareLessEqual); runtimeMethods[compareEqual] = reinterpret_cast<void*>(&method_compareEqual); runtimeMethods[compareNotEqual] = reinterpret_cast<void*>(&method_compareNotEqual); runtimeMethods[compareStrictEqual] = reinterpret_cast<void*>(&method_compareStrictEqual); runtimeMethods[compareStrictNotEqual] = reinterpret_cast<void*>(&method_compareStrictNotEqual); runtimeMethods[compareInstanceof] = reinterpret_cast<void*>(&method_compareInstanceof); runtimeMethods[compareIn] = reinterpret_cast<void*>(&method_compareIn); runtimeMethods[regexpLiteral] = reinterpret_cast<void*>(&method_regexpLiteral); runtimeMethods[loadQmlContext] = reinterpret_cast<void*>(&method_loadQmlContext); runtimeMethods[loadQmlImportedScripts] = reinterpret_cast<void*>(&method_loadQmlImportedScripts); runtimeMethods[loadQmlScopeObjectProperty] = reinterpret_cast<void*>(&method_loadQmlScopeObjectProperty); runtimeMethods[loadQmlContextObjectProperty] = reinterpret_cast<void*>(&method_loadQmlContextObjectProperty); runtimeMethods[loadQmlIdObject] = reinterpret_cast<void*>(&method_loadQmlIdObject); runtimeMethods[callQmlScopeObjectProperty] = reinterpret_cast<void*>(&method_callQmlScopeObjectProperty); runtimeMethods[callQmlContextObjectProperty] = reinterpret_cast<void*>(&method_callQmlContextObjectProperty); runtimeMethods[storeQmlScopeObjectProperty] = reinterpret_cast<void*>(&method_storeQmlScopeObjectProperty); runtimeMethods[storeQmlContextObjectProperty] = reinterpret_cast<void*>(&method_storeQmlContextObjectProperty); | - | ||||||||||||||||||
20 | - | |||||||||||||||||||
21 | } executed 99151 times by 153 tests: end of block Executed by:
| 99151 | ||||||||||||||||||
22 | - | |||||||||||||||||||
23 | void RuntimeHelpers::numberToString(QString *result, double num, int radix) | - | ||||||||||||||||||
24 | { | - | ||||||||||||||||||
25 | ((result) ? static_cast<void>(0) : qt_assert("result", __FILE__, 237)); | - | ||||||||||||||||||
26 | - | |||||||||||||||||||
27 | if (std::isnan(num)
| 2404-3021936 | ||||||||||||||||||
28 | *result = ([]() noexcept -> QString { enum { Size = sizeof(u"" "NaN")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "NaN" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()); | - | ||||||||||||||||||
29 | return; executed 2404 times by 1 test: return; Executed by:
| 2404 | ||||||||||||||||||
30 | } else if (qt_is_inf(num)
| 1655-3020283 | ||||||||||||||||||
31 | *result = num < 0 ? ([]() noexcept -> QString { enum { Size = sizeof(u"" "-Infinity")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "-Infinity" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()) : ([]() noexcept -> QString { enum { Size = sizeof(u"" "Infinity")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Infinity" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 976 times by 2 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 976 times by 2 tests: }());return qstring_literal_temp; Executed by:
| 976 | ||||||||||||||||||
32 | return; executed 1655 times by 2 tests: return; Executed by:
| 1655 | ||||||||||||||||||
33 | } | - | ||||||||||||||||||
34 | - | |||||||||||||||||||
35 | if (radix == 10
| 0-3020296 | ||||||||||||||||||
36 | - | |||||||||||||||||||
37 | - | |||||||||||||||||||
38 | const int ecma_shortest_low = -6; | - | ||||||||||||||||||
39 | const int ecma_shortest_high = 21; | - | ||||||||||||||||||
40 | - | |||||||||||||||||||
41 | const QLatin1Char zero('0'); | - | ||||||||||||||||||
42 | const QLatin1Char dot('.'); | - | ||||||||||||||||||
43 | - | |||||||||||||||||||
44 | int decpt = 0; | - | ||||||||||||||||||
45 | int sign = 0; | - | ||||||||||||||||||
46 | *result = qdtoa(num, &decpt, &sign); | - | ||||||||||||||||||
47 | - | |||||||||||||||||||
48 | if (decpt <= ecma_shortest_low
| 324-3019284 | ||||||||||||||||||
49 | if (result->length() > 1
| 124-1203 | ||||||||||||||||||
50 | result->insert(1, dot); executed 124 times by 3 tests: result->insert(1, dot); Executed by:
| 124 | ||||||||||||||||||
51 | result->append(QLatin1Char('e')); | - | ||||||||||||||||||
52 | if (decpt > 0
| 323-1004 | ||||||||||||||||||
53 | result->append(QLatin1Char('+')); executed 323 times by 2 tests: result->append(QLatin1Char('+')); Executed by:
| 323 | ||||||||||||||||||
54 | result->append(QString::number(decpt - 1)); | - | ||||||||||||||||||
55 | } executed 1328 times by 3 tests: else if (decpt <= 0end of block Executed by:
| 1328-3016568 | ||||||||||||||||||
56 | result->prepend(QLatin1String("0.") + QString(-decpt, zero)); | - | ||||||||||||||||||
57 | } executed 2398 times by 8 tests: else if (decpt < result->length()end of block Executed by:
| 2398-2989112 | ||||||||||||||||||
58 | result->insert(decpt, dot); | - | ||||||||||||||||||
59 | } executed 27459 times by 12 tests: else {end of block Executed by:
| 27459 | ||||||||||||||||||
60 | result->append(QString(decpt - result->length(), zero)); | - | ||||||||||||||||||
61 | } executed 2989103 times by 27 tests: end of block Executed by:
| 2989103 | ||||||||||||||||||
62 | - | |||||||||||||||||||
63 | if (sign
| 88077-2932220 | ||||||||||||||||||
64 | result->prepend(QLatin1Char('-')); executed 81118 times by 8 tests: result->prepend(QLatin1Char('-')); Executed by:
| 81118 | ||||||||||||||||||
65 | - | |||||||||||||||||||
66 | return; executed 3020290 times by 27 tests: return; Executed by:
| 3020290 | ||||||||||||||||||
67 | } | - | ||||||||||||||||||
68 | - | |||||||||||||||||||
69 | result->clear(); | - | ||||||||||||||||||
70 | bool negative = false; | - | ||||||||||||||||||
71 | - | |||||||||||||||||||
72 | if (num < 0
| 0 | ||||||||||||||||||
73 | negative = true; | - | ||||||||||||||||||
74 | num = -num; | - | ||||||||||||||||||
75 | } never executed: end of block | 0 | ||||||||||||||||||
76 | - | |||||||||||||||||||
77 | double frac = num - ::floor(num); | - | ||||||||||||||||||
78 | num = Primitive::toInteger(num); | - | ||||||||||||||||||
79 | - | |||||||||||||||||||
80 | do { | - | ||||||||||||||||||
81 | char c = (char)::fmod(num, radix); | - | ||||||||||||||||||
82 | c = (
| 0 | ||||||||||||||||||
83 | result->prepend(QLatin1Char(c)); | - | ||||||||||||||||||
84 | num = ::floor(num / radix); | - | ||||||||||||||||||
85 | } never executed: while (num != 0end of block
| 0 | ||||||||||||||||||
86 | - | |||||||||||||||||||
87 | if (frac != 0
| 0 | ||||||||||||||||||
88 | result->append(QLatin1Char('.')); | - | ||||||||||||||||||
89 | do { | - | ||||||||||||||||||
90 | frac = frac * radix; | - | ||||||||||||||||||
91 | char c = (char)::floor(frac); | - | ||||||||||||||||||
92 | c = (
| 0 | ||||||||||||||||||
93 | result->append(QLatin1Char(c)); | - | ||||||||||||||||||
94 | frac = frac - ::floor(frac); | - | ||||||||||||||||||
95 | } never executed: while (frac != 0end of block
| 0 | ||||||||||||||||||
96 | } never executed: end of block | 0 | ||||||||||||||||||
97 | - | |||||||||||||||||||
98 | if (negative
| 0 | ||||||||||||||||||
99 | result->prepend(QLatin1Char('-')); never executed: result->prepend(QLatin1Char('-')); | 0 | ||||||||||||||||||
100 | } never executed: end of block | 0 | ||||||||||||||||||
101 | - | |||||||||||||||||||
102 | ReturnedValue Runtime::method_closure(ExecutionEngine *engine, int functionId) | - | ||||||||||||||||||
103 | { | - | ||||||||||||||||||
104 | QV4::Function *clos = static_cast<CompiledData::CompilationUnit*>(engine->currentStackFrame->v4Function->compilationUnit)->runtimeFunctions[functionId]; | - | ||||||||||||||||||
105 | ((clos) ? static_cast<void>(0) : qt_assert("clos", __FILE__, 317)); | - | ||||||||||||||||||
106 | ExecutionContext *current = static_cast<ExecutionContext *>(&engine->currentStackFrame->jsFrame->context); | - | ||||||||||||||||||
107 | if (clos->isGenerator()
| 6116-948890 | ||||||||||||||||||
108 | return executed 6111 times by 1 test: GeneratorFunction::create(current, clos)->asReturnedValue();return GeneratorFunction::create(current, clos)->asReturnedValue(); Executed by:
executed 6111 times by 1 test: return GeneratorFunction::create(current, clos)->asReturnedValue(); Executed by:
| 6111 | ||||||||||||||||||
109 | return executed 949040 times by 31 tests: FunctionObject::createScriptFunction(current, clos)->asReturnedValue();return FunctionObject::createScriptFunction(current, clos)->asReturnedValue(); Executed by:
executed 949040 times by 31 tests: return FunctionObject::createScriptFunction(current, clos)->asReturnedValue(); Executed by:
| 949040 | ||||||||||||||||||
110 | } | - | ||||||||||||||||||
111 | - | |||||||||||||||||||
112 | bool Runtime::method_deleteProperty(ExecutionEngine *engine, const Value &base, const Value &index) | - | ||||||||||||||||||
113 | { | - | ||||||||||||||||||
114 | Scope scope(engine); | - | ||||||||||||||||||
115 | ScopedObject o(scope, base.toObject(engine)); | - | ||||||||||||||||||
116 | if (scope.engine->hasException
| 0-10266 | ||||||||||||||||||
117 | return never executed: Encode::undefined();return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
118 | ((o) ? static_cast<void>(0) : qt_assert("o", __FILE__, 330)); | - | ||||||||||||||||||
119 | - | |||||||||||||||||||
120 | ScopedPropertyKey key(scope, index.toPropertyKey(engine)); | - | ||||||||||||||||||
121 | if (engine->hasException
| 4-10289 | ||||||||||||||||||
122 | return executed 4 times by 1 test: false;return false; Executed by:
executed 4 times by 1 test: return false; Executed by:
| 4 | ||||||||||||||||||
123 | return executed 10279 times by 5 tests: o->deleteProperty(key);return o->deleteProperty(key); Executed by:
executed 10279 times by 5 tests: return o->deleteProperty(key); Executed by:
| 10279 | ||||||||||||||||||
124 | } | - | ||||||||||||||||||
125 | - | |||||||||||||||||||
126 | bool Runtime::method_deleteName(ExecutionEngine *engine, int nameIndex) | - | ||||||||||||||||||
127 | { | - | ||||||||||||||||||
128 | Scope scope(engine); | - | ||||||||||||||||||
129 | ScopedString name(scope, engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[nameIndex]); | - | ||||||||||||||||||
130 | return executed 142 times by 2 tests: static_cast<ExecutionContext &>(engine->currentStackFrame->jsFrame->context).deleteProperty(name);return static_cast<ExecutionContext &>(engine->currentStackFrame->jsFrame->context).deleteProperty(name); Executed by:
executed 142 times by 2 tests: return static_cast<ExecutionContext &>(engine->currentStackFrame->jsFrame->context).deleteProperty(name); Executed by:
| 142 | ||||||||||||||||||
131 | } | - | ||||||||||||||||||
132 | - | |||||||||||||||||||
133 | QV4::ReturnedValue Runtime::method_instanceof(ExecutionEngine *engine, const Value &lval, const Value &rval) | - | ||||||||||||||||||
134 | { | - | ||||||||||||||||||
135 | - | |||||||||||||||||||
136 | const Object *rhs = rval.as<Object>(); | - | ||||||||||||||||||
137 | if (!rhs
| 22-4252218 | ||||||||||||||||||
138 | return executed 22 times by 2 tests: engine->throwTypeError();return engine->throwTypeError(); Executed by:
executed 22 times by 2 tests: return engine->throwTypeError(); Executed by:
| 22 | ||||||||||||||||||
139 | - | |||||||||||||||||||
140 | Scope scope(engine); | - | ||||||||||||||||||
141 | ScopedValue hasInstance(scope, rhs->get(engine->symbol_hasInstance())); | - | ||||||||||||||||||
142 | if (hasInstance->isUndefined()
| 74-4262635 | ||||||||||||||||||
143 | return executed 74 times by 3 tests: rhs->instanceOf(lval);return rhs->instanceOf(lval); Executed by:
executed 74 times by 3 tests: return rhs->instanceOf(lval); Executed by:
| 74 | ||||||||||||||||||
144 | FunctionObject *f = hasInstance->as<FunctionObject>(); | - | ||||||||||||||||||
145 | if (!f
| 4-4299623 | ||||||||||||||||||
146 | return executed 4 times by 1 test: engine->throwTypeError();return engine->throwTypeError(); Executed by:
executed 4 times by 1 test: return engine->throwTypeError(); Executed by:
| 4 | ||||||||||||||||||
147 | - | |||||||||||||||||||
148 | ScopedValue result(scope, f->call(&rval, &lval, 1)); | - | ||||||||||||||||||
149 | return executed 4301818 times by 11 tests: Encode(result->toBoolean());return Encode(result->toBoolean()); Executed by:
executed 4301818 times by 11 tests: return Encode(result->toBoolean()); Executed by:
| 4301818 | ||||||||||||||||||
150 | } | - | ||||||||||||||||||
151 | - | |||||||||||||||||||
152 | QV4::ReturnedValue Runtime::method_in(ExecutionEngine *engine, const Value &left, const Value &right) | - | ||||||||||||||||||
153 | { | - | ||||||||||||||||||
154 | Object *ro = right.objectValue(); | - | ||||||||||||||||||
155 | if (!ro
| 20-672 | ||||||||||||||||||
156 | return executed 20 times by 1 test: engine->throwTypeError();return engine->throwTypeError(); Executed by:
executed 20 times by 1 test: return engine->throwTypeError(); Executed by:
| 20 | ||||||||||||||||||
157 | Scope scope(engine); | - | ||||||||||||||||||
158 | ScopedPropertyKey s(scope, left.toPropertyKey(engine)); | - | ||||||||||||||||||
159 | if (scope.hasException()
| 0-672 | ||||||||||||||||||
160 | return never executed: Encode::undefined();return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
161 | bool r = ro->hasProperty(s); | - | ||||||||||||||||||
162 | return executed 672 times by 6 tests: Encode(r);return Encode(r); Executed by:
executed 672 times by 6 tests: return Encode(r); Executed by:
| 672 | ||||||||||||||||||
163 | } | - | ||||||||||||||||||
164 | - | |||||||||||||||||||
165 | double RuntimeHelpers::stringToNumber(const QString &string) | - | ||||||||||||||||||
166 | { | - | ||||||||||||||||||
167 | const QStringRef s = QStringRef(&string).trimmed(); | - | ||||||||||||||||||
168 | if (s.startsWith(QLatin1String("0x"))
| 88-262320 | ||||||||||||||||||
169 | return executed 262408 times by 1 test: s.toLong(nullptr, 16);return s.toLong(nullptr, 16); Executed by:
executed 262408 times by 1 test: return s.toLong(nullptr, 16); Executed by:
| 262408 | ||||||||||||||||||
170 | bool ok; | - | ||||||||||||||||||
171 | QByteArray ba = s.toLatin1(); | - | ||||||||||||||||||
172 | const char *begin = ba.constData(); | - | ||||||||||||||||||
173 | const char *end = nullptr; | - | ||||||||||||||||||
174 | double d = qstrtod(begin, &end, &ok); | - | ||||||||||||||||||
175 | if (end - begin != ba.size()
| 1851-7212 | ||||||||||||||||||
176 | if (ba == "Infinity"
| 28-1720 | ||||||||||||||||||
177 | d = (::qInf()); executed 160 times by 2 tests: d = (::qInf()); Executed by:
| 160 | ||||||||||||||||||
178 | else if (ba == "-Infinity"
| 88-1604 | ||||||||||||||||||
179 | d = -(::qInf()); executed 88 times by 2 tests: d = -(::qInf()); Executed by:
| 88 | ||||||||||||||||||
180 | else | - | ||||||||||||||||||
181 | d = std::numeric_limits<double>::quiet_NaN(); executed 1604 times by 4 tests: d = std::numeric_limits<double>::quiet_NaN(); Executed by:
| 1604 | ||||||||||||||||||
182 | } | - | ||||||||||||||||||
183 | return executed 9067 times by 7 tests: d;return d; Executed by:
executed 9067 times by 7 tests: return d; Executed by:
| 9067 | ||||||||||||||||||
184 | } | - | ||||||||||||||||||
185 | - | |||||||||||||||||||
186 | Heap::String *RuntimeHelpers::stringFromNumber(ExecutionEngine *engine, double number) | - | ||||||||||||||||||
187 | { | - | ||||||||||||||||||
188 | QString qstr; | - | ||||||||||||||||||
189 | RuntimeHelpers::numberToString(&qstr, number, 10); | - | ||||||||||||||||||
190 | return executed 3013986 times by 20 tests: engine->newString(qstr);return engine->newString(qstr); Executed by:
executed 3013986 times by 20 tests: return engine->newString(qstr); Executed by:
| 3013986 | ||||||||||||||||||
191 | } | - | ||||||||||||||||||
192 | - | |||||||||||||||||||
193 | ReturnedValue RuntimeHelpers::objectDefaultValue(const Object *object, int typeHint) | - | ||||||||||||||||||
194 | { | - | ||||||||||||||||||
195 | ExecutionEngine *engine = object->internalClass()->engine; | - | ||||||||||||||||||
196 | if (engine->hasException
| 404-52222 | ||||||||||||||||||
197 | return executed 404 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 404 times by 1 test: return Encode::undefined(); Executed by:
| 404 | ||||||||||||||||||
198 | - | |||||||||||||||||||
199 | String *hint; | - | ||||||||||||||||||
200 | switch (typeHint) { | - | ||||||||||||||||||
201 | case executed 5749 times by 25 tests: STRING_HINT:case STRING_HINT: Executed by:
executed 5749 times by 25 tests: case STRING_HINT: Executed by:
| 5749 | ||||||||||||||||||
202 | hint = engine->id_string(); | - | ||||||||||||||||||
203 | break; executed 5748 times by 25 tests: break; Executed by:
| 5748 | ||||||||||||||||||
204 | case executed 42829 times by 6 tests: NUMBER_HINT:case NUMBER_HINT: Executed by:
executed 42829 times by 6 tests: case NUMBER_HINT: Executed by:
| 42829 | ||||||||||||||||||
205 | hint = engine->id_number(); | - | ||||||||||||||||||
206 | break; executed 42829 times by 6 tests: break; Executed by:
| 42829 | ||||||||||||||||||
207 | default executed 3638 times by 8 tests: :default: Executed by:
executed 3638 times by 8 tests: default: Executed by:
| 3638 | ||||||||||||||||||
208 | hint = engine->id_default(); | - | ||||||||||||||||||
209 | break; executed 3634 times by 8 tests: break; Executed by:
| 3634 | ||||||||||||||||||
210 | } | - | ||||||||||||||||||
211 | - | |||||||||||||||||||
212 | Scope scope(engine); | - | ||||||||||||||||||
213 | ScopedFunctionObject toPrimitive(scope, object->get(engine->symbol_toPrimitive())); | - | ||||||||||||||||||
214 | if (engine->hasException
| 28-52204 | ||||||||||||||||||
215 | return executed 28 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 28 times by 1 test: return Encode::undefined(); Executed by:
| 28 | ||||||||||||||||||
216 | if (toPrimitive
| 19715-32482 | ||||||||||||||||||
217 | ScopedValue result(scope, toPrimitive->call(object, hint, 1)); | - | ||||||||||||||||||
218 | if (engine->hasException
| 68-32414 | ||||||||||||||||||
219 | return executed 68 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 68 times by 1 test: return Encode::undefined(); Executed by:
| 68 | ||||||||||||||||||
220 | if (!result->isPrimitive()
| 92-32322 | ||||||||||||||||||
221 | return executed 92 times by 1 test: engine->throwTypeError();return engine->throwTypeError(); Executed by:
executed 92 times by 1 test: return engine->throwTypeError(); Executed by:
| 92 | ||||||||||||||||||
222 | return executed 32322 times by 3 tests: result->asReturnedValue();return result->asReturnedValue(); Executed by:
executed 32322 times by 3 tests: return result->asReturnedValue(); Executed by:
| 32322 | ||||||||||||||||||
223 | } | - | ||||||||||||||||||
224 | - | |||||||||||||||||||
225 | if (hint == engine->id_default()
| 3378-16320 | ||||||||||||||||||
226 | hint = engine->id_number(); executed 3380 times by 8 tests: hint = engine->id_number(); Executed by:
| 3380 | ||||||||||||||||||
227 | return executed 19699 times by 30 tests: ordinaryToPrimitive(engine, object, hint);return ordinaryToPrimitive(engine, object, hint); Executed by:
executed 19699 times by 30 tests: return ordinaryToPrimitive(engine, object, hint); Executed by:
| 19699 | ||||||||||||||||||
228 | } | - | ||||||||||||||||||
229 | - | |||||||||||||||||||
230 | - | |||||||||||||||||||
231 | ReturnedValue RuntimeHelpers::ordinaryToPrimitive(ExecutionEngine *engine, const Object *object, String *typeHint) | - | ||||||||||||||||||
232 | { | - | ||||||||||||||||||
233 | ((!engine->hasException) ? static_cast<void>(0) : qt_assert("!engine->hasException", __FILE__, 445)); | - | ||||||||||||||||||
234 | - | |||||||||||||||||||
235 | String *meth1 = engine->id_toString(); | - | ||||||||||||||||||
236 | String *meth2 = engine->id_valueOf(); | - | ||||||||||||||||||
237 | - | |||||||||||||||||||
238 | if (typeHint->propertyKey() == engine->id_number()->propertyKey()
| 5759-46039 | ||||||||||||||||||
239 | qSwap(meth1, meth2); | - | ||||||||||||||||||
240 | } executed 46041 times by 10 tests: else {end of block Executed by:
| 46041 | ||||||||||||||||||
241 | ((typeHint->propertyKey() == engine->id_string()->propertyKey()) ? static_cast<void>(0) : qt_assert("typeHint->propertyKey() == engine->id_string()->propertyKey()", __FILE__, 453)); | - | ||||||||||||||||||
242 | } executed 5766 times by 25 tests: end of block Executed by:
| 5766 | ||||||||||||||||||
243 | - | |||||||||||||||||||
244 | Scope scope(engine); | - | ||||||||||||||||||
245 | ScopedValue result(scope); | - | ||||||||||||||||||
246 | - | |||||||||||||||||||
247 | ScopedValue conv(scope, object->get(meth1)); | - | ||||||||||||||||||
248 | if (FunctionObject *o = conv->as<FunctionObject>()
| 228-51614 | ||||||||||||||||||
249 | result = o->call(object, nullptr, 0); | - | ||||||||||||||||||
250 | if (result->isPrimitive()
| 5324-46284 | ||||||||||||||||||
251 | return executed 46283 times by 26 tests: result->asReturnedValue();return result->asReturnedValue(); Executed by:
executed 46283 times by 26 tests: return result->asReturnedValue(); Executed by:
| 46283 | ||||||||||||||||||
252 | } executed 5323 times by 7 tests: end of block Executed by:
| 5323 | ||||||||||||||||||
253 | - | |||||||||||||||||||
254 | if (engine->hasException
| 0-5549 | ||||||||||||||||||
255 | return never executed: Encode::undefined();return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
256 | - | |||||||||||||||||||
257 | conv = object->get(meth2); | - | ||||||||||||||||||
258 | if (FunctionObject *o = conv->as<FunctionObject>()
| 60-5493 | ||||||||||||||||||
259 | result = o->call(object, nullptr, 0); | - | ||||||||||||||||||
260 | if (result->isPrimitive()
| 312-5179 | ||||||||||||||||||
261 | return executed 5179 times by 7 tests: result->asReturnedValue();return result->asReturnedValue(); Executed by:
executed 5179 times by 7 tests: return result->asReturnedValue(); Executed by:
| 5179 | ||||||||||||||||||
262 | } executed 312 times by 1 test: end of block Executed by:
| 312 | ||||||||||||||||||
263 | - | |||||||||||||||||||
264 | return executed 372 times by 1 test: engine->throwTypeError();return engine->throwTypeError(); Executed by:
executed 372 times by 1 test: return engine->throwTypeError(); Executed by:
| 372 | ||||||||||||||||||
265 | } | - | ||||||||||||||||||
266 | - | |||||||||||||||||||
267 | - | |||||||||||||||||||
268 | Heap::Object *RuntimeHelpers::convertToObject(ExecutionEngine *engine, const Value &value) | - | ||||||||||||||||||
269 | { | - | ||||||||||||||||||
270 | ((!value.isObject()) ? static_cast<void>(0) : qt_assert("!value.isObject()", __FILE__, 482)); | - | ||||||||||||||||||
271 | switch (value.type()) { | - | ||||||||||||||||||
272 | case executed 366 times by 3 tests: Value::Undefined_Type:case Value::Undefined_Type: Executed by:
executed 366 times by 3 tests: case Value::Undefined_Type: Executed by:
| 366 | ||||||||||||||||||
273 | engine->throwTypeError(QLatin1String("Value is undefined and could not be converted to an object")); | - | ||||||||||||||||||
274 | return executed 366 times by 3 tests: nullptr;return nullptr; Executed by:
executed 366 times by 3 tests: return nullptr; Executed by:
| 366 | ||||||||||||||||||
275 | case executed 342 times by 3 tests: Value::Null_Type:case Value::Null_Type: Executed by:
executed 342 times by 3 tests: case Value::Null_Type: Executed by:
| 342 | ||||||||||||||||||
276 | engine->throwTypeError(QLatin1String("Value is null and could not be converted to an object")); | - | ||||||||||||||||||
277 | return executed 342 times by 3 tests: nullptr;return nullptr; Executed by:
executed 342 times by 3 tests: return nullptr; Executed by:
| 342 | ||||||||||||||||||
278 | case executed 300 times by 1 test: Value::Boolean_Type:case Value::Boolean_Type: Executed by:
executed 300 times by 1 test: case Value::Boolean_Type: Executed by:
| 300 | ||||||||||||||||||
279 | return executed 300 times by 1 test: engine->newBooleanObject(value.booleanValue());return engine->newBooleanObject(value.booleanValue()); Executed by:
executed 300 times by 1 test: return engine->newBooleanObject(value.booleanValue()); Executed by:
| 300 | ||||||||||||||||||
280 | case executed 44954 times by 12 tests: Value::Managed_Type:case Value::Managed_Type: Executed by:
executed 44954 times by 12 tests: case Value::Managed_Type: Executed by:
| 44954 | ||||||||||||||||||
281 | ((value.isStringOrSymbol()) ? static_cast<void>(0) : qt_assert("value.isStringOrSymbol()", __FILE__, 493)); | - | ||||||||||||||||||
282 | if (!value.isString()
| 106-44845 | ||||||||||||||||||
283 | return executed 106 times by 1 test: engine->newSymbolObject(value.symbolValue());return engine->newSymbolObject(value.symbolValue()); Executed by:
executed 106 times by 1 test: return engine->newSymbolObject(value.symbolValue()); Executed by:
| 106 | ||||||||||||||||||
284 | return executed 44845 times by 12 tests: engine->newStringObject(value.stringValue());return engine->newStringObject(value.stringValue()); Executed by:
executed 44845 times by 12 tests: return engine->newStringObject(value.stringValue()); Executed by:
| 44845 | ||||||||||||||||||
285 | case executed 606 times by 7 tests: Value::Integer_Type:case Value::Integer_Type: Executed by:
executed 606 times by 7 tests: case Value::Integer_Type: Executed by:
| 606 | ||||||||||||||||||
286 | default executed 638 times by 8 tests: :default: Executed by:
executed 638 times by 8 tests: default: Executed by:
| 638 | ||||||||||||||||||
287 | return executed 1244 times by 9 tests: engine->newNumberObject(value.asDouble());return engine->newNumberObject(value.asDouble()); Executed by:
executed 1244 times by 9 tests: return engine->newNumberObject(value.asDouble()); Executed by:
| 1244 | ||||||||||||||||||
288 | } | - | ||||||||||||||||||
289 | } | - | ||||||||||||||||||
290 | - | |||||||||||||||||||
291 | Heap::String *RuntimeHelpers::convertToString(ExecutionEngine *engine, Value value, TypeHint hint) | - | ||||||||||||||||||
292 | { | - | ||||||||||||||||||
293 | redo: | - | ||||||||||||||||||
294 | switch (value.type()) { | - | ||||||||||||||||||
295 | case never executed: Value::Empty_Type:case Value::Empty_Type: never executed: case Value::Empty_Type: | 0 | ||||||||||||||||||
296 | ((!"empty Value encountered") ? static_cast<void>(0) : qt_assert("!\"empty Value encountered\"", __FILE__, 508)); | - | ||||||||||||||||||
297 | do { ((false) ? static_cast<void>(0) : qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached", __FILE__, 509)); __builtin_unreachable(); } while (false); | - | ||||||||||||||||||
298 | case executed 1151 times by 3 tests: case Value::Undefined_Type: Executed by:
code before this statement never executed: case Value::Undefined_Type: executed 1151 times by 3 tests: Value::Undefined_Type:case Value::Undefined_Type: Executed by:
code before this statement never executed: case Value::Undefined_Type: executed 1151 times by 3 tests: case Value::Undefined_Type: Executed by:
| 0-1151 | ||||||||||||||||||
299 | return executed 1149 times by 3 tests: engine->id_undefined()->d();return engine->id_undefined()->d(); Executed by:
executed 1149 times by 3 tests: return engine->id_undefined()->d(); Executed by:
| 1149 | ||||||||||||||||||
300 | case executed 152 times by 1 test: Value::Null_Type:case Value::Null_Type: Executed by:
executed 152 times by 1 test: case Value::Null_Type: Executed by:
| 152 | ||||||||||||||||||
301 | return executed 152 times by 1 test: engine->id_null()->d();return engine->id_null()->d(); Executed by:
executed 152 times by 1 test: return engine->id_null()->d(); Executed by:
| 152 | ||||||||||||||||||
302 | case executed 963 times by 3 tests: Value::Boolean_Type:case Value::Boolean_Type: Executed by:
executed 963 times by 3 tests: case Value::Boolean_Type: Executed by:
| 963 | ||||||||||||||||||
303 | if (value.booleanValue()
| 475-488 | ||||||||||||||||||
304 | return executed 475 times by 3 tests: engine->id_true()->d();return engine->id_true()->d(); Executed by:
executed 475 times by 3 tests: return engine->id_true()->d(); Executed by:
| 475 | ||||||||||||||||||
305 | else | - | ||||||||||||||||||
306 | return executed 488 times by 2 tests: engine->id_false()->d();return engine->id_false()->d(); Executed by:
executed 488 times by 2 tests: return engine->id_false()->d(); Executed by:
| 488 | ||||||||||||||||||
307 | case executed 1576 times by 2 tests: Value::Managed_Type:case Value::Managed_Type: Executed by:
executed 1576 times by 2 tests: {case Value::Managed_Type: Executed by:
| 1576 | ||||||||||||||||||
308 | if (value.isString()
| 0-1576 | ||||||||||||||||||
309 | return never executed: static_cast<const String &>(value).d();return static_cast<const String &>(value).d(); never executed: return static_cast<const String &>(value).d(); | 0 | ||||||||||||||||||
310 | if (value.isSymbol()
| 32-1545 | ||||||||||||||||||
311 | engine->throwTypeError(QLatin1String("Cannot convert a symbol to a string.")); | - | ||||||||||||||||||
312 | return executed 32 times by 1 test: nullptr;return nullptr; Executed by:
executed 32 times by 1 test: return nullptr; Executed by:
| 32 | ||||||||||||||||||
313 | } | - | ||||||||||||||||||
314 | value = Primitive::fromReturnedValue(RuntimeHelpers::toPrimitive(value, hint)); | - | ||||||||||||||||||
315 | ((value.isPrimitive()) ? static_cast<void>(0) : qt_assert("value.isPrimitive()", __FILE__, 527)); | - | ||||||||||||||||||
316 | if (value.isString()
| 375-1172 | ||||||||||||||||||
317 | return executed 1171 times by 2 tests: static_cast<const String &>(value).d();return static_cast<const String &>(value).d(); Executed by:
executed 1171 times by 2 tests: return static_cast<const String &>(value).d(); Executed by:
| 1171 | ||||||||||||||||||
318 | goto executed 372 times by 1 test: redo;goto redo; Executed by:
executed 372 times by 1 test: goto redo; Executed by:
| 372 | ||||||||||||||||||
319 | } | - | ||||||||||||||||||
320 | case executed 2614215 times by 15 tests: Value::Integer_Type:case Value::Integer_Type: Executed by:
executed 2614215 times by 15 tests: case Value::Integer_Type: Executed by:
| 2614215 | ||||||||||||||||||
321 | return executed 2614214 times by 15 tests: RuntimeHelpers::stringFromNumber(engine, value.int_32());return RuntimeHelpers::stringFromNumber(engine, value.int_32()); Executed by:
executed 2614214 times by 15 tests: return RuntimeHelpers::stringFromNumber(engine, value.int_32()); Executed by:
| 2614214 | ||||||||||||||||||
322 | default executed 399725 times by 13 tests: :default: Executed by:
executed 399725 times by 13 tests: default: Executed by:
| 399725 | ||||||||||||||||||
323 | return executed 399726 times by 13 tests: RuntimeHelpers::stringFromNumber(engine, value.doubleValue());return RuntimeHelpers::stringFromNumber(engine, value.doubleValue()); Executed by:
executed 399726 times by 13 tests: return RuntimeHelpers::stringFromNumber(engine, value.doubleValue()); Executed by:
| 399726 | ||||||||||||||||||
324 | } | - | ||||||||||||||||||
325 | } | - | ||||||||||||||||||
326 | - | |||||||||||||||||||
327 | - | |||||||||||||||||||
328 | - | |||||||||||||||||||
329 | static Heap::String *convert_to_string_add(ExecutionEngine *engine, Value value) | - | ||||||||||||||||||
330 | { | - | ||||||||||||||||||
331 | return executed 2395087 times by 18 tests: RuntimeHelpers::convertToString(engine, value, PREFERREDTYPE_HINT);return RuntimeHelpers::convertToString(engine, value, PREFERREDTYPE_HINT); Executed by:
executed 2395087 times by 18 tests: return RuntimeHelpers::convertToString(engine, value, PREFERREDTYPE_HINT); Executed by:
| 2395087 | ||||||||||||||||||
332 | } | - | ||||||||||||||||||
333 | - | |||||||||||||||||||
334 | QV4::ReturnedValue RuntimeHelpers::addHelper(ExecutionEngine *engine, const Value &left, const Value &right) | - | ||||||||||||||||||
335 | { | - | ||||||||||||||||||
336 | Scope scope(engine); | - | ||||||||||||||||||
337 | - | |||||||||||||||||||
338 | ScopedValue pleft(scope, RuntimeHelpers::toPrimitive(left, PREFERREDTYPE_HINT)); | - | ||||||||||||||||||
339 | ScopedValue pright(scope, RuntimeHelpers::toPrimitive(right, PREFERREDTYPE_HINT)); | - | ||||||||||||||||||
340 | String *sleft = pleft->stringValue(); | - | ||||||||||||||||||
341 | String *sright = pright->stringValue(); | - | ||||||||||||||||||
342 | if (sleft
| 402-57837409 | ||||||||||||||||||
343 | if (!sleft
| 185494-57842851 | ||||||||||||||||||
344 | pleft = convert_to_string_add(engine, pleft); | - | ||||||||||||||||||
345 | sleft = static_cast<String *>(pleft.ptr); | - | ||||||||||||||||||
346 | } executed 185496 times by 8 tests: end of block Executed by:
| 185496 | ||||||||||||||||||
347 | if (!sright
| 2209596-55841666 | ||||||||||||||||||
348 | pright = convert_to_string_add(engine, pright); | - | ||||||||||||||||||
349 | sright = static_cast<String *>(pright.ptr); | - | ||||||||||||||||||
350 | } executed 2209594 times by 16 tests: end of block Executed by:
| 2209594 | ||||||||||||||||||
351 | if (engine->hasException
| 32-58183347 | ||||||||||||||||||
352 | return executed 32 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 32 times by 1 test: return Encode::undefined(); Executed by:
| 32 | ||||||||||||||||||
353 | if (!sleft->d()->length()
| 271322-57979299 | ||||||||||||||||||
354 | return executed 271321 times by 7 tests: sright->asReturnedValue();return sright->asReturnedValue(); Executed by:
executed 271321 times by 7 tests: return sright->asReturnedValue(); Executed by:
| 271321 | ||||||||||||||||||
355 | if (!sright->d()->length()
| 1139831-57028952 | ||||||||||||||||||
356 | return executed 1139709 times by 6 tests: sleft->asReturnedValue();return sleft->asReturnedValue(); Executed by:
executed 1139709 times by 6 tests: return sleft->asReturnedValue(); Executed by:
| 1139709 | ||||||||||||||||||
357 | MemoryManager *mm = engine->memoryManager; | - | ||||||||||||||||||
358 | return executed 56942701 times by 35 tests: (mm->alloc<ComplexString>(sleft->d(), sright->d()))->asReturnedValue();return (mm->alloc<ComplexString>(sleft->d(), sright->d()))->asReturnedValue(); Executed by:
executed 56942701 times by 35 tests: return (mm->alloc<ComplexString>(sleft->d(), sright->d()))->asReturnedValue(); Executed by:
| 56942701 | ||||||||||||||||||
359 | } | - | ||||||||||||||||||
360 | double x = RuntimeHelpers::toNumber(pleft); | - | ||||||||||||||||||
361 | double y = RuntimeHelpers::toNumber(pright); | - | ||||||||||||||||||
362 | return executed 402 times by 3 tests: Encode(x + y);return Encode(x + y); Executed by:
executed 402 times by 3 tests: return Encode(x + y); Executed by:
| 402 | ||||||||||||||||||
363 | } | - | ||||||||||||||||||
364 | - | |||||||||||||||||||
365 | void Runtime::method_storeProperty(ExecutionEngine *engine, const Value &object, int nameIndex, const Value &value) | - | ||||||||||||||||||
366 | { | - | ||||||||||||||||||
367 | Scope scope(engine); | - | ||||||||||||||||||
368 | QV4::Function *v4Function = engine->currentStackFrame->v4Function; | - | ||||||||||||||||||
369 | ScopedString name(scope, v4Function->compilationUnit->runtimeStrings[nameIndex]); | - | ||||||||||||||||||
370 | ScopedObject o(scope, object.toObject(engine)); | - | ||||||||||||||||||
371 | if ((!o
| 0-52630 | ||||||||||||||||||
372 | engine->throwTypeError(); never executed: engine->throwTypeError(); | 0 | ||||||||||||||||||
373 | } executed 52634 times by 66 tests: end of block Executed by:
| 52634 | ||||||||||||||||||
374 | - | |||||||||||||||||||
375 | static __attribute__((noinline)) ReturnedValue getElementIntFallback(ExecutionEngine *engine, const Value &object, uint idx) | - | ||||||||||||||||||
376 | { | - | ||||||||||||||||||
377 | ((idx < | - | ||||||||||||||||||
378 | (0x7fffffff * 2U + 1U) | - | ||||||||||||||||||
379 | ) ? static_cast<void>(0) : qt_assert("idx < UINT_MAX", __FILE__, 589)); | - | ||||||||||||||||||
380 | Scope scope(engine); | - | ||||||||||||||||||
381 | - | |||||||||||||||||||
382 | ScopedObject o(scope, object); | - | ||||||||||||||||||
383 | if (!o
| 95522-24770144 | ||||||||||||||||||
384 | if (const
| 57-24804282 | ||||||||||||||||||
385 | if (idx >= (uint)str->toQString().length()
| 38-25127630 | ||||||||||||||||||
386 | return executed 38 times by 2 tests: Encode::undefined();return Encode::undefined(); Executed by:
executed 38 times by 2 tests: return Encode::undefined(); Executed by:
| 38 | ||||||||||||||||||
387 | } | - | ||||||||||||||||||
388 | const QString s = str->toQString().mid(idx, 1); | - | ||||||||||||||||||
389 | return executed 25086857 times by 3 tests: scope.engine->newString(s)->asReturnedValue();return scope.engine->newString(s)->asReturnedValue(); Executed by:
executed 25086857 times by 3 tests: return scope.engine->newString(s)->asReturnedValue(); Executed by:
| 25086857 | ||||||||||||||||||
390 | } | - | ||||||||||||||||||
391 | - | |||||||||||||||||||
392 | if (object.isNullOrUndefined()
| 4-54 | ||||||||||||||||||
393 | QString message = ([]() noexcept -> QString { enum { Size = sizeof(u"" "Cannot read property '%1' of %2")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Cannot read property '%1' of %2" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()).arg(idx).arg(object.toQStringNoThrow()); | - | ||||||||||||||||||
394 | return executed 53 times by 1 test: engine->throwTypeError(message);return engine->throwTypeError(message); Executed by:
executed 53 times by 1 test: return engine->throwTypeError(message); Executed by:
| 53 | ||||||||||||||||||
395 | } | - | ||||||||||||||||||
396 | - | |||||||||||||||||||
397 | o = RuntimeHelpers::convertToObject(scope.engine, object); | - | ||||||||||||||||||
398 | ((!!o) ? static_cast<void>(0) : qt_assert("!!o", __FILE__, 608)); | - | ||||||||||||||||||
399 | } executed 4 times by 2 tests: end of block Executed by:
| 4 | ||||||||||||||||||
400 | - | |||||||||||||||||||
401 | if (o->arrayData()
| 519-70912 | ||||||||||||||||||
402 | ScopedValue v(scope, o->arrayData()->get(idx)); | - | ||||||||||||||||||
403 | if (!v->isEmpty()
| 128-70267 | ||||||||||||||||||
404 | return executed 128 times by 1 test: v->asReturnedValue();return v->asReturnedValue(); Executed by:
executed 128 times by 1 test: return v->asReturnedValue(); Executed by:
| 128 | ||||||||||||||||||
405 | } executed 70267 times by 16 tests: end of block Executed by:
| 70267 | ||||||||||||||||||
406 | - | |||||||||||||||||||
407 | return executed 95391 times by 19 tests: o->get(idx);return o->get(idx); Executed by:
executed 95391 times by 19 tests: return o->get(idx); Executed by:
| 95391 | ||||||||||||||||||
408 | } | - | ||||||||||||||||||
409 | - | |||||||||||||||||||
410 | static __attribute__((noinline)) ReturnedValue getElementFallback(ExecutionEngine *engine, const Value &object, const Value &index) | - | ||||||||||||||||||
411 | { | - | ||||||||||||||||||
412 | ((!index.isPositiveInt()) ? static_cast<void>(0) : qt_assert("!index.isPositiveInt()", __FILE__, 622)); | - | ||||||||||||||||||
413 | - | |||||||||||||||||||
414 | Scope scope(engine); | - | ||||||||||||||||||
415 | - | |||||||||||||||||||
416 | ScopedObject o(scope, object); | - | ||||||||||||||||||
417 | if (!o
| 146-56286 | ||||||||||||||||||
418 | if (object.isNullOrUndefined()
| 17-130 | ||||||||||||||||||
419 | QString message = ([]() noexcept -> QString { enum { Size = sizeof(u"" "Cannot read property '%1' of %2")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Cannot read property '%1' of %2" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()).arg(index.toQStringNoThrow()).arg(object.toQStringNoThrow()); | - | ||||||||||||||||||
420 | return executed 130 times by 2 tests: engine->throwTypeError(message);return engine->throwTypeError(message); Executed by:
executed 130 times by 2 tests: return engine->throwTypeError(message); Executed by:
| 130 | ||||||||||||||||||
421 | } | - | ||||||||||||||||||
422 | - | |||||||||||||||||||
423 | o = RuntimeHelpers::convertToObject(scope.engine, object); | - | ||||||||||||||||||
424 | ((!!o) ? static_cast<void>(0) : qt_assert("!!o", __FILE__, 634)); | - | ||||||||||||||||||
425 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||||||||
426 | - | |||||||||||||||||||
427 | ScopedPropertyKey name(scope, index.toPropertyKey(engine)); | - | ||||||||||||||||||
428 | if (scope.hasException()
| 532-55842 | ||||||||||||||||||
429 | return executed 532 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 532 times by 1 test: return Encode::undefined(); Executed by:
| 532 | ||||||||||||||||||
430 | return executed 55810 times by 14 tests: o->get(name);return o->get(name); Executed by:
executed 55810 times by 14 tests: return o->get(name); Executed by:
| 55810 | ||||||||||||||||||
431 | } | - | ||||||||||||||||||
432 | - | |||||||||||||||||||
433 | ReturnedValue Runtime::method_loadElement(ExecutionEngine *engine, const Value &object, const Value &index) | - | ||||||||||||||||||
434 | { | - | ||||||||||||||||||
435 | if (index.isPositiveInt()
| 56402-34286590 | ||||||||||||||||||
436 | uint idx = static_cast<uint>(index.int_32()); | - | ||||||||||||||||||
437 | if (Heap::Base *b = object.heapObject()
| 56-34497689 | ||||||||||||||||||
438 | if (b->internalClass->vtable->isObject
| 9612362-24955547 | ||||||||||||||||||
439 | Heap::Object *o = static_cast<Heap::Object *>(b); | - | ||||||||||||||||||
440 | if (o->arrayData && o->arrayData->type == Heap::ArrayData::Simple
| 70115-9557515 | ||||||||||||||||||
441 | Heap::SimpleArrayData *s = o->arrayData.cast<Heap::SimpleArrayData>(); | - | ||||||||||||||||||
442 | if (idx < s->values.size
| 436-9594647 | ||||||||||||||||||
443 | if (!s->data(idx).isEmpty()
| 364-9438642 | ||||||||||||||||||
444 | return executed 9423221 times by 15 tests: s->data(idx).asReturnedValue();return s->data(idx).asReturnedValue(); Executed by:
executed 9423221 times by 15 tests: return s->data(idx).asReturnedValue(); Executed by:
| 9423221 | ||||||||||||||||||
445 | } executed 800 times by 1 test: end of block Executed by:
| 800 | ||||||||||||||||||
446 | } executed 95544 times by 19 tests: end of block Executed by:
| 95544 | ||||||||||||||||||
447 | } executed 25053953 times by 19 tests: end of block Executed by:
| 25053953 | ||||||||||||||||||
448 | return executed 25071920 times by 19 tests: getElementIntFallback(engine, object, idx);return getElementIntFallback(engine, object, idx); Executed by:
executed 25071920 times by 19 tests: return getElementIntFallback(engine, object, idx); Executed by:
| 25071920 | ||||||||||||||||||
449 | } | - | ||||||||||||||||||
450 | - | |||||||||||||||||||
451 | return executed 56403 times by 14 tests: getElementFallback(engine, object, index);return getElementFallback(engine, object, index); Executed by:
executed 56403 times by 14 tests: return getElementFallback(engine, object, index); Executed by:
| 56403 | ||||||||||||||||||
452 | } | - | ||||||||||||||||||
453 | - | |||||||||||||||||||
454 | static __attribute__((noinline)) bool setElementFallback(ExecutionEngine *engine, const Value &object, const Value &index, const Value &value) | - | ||||||||||||||||||
455 | { | - | ||||||||||||||||||
456 | Scope scope(engine); | - | ||||||||||||||||||
457 | ScopedObject o(scope, object.toObject(engine)); | - | ||||||||||||||||||
458 | if (engine->hasException
| 0-72043 | ||||||||||||||||||
459 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
460 | - | |||||||||||||||||||
461 | if (index.isPositiveInt()
| 25633-46447 | ||||||||||||||||||
462 | uint idx = static_cast<uint>(index.int_32()); | - | ||||||||||||||||||
463 | if (o->d()->arrayData && o->d()->arrayData->type == Heap::ArrayData::Simple
| 553-25729 | ||||||||||||||||||
464 | Heap::SimpleArrayData *s = o->d()->arrayData.cast<Heap::SimpleArrayData>(); | - | ||||||||||||||||||
465 | if (idx < s->values.size
| 0-25726 | ||||||||||||||||||
466 | s->setData(engine, idx, value); | - | ||||||||||||||||||
467 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||
468 | } | - | ||||||||||||||||||
469 | } executed 25727 times by 4 tests: end of block Executed by:
| 25727 | ||||||||||||||||||
470 | return executed 46450 times by 7 tests: o->put(idx, value);return o->put(idx, value); Executed by:
executed 46450 times by 7 tests: return o->put(idx, value); Executed by:
| 46450 | ||||||||||||||||||
471 | } | - | ||||||||||||||||||
472 | - | |||||||||||||||||||
473 | ScopedPropertyKey name(scope, index.toPropertyKey(engine)); | - | ||||||||||||||||||
474 | if (engine->hasException
| 60-25571 | ||||||||||||||||||
475 | return executed 60 times by 1 test: false;return false; Executed by:
executed 60 times by 1 test: return false; Executed by:
| 60 | ||||||||||||||||||
476 | return executed 25590 times by 8 tests: o->put(name, value);return o->put(name, value); Executed by:
executed 25590 times by 8 tests: return o->put(name, value); Executed by:
| 25590 | ||||||||||||||||||
477 | } | - | ||||||||||||||||||
478 | - | |||||||||||||||||||
479 | void Runtime::method_storeElement(ExecutionEngine *engine, const Value &object, const Value &index, const Value &value) | - | ||||||||||||||||||
480 | { | - | ||||||||||||||||||
481 | if (index.isPositiveInt()
| 25588-49814 | ||||||||||||||||||
482 | uint idx = static_cast<uint>(index.int_32()); | - | ||||||||||||||||||
483 | if (Heap::Base *b = object.heapObject()
| 0-49822 | ||||||||||||||||||
484 | if (b->internalClass->vtable->isObject
| 4-49823 | ||||||||||||||||||
485 | Heap::Object *o = static_cast<Heap::Object *>(b); | - | ||||||||||||||||||
486 | if (o->arrayData && o->arrayData->type == Heap::ArrayData::Simple
| 553-29104 | ||||||||||||||||||
487 | Heap::SimpleArrayData *s = o->arrayData.cast<Heap::SimpleArrayData>(); | - | ||||||||||||||||||
488 | if (idx < s->values.size
| 3372-25728 | ||||||||||||||||||
489 | s->setData(engine, idx, value); | - | ||||||||||||||||||
490 | return; executed 3370 times by 3 tests: return; Executed by:
| 3370 | ||||||||||||||||||
491 | } | - | ||||||||||||||||||
492 | } executed 25728 times by 4 tests: end of block Executed by:
| 25728 | ||||||||||||||||||
493 | } executed 46448 times by 7 tests: end of block Executed by:
| 46448 | ||||||||||||||||||
494 | } executed 46454 times by 7 tests: end of block Executed by:
| 46454 | ||||||||||||||||||
495 | } executed 46456 times by 7 tests: end of block Executed by:
| 46456 | ||||||||||||||||||
496 | - | |||||||||||||||||||
497 | if (!setElementFallback(engine, object, index, value)
| 2478-67057 | ||||||||||||||||||
498 | engine->throwTypeError(); executed 2473 times by 1 test: engine->throwTypeError(); Executed by:
| 2473 | ||||||||||||||||||
499 | } executed 72098 times by 11 tests: end of block Executed by:
| 72098 | ||||||||||||||||||
500 | - | |||||||||||||||||||
501 | ReturnedValue Runtime::method_getIterator(ExecutionEngine *engine, const Value &in, int iterator) | - | ||||||||||||||||||
502 | { | - | ||||||||||||||||||
503 | Scope scope(engine); | - | ||||||||||||||||||
504 | ScopedObject o(scope, (Object *)nullptr); | - | ||||||||||||||||||
505 | if (!in.isNullOrUndefined()
| 460-23158 | ||||||||||||||||||
506 | o = in.toObject(engine); executed 23160 times by 12 tests: o = in.toObject(engine); Executed by:
| 23160 | ||||||||||||||||||
507 | if (engine->hasException
| 0-23661 | ||||||||||||||||||
508 | return never executed: Encode::undefined();return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
509 | if (iterator
| 9100-14565 | ||||||||||||||||||
510 | if (!o
| 416-14132 | ||||||||||||||||||
511 | return executed 416 times by 1 test: engine->throwTypeError();return engine->throwTypeError(); Executed by:
executed 416 times by 1 test: return engine->throwTypeError(); Executed by:
| 416 | ||||||||||||||||||
512 | ScopedFunctionObject f(scope, o->get(engine->symbol_iterator())); | - | ||||||||||||||||||
513 | if (!f
| 108-14094 | ||||||||||||||||||
514 | return executed 108 times by 1 test: engine->throwTypeError();return engine->throwTypeError(); Executed by:
executed 108 times by 1 test: return engine->throwTypeError(); Executed by:
| 108 | ||||||||||||||||||
515 | JSCallData cData(scope, 0, nullptr, o); | - | ||||||||||||||||||
516 | ScopedObject it(scope, f->call(cData)); | - | ||||||||||||||||||
517 | if (!it
| 256-13779 | ||||||||||||||||||
518 | return executed 256 times by 1 test: engine->throwTypeError();return engine->throwTypeError(); Executed by:
executed 256 times by 1 test: return engine->throwTypeError(); Executed by:
| 256 | ||||||||||||||||||
519 | return executed 13753 times by 1 test: it->asReturnedValue();return it->asReturnedValue(); Executed by:
executed 13753 times by 1 test: return it->asReturnedValue(); Executed by:
| 13753 | ||||||||||||||||||
520 | } | - | ||||||||||||||||||
521 | return executed 9080 times by 12 tests: engine->newForInIteratorObject(o)->asReturnedValue();return engine->newForInIteratorObject(o)->asReturnedValue(); Executed by:
executed 9080 times by 12 tests: return engine->newForInIteratorObject(o)->asReturnedValue(); Executed by:
| 9080 | ||||||||||||||||||
522 | } | - | ||||||||||||||||||
523 | - | |||||||||||||||||||
524 | ReturnedValue Runtime::method_iteratorNext(ExecutionEngine *engine, const Value &iterator, Value *value) | - | ||||||||||||||||||
525 | { | - | ||||||||||||||||||
526 | ((iterator.isObject()) ? static_cast<void>(0) : qt_assert("iterator.isObject()", __FILE__, 736)); | - | ||||||||||||||||||
527 | - | |||||||||||||||||||
528 | Scope scope(engine); | - | ||||||||||||||||||
529 | ScopedFunctionObject f(scope, static_cast<const Object &>(iterator).get(engine->id_next())); | - | ||||||||||||||||||
530 | if (!f
| 36-51374 | ||||||||||||||||||
531 | return executed 36 times by 1 test: engine->throwTypeError();return engine->throwTypeError(); Executed by:
executed 36 times by 1 test: return engine->throwTypeError(); Executed by:
| 36 | ||||||||||||||||||
532 | JSCallData cData(scope, 0, nullptr, &iterator); | - | ||||||||||||||||||
533 | ScopedObject o(scope, f->call(cData)); | - | ||||||||||||||||||
534 | if (!o
| 815-50443 | ||||||||||||||||||
535 | return executed 815 times by 1 test: engine->throwTypeError();return engine->throwTypeError(); Executed by:
executed 815 times by 1 test: return engine->throwTypeError(); Executed by:
| 815 | ||||||||||||||||||
536 | ScopedValue d(scope, o->get(engine->id_done())); | - | ||||||||||||||||||
537 | bool done = d->toBoolean(); | - | ||||||||||||||||||
538 | if (done
| 16734-33726 | ||||||||||||||||||
539 | *value = Encode::undefined(); | - | ||||||||||||||||||
540 | } executed 16732 times by 12 tests: else {end of block Executed by:
| 16732 | ||||||||||||||||||
541 | *value = o->get(engine->id_value()); | - | ||||||||||||||||||
542 | } executed 33811 times by 12 tests: end of block Executed by:
| 33811 | ||||||||||||||||||
543 | return executed 50519 times by 12 tests: Encode(done);return Encode(done); Executed by:
executed 50519 times by 12 tests: return Encode(done); Executed by:
| 50519 | ||||||||||||||||||
544 | } | - | ||||||||||||||||||
545 | - | |||||||||||||||||||
546 | ReturnedValue Runtime::method_iteratorClose(ExecutionEngine *engine, const Value &iterator, const Value &done) | - | ||||||||||||||||||
547 | { | - | ||||||||||||||||||
548 | ((iterator.isObject()) ? static_cast<void>(0) : qt_assert("iterator.isObject()", __FILE__, 758)); | - | ||||||||||||||||||
549 | ((done.isBoolean()) ? static_cast<void>(0) : qt_assert("done.isBoolean()", __FILE__, 759)); | - | ||||||||||||||||||
550 | if (done.booleanValue()
| 3107-3606 | ||||||||||||||||||
551 | return executed 3107 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 3107 times by 1 test: return Encode::undefined(); Executed by:
| 3107 | ||||||||||||||||||
552 | - | |||||||||||||||||||
553 | Scope scope(engine); | - | ||||||||||||||||||
554 | bool hadException = engine->hasException; | - | ||||||||||||||||||
555 | ScopedValue e(scope); | - | ||||||||||||||||||
556 | if (hadException
| 16-3584 | ||||||||||||||||||
557 | e = *engine->exceptionValue; | - | ||||||||||||||||||
558 | engine->hasException = false; | - | ||||||||||||||||||
559 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||||||||
560 | ScopedFunctionObject f(scope, static_cast<const Object &>(iterator).get(engine->id_return())); | - | ||||||||||||||||||
561 | ScopedObject o(scope); | - | ||||||||||||||||||
562 | if (f
| 671-2937 | ||||||||||||||||||
563 | JSCallData cData(scope, 0, nullptr, &iterator); | - | ||||||||||||||||||
564 | o = f->call(cData); | - | ||||||||||||||||||
565 | } executed 672 times by 1 test: end of block Executed by:
| 672 | ||||||||||||||||||
566 | if (hadException
| 16-3591 | ||||||||||||||||||
567 | *engine->exceptionValue = e; | - | ||||||||||||||||||
568 | engine->hasException = hadException; | - | ||||||||||||||||||
569 | return executed 2948 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 2948 times by 1 test: return Encode::undefined(); Executed by:
| 2948 | ||||||||||||||||||
570 | } | - | ||||||||||||||||||
571 | if (engine->hasException
| 40-620 | ||||||||||||||||||
572 | return executed 40 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 40 times by 1 test: return Encode::undefined(); Executed by:
| 40 | ||||||||||||||||||
573 | - | |||||||||||||||||||
574 | if (!o
| 44-576 | ||||||||||||||||||
575 | return executed 44 times by 1 test: engine->throwTypeError();return engine->throwTypeError(); Executed by:
executed 44 times by 1 test: return engine->throwTypeError(); Executed by:
| 44 | ||||||||||||||||||
576 | return executed 576 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 576 times by 1 test: return Encode::undefined(); Executed by:
| 576 | ||||||||||||||||||
577 | } | - | ||||||||||||||||||
578 | - | |||||||||||||||||||
579 | ReturnedValue Runtime::method_destructureRestElement(ExecutionEngine *engine, const Value &iterator) | - | ||||||||||||||||||
580 | { | - | ||||||||||||||||||
581 | ((iterator.isObject()) ? static_cast<void>(0) : qt_assert("iterator.isObject()", __FILE__, 791)); | - | ||||||||||||||||||
582 | - | |||||||||||||||||||
583 | Scope scope(engine); | - | ||||||||||||||||||
584 | ScopedArrayObject array(scope, engine->newArrayObject()); | - | ||||||||||||||||||
585 | array->arrayCreate(); | - | ||||||||||||||||||
586 | uint index = 0; | - | ||||||||||||||||||
587 | while (1) { | - | ||||||||||||||||||
588 | ScopedValue n(scope); | - | ||||||||||||||||||
589 | ScopedValue done(scope, method_iteratorNext(engine, iterator, n)); | - | ||||||||||||||||||
590 | if (engine->hasException
| 360-7580 | ||||||||||||||||||
591 | return executed 360 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 360 times by 1 test: return Encode::undefined(); Executed by:
| 360 | ||||||||||||||||||
592 | ((done->isBoolean()) ? static_cast<void>(0) : qt_assert("done->isBoolean()", __FILE__, 802)); | - | ||||||||||||||||||
593 | if (done->booleanValue()
| 2252-5328 | ||||||||||||||||||
594 | break; executed 2252 times by 1 test: break; Executed by:
| 2252 | ||||||||||||||||||
595 | array->arraySet(index, n); | - | ||||||||||||||||||
596 | ++index; | - | ||||||||||||||||||
597 | } executed 5324 times by 1 test: end of block Executed by:
| 5324 | ||||||||||||||||||
598 | return executed 2252 times by 1 test: array->asReturnedValue();return array->asReturnedValue(); Executed by:
executed 2252 times by 1 test: return array->asReturnedValue(); Executed by:
| 2252 | ||||||||||||||||||
599 | } | - | ||||||||||||||||||
600 | - | |||||||||||||||||||
601 | void Runtime::method_storeNameSloppy(ExecutionEngine *engine, int nameIndex, const Value &value) | - | ||||||||||||||||||
602 | { | - | ||||||||||||||||||
603 | Scope scope(engine); | - | ||||||||||||||||||
604 | ScopedString name(scope, engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[nameIndex]); | - | ||||||||||||||||||
605 | ExecutionContext::Error e = static_cast<ExecutionContext &>(engine->currentStackFrame->jsFrame->context).setProperty(name, value); | - | ||||||||||||||||||
606 | - | |||||||||||||||||||
607 | if (e == ExecutionContext::RangeError
| 655-37125187 | ||||||||||||||||||
608 | engine->globalObject->put(name, value); executed 655 times by 3 tests: engine->globalObject->put(name, value); Executed by:
| 655 | ||||||||||||||||||
609 | } executed 37129448 times by 41 tests: end of block Executed by:
| 37129448 | ||||||||||||||||||
610 | - | |||||||||||||||||||
611 | void Runtime::method_storeNameStrict(ExecutionEngine *engine, int nameIndex, const Value &value) | - | ||||||||||||||||||
612 | { | - | ||||||||||||||||||
613 | Scope scope(engine); | - | ||||||||||||||||||
614 | ScopedString name(scope, engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[nameIndex]); | - | ||||||||||||||||||
615 | ExecutionContext::Error e = static_cast<ExecutionContext &>(engine->currentStackFrame->jsFrame->context).setProperty(name, value); | - | ||||||||||||||||||
616 | if (e == ExecutionContext::TypeError
| 100-36249757 | ||||||||||||||||||
617 | engine->throwTypeError(); executed 99 times by 1 test: engine->throwTypeError(); Executed by:
| 99 | ||||||||||||||||||
618 | else if (e == ExecutionContext::RangeError
| 132-36250661 | ||||||||||||||||||
619 | engine->throwReferenceError(name); executed 132 times by 1 test: engine->throwReferenceError(name); Executed by:
| 132 | ||||||||||||||||||
620 | } executed 36253804 times by 4 tests: end of block Executed by:
| 36253804 | ||||||||||||||||||
621 | - | |||||||||||||||||||
622 | ReturnedValue Runtime::method_loadProperty(ExecutionEngine *engine, const Value &object, int nameIndex) | - | ||||||||||||||||||
623 | { | - | ||||||||||||||||||
624 | Scope scope(engine); | - | ||||||||||||||||||
625 | ScopedString name(scope, engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[nameIndex]); | - | ||||||||||||||||||
626 | - | |||||||||||||||||||
627 | ScopedObject o(scope, object); | - | ||||||||||||||||||
628 | if (o
| 44920-1174858 | ||||||||||||||||||
629 | return executed 1174858 times by 97 tests: o->get(name);return o->get(name); Executed by:
executed 1174858 times by 97 tests: return o->get(name); Executed by:
| 1174858 | ||||||||||||||||||
630 | - | |||||||||||||||||||
631 | if (object.isNullOrUndefined()
| 190-44730 | ||||||||||||||||||
632 | QString message = ([]() noexcept -> QString { enum { Size = sizeof(u"" "Cannot read property '%1' of %2")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Cannot read property '%1' of %2" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()).arg(name->toQString()).arg(object.toQStringNoThrow()); | - | ||||||||||||||||||
633 | return executed 190 times by 14 tests: engine->throwTypeError(message);return engine->throwTypeError(message); Executed by:
executed 190 times by 14 tests: return engine->throwTypeError(message); Executed by:
| 190 | ||||||||||||||||||
634 | } | - | ||||||||||||||||||
635 | - | |||||||||||||||||||
636 | o = RuntimeHelpers::convertToObject(scope.engine, object); | - | ||||||||||||||||||
637 | if (!o
| 0-44730 | ||||||||||||||||||
638 | return never executed: Encode::undefined();return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
639 | return executed 44730 times by 11 tests: o->get(name);return o->get(name); Executed by:
executed 44730 times by 11 tests: return o->get(name); Executed by:
| 44730 | ||||||||||||||||||
640 | } | - | ||||||||||||||||||
641 | - | |||||||||||||||||||
642 | ReturnedValue Runtime::method_loadName(ExecutionEngine *engine, int nameIndex) | - | ||||||||||||||||||
643 | { | - | ||||||||||||||||||
644 | Scope scope(engine); | - | ||||||||||||||||||
645 | ScopedString name(scope, engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[nameIndex]); | - | ||||||||||||||||||
646 | return executed 5530077 times by 89 tests: static_cast<ExecutionContext &>(engine->currentStackFrame->jsFrame->context).getProperty(name);return static_cast<ExecutionContext &>(engine->currentStackFrame->jsFrame->context).getProperty(name); Executed by:
executed 5530077 times by 89 tests: return static_cast<ExecutionContext &>(engine->currentStackFrame->jsFrame->context).getProperty(name); Executed by:
| 5530077 | ||||||||||||||||||
647 | } | - | ||||||||||||||||||
648 | - | |||||||||||||||||||
649 | ReturnedValue Runtime::method_loadSuperProperty(ExecutionEngine *engine, const Value &property) | - | ||||||||||||||||||
650 | { | - | ||||||||||||||||||
651 | Scope scope(engine); | - | ||||||||||||||||||
652 | ScopedObject base(scope, engine->currentStackFrame->thisObject()); | - | ||||||||||||||||||
653 | if (!base
| 44-243 | ||||||||||||||||||
654 | return executed 44 times by 1 test: engine->throwTypeError();return engine->throwTypeError(); Executed by:
executed 44 times by 1 test: return engine->throwTypeError(); Executed by:
| 44 | ||||||||||||||||||
655 | ScopedObject proto(scope, base->getPrototypeOf()); | - | ||||||||||||||||||
656 | if (!proto
| 0-243 | ||||||||||||||||||
657 | return never executed: engine->throwTypeError();return engine->throwTypeError(); never executed: return engine->throwTypeError(); | 0 | ||||||||||||||||||
658 | ScopedPropertyKey key(scope, property.toPropertyKey(engine)); | - | ||||||||||||||||||
659 | if (engine->hasException
| 0-242 | ||||||||||||||||||
660 | return never executed: Encode::undefined();return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
661 | return executed 242 times by 1 test: proto->get(key, base);return proto->get(key, base); Executed by:
executed 242 times by 1 test: return proto->get(key, base); Executed by:
| 242 | ||||||||||||||||||
662 | } | - | ||||||||||||||||||
663 | - | |||||||||||||||||||
664 | void Runtime::method_storeSuperProperty(ExecutionEngine *engine, const Value &property, const Value &value) | - | ||||||||||||||||||
665 | { | - | ||||||||||||||||||
666 | Scope scope(engine); | - | ||||||||||||||||||
667 | ScopedObject base(scope, engine->currentStackFrame->thisObject()); | - | ||||||||||||||||||
668 | if (!base
| 0-40 | ||||||||||||||||||
669 | engine->throwTypeError(); | - | ||||||||||||||||||
670 | return; never executed: return; | 0 | ||||||||||||||||||
671 | } | - | ||||||||||||||||||
672 | ScopedObject proto(scope, base->getPrototypeOf()); | - | ||||||||||||||||||
673 | if (!proto
| 0-40 | ||||||||||||||||||
674 | engine->throwTypeError(); | - | ||||||||||||||||||
675 | return; never executed: return; | 0 | ||||||||||||||||||
676 | } | - | ||||||||||||||||||
677 | ScopedPropertyKey key(scope, property.toPropertyKey(engine)); | - | ||||||||||||||||||
678 | if (engine->hasException
| 0-40 | ||||||||||||||||||
679 | return; never executed: return; | 0 | ||||||||||||||||||
680 | bool result = proto->put(key, value, base); | - | ||||||||||||||||||
681 | if (!result
| 0-40 | ||||||||||||||||||
682 | engine->throwTypeError(); never executed: engine->throwTypeError(); | 0 | ||||||||||||||||||
683 | } executed 40 times by 1 test: end of block Executed by:
| 40 | ||||||||||||||||||
684 | - | |||||||||||||||||||
685 | - | |||||||||||||||||||
686 | - | |||||||||||||||||||
687 | uint RuntimeHelpers::equalHelper(const Value &x, const Value &y) | - | ||||||||||||||||||
688 | { | - | ||||||||||||||||||
689 | ((x.type() != y.type() || (x.isManaged() && (x.isString() != y.isString()))) ? static_cast<void>(0) : qt_assert("x.type() != y.type() || (x.isManaged() && (x.isString() != y.isString()))", __FILE__, 899)); | - | ||||||||||||||||||
690 | - | |||||||||||||||||||
691 | if (x.isNumber()
| 0 | ||||||||||||||||||
692 | return never executed: x.asDouble() == y.asDouble();return x.asDouble() == y.asDouble(); never executed: return x.asDouble() == y.asDouble(); | 0 | ||||||||||||||||||
693 | if (x.isNull()
| 0 | ||||||||||||||||||
694 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||
695 | } else if (x.isUndefined()
| 0 | ||||||||||||||||||
696 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||
697 | } else if (x.isNumber()
| 0 | ||||||||||||||||||
698 | double dy = RuntimeHelpers::toNumber(y); | - | ||||||||||||||||||
699 | return never executed: x.asDouble() == dy;return x.asDouble() == dy; never executed: return x.asDouble() == dy; | 0 | ||||||||||||||||||
700 | } else if (x.isString()
| 0 | ||||||||||||||||||
701 | double dx = RuntimeHelpers::toNumber(x); | - | ||||||||||||||||||
702 | return never executed: dx == y.asDouble();return dx == y.asDouble(); never executed: return dx == y.asDouble(); | 0 | ||||||||||||||||||
703 | } else if (x.isBoolean()
| 0 | ||||||||||||||||||
704 | return never executed: Runtime::method_compareEqual(Primitive::fromDouble((double) x.booleanValue()), y);return Runtime::method_compareEqual(Primitive::fromDouble((double) x.booleanValue()), y); never executed: return Runtime::method_compareEqual(Primitive::fromDouble((double) x.booleanValue()), y); | 0 | ||||||||||||||||||
705 | } else if (y.isBoolean()
| 0 | ||||||||||||||||||
706 | return never executed: Runtime::method_compareEqual(x, Primitive::fromDouble((double) y.booleanValue()));return Runtime::method_compareEqual(x, Primitive::fromDouble((double) y.booleanValue())); never executed: return Runtime::method_compareEqual(x, Primitive::fromDouble((double) y.booleanValue())); | 0 | ||||||||||||||||||
707 | } else { | - | ||||||||||||||||||
708 | - | |||||||||||||||||||
709 | - | |||||||||||||||||||
710 | - | |||||||||||||||||||
711 | Object *xo = x.objectValue(); | - | ||||||||||||||||||
712 | Object *yo = y.objectValue(); | - | ||||||||||||||||||
713 | if (yo
| 0 | ||||||||||||||||||
714 | Scope scope(yo->engine()); | - | ||||||||||||||||||
715 | ScopedValue py(scope, RuntimeHelpers::objectDefaultValue(yo, PREFERREDTYPE_HINT)); | - | ||||||||||||||||||
716 | return never executed: Runtime::method_compareEqual(x, py);return Runtime::method_compareEqual(x, py); never executed: return Runtime::method_compareEqual(x, py); | 0 | ||||||||||||||||||
717 | } else if (xo
| 0 | ||||||||||||||||||
718 | Scope scope(xo->engine()); | - | ||||||||||||||||||
719 | ScopedValue px(scope, RuntimeHelpers::objectDefaultValue(xo, PREFERREDTYPE_HINT)); | - | ||||||||||||||||||
720 | return never executed: Runtime::method_compareEqual(px, y);return Runtime::method_compareEqual(px, y); never executed: return Runtime::method_compareEqual(px, y); | 0 | ||||||||||||||||||
721 | } | - | ||||||||||||||||||
722 | - | |||||||||||||||||||
723 | } never executed: end of block | 0 | ||||||||||||||||||
724 | - | |||||||||||||||||||
725 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
726 | } | - | ||||||||||||||||||
727 | - | |||||||||||||||||||
728 | Bool RuntimeHelpers::strictEqual(const Value &x, const Value &y) | - | ||||||||||||||||||
729 | { | - | ||||||||||||||||||
730 | ; | - | ||||||||||||||||||
731 | - | |||||||||||||||||||
732 | if (x.rawValue() == y.rawValue()
| 16337-31668862 | ||||||||||||||||||
733 | - | |||||||||||||||||||
734 | return executed 16337 times by 10 tests: !x.isNaN();return !x.isNaN(); Executed by:
executed 16337 times by 10 tests: return !x.isNaN(); Executed by:
| 16337 | ||||||||||||||||||
735 | - | |||||||||||||||||||
736 | if (x.isNumber()
| 13114268-18551307 | ||||||||||||||||||
737 | return executed 18551304 times by 15 tests: y.isNumber() && x.asDouble() == y.asDouble();return y.isNumber() && x.asDouble() == y.asDouble(); Executed by:
executed 18551304 times by 15 tests: return y.isNumber() && x.asDouble() == y.asDouble(); Executed by:
| 18551304 | ||||||||||||||||||
738 | if (x.isManaged()
| 297603-12838325 | ||||||||||||||||||
739 | return executed 12839433 times by 15 tests: y.isManaged() && x.cast<Managed>()->isEqualTo(y.cast<Managed>());return y.isManaged() && x.cast<Managed>()->isEqualTo(y.cast<Managed>()); Executed by:
executed 12839433 times by 15 tests: return y.isManaged() && x.cast<Managed>()->isEqualTo(y.cast<Managed>()); Executed by:
| 12839433 | ||||||||||||||||||
740 | return executed 297615 times by 9 tests: false;return false; Executed by:
executed 297615 times by 9 tests: return false; Executed by:
| 297615 | ||||||||||||||||||
741 | } | - | ||||||||||||||||||
742 | - | |||||||||||||||||||
743 | QV4::Bool Runtime::method_compareGreaterThan(const Value &l, const Value &r) | - | ||||||||||||||||||
744 | { | - | ||||||||||||||||||
745 | ; | - | ||||||||||||||||||
746 | if (l.isInteger()
| 39-3684 | ||||||||||||||||||
747 | return executed 38 times by 1 test: l.integerValue() > r.integerValue();return l.integerValue() > r.integerValue(); Executed by:
executed 38 times by 1 test: return l.integerValue() > r.integerValue(); Executed by:
| 38 | ||||||||||||||||||
748 | if (l.isNumber()
| 87-2730 | ||||||||||||||||||
749 | return executed 2642 times by 9 tests: l.asDouble() > r.asDouble();return l.asDouble() > r.asDouble(); Executed by:
executed 2642 times by 9 tests: return l.asDouble() > r.asDouble(); Executed by:
| 2642 | ||||||||||||||||||
750 | String *sl = l.stringValue(); | - | ||||||||||||||||||
751 | String *sr = r.stringValue(); | - | ||||||||||||||||||
752 | if (sl
| 64-703 | ||||||||||||||||||
753 | - | |||||||||||||||||||
754 | - | |||||||||||||||||||
755 | - | |||||||||||||||||||
756 | - | |||||||||||||||||||
757 | return executed 639 times by 1 test: sr->compare(sl);return sr->compare(sl); Executed by:
executed 639 times by 1 test: return sr->compare(sl); Executed by:
| 639 | ||||||||||||||||||
758 | - | |||||||||||||||||||
759 | } | - | ||||||||||||||||||
760 | - | |||||||||||||||||||
761 | Object *ro = r.objectValue(); | - | ||||||||||||||||||
762 | Object *lo = l.objectValue(); | - | ||||||||||||||||||
763 | if (ro
| 76-323 | ||||||||||||||||||
764 | - | |||||||||||||||||||
765 | - | |||||||||||||||||||
766 | - | |||||||||||||||||||
767 | QV4::ExecutionEngine *e = (lo
| 76-146 | ||||||||||||||||||
768 | QV4::Scope scope(e); | - | ||||||||||||||||||
769 | QV4::ScopedValue pl(scope, lo ? RuntimeHelpers::objectDefaultValue(lo, QV4::NUMBER_HINT) : l.asReturnedValue()); | - | ||||||||||||||||||
770 | QV4::ScopedValue pr(scope, ro ? RuntimeHelpers::objectDefaultValue(ro, QV4::NUMBER_HINT) : r.asReturnedValue()); | - | ||||||||||||||||||
771 | return executed 223 times by 1 test: Runtime::method_compareGreaterThan(pl, pr);return Runtime::method_compareGreaterThan(pl, pr); Executed by:
executed 223 times by 1 test: return Runtime::method_compareGreaterThan(pl, pr); Executed by:
| 223 | ||||||||||||||||||
772 | - | |||||||||||||||||||
773 | } | - | ||||||||||||||||||
774 | - | |||||||||||||||||||
775 | double dl = RuntimeHelpers::toNumber(l); | - | ||||||||||||||||||
776 | double dr = RuntimeHelpers::toNumber(r); | - | ||||||||||||||||||
777 | return executed 248 times by 1 test: dl > dr;return dl > dr; Executed by:
executed 248 times by 1 test: return dl > dr; Executed by:
| 248 | ||||||||||||||||||
778 | } | - | ||||||||||||||||||
779 | - | |||||||||||||||||||
780 | QV4::Bool Runtime::method_compareLessThan(const Value &l, const Value &r) | - | ||||||||||||||||||
781 | { | - | ||||||||||||||||||
782 | ; | - | ||||||||||||||||||
783 | if (l.isInteger()
| 24-3229 | ||||||||||||||||||
784 | return executed 24 times by 1 test: l.integerValue() < r.integerValue();return l.integerValue() < r.integerValue(); Executed by:
executed 24 times by 1 test: return l.integerValue() < r.integerValue(); Executed by:
| 24 | ||||||||||||||||||
785 | if (l.isNumber()
| 88-3139 | ||||||||||||||||||
786 | return executed 320 times by 6 tests: l.asDouble() < r.asDouble();return l.asDouble() < r.asDouble(); Executed by:
executed 320 times by 6 tests: return l.asDouble() < r.asDouble(); Executed by:
| 320 | ||||||||||||||||||
787 | String *sl = l.stringValue(); | - | ||||||||||||||||||
788 | String *sr = r.stringValue(); | - | ||||||||||||||||||
789 | if (sl
| 216-2834 | ||||||||||||||||||
790 | - | |||||||||||||||||||
791 | - | |||||||||||||||||||
792 | - | |||||||||||||||||||
793 | - | |||||||||||||||||||
794 | return executed 2617 times by 3 tests: sl->compare(sr);return sl->compare(sr); Executed by:
executed 2617 times by 3 tests: return sl->compare(sr); Executed by:
| 2617 | ||||||||||||||||||
795 | - | |||||||||||||||||||
796 | } | - | ||||||||||||||||||
797 | - | |||||||||||||||||||
798 | Object *ro = r.objectValue(); | - | ||||||||||||||||||
799 | Object *lo = l.objectValue(); | - | ||||||||||||||||||
800 | if (ro
| 80-472 | ||||||||||||||||||
801 | - | |||||||||||||||||||
802 | - | |||||||||||||||||||
803 | - | |||||||||||||||||||
804 | QV4::ExecutionEngine *e = (lo
| 80-136 | ||||||||||||||||||
805 | QV4::Scope scope(e); | - | ||||||||||||||||||
806 | QV4::ScopedValue pl(scope, lo ? RuntimeHelpers::objectDefaultValue(lo, QV4::NUMBER_HINT) : l.asReturnedValue()); | - | ||||||||||||||||||
807 | QV4::ScopedValue pr(scope, ro ? RuntimeHelpers::objectDefaultValue(ro, QV4::NUMBER_HINT) : r.asReturnedValue()); | - | ||||||||||||||||||
808 | return executed 216 times by 1 test: Runtime::method_compareLessThan(pl, pr);return Runtime::method_compareLessThan(pl, pr); Executed by:
executed 216 times by 1 test: return Runtime::method_compareLessThan(pl, pr); Executed by:
| 216 | ||||||||||||||||||
809 | - | |||||||||||||||||||
810 | } | - | ||||||||||||||||||
811 | - | |||||||||||||||||||
812 | double dl = RuntimeHelpers::toNumber(l); | - | ||||||||||||||||||
813 | double dr = RuntimeHelpers::toNumber(r); | - | ||||||||||||||||||
814 | return executed 392 times by 2 tests: dl < dr;return dl < dr; Executed by:
executed 392 times by 2 tests: return dl < dr; Executed by:
| 392 | ||||||||||||||||||
815 | } | - | ||||||||||||||||||
816 | - | |||||||||||||||||||
817 | QV4::Bool Runtime::method_compareGreaterEqual(const Value &l, const Value &r) | - | ||||||||||||||||||
818 | { | - | ||||||||||||||||||
819 | ; | - | ||||||||||||||||||
820 | if (l.isInteger()
| 24-891 | ||||||||||||||||||
821 | return executed 24 times by 1 test: l.integerValue() >= r.integerValue();return l.integerValue() >= r.integerValue(); Executed by:
executed 24 times by 1 test: return l.integerValue() >= r.integerValue(); Executed by:
| 24 | ||||||||||||||||||
822 | if (l.isNumber()
| 88-534 | ||||||||||||||||||
823 | return executed 338 times by 4 tests: l.asDouble() >= r.asDouble();return l.asDouble() >= r.asDouble(); Executed by:
executed 338 times by 4 tests: return l.asDouble() >= r.asDouble(); Executed by:
| 338 | ||||||||||||||||||
824 | String *sl = l.stringValue(); | - | ||||||||||||||||||
825 | String *sr = r.stringValue(); | - | ||||||||||||||||||
826 | if (sl
| 64-392 | ||||||||||||||||||
827 | - | |||||||||||||||||||
828 | - | |||||||||||||||||||
829 | - | |||||||||||||||||||
830 | - | |||||||||||||||||||
831 | return executed 168 times by 1 test: !sl->compare(sr);return !sl->compare(sr); Executed by:
executed 168 times by 1 test: return !sl->compare(sr); Executed by:
| 168 | ||||||||||||||||||
832 | - | |||||||||||||||||||
833 | } | - | ||||||||||||||||||
834 | - | |||||||||||||||||||
835 | Object *ro = r.objectValue(); | - | ||||||||||||||||||
836 | Object *lo = l.objectValue(); | - | ||||||||||||||||||
837 | if (ro
| 75-324 | ||||||||||||||||||
838 | - | |||||||||||||||||||
839 | - | |||||||||||||||||||
840 | - | |||||||||||||||||||
841 | QV4::ExecutionEngine *e = (lo
| 76-131 | ||||||||||||||||||
842 | QV4::Scope scope(e); | - | ||||||||||||||||||
843 | QV4::ScopedValue pl(scope, lo ? RuntimeHelpers::objectDefaultValue(lo, QV4::NUMBER_HINT) : l.asReturnedValue()); | - | ||||||||||||||||||
844 | QV4::ScopedValue pr(scope, ro ? RuntimeHelpers::objectDefaultValue(ro, QV4::NUMBER_HINT) : r.asReturnedValue()); | - | ||||||||||||||||||
845 | return executed 208 times by 1 test: Runtime::method_compareGreaterEqual(pl, pr);return Runtime::method_compareGreaterEqual(pl, pr); Executed by:
executed 208 times by 1 test: return Runtime::method_compareGreaterEqual(pl, pr); Executed by:
| 208 | ||||||||||||||||||
846 | - | |||||||||||||||||||
847 | } | - | ||||||||||||||||||
848 | - | |||||||||||||||||||
849 | double dl = RuntimeHelpers::toNumber(l); | - | ||||||||||||||||||
850 | double dr = RuntimeHelpers::toNumber(r); | - | ||||||||||||||||||
851 | return executed 247 times by 1 test: dl >= dr;return dl >= dr; Executed by:
executed 247 times by 1 test: return dl >= dr; Executed by:
| 247 | ||||||||||||||||||
852 | } | - | ||||||||||||||||||
853 | - | |||||||||||||||||||
854 | QV4::Bool Runtime::method_compareLessEqual(const Value &l, const Value &r) | - | ||||||||||||||||||
855 | { | - | ||||||||||||||||||
856 | ; | - | ||||||||||||||||||
857 | if (l.isInteger()
| 44-7457 | ||||||||||||||||||
858 | return executed 44 times by 1 test: l.integerValue() <= r.integerValue();return l.integerValue() <= r.integerValue(); Executed by:
executed 44 times by 1 test: return l.integerValue() <= r.integerValue(); Executed by:
| 44 | ||||||||||||||||||
859 | if (l.isNumber()
| 88-7234 | ||||||||||||||||||
860 | return executed 202 times by 6 tests: l.asDouble() <= r.asDouble();return l.asDouble() <= r.asDouble(); Executed by:
executed 202 times by 6 tests: return l.asDouble() <= r.asDouble(); Executed by:
| 202 | ||||||||||||||||||
861 | String *sl = l.stringValue(); | - | ||||||||||||||||||
862 | String *sr = r.stringValue(); | - | ||||||||||||||||||
863 | if (sl
| 64-6913 | ||||||||||||||||||
864 | - | |||||||||||||||||||
865 | - | |||||||||||||||||||
866 | - | |||||||||||||||||||
867 | - | |||||||||||||||||||
868 | return executed 6847 times by 1 test: !sr->compare(sl);return !sr->compare(sl); Executed by:
executed 6847 times by 1 test: return !sr->compare(sl); Executed by:
| 6847 | ||||||||||||||||||
869 | - | |||||||||||||||||||
870 | } | - | ||||||||||||||||||
871 | - | |||||||||||||||||||
872 | Object *ro = r.objectValue(); | - | ||||||||||||||||||
873 | Object *lo = l.objectValue(); | - | ||||||||||||||||||
874 | if (ro
| 76-324 | ||||||||||||||||||
875 | - | |||||||||||||||||||
876 | - | |||||||||||||||||||
877 | - | |||||||||||||||||||
878 | QV4::ExecutionEngine *e = (lo
| 76-151 | ||||||||||||||||||
879 | QV4::Scope scope(e); | - | ||||||||||||||||||
880 | QV4::ScopedValue pl(scope, lo ? RuntimeHelpers::objectDefaultValue(lo, QV4::NUMBER_HINT) : l.asReturnedValue()); | - | ||||||||||||||||||
881 | QV4::ScopedValue pr(scope, ro ? RuntimeHelpers::objectDefaultValue(ro, QV4::NUMBER_HINT) : r.asReturnedValue()); | - | ||||||||||||||||||
882 | return executed 228 times by 1 test: Runtime::method_compareLessEqual(pl, pr);return Runtime::method_compareLessEqual(pl, pr); Executed by:
executed 228 times by 1 test: return Runtime::method_compareLessEqual(pl, pr); Executed by:
| 228 | ||||||||||||||||||
883 | - | |||||||||||||||||||
884 | } | - | ||||||||||||||||||
885 | - | |||||||||||||||||||
886 | double dl = RuntimeHelpers::toNumber(l); | - | ||||||||||||||||||
887 | double dr = RuntimeHelpers::toNumber(r); | - | ||||||||||||||||||
888 | return executed 245 times by 1 test: dl <= dr;return dl <= dr; Executed by:
executed 245 times by 1 test: return dl <= dr; Executed by:
| 245 | ||||||||||||||||||
889 | } | - | ||||||||||||||||||
890 | - | |||||||||||||||||||
891 | - | |||||||||||||||||||
892 | Bool Runtime::method_compareInstanceof(ExecutionEngine *engine, const Value &left, const Value &right) | - | ||||||||||||||||||
893 | { | - | ||||||||||||||||||
894 | ; | - | ||||||||||||||||||
895 | - | |||||||||||||||||||
896 | Scope scope(engine); | - | ||||||||||||||||||
897 | ScopedValue v(scope, method_instanceof(engine, left, right)); | - | ||||||||||||||||||
898 | return never executed: v->booleanValue();return v->booleanValue(); never executed: return v->booleanValue(); | 0 | ||||||||||||||||||
899 | } | - | ||||||||||||||||||
900 | - | |||||||||||||||||||
901 | uint Runtime::method_compareIn(ExecutionEngine *engine, const Value &left, const Value &right) | - | ||||||||||||||||||
902 | { | - | ||||||||||||||||||
903 | ; | - | ||||||||||||||||||
904 | - | |||||||||||||||||||
905 | Scope scope(engine); | - | ||||||||||||||||||
906 | ScopedValue v(scope, method_in(engine, left, right)); | - | ||||||||||||||||||
907 | return never executed: v->booleanValue();return v->booleanValue(); never executed: return v->booleanValue(); | 0 | ||||||||||||||||||
908 | } | - | ||||||||||||||||||
909 | - | |||||||||||||||||||
910 | - | |||||||||||||||||||
911 | ReturnedValue Runtime::method_callGlobalLookup(ExecutionEngine *engine, uint index, Value *argv, int argc) | - | ||||||||||||||||||
912 | { | - | ||||||||||||||||||
913 | Lookup *l = engine->currentStackFrame->v4Function->compilationUnit->runtimeLookups + index; | - | ||||||||||||||||||
914 | Value function = Value::fromReturnedValue(l->globalGetter(l, engine)); | - | ||||||||||||||||||
915 | if (!function.isFunctionObject()
| 140-26886643 | ||||||||||||||||||
916 | return executed 140 times by 1 test: engine->throwTypeError();return engine->throwTypeError(); Executed by:
executed 140 times by 1 test: return engine->throwTypeError(); Executed by:
| 140 | ||||||||||||||||||
917 | - | |||||||||||||||||||
918 | Value thisObject = Primitive::undefinedValue(); | - | ||||||||||||||||||
919 | return executed 26901057 times by 2 tests: static_cast<FunctionObject &>(function).call(&thisObject, argv, argc);return static_cast<FunctionObject &>(function).call(&thisObject, argv, argc); Executed by:
executed 26901057 times by 2 tests: return static_cast<FunctionObject &>(function).call(&thisObject, argv, argc); Executed by:
| 26901057 | ||||||||||||||||||
920 | } | - | ||||||||||||||||||
921 | - | |||||||||||||||||||
922 | ReturnedValue Runtime::method_callPossiblyDirectEval(ExecutionEngine *engine, Value *argv, int argc) | - | ||||||||||||||||||
923 | { | - | ||||||||||||||||||
924 | Scope scope(engine); | - | ||||||||||||||||||
925 | ScopedValue thisObject(scope); | - | ||||||||||||||||||
926 | - | |||||||||||||||||||
927 | ExecutionContext &ctx = static_cast<ExecutionContext &>(engine->currentStackFrame->jsFrame->context); | - | ||||||||||||||||||
928 | ScopedFunctionObject function(scope, ctx.getPropertyAndBase(engine->id_eval(), thisObject)); | - | ||||||||||||||||||
929 | if (engine->hasException
| 0-1580728 | ||||||||||||||||||
930 | return never executed: Encode::undefined();return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
931 | - | |||||||||||||||||||
932 | if (!function
| 0-1580745 | ||||||||||||||||||
933 | QString objectAsString = ([]() noexcept -> QString { enum { Size = sizeof(u"" "[null]")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "[null]" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()); | - | ||||||||||||||||||
934 | if (!thisObject->isUndefined()
| 0 | ||||||||||||||||||
935 | objectAsString = thisObject->toQStringNoThrow(); never executed: objectAsString = thisObject->toQStringNoThrow(); | 0 | ||||||||||||||||||
936 | QString msg = ([]() noexcept -> QString { enum { Size = sizeof(u"" "Property 'eval' of object %2 is not a function")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Property 'eval' of object %2 is not a function" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()).arg(objectAsString); | - | ||||||||||||||||||
937 | return never executed: engine->throwTypeError(msg);return engine->throwTypeError(msg); never executed: return engine->throwTypeError(msg); | 0 | ||||||||||||||||||
938 | } | - | ||||||||||||||||||
939 | - | |||||||||||||||||||
940 | if (function->d() == engine->evalFunction()->d()
| 1187-1579469 | ||||||||||||||||||
941 | return executed 1579460 times by 7 tests: static_cast<EvalFunction *>(function.getPointer())->evalCall(thisObject, argv, argc, true);return static_cast<EvalFunction *>(function.getPointer())->evalCall(thisObject, argv, argc, true); Executed by:
executed 1579460 times by 7 tests: return static_cast<EvalFunction *>(function.getPointer())->evalCall(thisObject, argv, argc, true); Executed by:
| 1579460 | ||||||||||||||||||
942 | - | |||||||||||||||||||
943 | return executed 1187 times by 1 test: function->call(thisObject, argv, argc);return function->call(thisObject, argv, argc); Executed by:
executed 1187 times by 1 test: return function->call(thisObject, argv, argc); Executed by:
| 1187 | ||||||||||||||||||
944 | } | - | ||||||||||||||||||
945 | - | |||||||||||||||||||
946 | ReturnedValue Runtime::method_callName(ExecutionEngine *engine, int nameIndex, Value *argv, int argc) | - | ||||||||||||||||||
947 | { | - | ||||||||||||||||||
948 | Scope scope(engine); | - | ||||||||||||||||||
949 | ScopedValue thisObject(scope); | - | ||||||||||||||||||
950 | ScopedString name(scope, engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[nameIndex]); | - | ||||||||||||||||||
951 | - | |||||||||||||||||||
952 | ExecutionContext &ctx = static_cast<ExecutionContext &>(engine->currentStackFrame->jsFrame->context); | - | ||||||||||||||||||
953 | ScopedFunctionObject f(scope, ctx.getPropertyAndBase(name, thisObject)); | - | ||||||||||||||||||
954 | if (engine->hasException
| 20-52483 | ||||||||||||||||||
955 | return executed 20 times by 6 tests: Encode::undefined();return Encode::undefined(); Executed by:
executed 20 times by 6 tests: return Encode::undefined(); Executed by:
| 20 | ||||||||||||||||||
956 | - | |||||||||||||||||||
957 | if (!f
| 2-52482 | ||||||||||||||||||
958 | QString objectAsString = ([]() noexcept -> QString { enum { Size = sizeof(u"" "[null]")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "[null]" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()); | - | ||||||||||||||||||
959 | if (!thisObject->isUndefined()
| 0-2 | ||||||||||||||||||
960 | objectAsString = thisObject->toQStringNoThrow(); executed 2 times by 1 test: objectAsString = thisObject->toQStringNoThrow(); Executed by:
| 2 | ||||||||||||||||||
961 | QString msg = ([]() noexcept -> QString { enum { Size = sizeof(u"" "Property '%1' of object %2 is not a function")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Property '%1' of object %2 is not a function" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()) | - | ||||||||||||||||||
962 | .arg(engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[nameIndex]->toQString(), | - | ||||||||||||||||||
963 | objectAsString); | - | ||||||||||||||||||
964 | return executed 2 times by 1 test: engine->throwTypeError(msg);return engine->throwTypeError(msg); Executed by:
executed 2 times by 1 test: return engine->throwTypeError(msg); Executed by:
| 2 | ||||||||||||||||||
965 | } | - | ||||||||||||||||||
966 | - | |||||||||||||||||||
967 | return executed 52482 times by 42 tests: f->call(thisObject, argv, argc);return f->call(thisObject, argv, argc); Executed by:
executed 52482 times by 42 tests: return f->call(thisObject, argv, argc); Executed by:
| 52482 | ||||||||||||||||||
968 | } | - | ||||||||||||||||||
969 | - | |||||||||||||||||||
970 | ReturnedValue Runtime::method_callProperty(ExecutionEngine *engine, Value *base, int nameIndex, Value *argv, int argc) | - | ||||||||||||||||||
971 | { | - | ||||||||||||||||||
972 | Scope scope(engine); | - | ||||||||||||||||||
973 | ScopedString name(scope, engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[nameIndex]); | - | ||||||||||||||||||
974 | ScopedObject lookupObject(scope, base); | - | ||||||||||||||||||
975 | - | |||||||||||||||||||
976 | if (!lookupObject
| 11332-472284 | ||||||||||||||||||
977 | ((!base->isEmpty()) ? static_cast<void>(0) : qt_assert("!base->isEmpty()", __FILE__, 1187)); | - | ||||||||||||||||||
978 | if (base->isNullOrUndefined()
| 8-11324 | ||||||||||||||||||
979 | QString message = ([]() noexcept -> QString { enum { Size = sizeof(u"" "Cannot call method '%1' of %2")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Cannot call method '%1' of %2" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()) | - | ||||||||||||||||||
980 | .arg(name->toQString(), base->toQStringNoThrow()); | - | ||||||||||||||||||
981 | return executed 8 times by 1 test: engine->throwTypeError(message);return engine->throwTypeError(message); Executed by:
executed 8 times by 1 test: return engine->throwTypeError(message); Executed by:
| 8 | ||||||||||||||||||
982 | } | - | ||||||||||||||||||
983 | - | |||||||||||||||||||
984 | if (base->isManaged()
| 376-10948 | ||||||||||||||||||
985 | Managed *m = static_cast<Managed *>(base); | - | ||||||||||||||||||
986 | lookupObject = m->internalClass()->prototype; | - | ||||||||||||||||||
987 | ((m->internalClass()->prototype) ? static_cast<void>(0) : qt_assert("m->internalClass()->prototype", __FILE__, 1197)); | - | ||||||||||||||||||
988 | } executed 10948 times by 14 tests: else {end of block Executed by:
| 10948 | ||||||||||||||||||
989 | lookupObject = RuntimeHelpers::convertToObject(engine, *base); | - | ||||||||||||||||||
990 | if (engine->hasException
| 0-376 | ||||||||||||||||||
991 | return never executed: Encode::undefined();return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
992 | if (!engine->currentStackFrame->v4Function->isStrict()
| 0-376 | ||||||||||||||||||
993 | base = lookupObject; executed 376 times by 5 tests: base = lookupObject; Executed by:
| 376 | ||||||||||||||||||
994 | } executed 376 times by 5 tests: end of block Executed by:
| 376 | ||||||||||||||||||
995 | } | - | ||||||||||||||||||
996 | - | |||||||||||||||||||
997 | ScopedFunctionObject f(scope, static_cast<Object *>(lookupObject)->get(name)); | - | ||||||||||||||||||
998 | - | |||||||||||||||||||
999 | if (!f
| 14-483594 | ||||||||||||||||||
1000 | QString error = ([]() noexcept -> QString { enum { Size = sizeof(u"" "Property '%1' of object %2 is not a function")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Property '%1' of object %2 is not a function" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()) | - | ||||||||||||||||||
1001 | .arg(engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[nameIndex]->toQString(), | - | ||||||||||||||||||
1002 | base->toQStringNoThrow()); | - | ||||||||||||||||||
1003 | return executed 14 times by 2 tests: engine->throwTypeError(error);return engine->throwTypeError(error); Executed by:
executed 14 times by 2 tests: return engine->throwTypeError(error); Executed by:
| 14 | ||||||||||||||||||
1004 | } | - | ||||||||||||||||||
1005 | - | |||||||||||||||||||
1006 | return executed 483594 times by 78 tests: f->call(base, argv, argc);return f->call(base, argv, argc); Executed by:
executed 483594 times by 78 tests: return f->call(base, argv, argc); Executed by:
| 483594 | ||||||||||||||||||
1007 | } | - | ||||||||||||||||||
1008 | - | |||||||||||||||||||
1009 | ReturnedValue Runtime::method_callPropertyLookup(ExecutionEngine *engine, Value *base, uint index, Value *argv, int argc) | - | ||||||||||||||||||
1010 | { | - | ||||||||||||||||||
1011 | Lookup *l = engine->currentStackFrame->v4Function->compilationUnit->runtimeLookups + index; | - | ||||||||||||||||||
1012 | - | |||||||||||||||||||
1013 | Value f = Value::fromReturnedValue(l->getter(l, engine, *base)); | - | ||||||||||||||||||
1014 | - | |||||||||||||||||||
1015 | if (!f.isFunctionObject()
| 0-48 | ||||||||||||||||||
1016 | return never executed: engine->throwTypeError();return engine->throwTypeError(); never executed: return engine->throwTypeError(); | 0 | ||||||||||||||||||
1017 | - | |||||||||||||||||||
1018 | return executed 48 times by 3 tests: static_cast<FunctionObject &>(f).call(base, argv, argc);return static_cast<FunctionObject &>(f).call(base, argv, argc); Executed by:
executed 48 times by 3 tests: return static_cast<FunctionObject &>(f).call(base, argv, argc); Executed by:
| 48 | ||||||||||||||||||
1019 | } | - | ||||||||||||||||||
1020 | - | |||||||||||||||||||
1021 | ReturnedValue Runtime::method_callElement(ExecutionEngine *engine, Value *base, const Value &index, Value *argv, int argc) | - | ||||||||||||||||||
1022 | { | - | ||||||||||||||||||
1023 | Scope scope(engine); | - | ||||||||||||||||||
1024 | ScopedValue thisObject(scope, base->toObject(engine)); | - | ||||||||||||||||||
1025 | base = thisObject; | - | ||||||||||||||||||
1026 | - | |||||||||||||||||||
1027 | ScopedPropertyKey str(scope, index.toPropertyKey(engine)); | - | ||||||||||||||||||
1028 | if (engine->hasException
| 0-1903 | ||||||||||||||||||
1029 | return never executed: Encode::undefined();return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
1030 | - | |||||||||||||||||||
1031 | ScopedFunctionObject f(scope, static_cast<Object *>(base)->get(str)); | - | ||||||||||||||||||
1032 | if (!f
| 328-1575 | ||||||||||||||||||
1033 | return executed 328 times by 1 test: engine->throwTypeError();return engine->throwTypeError(); Executed by:
executed 328 times by 1 test: return engine->throwTypeError(); Executed by:
| 328 | ||||||||||||||||||
1034 | - | |||||||||||||||||||
1035 | return executed 1575 times by 6 tests: f->call(base, argv, argc);return f->call(base, argv, argc); Executed by:
executed 1575 times by 6 tests: return f->call(base, argv, argc); Executed by:
| 1575 | ||||||||||||||||||
1036 | } | - | ||||||||||||||||||
1037 | - | |||||||||||||||||||
1038 | ReturnedValue Runtime::method_callValue(ExecutionEngine *engine, const Value &func, Value *argv, int argc) | - | ||||||||||||||||||
1039 | { | - | ||||||||||||||||||
1040 | if (!func.isFunctionObject()
| 0-472 | ||||||||||||||||||
1041 | return never executed: engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "%1 is not a function")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "%1 is not a function" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); returnreturn engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "%1 is not a function")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "%1 is not a function" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()).arg(func.toQStringNoThrow())); never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()).arg(func.toQStringNoThrow()));return qstring_literal_temp; never executed: return engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "%1 is not a function")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "%1 is not a function" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()).arg(func.toQStringNoThrow())); | 0 | ||||||||||||||||||
1042 | return executed 472 times by 5 tests: static_cast<const FunctionObject &>(func).call(nullptr, argv, argc);return static_cast<const FunctionObject &>(func).call(nullptr, argv, argc); Executed by:
executed 472 times by 5 tests: return static_cast<const FunctionObject &>(func).call(nullptr, argv, argc); Executed by:
| 472 | ||||||||||||||||||
1043 | } | - | ||||||||||||||||||
1044 | - | |||||||||||||||||||
1045 | ReturnedValue Runtime::method_callQmlScopeObjectProperty(ExecutionEngine *engine, Value *base, | - | ||||||||||||||||||
1046 | int propertyIndex, Value *argv, int argc) | - | ||||||||||||||||||
1047 | { | - | ||||||||||||||||||
1048 | Scope scope(engine); | - | ||||||||||||||||||
1049 | ScopedFunctionObject fo(scope, method_loadQmlScopeObjectProperty(engine, *base, propertyIndex, | - | ||||||||||||||||||
1050 | true)); | - | ||||||||||||||||||
1051 | if (!fo
| 2-14 | ||||||||||||||||||
1052 | QString error = ([]() noexcept -> QString { enum { Size = sizeof(u"" "Property '%1' of scope object is not a function")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Property '%1' of scope object is not a function" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()).arg(propertyIndex); | - | ||||||||||||||||||
1053 | return executed 2 times by 1 test: engine->throwTypeError(error);return engine->throwTypeError(error); Executed by:
executed 2 times by 1 test: return engine->throwTypeError(error); Executed by:
| 2 | ||||||||||||||||||
1054 | } | - | ||||||||||||||||||
1055 | - | |||||||||||||||||||
1056 | QObject *qmlScopeObj = static_cast<QmlContext *>(base)->d()->qml()->scopeObject; | - | ||||||||||||||||||
1057 | ScopedValue qmlScopeValue(scope, QObjectWrapper::wrap(engine, qmlScopeObj)); | - | ||||||||||||||||||
1058 | return executed 14 times by 1 test: fo->call(qmlScopeValue, argv, argc);return fo->call(qmlScopeValue, argv, argc); Executed by:
executed 14 times by 1 test: return fo->call(qmlScopeValue, argv, argc); Executed by:
| 14 | ||||||||||||||||||
1059 | } | - | ||||||||||||||||||
1060 | - | |||||||||||||||||||
1061 | ReturnedValue Runtime::method_callQmlContextObjectProperty(ExecutionEngine *engine, Value *base, | - | ||||||||||||||||||
1062 | int propertyIndex, Value *argv, int argc) | - | ||||||||||||||||||
1063 | { | - | ||||||||||||||||||
1064 | Scope scope(engine); | - | ||||||||||||||||||
1065 | ScopedFunctionObject fo(scope, method_loadQmlContextObjectProperty(engine, *base, propertyIndex, | - | ||||||||||||||||||
1066 | true)); | - | ||||||||||||||||||
1067 | if (!fo
| 0 | ||||||||||||||||||
1068 | QString error = ([]() noexcept -> QString { enum { Size = sizeof(u"" "Property '%1' of context object is not a function")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Property '%1' of context object is not a function" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()).arg(propertyIndex); | - | ||||||||||||||||||
1069 | return never executed: engine->throwTypeError(error);return engine->throwTypeError(error); never executed: return engine->throwTypeError(error); | 0 | ||||||||||||||||||
1070 | } | - | ||||||||||||||||||
1071 | - | |||||||||||||||||||
1072 | QObject *qmlContextObj = static_cast<QmlContext *>(base)->d()->qml()->context->contextData()->contextObject; | - | ||||||||||||||||||
1073 | ScopedValue qmlContextValue(scope, QObjectWrapper::wrap(engine, qmlContextObj)); | - | ||||||||||||||||||
1074 | return never executed: fo->call(qmlContextValue, argv, argc);return fo->call(qmlContextValue, argv, argc); never executed: return fo->call(qmlContextValue, argv, argc); | 0 | ||||||||||||||||||
1075 | } | - | ||||||||||||||||||
1076 | - | |||||||||||||||||||
1077 | struct CallArgs { | - | ||||||||||||||||||
1078 | Value *argv; | - | ||||||||||||||||||
1079 | int argc; | - | ||||||||||||||||||
1080 | }; | - | ||||||||||||||||||
1081 | - | |||||||||||||||||||
1082 | static CallArgs createSpreadArguments(Scope &scope, Value *argv, int argc) | - | ||||||||||||||||||
1083 | { | - | ||||||||||||||||||
1084 | ScopedValue it(scope); | - | ||||||||||||||||||
1085 | ScopedValue done(scope); | - | ||||||||||||||||||
1086 | - | |||||||||||||||||||
1087 | int argCount = 0; | - | ||||||||||||||||||
1088 | - | |||||||||||||||||||
1089 | Value *v = scope.alloc<Scope::Uninitialized>(); | - | ||||||||||||||||||
1090 | Value *arguments = v; | - | ||||||||||||||||||
1091 | for (int i = 0; i < argc
| 116-457 | ||||||||||||||||||
1092 | if (!argv[i].isEmpty()
| 199-258 | ||||||||||||||||||
1093 | *v = argv[i]; | - | ||||||||||||||||||
1094 | ++argCount; | - | ||||||||||||||||||
1095 | v = scope.alloc<Scope::Uninitialized>(); | - | ||||||||||||||||||
1096 | continue; executed 199 times by 1 test: continue; Executed by:
| 199 | ||||||||||||||||||
1097 | } | - | ||||||||||||||||||
1098 | - | |||||||||||||||||||
1099 | ++i; | - | ||||||||||||||||||
1100 | it = Runtime::method_getIterator(scope.engine, argv[i], 1); | - | ||||||||||||||||||
1101 | if (scope.engine->hasException
| 72-188 | ||||||||||||||||||
1102 | return executed 72 times by 1 test: { nullptr, 0 };return { nullptr, 0 }; Executed by:
executed 72 times by 1 test: return { nullptr, 0 }; Executed by:
| 72 | ||||||||||||||||||
1103 | while (1) { | - | ||||||||||||||||||
1104 | done = Runtime::method_iteratorNext(scope.engine, it, v); | - | ||||||||||||||||||
1105 | if (scope.engine->hasException
| 72-316 | ||||||||||||||||||
1106 | return executed 72 times by 1 test: { nullptr, 0 };return { nullptr, 0 }; Executed by:
executed 72 times by 1 test: return { nullptr, 0 }; Executed by:
| 72 | ||||||||||||||||||
1107 | ((done->isBoolean()) ? static_cast<void>(0) : qt_assert("done->isBoolean()", __FILE__, 1317)); | - | ||||||||||||||||||
1108 | if (done->booleanValue()
| 116-200 | ||||||||||||||||||
1109 | break; executed 116 times by 1 test: break; Executed by:
| 116 | ||||||||||||||||||
1110 | ++argCount; | - | ||||||||||||||||||
1111 | v = scope.alloc<Scope::Uninitialized>(); | - | ||||||||||||||||||
1112 | } executed 200 times by 1 test: end of block Executed by:
| 200 | ||||||||||||||||||
1113 | } executed 116 times by 1 test: end of block Executed by:
| 116 | ||||||||||||||||||
1114 | return executed 116 times by 1 test: { arguments, argCount };return { arguments, argCount }; Executed by:
executed 116 times by 1 test: return { arguments, argCount }; Executed by:
| 116 | ||||||||||||||||||
1115 | } | - | ||||||||||||||||||
1116 | - | |||||||||||||||||||
1117 | ReturnedValue Runtime::method_callWithSpread(ExecutionEngine *engine, const Value &function, const Value &thisObject, Value *argv, int argc) | - | ||||||||||||||||||
1118 | { | - | ||||||||||||||||||
1119 | ((argc >= 1) ? static_cast<void>(0) : qt_assert("argc >= 1", __FILE__, 1329)); | - | ||||||||||||||||||
1120 | if (!function.isFunctionObject()
| 0-100 | ||||||||||||||||||
1121 | return never executed: engine->throwTypeError();return engine->throwTypeError(); never executed: return engine->throwTypeError(); | 0 | ||||||||||||||||||
1122 | - | |||||||||||||||||||
1123 | Scope scope(engine); | - | ||||||||||||||||||
1124 | CallArgs arguments = createSpreadArguments(scope, argv, argc); | - | ||||||||||||||||||
1125 | if (engine->hasException
| 48-52 | ||||||||||||||||||
1126 | return executed 48 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 48 times by 1 test: return Encode::undefined(); Executed by:
| 48 | ||||||||||||||||||
1127 | - | |||||||||||||||||||
1128 | return executed 52 times by 1 test: static_cast<const FunctionObject &>(function).call(&thisObject, arguments.argv, arguments.argc);return static_cast<const FunctionObject &>(function).call(&thisObject, arguments.argv, arguments.argc); Executed by:
executed 52 times by 1 test: return static_cast<const FunctionObject &>(function).call(&thisObject, arguments.argv, arguments.argc); Executed by:
| 52 | ||||||||||||||||||
1129 | } | - | ||||||||||||||||||
1130 | - | |||||||||||||||||||
1131 | ReturnedValue Runtime::method_construct(ExecutionEngine *engine, const Value &function, const Value &newTarget, Value *argv, int argc) | - | ||||||||||||||||||
1132 | { | - | ||||||||||||||||||
1133 | if (!function.isFunctionObject()
| 206-113560 | ||||||||||||||||||
1134 | return executed 206 times by 1 test: engine->throwTypeError();return engine->throwTypeError(); Executed by:
executed 206 times by 1 test: return engine->throwTypeError(); Executed by:
| 206 | ||||||||||||||||||
1135 | - | |||||||||||||||||||
1136 | return executed 113556 times by 18 tests: static_cast<const FunctionObject &>(function).callAsConstructor(argv, argc, &newTarget);return static_cast<const FunctionObject &>(function).callAsConstructor(argv, argc, &newTarget); Executed by:
executed 113556 times by 18 tests: return static_cast<const FunctionObject &>(function).callAsConstructor(argv, argc, &newTarget); Executed by:
| 113556 | ||||||||||||||||||
1137 | } | - | ||||||||||||||||||
1138 | - | |||||||||||||||||||
1139 | ReturnedValue Runtime::method_constructWithSpread(ExecutionEngine *engine, const Value &function, const Value &newTarget, Value *argv, int argc) | - | ||||||||||||||||||
1140 | { | - | ||||||||||||||||||
1141 | QMessageLogger(__FILE__, 1351, __PRETTY_FUNCTION__).warning("Unimplemented code."); | - | ||||||||||||||||||
1142 | if (!function.isFunctionObject()
| 0-160 | ||||||||||||||||||
1143 | return never executed: engine->throwTypeError();return engine->throwTypeError(); never executed: return engine->throwTypeError(); | 0 | ||||||||||||||||||
1144 | - | |||||||||||||||||||
1145 | Scope scope(engine); | - | ||||||||||||||||||
1146 | CallArgs arguments = createSpreadArguments(scope, argv, argc); | - | ||||||||||||||||||
1147 | if (engine->hasException
| 64-96 | ||||||||||||||||||
1148 | return executed 96 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 96 times by 1 test: return Encode::undefined(); Executed by:
| 96 | ||||||||||||||||||
1149 | - | |||||||||||||||||||
1150 | return executed 64 times by 1 test: static_cast<const FunctionObject &>(function).callAsConstructor(arguments.argv, arguments.argc, &newTarget);return static_cast<const FunctionObject &>(function).callAsConstructor(arguments.argv, arguments.argc, &newTarget); Executed by:
executed 64 times by 1 test: return static_cast<const FunctionObject &>(function).callAsConstructor(arguments.argv, arguments.argc, &newTarget); Executed by:
| 64 | ||||||||||||||||||
1151 | } | - | ||||||||||||||||||
1152 | - | |||||||||||||||||||
1153 | void Runtime::method_throwException(ExecutionEngine *engine, const Value &value) | - | ||||||||||||||||||
1154 | { | - | ||||||||||||||||||
1155 | if (!value.isEmpty()
| 0-17309 | ||||||||||||||||||
1156 | engine->throwError(value); executed 17309 times by 9 tests: engine->throwError(value); Executed by:
| 17309 | ||||||||||||||||||
1157 | } executed 17301 times by 9 tests: end of block Executed by:
| 17301 | ||||||||||||||||||
1158 | - | |||||||||||||||||||
1159 | ReturnedValue Runtime::method_typeofValue(ExecutionEngine *engine, const Value &value) | - | ||||||||||||||||||
1160 | { | - | ||||||||||||||||||
1161 | Scope scope(engine); | - | ||||||||||||||||||
1162 | ScopedString res(scope); | - | ||||||||||||||||||
1163 | switch (value.type()) { | - | ||||||||||||||||||
1164 | case executed 2122 times by 4 tests: Value::Undefined_Type:case Value::Undefined_Type: Executed by:
executed 2122 times by 4 tests: case Value::Undefined_Type: Executed by:
| 2122 | ||||||||||||||||||
1165 | res = engine->id_undefined(); | - | ||||||||||||||||||
1166 | break; executed 2125 times by 4 tests: break; Executed by:
| 2125 | ||||||||||||||||||
1167 | case executed 30 times by 5 tests: Value::Null_Type:case Value::Null_Type: Executed by:
executed 30 times by 5 tests: case Value::Null_Type: Executed by:
| 30 | ||||||||||||||||||
1168 | res = engine->id_object(); | - | ||||||||||||||||||
1169 | break; executed 30 times by 5 tests: break; Executed by:
| 30 | ||||||||||||||||||
1170 | case executed 148 times by 4 tests: Value::Boolean_Type:case Value::Boolean_Type: Executed by:
executed 148 times by 4 tests: case Value::Boolean_Type: Executed by:
| 148 | ||||||||||||||||||
1171 | res = engine->id_boolean(); | - | ||||||||||||||||||
1172 | break; executed 148 times by 4 tests: break; Executed by:
| 148 | ||||||||||||||||||
1173 | case executed 83799 times by 10 tests: Value::Managed_Type:case Value::Managed_Type: Executed by:
executed 83799 times by 10 tests: case Value::Managed_Type: Executed by:
| 83799 | ||||||||||||||||||
1174 | if (value.isString()
| 6923-76792 | ||||||||||||||||||
1175 | res = engine->id_string(); executed 6918 times by 8 tests: res = engine->id_string(); Executed by:
| 6918 | ||||||||||||||||||
1176 | else if (value.isSymbol()
| 212-76608 | ||||||||||||||||||
1177 | res = engine->id_symbol(); executed 212 times by 1 test: res = engine->id_symbol(); Executed by:
| 212 | ||||||||||||||||||
1178 | else if (value.objectValue()->as<FunctionObject>()
| 37190-39445 | ||||||||||||||||||
1179 | res = engine->id_function(); executed 37162 times by 5 tests: res = engine->id_function(); Executed by:
| 37162 | ||||||||||||||||||
1180 | else | - | ||||||||||||||||||
1181 | res = engine->id_object(); executed 39432 times by 7 tests: res = engine->id_object(); Executed by:
| 39432 | ||||||||||||||||||
1182 | break; executed 83723 times by 10 tests: break; Executed by:
| 83723 | ||||||||||||||||||
1183 | default executed 1432 times by 7 tests: :default: Executed by:
executed 1432 times by 7 tests: default: Executed by:
| 1432 | ||||||||||||||||||
1184 | res = engine->id_number(); | - | ||||||||||||||||||
1185 | break; executed 1432 times by 7 tests: break; Executed by:
| 1432 | ||||||||||||||||||
1186 | } | - | ||||||||||||||||||
1187 | return executed 87355 times by 10 tests: res.asReturnedValue();return res.asReturnedValue(); Executed by:
executed 87355 times by 10 tests: return res.asReturnedValue(); Executed by:
| 87355 | ||||||||||||||||||
1188 | } | - | ||||||||||||||||||
1189 | - | |||||||||||||||||||
1190 | QV4::ReturnedValue Runtime::method_typeofName(ExecutionEngine *engine, int nameIndex) | - | ||||||||||||||||||
1191 | { | - | ||||||||||||||||||
1192 | Scope scope(engine); | - | ||||||||||||||||||
1193 | ScopedString name(scope, engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[nameIndex]); | - | ||||||||||||||||||
1194 | ScopedValue prop(scope, static_cast<ExecutionContext &>(engine->currentStackFrame->jsFrame->context).getProperty(name)); | - | ||||||||||||||||||
1195 | - | |||||||||||||||||||
1196 | scope.engine->hasException = false; | - | ||||||||||||||||||
1197 | return executed 2895 times by 4 tests: method_typeofValue(engine, prop);return method_typeofValue(engine, prop); Executed by:
executed 2895 times by 4 tests: return method_typeofValue(engine, prop); Executed by:
| 2895 | ||||||||||||||||||
1198 | } | - | ||||||||||||||||||
1199 | - | |||||||||||||||||||
1200 | ReturnedValue Runtime::method_createWithContext(ExecutionEngine *engine, Value *jsStackFrame) | - | ||||||||||||||||||
1201 | { | - | ||||||||||||||||||
1202 | QV4::Value &accumulator = jsStackFrame[CallData::Accumulator]; | - | ||||||||||||||||||
1203 | accumulator = accumulator.toObject(engine); | - | ||||||||||||||||||
1204 | if (engine->hasException
| 7-657 | ||||||||||||||||||
1205 | return executed 7 times by 2 tests: Encode::undefined();return Encode::undefined(); Executed by:
executed 7 times by 2 tests: return Encode::undefined(); Executed by:
| 7 | ||||||||||||||||||
1206 | ((accumulator.isObject()) ? static_cast<void>(0) : qt_assert("accumulator.isObject()", __FILE__, 1416)); | - | ||||||||||||||||||
1207 | const Object &obj = static_cast<const Object &>(accumulator); | - | ||||||||||||||||||
1208 | ExecutionContext *context = static_cast<ExecutionContext *>(jsStackFrame + CallData::Context); | - | ||||||||||||||||||
1209 | return executed 659 times by 4 tests: context->newWithContext(obj.d())->asReturnedValue();return context->newWithContext(obj.d())->asReturnedValue(); Executed by:
executed 659 times by 4 tests: return context->newWithContext(obj.d())->asReturnedValue(); Executed by:
| 659 | ||||||||||||||||||
1210 | } | - | ||||||||||||||||||
1211 | - | |||||||||||||||||||
1212 | ReturnedValue Runtime::method_createCatchContext(ExecutionContext *parent, int blockIndex, int exceptionVarNameIndex) | - | ||||||||||||||||||
1213 | { | - | ||||||||||||||||||
1214 | ExecutionEngine *e = parent->engine(); | - | ||||||||||||||||||
1215 | return executed 4320786 times by 13 tests: parent->newCatchContext(e->currentStackFrame, blockIndex,return parent->newCatchContext(e->currentStackFrame, blockIndex, e->currentStackFrame->v4Function->compilationUnit->runtimeStrings[exceptionVarNameIndex])->asReturnedValue(); Executed by:
executed 4320786 times by 13 tests: return parent->newCatchContext(e->currentStackFrame, blockIndex, e->currentStackFrame->v4Function->compilationUnit->runtimeStrings[exceptionVarNameIndex])->asReturnedValue(); Executed by:
| 4320786 | ||||||||||||||||||
1216 | e->currentStackFrame->v4Function->compilationUnit->runtimeStrings[exceptionVarNameIndex])->asReturnedValue(); executed 4320786 times by 13 tests: return parent->newCatchContext(e->currentStackFrame, blockIndex, e->currentStackFrame->v4Function->compilationUnit->runtimeStrings[exceptionVarNameIndex])->asReturnedValue(); Executed by:
| 4320786 | ||||||||||||||||||
1217 | } | - | ||||||||||||||||||
1218 | - | |||||||||||||||||||
1219 | ReturnedValue Runtime::method_createBlockContext(ExecutionContext *parent, int index) | - | ||||||||||||||||||
1220 | { | - | ||||||||||||||||||
1221 | ExecutionEngine *e = parent->engine(); | - | ||||||||||||||||||
1222 | return executed 562 times by 2 tests: parent->newBlockContext(e->currentStackFrame, index)->asReturnedValue();return parent->newBlockContext(e->currentStackFrame, index)->asReturnedValue(); Executed by:
executed 562 times by 2 tests: return parent->newBlockContext(e->currentStackFrame, index)->asReturnedValue(); Executed by:
| 562 | ||||||||||||||||||
1223 | } | - | ||||||||||||||||||
1224 | - | |||||||||||||||||||
1225 | ReturnedValue Runtime::method_cloneBlockContext(ExecutionContext *previous) | - | ||||||||||||||||||
1226 | { | - | ||||||||||||||||||
1227 | return executed 194 times by 2 tests: ExecutionContext::cloneBlockContext(static_cast<Heap::CallContext *>(previous->d()))->asReturnedValue();return ExecutionContext::cloneBlockContext(static_cast<Heap::CallContext *>(previous->d()))->asReturnedValue(); Executed by:
executed 194 times by 2 tests: return ExecutionContext::cloneBlockContext(static_cast<Heap::CallContext *>(previous->d()))->asReturnedValue(); Executed by:
| 194 | ||||||||||||||||||
1228 | } | - | ||||||||||||||||||
1229 | - | |||||||||||||||||||
1230 | - | |||||||||||||||||||
1231 | ReturnedValue Runtime::method_createScriptContext(ExecutionEngine *engine, int index) | - | ||||||||||||||||||
1232 | { | - | ||||||||||||||||||
1233 | ((engine->currentStackFrame->context()->d()->type == Heap::ExecutionContext::Type_GlobalContext || engine->currentStackFrame->context()->d()->type == Heap::ExecutionContext::Type_QmlContext) ? static_cast<void>(0) : qt_assert("engine->currentStackFrame->context()->d()->type == Heap::ExecutionContext::Type_GlobalContext || engine->currentStackFrame->context()->d()->type == Heap::ExecutionContext::Type_QmlContext", | - | ||||||||||||||||||
1234 | __FILE__ | - | ||||||||||||||||||
1235 | , | - | ||||||||||||||||||
1236 | 1444 | - | ||||||||||||||||||
1237 | )) | - | ||||||||||||||||||
1238 | ; | - | ||||||||||||||||||
1239 | ReturnedValue c = ExecutionContext::newBlockContext(engine->currentStackFrame, index)->asReturnedValue(); | - | ||||||||||||||||||
1240 | engine->setScriptContext(c); | - | ||||||||||||||||||
1241 | return executed 5093 times by 2 tests: c;return c; Executed by:
executed 5093 times by 2 tests: return c; Executed by:
| 5093 | ||||||||||||||||||
1242 | } | - | ||||||||||||||||||
1243 | - | |||||||||||||||||||
1244 | ReturnedValue Runtime::method_popScriptContext(ExecutionEngine *engine) | - | ||||||||||||||||||
1245 | { | - | ||||||||||||||||||
1246 | ReturnedValue root = engine->rootContext()->asReturnedValue(); | - | ||||||||||||||||||
1247 | engine->setScriptContext(root); | - | ||||||||||||||||||
1248 | return executed 4376 times by 2 tests: root;return root; Executed by:
executed 4376 times by 2 tests: return root; Executed by:
| 4376 | ||||||||||||||||||
1249 | } | - | ||||||||||||||||||
1250 | - | |||||||||||||||||||
1251 | - | |||||||||||||||||||
1252 | void Runtime::method_declareVar(ExecutionEngine *engine, bool deletable, int nameIndex) | - | ||||||||||||||||||
1253 | { | - | ||||||||||||||||||
1254 | Scope scope(engine); | - | ||||||||||||||||||
1255 | ScopedString name(scope, engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[nameIndex]); | - | ||||||||||||||||||
1256 | static_cast<ExecutionContext &>(engine->currentStackFrame->jsFrame->context).createMutableBinding(name, deletable); | - | ||||||||||||||||||
1257 | } executed 517505 times by 21 tests: end of block Executed by:
| 517505 | ||||||||||||||||||
1258 | - | |||||||||||||||||||
1259 | ReturnedValue Runtime::method_arrayLiteral(ExecutionEngine *engine, Value *values, uint length) | - | ||||||||||||||||||
1260 | { | - | ||||||||||||||||||
1261 | return executed 52683 times by 45 tests: engine->newArrayObject(values, length)->asReturnedValue();return engine->newArrayObject(values, length)->asReturnedValue(); Executed by:
executed 52683 times by 45 tests: return engine->newArrayObject(values, length)->asReturnedValue(); Executed by:
| 52683 | ||||||||||||||||||
1262 | } | - | ||||||||||||||||||
1263 | - | |||||||||||||||||||
1264 | ReturnedValue Runtime::method_objectLiteral(ExecutionEngine *engine, int classId, int argc, const QV4::Value *args) | - | ||||||||||||||||||
1265 | { | - | ||||||||||||||||||
1266 | Scope scope(engine); | - | ||||||||||||||||||
1267 | Scoped<InternalClass> klass(scope, engine->currentStackFrame->v4Function->compilationUnit->runtimeClasses[classId]); | - | ||||||||||||||||||
1268 | ScopedObject o(scope, engine->newObject(klass->d())); | - | ||||||||||||||||||
1269 | - | |||||||||||||||||||
1270 | ((uint(argc) >= klass->d()->size) ? static_cast<void>(0) : qt_assert("uint(argc) >= klass->d()->size", __FILE__, 1476)); | - | ||||||||||||||||||
1271 | - | |||||||||||||||||||
1272 | for (uint i = 0; i < klass->d()->size
| 75065-78656 | ||||||||||||||||||
1273 | o->setProperty(i, *args++); executed 78652 times by 33 tests: o->setProperty(i, *args++); Executed by:
| 78652 | ||||||||||||||||||
1274 | - | |||||||||||||||||||
1275 | (((argc - klass->d()->size) % 3 == 0) ? static_cast<void>(0) : qt_assert("(argc - klass->d()->size) % 3 == 0", __FILE__, 1481)); | - | ||||||||||||||||||
1276 | int additionalArgs = (argc - int(klass->d()->size))/3; | - | ||||||||||||||||||
1277 | - | |||||||||||||||||||
1278 | if (!additionalArgs
| 4203-70740 | ||||||||||||||||||
1279 | return executed 70740 times by 36 tests: o->asReturnedValue();return o->asReturnedValue(); Executed by:
executed 70740 times by 36 tests: return o->asReturnedValue(); Executed by:
| 70740 | ||||||||||||||||||
1280 | - | |||||||||||||||||||
1281 | ScopedPropertyKey name(scope); | - | ||||||||||||||||||
1282 | ScopedProperty pd(scope); | - | ||||||||||||||||||
1283 | for (int i = 0; i < additionalArgs
| 4228-9778 | ||||||||||||||||||
1284 | ((args->isInteger()) ? static_cast<void>(0) : qt_assert("args->isInteger()", __FILE__, 1490)); | - | ||||||||||||||||||
1285 | ObjectLiteralArgument arg = ObjectLiteralArgument(args->integerValue()); | - | ||||||||||||||||||
1286 | name = args[1].toPropertyKey(engine); | - | ||||||||||||||||||
1287 | if (engine->hasException
| 8-9772 | ||||||||||||||||||
1288 | 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 | ||||||||||||||||||
1289 | ((arg == ObjectLiteralArgument::Value || args[2].isFunctionObject()) ? static_cast<void>(0) : qt_assert("arg == ObjectLiteralArgument::Value || args[2].isFunctionObject()", __FILE__, 1495)); | - | ||||||||||||||||||
1290 | if (arg == ObjectLiteralArgument::Value
| 580-8319 | ||||||||||||||||||
1291 | pd->value = args[2]; | - | ||||||||||||||||||
1292 | pd->set = Primitive::emptyValue(); | - | ||||||||||||||||||
1293 | } executed 9179 times by 2 tests: else {end of block Executed by:
| 9179 | ||||||||||||||||||
1294 | pd->value = Primitive::emptyValue(); | - | ||||||||||||||||||
1295 | pd->set = args[2]; | - | ||||||||||||||||||
1296 | } executed 579 times by 1 test: end of block Executed by:
| 579 | ||||||||||||||||||
1297 | bool ok = o->defineOwnProperty(name, pd, (arg == ObjectLiteralArgument::Value ? Attr_Data : Attr_Accessor)); | - | ||||||||||||||||||
1298 | if (!ok
| 0-9774 | ||||||||||||||||||
1299 | return never executed: engine->throwTypeError();return engine->throwTypeError(); never executed: return engine->throwTypeError(); | 0 | ||||||||||||||||||
1300 | - | |||||||||||||||||||
1301 | args += 3; | - | ||||||||||||||||||
1302 | } executed 9775 times by 2 tests: end of block Executed by:
| 9775 | ||||||||||||||||||
1303 | return executed 4230 times by 2 tests: o.asReturnedValue();return o.asReturnedValue(); Executed by:
executed 4230 times by 2 tests: return o.asReturnedValue(); Executed by:
| 4230 | ||||||||||||||||||
1304 | } | - | ||||||||||||||||||
1305 | - | |||||||||||||||||||
1306 | ReturnedValue Runtime::method_createClass(ExecutionEngine *engine, int classIndex, const Value &superClass, const Value *computedNames) | - | ||||||||||||||||||
1307 | { | - | ||||||||||||||||||
1308 | const CompiledData::CompilationUnit *unit = engine->currentStackFrame->v4Function->compilationUnit; | - | ||||||||||||||||||
1309 | const QV4::CompiledData::Class *cls = unit->data->classAt(classIndex); | - | ||||||||||||||||||
1310 | - | |||||||||||||||||||
1311 | Scope scope(engine); | - | ||||||||||||||||||
1312 | ScopedObject protoParent(scope, engine->objectPrototype()); | - | ||||||||||||||||||
1313 | ScopedObject constructorParent(scope, engine->functionPrototype()); | - | ||||||||||||||||||
1314 | if (!superClass.isEmpty()
| 879-8126 | ||||||||||||||||||
1315 | if (superClass.isNull()
| 28-850 | ||||||||||||||||||
1316 | protoParent = Encode::null(); | - | ||||||||||||||||||
1317 | } executed 28 times by 1 test: else {end of block Executed by:
| 28 | ||||||||||||||||||
1318 | - | |||||||||||||||||||
1319 | if (!superClass.isFunctionObject()
| 16-836 | ||||||||||||||||||
1320 | return executed 16 times by 1 test: engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "The superclass is not a function object.")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "The superclass is not a function object." }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); returnreturn engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "The superclass is not a function object.")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "The superclass is not a function object." }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())); Executed by:
executed 16 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 16 times by 1 test: }()));return qstring_literal_temp; Executed by:
executed 16 times by 1 test: return engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "The superclass is not a function object.")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "The superclass is not a function object." }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())); Executed by:
| 16 | ||||||||||||||||||
1321 | const FunctionObject *s = static_cast<const FunctionObject *>(&superClass); | - | ||||||||||||||||||
1322 | ScopedValue result(scope, s->get(scope.engine->id_prototype())); | - | ||||||||||||||||||
1323 | if (!result->isObject()
| 4-811 | ||||||||||||||||||
1324 | return executed 16 times by 1 test: engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "The value of the superclass's prototype property is not an object.")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "The value of the superclass's prototype property is not an object." }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); returnreturn engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "The value of the superclass's prototype property is not an object.")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "The value of the superclass's prototype property is not an object." }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())); Executed by:
executed 16 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 16 times by 1 test: }()));return qstring_literal_temp; Executed by:
executed 16 times by 1 test: return engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "The value of the superclass's prototype property is not an object.")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "The value of the superclass's prototype property is not an object." }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())); Executed by:
| 16 | ||||||||||||||||||
1325 | protoParent = *result; | - | ||||||||||||||||||
1326 | constructorParent = superClass; | - | ||||||||||||||||||
1327 | } executed 817 times by 1 test: end of block Executed by:
| 817 | ||||||||||||||||||
1328 | } | - | ||||||||||||||||||
1329 | - | |||||||||||||||||||
1330 | ScopedObject proto(scope, engine->newObject()); | - | ||||||||||||||||||
1331 | proto->setPrototypeUnchecked(protoParent); | - | ||||||||||||||||||
1332 | ExecutionContext *current = static_cast<ExecutionContext *>(&engine->currentStackFrame->jsFrame->context); | - | ||||||||||||||||||
1333 | - | |||||||||||||||||||
1334 | ScopedFunctionObject constructor(scope); | - | ||||||||||||||||||
1335 | QV4::Function *f = cls->constructorFunction !=
| 658-8353 | ||||||||||||||||||
1336 | (0x7fffffff * 2U + 1U)
| 658-8353 | ||||||||||||||||||
1337 | ? unit->runtimeFunctions[cls->constructorFunction] : nullptr; | - | ||||||||||||||||||
1338 | constructor = FunctionObject::createConstructorFunction(current, f, !superClass.isEmpty())->asReturnedValue(); | - | ||||||||||||||||||
1339 | constructor->setPrototypeUnchecked(constructorParent); | - | ||||||||||||||||||
1340 | constructor->defineDefaultProperty(engine->id_prototype(), proto); | - | ||||||||||||||||||
1341 | proto->defineDefaultProperty(engine->id_constructor(), constructor); | - | ||||||||||||||||||
1342 | - | |||||||||||||||||||
1343 | ScopedString name(scope); | - | ||||||||||||||||||
1344 | if (cls->nameIndex !=
| 0-9039 | ||||||||||||||||||
1345 | (0x7fffffff * 2U + 1U)
| 0-9039 | ||||||||||||||||||
1346 | ) { | - | ||||||||||||||||||
1347 | name = unit->runtimeStrings[cls->nameIndex]; | - | ||||||||||||||||||
1348 | constructor->defineReadonlyConfigurableProperty(engine->id_name(), name); | - | ||||||||||||||||||
1349 | } executed 9011 times by 1 test: end of block Executed by:
| 9011 | ||||||||||||||||||
1350 | - | |||||||||||||||||||
1351 | ScopedObject receiver(scope, *constructor); | - | ||||||||||||||||||
1352 | ScopedPropertyKey propertyName(scope); | - | ||||||||||||||||||
1353 | ScopedFunctionObject function(scope); | - | ||||||||||||||||||
1354 | ScopedProperty property(scope); | - | ||||||||||||||||||
1355 | const CompiledData::Method *methods = cls->methodTable(); | - | ||||||||||||||||||
1356 | for (uint i = 0; i < cls->nStaticMethods + cls->nMethods
| 7716-9019 | ||||||||||||||||||
1357 | if (i == cls->nStaticMethods
| 3512-4200 | ||||||||||||||||||
1358 | receiver = proto; executed 3542 times by 1 test: receiver = proto; Executed by:
| 3542 | ||||||||||||||||||
1359 | if (methods[i].name ==
| 479-7239 | ||||||||||||||||||
1360 | (0x7fffffff * 2U + 1U)
| 479-7239 | ||||||||||||||||||
1361 | ) { | - | ||||||||||||||||||
1362 | propertyName = computedNames->toPropertyKey(engine); | - | ||||||||||||||||||
1363 | if (engine->hasException
| 32-447 | ||||||||||||||||||
1364 | return executed 32 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 32 times by 1 test: return Encode::undefined(); Executed by:
| 32 | ||||||||||||||||||
1365 | ++computedNames; | - | ||||||||||||||||||
1366 | } executed 447 times by 1 test: else {end of block Executed by:
| 447 | ||||||||||||||||||
1367 | name = unit->runtimeStrings[methods[i].name]; | - | ||||||||||||||||||
1368 | propertyName = name->toPropertyKey(); | - | ||||||||||||||||||
1369 | } executed 7332 times by 1 test: end of block Executed by:
| 7332 | ||||||||||||||||||
1370 | QV4::Function *f = unit->runtimeFunctions[methods[i].function]; | - | ||||||||||||||||||
1371 | ((f) ? static_cast<void>(0) : qt_assert("f", __FILE__, 1571)); | - | ||||||||||||||||||
1372 | if (f->isGenerator()
| 3043-4725 | ||||||||||||||||||
1373 | function = MemberGeneratorFunction::create(current, f); executed 3047 times by 1 test: function = MemberGeneratorFunction::create(current, f); Executed by:
| 3047 | ||||||||||||||||||
1374 | else | - | ||||||||||||||||||
1375 | function = FunctionObject::createMemberFunction(current, f); executed 4720 times by 1 test: function = FunctionObject::createMemberFunction(current, f); Executed by:
| 4720 | ||||||||||||||||||
1376 | ((function) ? static_cast<void>(0) : qt_assert("function", __FILE__, 1576)); | - | ||||||||||||||||||
1377 | PropertyAttributes attributes; | - | ||||||||||||||||||
1378 | switch (methods[i].type) { | - | ||||||||||||||||||
1379 | case executed 481 times by 1 test: CompiledData::Method::Getter:case CompiledData::Method::Getter: Executed by:
executed 481 times by 1 test: case CompiledData::Method::Getter: Executed by:
| 481 | ||||||||||||||||||
1380 | property->setGetter(function); | - | ||||||||||||||||||
1381 | property->set = Primitive::emptyValue(); | - | ||||||||||||||||||
1382 | attributes = Attr_Accessor|Attr_NotEnumerable; | - | ||||||||||||||||||
1383 | break; executed 475 times by 1 test: break; Executed by:
| 475 | ||||||||||||||||||
1384 | case executed 490 times by 1 test: CompiledData::Method::Setter:case CompiledData::Method::Setter: Executed by:
executed 490 times by 1 test: case CompiledData::Method::Setter: Executed by:
| 490 | ||||||||||||||||||
1385 | property->value = Primitive::emptyValue(); | - | ||||||||||||||||||
1386 | property->setSetter(function); | - | ||||||||||||||||||
1387 | attributes = Attr_Accessor|Attr_NotEnumerable; | - | ||||||||||||||||||
1388 | break; executed 489 times by 1 test: break; Executed by:
| 489 | ||||||||||||||||||
1389 | default executed 6776 times by 1 test: :default: Executed by:
executed 6776 times by 1 test: default: Executed by:
| 6776 | ||||||||||||||||||
1390 | property->value = function; | - | ||||||||||||||||||
1391 | property->set = Primitive::emptyValue(); | - | ||||||||||||||||||
1392 | attributes = Attr_Data|Attr_NotEnumerable; | - | ||||||||||||||||||
1393 | break; executed 6776 times by 1 test: break; Executed by:
| 6776 | ||||||||||||||||||
1394 | } | - | ||||||||||||||||||
1395 | receiver->defineOwnProperty(propertyName, property, attributes); | - | ||||||||||||||||||
1396 | } executed 7777 times by 1 test: end of block Executed by:
| 7777 | ||||||||||||||||||
1397 | - | |||||||||||||||||||
1398 | return executed 9027 times by 1 test: constructor->asReturnedValue();return constructor->asReturnedValue(); Executed by:
executed 9027 times by 1 test: return constructor->asReturnedValue(); Executed by:
| 9027 | ||||||||||||||||||
1399 | } | - | ||||||||||||||||||
1400 | - | |||||||||||||||||||
1401 | QV4::ReturnedValue Runtime::method_createMappedArgumentsObject(ExecutionEngine *engine) | - | ||||||||||||||||||
1402 | { | - | ||||||||||||||||||
1403 | ((engine->currentContext()->d()->type == Heap::ExecutionContext::Type_CallContext) ? static_cast<void>(0) : qt_assert("engine->currentContext()->d()->type == Heap::ExecutionContext::Type_CallContext", __FILE__, 1603)); | - | ||||||||||||||||||
1404 | Heap::InternalClass *ic = engine->internalClasses(EngineBase::Class_ArgumentsObject); | - | ||||||||||||||||||
1405 | return executed 4497 times by 11 tests: engine->memoryManager->allocObject<ArgumentsObject>(ic, engine->currentStackFrame)->asReturnedValue();return engine->memoryManager->allocObject<ArgumentsObject>(ic, engine->currentStackFrame)->asReturnedValue(); Executed by:
executed 4497 times by 11 tests: return engine->memoryManager->allocObject<ArgumentsObject>(ic, engine->currentStackFrame)->asReturnedValue(); Executed by:
| 4497 | ||||||||||||||||||
1406 | } | - | ||||||||||||||||||
1407 | - | |||||||||||||||||||
1408 | QV4::ReturnedValue Runtime::method_createUnmappedArgumentsObject(ExecutionEngine *engine) | - | ||||||||||||||||||
1409 | { | - | ||||||||||||||||||
1410 | Heap::InternalClass *ic = engine->internalClasses(EngineBase::Class_StrictArgumentsObject); | - | ||||||||||||||||||
1411 | return executed 3845 times by 2 tests: engine->memoryManager->allocObject<StrictArgumentsObject>(ic, engine->currentStackFrame)->asReturnedValue();return engine->memoryManager->allocObject<StrictArgumentsObject>(ic, engine->currentStackFrame)->asReturnedValue(); Executed by:
executed 3845 times by 2 tests: return engine->memoryManager->allocObject<StrictArgumentsObject>(ic, engine->currentStackFrame)->asReturnedValue(); Executed by:
| 3845 | ||||||||||||||||||
1412 | } | - | ||||||||||||||||||
1413 | - | |||||||||||||||||||
1414 | QV4::ReturnedValue Runtime::method_createRestParameter(ExecutionEngine *engine, int argIndex) | - | ||||||||||||||||||
1415 | { | - | ||||||||||||||||||
1416 | const Value *values = engine->currentStackFrame->originalArguments + argIndex; | - | ||||||||||||||||||
1417 | int nValues = engine->currentStackFrame->originalArgumentsCount - argIndex; | - | ||||||||||||||||||
1418 | if (nValues <= 0
| 56-87 | ||||||||||||||||||
1419 | return executed 56 times by 1 test: engine->newArrayObject(0)->asReturnedValue();return engine->newArrayObject(0)->asReturnedValue(); Executed by:
executed 56 times by 1 test: return engine->newArrayObject(0)->asReturnedValue(); Executed by:
| 56 | ||||||||||||||||||
1420 | return executed 87 times by 1 test: engine->newArrayObject(values, nValues)->asReturnedValue();return engine->newArrayObject(values, nValues)->asReturnedValue(); Executed by:
executed 87 times by 1 test: return engine->newArrayObject(values, nValues)->asReturnedValue(); Executed by:
| 87 | ||||||||||||||||||
1421 | } | - | ||||||||||||||||||
1422 | - | |||||||||||||||||||
1423 | - | |||||||||||||||||||
1424 | ReturnedValue Runtime::method_loadQmlContext(NoThrowEngine *engine) | - | ||||||||||||||||||
1425 | { | - | ||||||||||||||||||
1426 | Heap::QmlContext *ctx = engine->qmlContext(); | - | ||||||||||||||||||
1427 | ((ctx) ? static_cast<void>(0) : qt_assert("ctx", __FILE__, 1627)); | - | ||||||||||||||||||
1428 | return executed 1132860 times by 127 tests: ctx->asReturnedValue();return ctx->asReturnedValue(); Executed by:
executed 1132860 times by 127 tests: return ctx->asReturnedValue(); Executed by:
| 1132860 | ||||||||||||||||||
1429 | } | - | ||||||||||||||||||
1430 | - | |||||||||||||||||||
1431 | ReturnedValue Runtime::method_regexpLiteral(ExecutionEngine *engine, int id) | - | ||||||||||||||||||
1432 | { | - | ||||||||||||||||||
1433 | Heap::RegExpObject *ro = engine->newRegExpObject(engine->currentStackFrame->v4Function->compilationUnit->runtimeRegularExpressions[id].as<RegExp>()); | - | ||||||||||||||||||
1434 | return executed 1052987 times by 7 tests: ro->asReturnedValue();return ro->asReturnedValue(); Executed by:
executed 1052987 times by 7 tests: return ro->asReturnedValue(); Executed by:
| 1052987 | ||||||||||||||||||
1435 | } | - | ||||||||||||||||||
1436 | - | |||||||||||||||||||
1437 | ReturnedValue Runtime::method_loadQmlScopeObjectProperty(ExecutionEngine *engine, const Value &context, int propertyIndex, bool captureRequired) | - | ||||||||||||||||||
1438 | { | - | ||||||||||||||||||
1439 | const QmlContext &c = static_cast<const QmlContext &>(context); | - | ||||||||||||||||||
1440 | return executed 387980 times by 101 tests: QV4::QObjectWrapper::getProperty(engine, c.d()->qml()->scopeObject, propertyIndex, captureRequired);return QV4::QObjectWrapper::getProperty(engine, c.d()->qml()->scopeObject, propertyIndex, captureRequired); Executed by:
executed 387980 times by 101 tests: return QV4::QObjectWrapper::getProperty(engine, c.d()->qml()->scopeObject, propertyIndex, captureRequired); Executed by:
| 387980 | ||||||||||||||||||
1441 | } | - | ||||||||||||||||||
1442 | - | |||||||||||||||||||
1443 | ReturnedValue Runtime::method_loadQmlContextObjectProperty(ExecutionEngine *engine, const Value &context, int propertyIndex, bool captureRequired) | - | ||||||||||||||||||
1444 | { | - | ||||||||||||||||||
1445 | const QmlContext &c = static_cast<const QmlContext &>(context); | - | ||||||||||||||||||
1446 | return never executed: QV4::QObjectWrapper::getProperty(engine, (*c.d()->qml()->context)->contextObject, propertyIndex, captureRequired);return QV4::QObjectWrapper::getProperty(engine, (*c.d()->qml()->context)->contextObject, propertyIndex, captureRequired); never executed: return QV4::QObjectWrapper::getProperty(engine, (*c.d()->qml()->context)->contextObject, propertyIndex, captureRequired); | 0 | ||||||||||||||||||
1447 | } | - | ||||||||||||||||||
1448 | - | |||||||||||||||||||
1449 | ReturnedValue Runtime::method_loadQmlIdObject(ExecutionEngine *engine, const Value &c, uint index) | - | ||||||||||||||||||
1450 | { | - | ||||||||||||||||||
1451 | const QmlContext &qmlContext = static_cast<const QmlContext &>(c); | - | ||||||||||||||||||
1452 | QQmlContextData *context = *qmlContext.d()->qml()->context; | - | ||||||||||||||||||
1453 | if (!context
| 0-475345 | ||||||||||||||||||
1454 | return never executed: Encode::undefined();return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
1455 | - | |||||||||||||||||||
1456 | QQmlEnginePrivate *ep = engine->qmlEngine()
| 0-475345 | ||||||||||||||||||
1457 | if (ep
| 0-475345 | ||||||||||||||||||
1458 | ep->propertyCapture->captureProperty(&context->idValues[index].bindings); executed 442980 times by 66 tests: ep->propertyCapture->captureProperty(&context->idValues[index].bindings); Executed by:
| 442980 | ||||||||||||||||||
1459 | - | |||||||||||||||||||
1460 | return executed 475345 times by 80 tests: QObjectWrapper::wrap(engine, context->idValues[index].data());return QObjectWrapper::wrap(engine, context->idValues[index].data()); Executed by:
executed 475345 times by 80 tests: return QObjectWrapper::wrap(engine, context->idValues[index].data()); Executed by:
| 475345 | ||||||||||||||||||
1461 | } | - | ||||||||||||||||||
1462 | - | |||||||||||||||||||
1463 | void Runtime::method_storeQmlScopeObjectProperty(ExecutionEngine *engine, const Value &context, int propertyIndex, const Value &value) | - | ||||||||||||||||||
1464 | { | - | ||||||||||||||||||
1465 | const QmlContext &c = static_cast<const QmlContext &>(context); | - | ||||||||||||||||||
1466 | return executed 11831 times by 57 tests: QV4::QObjectWrapper::setProperty(engine, c.d()->qml()->scopeObject, propertyIndex, value);return QV4::QObjectWrapper::setProperty(engine, c.d()->qml()->scopeObject, propertyIndex, value); Executed by:
executed 11831 times by 57 tests: return QV4::QObjectWrapper::setProperty(engine, c.d()->qml()->scopeObject, propertyIndex, value); Executed by:
| 11831 | ||||||||||||||||||
1467 | } | - | ||||||||||||||||||
1468 | - | |||||||||||||||||||
1469 | void Runtime::method_storeQmlContextObjectProperty(ExecutionEngine *engine, const Value &context, int propertyIndex, const Value &value) | - | ||||||||||||||||||
1470 | { | - | ||||||||||||||||||
1471 | const QmlContext &c = static_cast<const QmlContext &>(context); | - | ||||||||||||||||||
1472 | return never executed: QV4::QObjectWrapper::setProperty(engine, (*c.d()->qml()->context)->contextObject, propertyIndex, value);return QV4::QObjectWrapper::setProperty(engine, (*c.d()->qml()->context)->contextObject, propertyIndex, value); never executed: return QV4::QObjectWrapper::setProperty(engine, (*c.d()->qml()->context)->contextObject, propertyIndex, value); | 0 | ||||||||||||||||||
1473 | } | - | ||||||||||||||||||
1474 | - | |||||||||||||||||||
1475 | ReturnedValue Runtime::method_loadQmlImportedScripts(NoThrowEngine *engine) | - | ||||||||||||||||||
1476 | { | - | ||||||||||||||||||
1477 | QQmlContextData *context = engine->callingQmlContext(); | - | ||||||||||||||||||
1478 | if (!context
| 0-1132860 | ||||||||||||||||||
1479 | return never executed: Encode::undefined();return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
1480 | return executed 1132860 times by 127 tests: context->importedScripts.value();return context->importedScripts.value(); Executed by:
executed 1132860 times by 127 tests: return context->importedScripts.value(); Executed by:
| 1132860 | ||||||||||||||||||
1481 | } | - | ||||||||||||||||||
1482 | - | |||||||||||||||||||
1483 | ReturnedValue Runtime::method_uMinus(const Value &value) | - | ||||||||||||||||||
1484 | { | - | ||||||||||||||||||
1485 | ; | - | ||||||||||||||||||
1486 | - | |||||||||||||||||||
1487 | - | |||||||||||||||||||
1488 | if (value.isInteger()
| 3231-45696 | ||||||||||||||||||
1489 | value.integerValue() != std::numeric_limits<int>::min()
| 0-42597 | ||||||||||||||||||
1490 | return executed 42514 times by 20 tests: Encode(-value.integerValue());return Encode(-value.integerValue()); Executed by:
executed 42514 times by 20 tests: return Encode(-value.integerValue()); Executed by:
| 42514 | ||||||||||||||||||
1491 | else { | - | ||||||||||||||||||
1492 | double n = RuntimeHelpers::toNumber(value); | - | ||||||||||||||||||
1493 | return executed 9347 times by 9 tests: Encode(-n);return Encode(-n); Executed by:
executed 9347 times by 9 tests: return Encode(-n); Executed by:
| 9347 | ||||||||||||||||||
1494 | } | - | ||||||||||||||||||
1495 | } | - | ||||||||||||||||||
1496 | - | |||||||||||||||||||
1497 | - | |||||||||||||||||||
1498 | - | |||||||||||||||||||
1499 | - | |||||||||||||||||||
1500 | ReturnedValue Runtime::method_add(ExecutionEngine *engine, const Value &left, const Value &right) | - | ||||||||||||||||||
1501 | { | - | ||||||||||||||||||
1502 | ; | - | ||||||||||||||||||
1503 | - | |||||||||||||||||||
1504 | if (__builtin_expect(!!(left.integerCompatible() && right.integerCompatible()), true)
| 0-58258761 | ||||||||||||||||||
1505 | return never executed: add_int32(left.integerValue(), right.integerValue());return add_int32(left.integerValue(), right.integerValue()); never executed: return add_int32(left.integerValue(), right.integerValue()); | 0 | ||||||||||||||||||
1506 | if (left.isNumber()
| 15197-58174134 | ||||||||||||||||||
1507 | return executed 15197 times by 16 tests: Primitive::fromDouble(left.asDouble() + right.asDouble()).asReturnedValue();return Primitive::fromDouble(left.asDouble() + right.asDouble()).asReturnedValue(); Executed by:
executed 15197 times by 16 tests: return Primitive::fromDouble(left.asDouble() + right.asDouble()).asReturnedValue(); Executed by:
| 15197 | ||||||||||||||||||
1508 | - | |||||||||||||||||||
1509 | return executed 58324886 times by 37 tests: RuntimeHelpers::addHelper(engine, left, right);return RuntimeHelpers::addHelper(engine, left, right); Executed by:
executed 58324886 times by 37 tests: return RuntimeHelpers::addHelper(engine, left, right); Executed by:
| 58324886 | ||||||||||||||||||
1510 | } | - | ||||||||||||||||||
1511 | - | |||||||||||||||||||
1512 | - | |||||||||||||||||||
1513 | ReturnedValue Runtime::method_sub(const Value &left, const Value &right) | - | ||||||||||||||||||
1514 | { | - | ||||||||||||||||||
1515 | ; | - | ||||||||||||||||||
1516 | - | |||||||||||||||||||
1517 | if (__builtin_expect(!!(left.integerCompatible() && right.integerCompatible()), true)
| 0-10773 | ||||||||||||||||||
1518 | return never executed: sub_int32(left.integerValue(), right.integerValue());return sub_int32(left.integerValue(), right.integerValue()); never executed: return sub_int32(left.integerValue(), right.integerValue()); | 0 | ||||||||||||||||||
1519 | - | |||||||||||||||||||
1520 | double lval = left.isNumber()
| 418-10355 | ||||||||||||||||||
1521 | double rval = right.isNumber()
| 476-10297 | ||||||||||||||||||
1522 | - | |||||||||||||||||||
1523 | return executed 10773 times by 19 tests: Primitive::fromDouble(lval - rval).asReturnedValue();return Primitive::fromDouble(lval - rval).asReturnedValue(); Executed by:
executed 10773 times by 19 tests: return Primitive::fromDouble(lval - rval).asReturnedValue(); Executed by:
| 10773 | ||||||||||||||||||
1524 | } | - | ||||||||||||||||||
1525 | - | |||||||||||||||||||
1526 | ReturnedValue Runtime::method_mul(const Value &left, const Value &right) | - | ||||||||||||||||||
1527 | { | - | ||||||||||||||||||
1528 | ; | - | ||||||||||||||||||
1529 | - | |||||||||||||||||||
1530 | if (__builtin_expect(!!(left.integerCompatible() && right.integerCompatible()), true)
| 0-18950 | ||||||||||||||||||
1531 | return never executed: mul_int32(left.integerValue(), right.integerValue());return mul_int32(left.integerValue(), right.integerValue()); never executed: return mul_int32(left.integerValue(), right.integerValue()); | 0 | ||||||||||||||||||
1532 | - | |||||||||||||||||||
1533 | double lval = left.isNumber()
| 521-18429 | ||||||||||||||||||
1534 | double rval = right.isNumber()
| 484-18467 | ||||||||||||||||||
1535 | - | |||||||||||||||||||
1536 | return executed 18950 times by 10 tests: Primitive::fromDouble(lval * rval).asReturnedValue();return Primitive::fromDouble(lval * rval).asReturnedValue(); Executed by:
executed 18950 times by 10 tests: return Primitive::fromDouble(lval * rval).asReturnedValue(); Executed by:
| 18950 | ||||||||||||||||||
1537 | } | - | ||||||||||||||||||
1538 | - | |||||||||||||||||||
1539 | ReturnedValue Runtime::method_div(const Value &left, const Value &right) | - | ||||||||||||||||||
1540 | { | - | ||||||||||||||||||
1541 | ; | - | ||||||||||||||||||
1542 | - | |||||||||||||||||||
1543 | if (Value::integerCompatible(left, right)
| 996134-1195746 | ||||||||||||||||||
1544 | int lval = left.integerValue(); | - | ||||||||||||||||||
1545 | int rval = right.integerValue(); | - | ||||||||||||||||||
1546 | if (rval != 0
| 28185-1168689 | ||||||||||||||||||
1547 | && (
| 23489-1145725 | ||||||||||||||||||
1548 | && !(lval == 0
| 12-1106031 | ||||||||||||||||||
1549 | return executed 1145210 times by 5 tests: Encode(int(lval / rval));return Encode(int(lval / rval)); Executed by:
executed 1145210 times by 5 tests: return Encode(int(lval / rval)); Executed by:
| 1145210 | ||||||||||||||||||
1550 | else | - | ||||||||||||||||||
1551 | return executed 51684 times by 9 tests: Encode(double(lval) / rval);return Encode(double(lval) / rval); Executed by:
executed 51684 times by 9 tests: return Encode(double(lval) / rval); Executed by:
| 51684 | ||||||||||||||||||
1552 | } | - | ||||||||||||||||||
1553 | - | |||||||||||||||||||
1554 | double lval = left.toNumber(); | - | ||||||||||||||||||
1555 | double rval = right.toNumber(); | - | ||||||||||||||||||
1556 | return executed 996136 times by 24 tests: Primitive::fromDouble(lval / rval).asReturnedValue();return Primitive::fromDouble(lval / rval).asReturnedValue(); Executed by:
executed 996136 times by 24 tests: return Primitive::fromDouble(lval / rval).asReturnedValue(); Executed by:
| 996136 | ||||||||||||||||||
1557 | } | - | ||||||||||||||||||
1558 | - | |||||||||||||||||||
1559 | ReturnedValue Runtime::method_mod(const Value &left, const Value &right) | - | ||||||||||||||||||
1560 | { | - | ||||||||||||||||||
1561 | ; | - | ||||||||||||||||||
1562 | - | |||||||||||||||||||
1563 | if (Value::integerCompatible(left, right)
| 32-31274 | ||||||||||||||||||
1564 | int intRes = left.integerValue() % right.integerValue(); | - | ||||||||||||||||||
1565 | if (intRes != 0
| 0-3643 | ||||||||||||||||||
1566 | return executed 5139 times by 6 tests: Encode(intRes);return Encode(intRes); Executed by:
executed 5139 times by 6 tests: return Encode(intRes); Executed by:
| 5139 | ||||||||||||||||||
1567 | } never executed: end of block | 0 | ||||||||||||||||||
1568 | - | |||||||||||||||||||
1569 | double lval = RuntimeHelpers::toNumber(left); | - | ||||||||||||||||||
1570 | double rval = RuntimeHelpers::toNumber(right); | - | ||||||||||||||||||
1571 | - | |||||||||||||||||||
1572 | - | |||||||||||||||||||
1573 | - | |||||||||||||||||||
1574 | return executed 31744 times by 8 tests: Primitive::fromDouble(std::fmod(lval, rval)).asReturnedValue();return Primitive::fromDouble(std::fmod(lval, rval)).asReturnedValue(); Executed by:
executed 31744 times by 8 tests: return Primitive::fromDouble(std::fmod(lval, rval)).asReturnedValue(); Executed by:
| 31744 | ||||||||||||||||||
1575 | } | - | ||||||||||||||||||
1576 | - | |||||||||||||||||||
1577 | ReturnedValue Runtime::method_shl(const Value &left, const Value &right) | - | ||||||||||||||||||
1578 | { | - | ||||||||||||||||||
1579 | ; | - | ||||||||||||||||||
1580 | - | |||||||||||||||||||
1581 | int lval = left.toInt32(); | - | ||||||||||||||||||
1582 | int rval = right.toInt32() & 0x1f; | - | ||||||||||||||||||
1583 | return never executed: Encode((int)(lval << rval));return Encode((int)(lval << rval)); never executed: return Encode((int)(lval << rval)); | 0 | ||||||||||||||||||
1584 | } | - | ||||||||||||||||||
1585 | - | |||||||||||||||||||
1586 | ReturnedValue Runtime::method_shr(const Value &left, const Value &right) | - | ||||||||||||||||||
1587 | { | - | ||||||||||||||||||
1588 | ; | - | ||||||||||||||||||
1589 | - | |||||||||||||||||||
1590 | int lval = left.toInt32(); | - | ||||||||||||||||||
1591 | unsigned rval = right.toUInt32() & 0x1f; | - | ||||||||||||||||||
1592 | return never executed: Encode((int)(lval >> rval));return Encode((int)(lval >> rval)); never executed: return Encode((int)(lval >> rval)); | 0 | ||||||||||||||||||
1593 | } | - | ||||||||||||||||||
1594 | - | |||||||||||||||||||
1595 | ReturnedValue Runtime::method_ushr(const Value &left, const Value &right) | - | ||||||||||||||||||
1596 | { | - | ||||||||||||||||||
1597 | ; | - | ||||||||||||||||||
1598 | - | |||||||||||||||||||
1599 | unsigned lval = left.toUInt32(); | - | ||||||||||||||||||
1600 | unsigned rval = right.toUInt32() & 0x1f; | - | ||||||||||||||||||
1601 | uint res = lval >> rval; | - | ||||||||||||||||||
1602 | - | |||||||||||||||||||
1603 | return never executed: Encode(res);return Encode(res); never executed: return Encode(res); | 0 | ||||||||||||||||||
1604 | } | - | ||||||||||||||||||
1605 | - | |||||||||||||||||||
1606 | - | |||||||||||||||||||
1607 | - | |||||||||||||||||||
1608 | ReturnedValue Runtime::method_greaterThan(const Value &left, const Value &right) | - | ||||||||||||||||||
1609 | { | - | ||||||||||||||||||
1610 | ; | - | ||||||||||||||||||
1611 | - | |||||||||||||||||||
1612 | bool r = method_compareGreaterThan(left, right); | - | ||||||||||||||||||
1613 | return never executed: Encode(r);return Encode(r); never executed: return Encode(r); | 0 | ||||||||||||||||||
1614 | } | - | ||||||||||||||||||
1615 | - | |||||||||||||||||||
1616 | ReturnedValue Runtime::method_lessThan(const Value &left, const Value &right) | - | ||||||||||||||||||
1617 | { | - | ||||||||||||||||||
1618 | ; | - | ||||||||||||||||||
1619 | - | |||||||||||||||||||
1620 | bool r = method_compareLessThan(left, right); | - | ||||||||||||||||||
1621 | return never executed: Encode(r);return Encode(r); never executed: return Encode(r); | 0 | ||||||||||||||||||
1622 | } | - | ||||||||||||||||||
1623 | - | |||||||||||||||||||
1624 | ReturnedValue Runtime::method_greaterEqual(const Value &left, const Value &right) | - | ||||||||||||||||||
1625 | { | - | ||||||||||||||||||
1626 | ; | - | ||||||||||||||||||
1627 | - | |||||||||||||||||||
1628 | bool r = method_compareGreaterEqual(left, right); | - | ||||||||||||||||||
1629 | return never executed: Encode(r);return Encode(r); never executed: return Encode(r); | 0 | ||||||||||||||||||
1630 | } | - | ||||||||||||||||||
1631 | - | |||||||||||||||||||
1632 | ReturnedValue Runtime::method_lessEqual(const Value &left, const Value &right) | - | ||||||||||||||||||
1633 | { | - | ||||||||||||||||||
1634 | ; | - | ||||||||||||||||||
1635 | - | |||||||||||||||||||
1636 | bool r = method_compareLessEqual(left, right); | - | ||||||||||||||||||
1637 | return never executed: Encode(r);return Encode(r); never executed: return Encode(r); | 0 | ||||||||||||||||||
1638 | } | - | ||||||||||||||||||
1639 | - | |||||||||||||||||||
1640 | struct LazyScope | - | ||||||||||||||||||
1641 | { | - | ||||||||||||||||||
1642 | ExecutionEngine *engine = nullptr; | - | ||||||||||||||||||
1643 | Value *stackMark = nullptr; | - | ||||||||||||||||||
1644 | ~LazyScope() { | - | ||||||||||||||||||
1645 | if (engine
| 663-192641 | ||||||||||||||||||
1646 | engine->jsStackTop = stackMark; executed 663 times by 5 tests: engine->jsStackTop = stackMark; Executed by:
| 663 | ||||||||||||||||||
1647 | } executed 193304 times by 33 tests: end of block Executed by:
| 193304 | ||||||||||||||||||
1648 | template <typename T> | - | ||||||||||||||||||
1649 | void set(Value **scopedValue, T value, ExecutionEngine *e) { | - | ||||||||||||||||||
1650 | if (!engine
| 0-662 | ||||||||||||||||||
1651 | engine = e; | - | ||||||||||||||||||
1652 | stackMark = engine->jsStackTop; | - | ||||||||||||||||||
1653 | } executed 662 times by 5 tests: end of block Executed by:
| 662 | ||||||||||||||||||
1654 | if (!*scopedValue
| 0-661 | ||||||||||||||||||
1655 | * executed 662 times by 5 tests: scopedValue = e->jsAlloca(1);*scopedValue = e->jsAlloca(1); Executed by:
executed 662 times by 5 tests: *scopedValue = e->jsAlloca(1); Executed by:
| 662 | ||||||||||||||||||
1656 | **scopedValue = value; | - | ||||||||||||||||||
1657 | } executed 661 times by 5 tests: end of block Executed by:
| 661 | ||||||||||||||||||
1658 | }; | - | ||||||||||||||||||
1659 | - | |||||||||||||||||||
1660 | Bool Runtime::method_compareEqual(const Value &left, const Value &right) | - | ||||||||||||||||||
1661 | { | - | ||||||||||||||||||
1662 | ; | - | ||||||||||||||||||
1663 | - | |||||||||||||||||||
1664 | Value lhs = left; | - | ||||||||||||||||||
1665 | Value rhs = right; | - | ||||||||||||||||||
1666 | - | |||||||||||||||||||
1667 | - | |||||||||||||||||||
1668 | LazyScope scope; | - | ||||||||||||||||||
1669 | Value *lhsGuard = nullptr; | - | ||||||||||||||||||
1670 | Value *rhsGuard = nullptr; | - | ||||||||||||||||||
1671 | - | |||||||||||||||||||
1672 | - | |||||||||||||||||||
1673 | redo: code before this statement executed 193302 times by 33 tests: redo: Executed by:
| 193302 | ||||||||||||||||||
1674 | if (lhs.asReturnedValue() == rhs.asReturnedValue()
| 2620-191347 | ||||||||||||||||||
1675 | return executed 2620 times by 17 tests: !lhs.isNaN();return !lhs.isNaN(); Executed by:
executed 2620 times by 17 tests: return !lhs.isNaN(); Executed by:
| 2620 | ||||||||||||||||||
1676 | - | |||||||||||||||||||
1677 | int lt = lhs.quickType(); | - | ||||||||||||||||||
1678 | int rt = rhs.quickType(); | - | ||||||||||||||||||
1679 | if (rt < lt
| 1040-190308 | ||||||||||||||||||
1680 | qSwap(lhs, rhs); | - | ||||||||||||||||||
1681 | qSwap(lt, rt); | - | ||||||||||||||||||
1682 | } executed 1040 times by 10 tests: end of block Executed by:
| 1040 | ||||||||||||||||||
1683 | - | |||||||||||||||||||
1684 | switch (lt) { | - | ||||||||||||||||||
1685 | case executed 188032 times by 29 tests: QV4::Value::QT_ManagedOrUndefined:case QV4::Value::QT_ManagedOrUndefined: Executed by:
executed 188032 times by 29 tests: case QV4::Value::QT_ManagedOrUndefined: Executed by:
| 188032 | ||||||||||||||||||
1686 | if (lhs.isUndefined()
| 164-187867 | ||||||||||||||||||
1687 | return executed 164 times by 4 tests: rhs.isNullOrUndefined();return rhs.isNullOrUndefined(); Executed by:
executed 164 times by 4 tests: return rhs.isNullOrUndefined(); Executed by:
| 164 | ||||||||||||||||||
1688 | (void)0; | - | ||||||||||||||||||
1689 | case never executed: case QV4::Value::QT_ManagedOrUndefined1: code before this statement executed 187867 times by 29 tests: case QV4::Value::QT_ManagedOrUndefined1: Executed by:
never executed: QV4::Value::QT_ManagedOrUndefined1:case QV4::Value::QT_ManagedOrUndefined1: code before this statement executed 187867 times by 29 tests: case QV4::Value::QT_ManagedOrUndefined1: Executed by:
never executed: case QV4::Value::QT_ManagedOrUndefined1: | 0-187867 | ||||||||||||||||||
1690 | case never executed: QV4::Value::QT_ManagedOrUndefined2:case QV4::Value::QT_ManagedOrUndefined2: never executed: case QV4::Value::QT_ManagedOrUndefined2: | 0 | ||||||||||||||||||
1691 | case never executed: QV4::Value::QT_ManagedOrUndefined3:case QV4::Value::QT_ManagedOrUndefined3: never executed: case QV4::Value::QT_ManagedOrUndefined3: | 0 | ||||||||||||||||||
1692 | - | |||||||||||||||||||
1693 | switch (rt) { | - | ||||||||||||||||||
1694 | case executed 187127 times by 29 tests: QV4::Value::QT_ManagedOrUndefined:case QV4::Value::QT_ManagedOrUndefined: Executed by:
executed 187127 times by 29 tests: case QV4::Value::QT_ManagedOrUndefined: Executed by:
| 187127 | ||||||||||||||||||
1695 | if (rhs.isUndefined()
| 70-187057 | ||||||||||||||||||
1696 | return executed 70 times by 7 tests: false;return false; Executed by:
executed 70 times by 7 tests: return false; Executed by:
| 70 | ||||||||||||||||||
1697 | (void)0; | - | ||||||||||||||||||
1698 | case never executed: case QV4::Value::QT_ManagedOrUndefined1: code before this statement executed 187058 times by 28 tests: case QV4::Value::QT_ManagedOrUndefined1: Executed by:
never executed: QV4::Value::QT_ManagedOrUndefined1:case QV4::Value::QT_ManagedOrUndefined1: code before this statement executed 187058 times by 28 tests: case QV4::Value::QT_ManagedOrUndefined1: Executed by:
never executed: case QV4::Value::QT_ManagedOrUndefined1: | 0-187058 | ||||||||||||||||||
1699 | case never executed: QV4::Value::QT_ManagedOrUndefined2:case QV4::Value::QT_ManagedOrUndefined2: never executed: case QV4::Value::QT_ManagedOrUndefined2: | 0 | ||||||||||||||||||
1700 | case never executed: QV4::Value::QT_ManagedOrUndefined3:case QV4::Value::QT_ManagedOrUndefined3: never executed: {case QV4::Value::QT_ManagedOrUndefined3: | 0 | ||||||||||||||||||
1701 | - | |||||||||||||||||||
1702 | - | |||||||||||||||||||
1703 | Heap::Base *l = lhs.m(); | - | ||||||||||||||||||
1704 | Heap::Base *r = rhs.m(); | - | ||||||||||||||||||
1705 | ((l) ? static_cast<void>(0) : qt_assert("l", __FILE__, 1905)); | - | ||||||||||||||||||
1706 | ((r) ? static_cast<void>(0) : qt_assert("r", __FILE__, 1906)); | - | ||||||||||||||||||
1707 | if (l->internalClass->vtable->isStringOrSymbol == r->internalClass->vtable->isStringOrSymbol
| 302-186756 | ||||||||||||||||||
1708 | return executed 186756 times by 28 tests: static_cast<QV4::Managed &>(lhs).isEqualTo(&static_cast<QV4::Managed &>(rhs));return static_cast<QV4::Managed &>(lhs).isEqualTo(&static_cast<QV4::Managed &>(rhs)); Executed by:
executed 186756 times by 28 tests: return static_cast<QV4::Managed &>(lhs).isEqualTo(&static_cast<QV4::Managed &>(rhs)); Executed by:
| 186756 | ||||||||||||||||||
1709 | if (l->internalClass->vtable->isStringOrSymbol
| 84-218 | ||||||||||||||||||
1710 | scope.set(&rhsGuard, RuntimeHelpers::objectDefaultValue(&static_cast<QV4::Object &>(rhs), PREFERREDTYPE_HINT), r->internalClass->engine); | - | ||||||||||||||||||
1711 | rhs = rhsGuard->asReturnedValue(); | - | ||||||||||||||||||
1712 | break; executed 84 times by 2 tests: break; Executed by:
| 84 | ||||||||||||||||||
1713 | } else { | - | ||||||||||||||||||
1714 | ((r->internalClass->vtable->isStringOrSymbol) ? static_cast<void>(0) : qt_assert("r->internalClass->vtable->isStringOrSymbol", __FILE__, 1914)); | - | ||||||||||||||||||
1715 | scope.set(&lhsGuard, RuntimeHelpers::objectDefaultValue(&static_cast<QV4::Object &>(lhs), PREFERREDTYPE_HINT), l->internalClass->engine); | - | ||||||||||||||||||
1716 | lhs = lhsGuard->asReturnedValue(); | - | ||||||||||||||||||
1717 | break; executed 217 times by 5 tests: break; Executed by:
| 217 | ||||||||||||||||||
1718 | } | - | ||||||||||||||||||
1719 | - | |||||||||||||||||||
1720 | return dead code: false;return false; dead code: return false; | - | ||||||||||||||||||
1721 | } | - | ||||||||||||||||||
1722 | case never executed: QV4::Value::QT_Empty:case QV4::Value::QT_Empty: never executed: case QV4::Value::QT_Empty: | 0 | ||||||||||||||||||
1723 | do { ((false) ? static_cast<void>(0) : qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached", __FILE__, 1923)); __builtin_unreachable(); } while (false); | - | ||||||||||||||||||
1724 | case executed 40 times by 5 tests: case QV4::Value::QT_Null: Executed by:
code before this statement never executed: case QV4::Value::QT_Null: executed 40 times by 5 tests: QV4::Value::QT_Null:case QV4::Value::QT_Null: Executed by:
code before this statement never executed: case QV4::Value::QT_Null: executed 40 times by 5 tests: case QV4::Value::QT_Null: Executed by:
| 0-40 | ||||||||||||||||||
1725 | return executed 40 times by 5 tests: false;return false; Executed by:
executed 40 times by 5 tests: return false; Executed by:
| 40 | ||||||||||||||||||
1726 | case executed 188 times by 2 tests: QV4::Value::QT_Bool:case QV4::Value::QT_Bool: Executed by:
executed 188 times by 2 tests: case QV4::Value::QT_Bool: Executed by:
| 188 | ||||||||||||||||||
1727 | case executed 279 times by 4 tests: QV4::Value::QT_Int:case QV4::Value::QT_Int: Executed by:
executed 279 times by 4 tests: case QV4::Value::QT_Int: Executed by:
| 279 | ||||||||||||||||||
1728 | rhs = Primitive::fromDouble(rhs.int_32()); | - | ||||||||||||||||||
1729 | - | |||||||||||||||||||
1730 | default executed 701 times by 5 tests: :default: Executed by:
executed 701 times by 5 tests: default: Executed by:
code before this statement executed 467 times by 4 tests: default: Executed by:
| 467-701 | ||||||||||||||||||
1731 | - | |||||||||||||||||||
1732 | if (lhs.m()->internalClass->vtable->isStringOrSymbol
| 340-360 | ||||||||||||||||||
1733 | return executed 340 times by 5 tests: lhs.m()->internalClass->vtable->isString ? (RuntimeHelpers::toNumber(lhs) == rhs.doubleValue()) : false;return lhs.m()->internalClass->vtable->isString ? (RuntimeHelpers::toNumber(lhs) == rhs.doubleValue()) : false; Executed by:
executed 340 times by 5 tests: return lhs.m()->internalClass->vtable->isString ? (RuntimeHelpers::toNumber(lhs) == rhs.doubleValue()) : false; Executed by:
| 340 | ||||||||||||||||||
1734 | } else { | - | ||||||||||||||||||
1735 | scope.set(&lhsGuard, RuntimeHelpers::objectDefaultValue(&static_cast<QV4::Object &>(lhs), PREFERREDTYPE_HINT), lhs.m()->internalClass->engine); | - | ||||||||||||||||||
1736 | lhs = lhsGuard->asReturnedValue(); | - | ||||||||||||||||||
1737 | } executed 361 times by 2 tests: end of block Executed by:
| 361 | ||||||||||||||||||
1738 | - | |||||||||||||||||||
1739 | - | |||||||||||||||||||
1740 | - | |||||||||||||||||||
1741 | } | - | ||||||||||||||||||
1742 | goto executed 662 times by 5 tests: redo;goto redo; Executed by:
executed 662 times by 5 tests: goto redo; Executed by:
| 662 | ||||||||||||||||||
1743 | case never executed: QV4::Value::QT_Empty:case QV4::Value::QT_Empty: never executed: case QV4::Value::QT_Empty: | 0 | ||||||||||||||||||
1744 | do { ((false) ? static_cast<void>(0) : qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached", __FILE__, 1944)); __builtin_unreachable(); } while (false); | - | ||||||||||||||||||
1745 | case executed 44 times by 3 tests: case QV4::Value::QT_Null: Executed by:
code before this statement never executed: case QV4::Value::QT_Null: executed 44 times by 3 tests: QV4::Value::QT_Null:case QV4::Value::QT_Null: Executed by:
code before this statement never executed: case QV4::Value::QT_Null: executed 44 times by 3 tests: case QV4::Value::QT_Null: Executed by:
| 0-44 | ||||||||||||||||||
1746 | return executed 44 times by 3 tests: rhs.isNull();return rhs.isNull(); Executed by:
executed 44 times by 3 tests: return rhs.isNull(); Executed by:
| 44 | ||||||||||||||||||
1747 | case executed 2094 times by 10 tests: QV4::Value::QT_Bool:case QV4::Value::QT_Bool: Executed by:
executed 2094 times by 10 tests: case QV4::Value::QT_Bool: Executed by:
| 2094 | ||||||||||||||||||
1748 | case executed 1090 times by 7 tests: QV4::Value::QT_Int:case QV4::Value::QT_Int: Executed by:
executed 1090 times by 7 tests: case QV4::Value::QT_Int: Executed by:
| 1090 | ||||||||||||||||||
1749 | switch (rt) { | - | ||||||||||||||||||
1750 | case never executed: QV4::Value::QT_ManagedOrUndefined:case QV4::Value::QT_ManagedOrUndefined: never executed: case QV4::Value::QT_ManagedOrUndefined: | 0 | ||||||||||||||||||
1751 | case never executed: QV4::Value::QT_ManagedOrUndefined1:case QV4::Value::QT_ManagedOrUndefined1: never executed: case QV4::Value::QT_ManagedOrUndefined1: | 0 | ||||||||||||||||||
1752 | case never executed: QV4::Value::QT_ManagedOrUndefined2:case QV4::Value::QT_ManagedOrUndefined2: never executed: case QV4::Value::QT_ManagedOrUndefined2: | 0 | ||||||||||||||||||
1753 | case never executed: QV4::Value::QT_ManagedOrUndefined3:case QV4::Value::QT_ManagedOrUndefined3: never executed: case QV4::Value::QT_ManagedOrUndefined3: | 0 | ||||||||||||||||||
1754 | case never executed: QV4::Value::QT_Empty:case QV4::Value::QT_Empty: never executed: case QV4::Value::QT_Empty: | 0 | ||||||||||||||||||
1755 | case never executed: QV4::Value::QT_Null:case QV4::Value::QT_Null: never executed: case QV4::Value::QT_Null: | 0 | ||||||||||||||||||
1756 | do { ((false) ? static_cast<void>(0) : qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached", __FILE__, 1956)); __builtin_unreachable(); } while (false); | - | ||||||||||||||||||
1757 | case executed 1898 times by 10 tests: case QV4::Value::QT_Bool: Executed by:
code before this statement never executed: case QV4::Value::QT_Bool: executed 1898 times by 10 tests: QV4::Value::QT_Bool:case QV4::Value::QT_Bool: Executed by:
code before this statement never executed: case QV4::Value::QT_Bool: executed 1898 times by 10 tests: case QV4::Value::QT_Bool: Executed by:
| 0-1898 | ||||||||||||||||||
1758 | case executed 114 times by 2 tests: QV4::Value::QT_Int:case QV4::Value::QT_Int: Executed by:
executed 114 times by 2 tests: case QV4::Value::QT_Int: Executed by:
| 114 | ||||||||||||||||||
1759 | return executed 2011 times by 10 tests: lhs.int_32() == rhs.int_32();return lhs.int_32() == rhs.int_32(); Executed by:
executed 2011 times by 10 tests: return lhs.int_32() == rhs.int_32(); Executed by:
| 2011 | ||||||||||||||||||
1760 | default executed 1173 times by 7 tests: :default: Executed by:
executed 1173 times by 7 tests: default: Executed by:
| 1173 | ||||||||||||||||||
1761 | return executed 1173 times by 7 tests: lhs.int_32() == rhs.doubleValue();return lhs.int_32() == rhs.doubleValue(); Executed by:
executed 1173 times by 7 tests: return lhs.int_32() == rhs.doubleValue(); Executed by:
| 1173 | ||||||||||||||||||
1762 | } | - | ||||||||||||||||||
1763 | default executed 86 times by 5 tests: :default: Executed by:
executed 86 times by 5 tests: default: Executed by:
| 86 | ||||||||||||||||||
1764 | ((rhs.isDouble()) ? static_cast<void>(0) : qt_assert("rhs.isDouble()", __FILE__, 1964)); | - | ||||||||||||||||||
1765 | return executed 86 times by 5 tests: lhs.doubleValue() == rhs.doubleValue();return lhs.doubleValue() == rhs.doubleValue(); Executed by:
executed 86 times by 5 tests: return lhs.doubleValue() == rhs.doubleValue(); Executed by:
| 86 | ||||||||||||||||||
1766 | } | - | ||||||||||||||||||
1767 | } | - | ||||||||||||||||||
1768 | - | |||||||||||||||||||
1769 | ReturnedValue Runtime::method_equal(const Value &left, const Value &right) | - | ||||||||||||||||||
1770 | { | - | ||||||||||||||||||
1771 | ; | - | ||||||||||||||||||
1772 | - | |||||||||||||||||||
1773 | bool r = method_compareEqual(left, right); | - | ||||||||||||||||||
1774 | return executed 12 times by 2 tests: Encode(r);return Encode(r); Executed by:
executed 12 times by 2 tests: return Encode(r); Executed by:
| 12 | ||||||||||||||||||
1775 | } | - | ||||||||||||||||||
1776 | - | |||||||||||||||||||
1777 | ReturnedValue Runtime::method_notEqual(const Value &left, const Value &right) | - | ||||||||||||||||||
1778 | { | - | ||||||||||||||||||
1779 | ; | - | ||||||||||||||||||
1780 | - | |||||||||||||||||||
1781 | bool r = !method_compareEqual(left, right); | - | ||||||||||||||||||
1782 | return never executed: Encode(r);return Encode(r); never executed: return Encode(r); | 0 | ||||||||||||||||||
1783 | } | - | ||||||||||||||||||
1784 | - | |||||||||||||||||||
1785 | ReturnedValue Runtime::method_strictEqual(const Value &left, const Value &right) | - | ||||||||||||||||||
1786 | { | - | ||||||||||||||||||
1787 | ; | - | ||||||||||||||||||
1788 | - | |||||||||||||||||||
1789 | bool r = RuntimeHelpers::strictEqual(left, right); | - | ||||||||||||||||||
1790 | return executed 132 times by 1 test: Encode(r);return Encode(r); Executed by:
executed 132 times by 1 test: return Encode(r); Executed by:
| 132 | ||||||||||||||||||
1791 | } | - | ||||||||||||||||||
1792 | - | |||||||||||||||||||
1793 | ReturnedValue Runtime::method_strictNotEqual(const Value &left, const Value &right) | - | ||||||||||||||||||
1794 | { | - | ||||||||||||||||||
1795 | ; | - | ||||||||||||||||||
1796 | - | |||||||||||||||||||
1797 | bool r = ! RuntimeHelpers::strictEqual(left, right); | - | ||||||||||||||||||
1798 | return never executed: Encode(r);return Encode(r); never executed: return Encode(r); | 0 | ||||||||||||||||||
1799 | } | - | ||||||||||||||||||
1800 | - | |||||||||||||||||||
1801 | Bool Runtime::method_compareNotEqual(const Value &left, const Value &right) | - | ||||||||||||||||||
1802 | { | - | ||||||||||||||||||
1803 | ; | - | ||||||||||||||||||
1804 | - | |||||||||||||||||||
1805 | return executed 1520 times by 4 tests: !Runtime::method_compareEqual(left, right);return !Runtime::method_compareEqual(left, right); Executed by:
executed 1520 times by 4 tests: return !Runtime::method_compareEqual(left, right); Executed by:
| 1520 | ||||||||||||||||||
1806 | } | - | ||||||||||||||||||
1807 | - | |||||||||||||||||||
1808 | Bool Runtime::method_compareStrictEqual(const Value &left, const Value &right) | - | ||||||||||||||||||
1809 | { | - | ||||||||||||||||||
1810 | ; | - | ||||||||||||||||||
1811 | - | |||||||||||||||||||
1812 | return never executed: RuntimeHelpers::strictEqual(left, right);return RuntimeHelpers::strictEqual(left, right); never executed: return RuntimeHelpers::strictEqual(left, right); | 0 | ||||||||||||||||||
1813 | } | - | ||||||||||||||||||
1814 | - | |||||||||||||||||||
1815 | Bool Runtime::method_compareStrictNotEqual(const Value &left, const Value &right) | - | ||||||||||||||||||
1816 | { | - | ||||||||||||||||||
1817 | ; | - | ||||||||||||||||||
1818 | - | |||||||||||||||||||
1819 | return never executed: ! RuntimeHelpers::strictEqual(left, right);return ! RuntimeHelpers::strictEqual(left, right); never executed: return ! RuntimeHelpers::strictEqual(left, right); | 0 | ||||||||||||||||||
1820 | } | - | ||||||||||||||||||
1821 | - | |||||||||||||||||||
1822 | } | - | ||||||||||||||||||
1823 | - | |||||||||||||||||||
1824 | - | |||||||||||||||||||
Switch to Source code | Preprocessed file |