| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jit/qv4jithelpers.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||||||||
| 2 | ** | - | ||||||||||||||||||
| 3 | ** Copyright (C) 2018 The Qt Company Ltd. | - | ||||||||||||||||||
| 4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||
| 6 | ** This file is part of the QtQml module of the Qt Toolkit. | - | ||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||||||||||||||
| 16 | ** | - | ||||||||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||
| 19 | ** General Public License version 3 as published by the Free Software | - | ||||||||||||||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||||||||||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||||||||
| 24 | ** | - | ||||||||||||||||||
| 25 | ** GNU General Public License Usage | - | ||||||||||||||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||||||||
| 35 | ** | - | ||||||||||||||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||
| 37 | ** | - | ||||||||||||||||||
| 38 | ****************************************************************************/ | - | ||||||||||||||||||
| 39 | - | |||||||||||||||||||
| 40 | #include "qv4jithelpers_p.h" | - | ||||||||||||||||||
| 41 | #include "qv4engine_p.h" | - | ||||||||||||||||||
| 42 | #include "qv4function_p.h" | - | ||||||||||||||||||
| 43 | #include "qv4value_p.h" | - | ||||||||||||||||||
| 44 | #include "qv4object_p.h" | - | ||||||||||||||||||
| 45 | #include "qv4lookup_p.h" | - | ||||||||||||||||||
| 46 | #include <QtCore/private/qnumeric_p.h> | - | ||||||||||||||||||
| 47 | - | |||||||||||||||||||
| 48 | #ifdef V4_ENABLE_JIT | - | ||||||||||||||||||
| 49 | - | |||||||||||||||||||
| 50 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||
| 51 | namespace QV4 { | - | ||||||||||||||||||
| 52 | namespace JIT { | - | ||||||||||||||||||
| 53 | namespace Helpers { | - | ||||||||||||||||||
| 54 | - | |||||||||||||||||||
| 55 | void convertThisToObject(ExecutionEngine *engine, Value *t) | - | ||||||||||||||||||
| 56 | { | - | ||||||||||||||||||
| 57 | if (!t->isObject()) {
| 0-14 | ||||||||||||||||||
| 58 | if (t->isNullOrUndefined()) {
| 0 | ||||||||||||||||||
| 59 | *t = engine->globalObject->asReturnedValue(); | - | ||||||||||||||||||
| 60 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 61 | *t = t->toObject(engine)->asReturnedValue(); | - | ||||||||||||||||||
| 62 | } never executed: end of block | 0 | ||||||||||||||||||
| 63 | } | - | ||||||||||||||||||
| 64 | } executed 14 times by 1 test: end of blockExecuted by:
| 14 | ||||||||||||||||||
| 65 | - | |||||||||||||||||||
| 66 | ReturnedValue loadGlobalLookup(ExecutionEngine *engine, Function *f, int index) | - | ||||||||||||||||||
| 67 | { | - | ||||||||||||||||||
| 68 | Lookup *l = f->compilationUnit->runtimeLookups + index; | - | ||||||||||||||||||
| 69 | return l->globalGetter(l, engine); executed 44 times by 3 tests: return l->globalGetter(l, engine);Executed by:
| 44 | ||||||||||||||||||
| 70 | } | - | ||||||||||||||||||
| 71 | - | |||||||||||||||||||
| 72 | ReturnedValue loadSuperConstructor(ExecutionEngine *engine, const Value *t) | - | ||||||||||||||||||
| 73 | { | - | ||||||||||||||||||
| 74 | if (!t->isObject()) {
| 0 | ||||||||||||||||||
| 75 | engine->throwTypeError(); | - | ||||||||||||||||||
| 76 | return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
| 77 | } | - | ||||||||||||||||||
| 78 | return static_cast<const Object *>(t)->getPrototypeOf()->asReturnedValue(); never executed: return static_cast<const Object *>(t)->getPrototypeOf()->asReturnedValue(); | 0 | ||||||||||||||||||
| 79 | } | - | ||||||||||||||||||
| 80 | - | |||||||||||||||||||
| 81 | ReturnedValue toObject(ExecutionEngine *engine, const Value &obj) | - | ||||||||||||||||||
| 82 | { | - | ||||||||||||||||||
| 83 | if (obj.isObject())
| 0 | ||||||||||||||||||
| 84 | return obj.asReturnedValue(); never executed: return obj.asReturnedValue(); | 0 | ||||||||||||||||||
| 85 | - | |||||||||||||||||||
| 86 | return obj.toObject(engine)->asReturnedValue(); never executed: return obj.toObject(engine)->asReturnedValue(); | 0 | ||||||||||||||||||
| 87 | } | - | ||||||||||||||||||
| 88 | - | |||||||||||||||||||
| 89 | ReturnedValue exp(const Value &base, const Value &exp) | - | ||||||||||||||||||
| 90 | { | - | ||||||||||||||||||
| 91 | double b = base.toNumber(); | - | ||||||||||||||||||
| 92 | double e = exp.toNumber(); | - | ||||||||||||||||||
| 93 | if (qt_is_inf(e) && (b == 1 || b == -1))
| 0 | ||||||||||||||||||
| 94 | return Encode(qt_snan()); never executed: return Encode(qt_snan()); | 0 | ||||||||||||||||||
| 95 | return Encode(pow(b,e)); never executed: return Encode(pow(b,e)); | 0 | ||||||||||||||||||
| 96 | } | - | ||||||||||||||||||
| 97 | - | |||||||||||||||||||
| 98 | ReturnedValue getLookup(ExecutionEngine *engine, Function *f, int index, const Value &base) | - | ||||||||||||||||||
| 99 | { | - | ||||||||||||||||||
| 100 | Lookup *l = f->compilationUnit->runtimeLookups + index; | - | ||||||||||||||||||
| 101 | return l->getter(l, engine, base); executed 176 times by 3 tests: return l->getter(l, engine, base);Executed by:
| 176 | ||||||||||||||||||
| 102 | } | - | ||||||||||||||||||
| 103 | - | |||||||||||||||||||
| 104 | void setLookup(Function *f, int index, Value &base, const Value &value) | - | ||||||||||||||||||
| 105 | { | - | ||||||||||||||||||
| 106 | ExecutionEngine *engine = f->internalClass->engine; | - | ||||||||||||||||||
| 107 | QV4::Lookup *l = f->compilationUnit->runtimeLookups + index; | - | ||||||||||||||||||
| 108 | if (!l->setter(l, engine, base, value) && f->isStrict())
| 0 | ||||||||||||||||||
| 109 | engine->throwTypeError(); never executed: engine->throwTypeError(); | 0 | ||||||||||||||||||
| 110 | } never executed: end of block | 0 | ||||||||||||||||||
| 111 | - | |||||||||||||||||||
| 112 | void pushBlockContext(Value *stack, int index) | - | ||||||||||||||||||
| 113 | { | - | ||||||||||||||||||
| 114 | ExecutionContext *c = static_cast<ExecutionContext *>(stack + CallData::Context); | - | ||||||||||||||||||
| 115 | stack[CallData::Context] = Runtime::method_createBlockContext(c, index); | - | ||||||||||||||||||
| 116 | } never executed: end of block | 0 | ||||||||||||||||||
| 117 | - | |||||||||||||||||||
| 118 | void cloneBlockContext(Value *contextSlot) | - | ||||||||||||||||||
| 119 | { | - | ||||||||||||||||||
| 120 | *contextSlot = Runtime::method_cloneBlockContext(static_cast<QV4::ExecutionContext *>(contextSlot)); | - | ||||||||||||||||||
| 121 | } never executed: end of block | 0 | ||||||||||||||||||
| 122 | - | |||||||||||||||||||
| 123 | void pushScriptContext(Value *stack, ExecutionEngine *engine, int index) | - | ||||||||||||||||||
| 124 | { | - | ||||||||||||||||||
| 125 | stack[CallData::Context] = Runtime::method_createScriptContext(engine, index); | - | ||||||||||||||||||
| 126 | } never executed: end of block | 0 | ||||||||||||||||||
| 127 | - | |||||||||||||||||||
| 128 | void popScriptContext(Value *stack, ExecutionEngine *engine) | - | ||||||||||||||||||
| 129 | { | - | ||||||||||||||||||
| 130 | stack[CallData::Context] = Runtime::method_popScriptContext(engine); | - | ||||||||||||||||||
| 131 | } never executed: end of block | 0 | ||||||||||||||||||
| 132 | - | |||||||||||||||||||
| 133 | ReturnedValue deleteProperty(QV4::Function *function, const QV4::Value &base, const QV4::Value &index) | - | ||||||||||||||||||
| 134 | { | - | ||||||||||||||||||
| 135 | auto engine = function->internalClass->engine; | - | ||||||||||||||||||
| 136 | if (!Runtime::method_deleteProperty(engine, base, index)) {
| 0 | ||||||||||||||||||
| 137 | if (function->isStrict())
| 0 | ||||||||||||||||||
| 138 | engine->throwTypeError(); never executed: engine->throwTypeError(); | 0 | ||||||||||||||||||
| 139 | return Encode(false); never executed: return Encode(false); | 0 | ||||||||||||||||||
| 140 | } else { | - | ||||||||||||||||||
| 141 | return Encode(true); never executed: return Encode(true); | 0 | ||||||||||||||||||
| 142 | } | - | ||||||||||||||||||
| 143 | } | - | ||||||||||||||||||
| 144 | - | |||||||||||||||||||
| 145 | ReturnedValue deleteName(Function *function, int name) | - | ||||||||||||||||||
| 146 | { | - | ||||||||||||||||||
| 147 | auto engine = function->internalClass->engine; | - | ||||||||||||||||||
| 148 | if (!Runtime::method_deleteName(engine, name)) {
| 0 | ||||||||||||||||||
| 149 | if (function->isStrict())
| 0 | ||||||||||||||||||
| 150 | engine->throwTypeError(); never executed: engine->throwTypeError(); | 0 | ||||||||||||||||||
| 151 | return Encode(false); never executed: return Encode(false); | 0 | ||||||||||||||||||
| 152 | } else { | - | ||||||||||||||||||
| 153 | return Encode(true); never executed: return Encode(true); | 0 | ||||||||||||||||||
| 154 | } | - | ||||||||||||||||||
| 155 | } | - | ||||||||||||||||||
| 156 | - | |||||||||||||||||||
| 157 | } // Helpers namespace | - | ||||||||||||||||||
| 158 | } // JIT namespace | - | ||||||||||||||||||
| 159 | } // QV4 namespace | - | ||||||||||||||||||
| 160 | QT_END_NAMESPACE | - | ||||||||||||||||||
| 161 | - | |||||||||||||||||||
| 162 | #endif // V4_ENABLE_JIT | - | ||||||||||||||||||
| Source code | Switch to Preprocessed file |