OpenCoverage

qv4jithelpers.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jit/qv4jithelpers.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
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-
50QT_BEGIN_NAMESPACE-
51namespace QV4 {-
52namespace JIT {-
53namespace Helpers {-
54-
55void convertThisToObject(ExecutionEngine *engine, Value *t)-
56{-
57 if (!t->isObject()) {
!t->isObject()Description
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qjsengine
0-14
58 if (t->isNullOrUndefined()) {
t->isNullOrUndefined()Description
TRUEnever evaluated
FALSEnever evaluated
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 block
Executed by:
  • tst_qjsengine
14
65-
66ReturnedValue 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:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
44
70}-
71-
72ReturnedValue loadSuperConstructor(ExecutionEngine *engine, const Value *t)-
73{-
74 if (!t->isObject()) {
!t->isObject()Description
TRUEnever evaluated
FALSEnever evaluated
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-
81ReturnedValue toObject(ExecutionEngine *engine, const Value &obj)-
82{-
83 if (obj.isObject())
obj.isObject()Description
TRUEnever evaluated
FALSEnever evaluated
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-
89ReturnedValue 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))
qt_is_inf(e)Description
TRUEnever evaluated
FALSEnever evaluated
b == 1Description
TRUEnever evaluated
FALSEnever evaluated
b == -1Description
TRUEnever evaluated
FALSEnever evaluated
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-
98ReturnedValue 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:
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
176
102}-
103-
104void 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())
!l->setter(l, ..., base, value)Description
TRUEnever evaluated
FALSEnever evaluated
f->isStrict()Description
TRUEnever evaluated
FALSEnever evaluated
0
109 engine->throwTypeError();
never executed: engine->throwTypeError();
0
110}
never executed: end of block
0
111-
112void 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-
118void cloneBlockContext(Value *contextSlot)-
119{-
120 *contextSlot = Runtime::method_cloneBlockContext(static_cast<QV4::ExecutionContext *>(contextSlot));-
121}
never executed: end of block
0
122-
123void 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-
128void popScriptContext(Value *stack, ExecutionEngine *engine)-
129{-
130 stack[CallData::Context] = Runtime::method_popScriptContext(engine);-
131}
never executed: end of block
0
132-
133ReturnedValue 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)) {
!Runtime::meth..., base, index)Description
TRUEnever evaluated
FALSEnever evaluated
0
137 if (function->isStrict())
function->isStrict()Description
TRUEnever evaluated
FALSEnever evaluated
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-
145ReturnedValue deleteName(Function *function, int name)-
146{-
147 auto engine = function->internalClass->engine;-
148 if (!Runtime::method_deleteName(engine, name)) {
!Runtime::meth...(engine, name)Description
TRUEnever evaluated
FALSEnever evaluated
0
149 if (function->isStrict())
function->isStrict()Description
TRUEnever evaluated
FALSEnever evaluated
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-
160QT_END_NAMESPACE-
161-
162#endif // V4_ENABLE_JIT-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0