| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsapi/qjsvalue_p.h |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | - | |||||||
| 4 | class QJSValuePrivate | - | ||||||
| 5 | { | - | ||||||
| 6 | public: | - | ||||||
| 7 | static inline QV4::Value *getValue(const QJSValue *jsval) | - | ||||||
| 8 | { | - | ||||||
| 9 | if (jsval->d & 3
| 296-2436 | ||||||
| 10 | return executed 296 times by 4 tests: nullptr;return nullptr;Executed by:
executed 296 times by 4 tests: return nullptr;Executed by:
| 296 | ||||||
| 11 | return executed 2436 times by 18 tests: reinterpret_cast<QV4::Value *>(jsval->d);return reinterpret_cast<QV4::Value *>(jsval->d);Executed by:
executed 2436 times by 18 tests: return reinterpret_cast<QV4::Value *>(jsval->d);Executed by:
| 2436 | ||||||
| 12 | } | - | ||||||
| 13 | - | |||||||
| 14 | static inline QVariant *getVariant(const QJSValue *jsval) | - | ||||||
| 15 | { | - | ||||||
| 16 | if (jsval->d & 1
| 16-194 | ||||||
| 17 | return executed 194 times by 3 tests: reinterpret_cast<QVariant *>(jsval->d & ~3);return reinterpret_cast<QVariant *>(jsval->d & ~3);Executed by:
executed 194 times by 3 tests: return reinterpret_cast<QVariant *>(jsval->d & ~3);Executed by:
| 194 | ||||||
| 18 | return executed 16 times by 1 test: nullptr;return nullptr;Executed by:
executed 16 times by 1 test: return nullptr;Executed by:
| 16 | ||||||
| 19 | } | - | ||||||
| 20 | - | |||||||
| 21 | static inline void setVariant(QJSValue *jsval, const QVariant &v) { | - | ||||||
| 22 | QVariant *val = new QVariant(v); | - | ||||||
| 23 | jsval->d = reinterpret_cast<quintptr>(val) | 1; | - | ||||||
| 24 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||
| 25 | - | |||||||
| 26 | static inline void setValue(QJSValue *jsval, QV4::ExecutionEngine *engine, const QV4::Value &v) { | - | ||||||
| 27 | QV4::Value *value = engine->memoryManager->m_persistentValues->allocate(); | - | ||||||
| 28 | *value = v; | - | ||||||
| 29 | jsval->d = reinterpret_cast<quintptr>(value); | - | ||||||
| 30 | } never executed: end of block | 0 | ||||||
| 31 | - | |||||||
| 32 | static inline void setValue(QJSValue *jsval, QV4::ExecutionEngine *engine, QV4::ReturnedValue v) { | - | ||||||
| 33 | QV4::Value *value = engine->memoryManager->m_persistentValues->allocate(); | - | ||||||
| 34 | *value = v; | - | ||||||
| 35 | jsval->d = reinterpret_cast<quintptr>(value); | - | ||||||
| 36 | } never executed: end of block | 0 | ||||||
| 37 | - | |||||||
| 38 | static QV4::ReturnedValue convertedToValue(QV4::ExecutionEngine *e, const QJSValue &jsval) | - | ||||||
| 39 | { | - | ||||||
| 40 | QV4::Value *v = getValue(&jsval); | - | ||||||
| 41 | if (!v
| 14-700 | ||||||
| 42 | QVariant *variant = getVariant(&jsval); | - | ||||||
| 43 | v = e->memoryManager->m_persistentValues->allocate(); | - | ||||||
| 44 | *v = variant
| 0-14 | ||||||
| 45 | jsval.d = reinterpret_cast<quintptr>(v); | - | ||||||
| 46 | delete variant; | - | ||||||
| 47 | } executed 14 times by 2 tests: end of blockExecuted by:
| 14 | ||||||
| 48 | - | |||||||
| 49 | if (QV4::PersistentValueStorage::getEngine(v) != e
| 14-700 | ||||||
| 50 | QMessageLogger(__FILE__, 111, __PRETTY_FUNCTION__).warning("JSValue can't be reassigned to another engine."); | - | ||||||
| 51 | return executed 14 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined();Executed by:
executed 14 times by 1 test: return QV4::Encode::undefined();Executed by:
| 14 | ||||||
| 52 | } | - | ||||||
| 53 | - | |||||||
| 54 | return executed 700 times by 15 tests: v->asReturnedValue();return v->asReturnedValue();Executed by:
executed 700 times by 15 tests: return v->asReturnedValue();Executed by:
| 700 | ||||||
| 55 | } | - | ||||||
| 56 | - | |||||||
| 57 | static QV4::Value *valueForData(const QJSValue *jsval, QV4::Value *scratch) | - | ||||||
| 58 | { | - | ||||||
| 59 | QV4::Value *v = getValue(jsval); | - | ||||||
| 60 | if (v
| 152-330 | ||||||
| 61 | return executed 330 times by 4 tests: v;return v;Executed by:
executed 330 times by 4 tests: return v;Executed by:
| 330 | ||||||
| 62 | v = scratch; | - | ||||||
| 63 | QVariant *variant = getVariant(jsval); | - | ||||||
| 64 | if (!variant
| 16-136 | ||||||
| 65 | *v = QV4::Encode::undefined(); | - | ||||||
| 66 | return executed 16 times by 1 test: v;return v;Executed by:
executed 16 times by 1 test: return v;Executed by:
| 16 | ||||||
| 67 | } | - | ||||||
| 68 | - | |||||||
| 69 | switch (variant->userType()) { | - | ||||||
| 70 | case never executed: QMetaType::UnknownType:case QMetaType::UnknownType:never executed: case QMetaType::UnknownType: | 0 | ||||||
| 71 | case never executed: QMetaType::Void:case QMetaType::Void:never executed: case QMetaType::Void: | 0 | ||||||
| 72 | *v = QV4::Encode::undefined(); | - | ||||||
| 73 | break; never executed: break; | 0 | ||||||
| 74 | case executed 2 times by 1 test: QMetaType::Nullptr:case QMetaType::Nullptr:Executed by:
executed 2 times by 1 test: case QMetaType::Nullptr:Executed by:
| 2 | ||||||
| 75 | case never executed: QMetaType::VoidStar:case QMetaType::VoidStar:never executed: case QMetaType::VoidStar: | 0 | ||||||
| 76 | *v = QV4::Encode::null(); | - | ||||||
| 77 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||
| 78 | case executed 22 times by 1 test: QMetaType::Bool:case QMetaType::Bool:Executed by:
executed 22 times by 1 test: case QMetaType::Bool:Executed by:
| 22 | ||||||
| 79 | *v = QV4::Encode(variant->toBool()); | - | ||||||
| 80 | break; executed 22 times by 1 test: break;Executed by:
| 22 | ||||||
| 81 | case executed 46 times by 1 test: QMetaType::Double:case QMetaType::Double:Executed by:
executed 46 times by 1 test: case QMetaType::Double:Executed by:
| 46 | ||||||
| 82 | *v = QV4::Encode(variant->toDouble()); | - | ||||||
| 83 | break; executed 46 times by 1 test: break;Executed by:
| 46 | ||||||
| 84 | case executed 22 times by 2 tests: QMetaType::Int:case QMetaType::Int:Executed by:
executed 22 times by 2 tests: case QMetaType::Int:Executed by:
| 22 | ||||||
| 85 | case never executed: QMetaType::Short:case QMetaType::Short:never executed: case QMetaType::Short: | 0 | ||||||
| 86 | case never executed: QMetaType::UShort:case QMetaType::UShort:never executed: case QMetaType::UShort: | 0 | ||||||
| 87 | case never executed: QMetaType::Char:case QMetaType::Char:never executed: case QMetaType::Char: | 0 | ||||||
| 88 | case never executed: QMetaType::UChar:case QMetaType::UChar:never executed: case QMetaType::UChar: | 0 | ||||||
| 89 | *v = QV4::Encode(variant->toInt()); | - | ||||||
| 90 | break; executed 22 times by 2 tests: break;Executed by:
| 22 | ||||||
| 91 | case never executed: QMetaType::UInt:case QMetaType::UInt:never executed: case QMetaType::UInt: | 0 | ||||||
| 92 | *v = QV4::Encode(variant->toUInt()); | - | ||||||
| 93 | break; never executed: break; | 0 | ||||||
| 94 | default executed 44 times by 1 test: :default:Executed by:
executed 44 times by 1 test: default:Executed by:
| 44 | ||||||
| 95 | return executed 44 times by 1 test: nullptr;return nullptr;Executed by:
executed 44 times by 1 test: return nullptr;Executed by:
| 44 | ||||||
| 96 | } | - | ||||||
| 97 | return executed 92 times by 2 tests: v;return v;Executed by:
executed 92 times by 2 tests: return v;Executed by:
| 92 | ||||||
| 98 | } | - | ||||||
| 99 | - | |||||||
| 100 | static QV4::ExecutionEngine *engine(const QJSValue *jsval) { | - | ||||||
| 101 | QV4::Value *v = getValue(jsval); | - | ||||||
| 102 | return executed 678 times by 5 tests: v ? QV4::PersistentValueStorage::getEngine(v) : nullptr;return v ? QV4::PersistentValueStorage::getEngine(v) : nullptr;Executed by:
executed 678 times by 5 tests: return v ? QV4::PersistentValueStorage::getEngine(v) : nullptr;Executed by:
| 678 | ||||||
| 103 | } | - | ||||||
| 104 | - | |||||||
| 105 | static inline bool checkEngine(QV4::ExecutionEngine *e, const QJSValue &jsval) { | - | ||||||
| 106 | QV4::ExecutionEngine *v4 = engine(&jsval); | - | ||||||
| 107 | return never executed: !v4 || v4 == e;return !v4 || v4 == e;never executed: return !v4 || v4 == e; | 0 | ||||||
| 108 | } | - | ||||||
| 109 | - | |||||||
| 110 | static inline void free(QJSValue *jsval) { | - | ||||||
| 111 | if (QV4::Value *v = QJSValuePrivate::getValue(jsval)
| 0 | ||||||
| 112 | QV4::PersistentValueStorage::free(v); never executed: QV4::PersistentValueStorage::free(v); | 0 | ||||||
| 113 | else if (QVariant *v = QJSValuePrivate::getVariant(jsval)
| 0 | ||||||
| 114 | delete v; never executed: delete v; | 0 | ||||||
| 115 | } never executed: end of block | 0 | ||||||
| 116 | }; | - | ||||||
| 117 | - | |||||||
| 118 | - | |||||||
| Switch to Source code | Preprocessed file |