OpenCoverage

qv4context_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4context_p.h
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 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#ifndef QMLJS_ENVIRONMENT_H-
40#define QMLJS_ENVIRONMENT_H-
41-
42//-
43// W A R N I N G-
44// --------------
45//-
46// This file is not part of the Qt API. It exists purely as an-
47// implementation detail. This header file may change from version to-
48// version without notice, or even be removed.-
49//-
50// We mean it.-
51//-
52-
53#include "qv4global_p.h"-
54#include "qv4managed_p.h"-
55-
56QT_BEGIN_NAMESPACE-
57-
58namespace QV4 {-
59-
60-
61namespace Heap {-
62-
63#define ExecutionContextMembers(class, Member) \-
64 Member(class, Pointer, ExecutionContext *, outer) \-
65 Member(class, Pointer, Object *, activation)-
66-
67DECLARE_HEAP_OBJECT(ExecutionContext, Base) {-
68 DECLARE_MARKOBJECTS(ExecutionContext);
executed 89894 times by 27 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qqmlcomponent
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlnotifier
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
  • tst_qquickwindow
  • tst_quicktestmainwithsetup
  • tst_qv4mm
  • ...
executed 81038 times by 22 tests: o->outer.heapObject()->mark(stack);
Executed by:
  • tst_examples
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmlnotifier
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpositioners
  • tst_qquickvisualdatamodel
  • tst_qquickwindow
  • tst_quicktestmainwithsetup
  • tst_scenegraph
  • tst_testfiltering
executed 89874 times by 27 tests: o->activation.heapObject()->mark(stack);
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qqmlcomponent
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlnotifier
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
  • tst_qquickwindow
  • tst_quicktestmainwithsetup
  • tst_qv4mm
  • ...
o->outerDescription
TRUEevaluated 81038 times by 22 tests
Evaluated by:
  • tst_examples
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmlnotifier
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpositioners
  • tst_qquickvisualdatamodel
  • tst_qquickwindow
  • tst_quicktestmainwithsetup
  • tst_scenegraph
  • tst_testfiltering
FALSEevaluated 8856 times by 27 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qqmlcomponent
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlnotifier
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
  • tst_qquickwindow
  • tst_quicktestmainwithsetup
  • tst_qv4mm
  • ...
o->activationDescription
TRUEevaluated 89874 times by 27 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qqmlcomponent
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlnotifier
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
  • tst_qquickwindow
  • tst_quicktestmainwithsetup
  • tst_qv4mm
  • ...
FALSEevaluated 20 times by 2 tests
Evaluated by:
  • tst_qqmlxmlhttprequest
  • tst_qquicklayouts
20-89894
69-
70 enum ContextType {-
71 Type_GlobalContext = 0x1,-
72 Type_WithContext = 0x2,-
73 Type_QmlContext = 0x3,-
74 Type_BlockContext = 0x4,-
75 Type_CallContext = 0x5-
76 };-
77-
78 void init(ContextType t)-
79 {-
80 Base::init();-
81-
82 type = t;-
83 }
executed 6062128 times by 154 tests: end of block
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
6062128
84-
85 const VTable *vtable() const {-
86 return internalClass->vtable;
executed 1559567 times by 130 tests: return internalClass->vtable;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • tst_qqmllocale
  • ...
1559567
87 }-
88-
89 quint32 type : 8;-
90 quint32 nArgs : 24;-
91#if QT_POINTER_SIZE == 8-
92 quint8 padding_[4];-
93#endif-
94};-
95Q_STATIC_ASSERT(std::is_trivial< ExecutionContext >::value);-
96Q_STATIC_ASSERT(sizeof(ExecutionContext) == sizeof(Base) + sizeof(ExecutionContextData) + QT_POINTER_SIZE);-
97-
98Q_STATIC_ASSERT(std::is_standard_layout<ExecutionContextData>::value);-
99Q_STATIC_ASSERT(offsetof(ExecutionContextData, outer) == 0);-
100Q_STATIC_ASSERT(offsetof(ExecutionContextData, activation) == offsetof(ExecutionContextData, outer) + QT_POINTER_SIZE);-
101-
102#define CallContextMembers(class, Member) \-
103 Member(class, Pointer, FunctionObject *, function) \-
104 Member(class, ValueArray, ValueArray, locals)-
105-
106DECLARE_HEAP_OBJECT(CallContext, ExecutionContext) {-
107 DECLARE_MARKOBJECTS(CallContext);
executed 20 times by 2 tests: end of block
Executed by:
  • tst_qqmlxmlhttprequest
  • tst_qquicklayouts
executed 4 times by 1 test: o->function.heapObject()->mark(stack);
Executed by:
  • tst_qquicklayouts
o->functionDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicklayouts
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qqmlxmlhttprequest
4-20
108-
109 void init()-
110 {-
111 ExecutionContext::init(Type_CallContext);-
112 }
executed 4410185 times by 29 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qmlcachegen
  • tst_qqmlapplicationengine
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickapplication
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstates
  • ...
4410185
113-
114 int argc() const {-
115 return static_cast<int>(nArgs);
executed 6590 times by 11 tests: return static_cast<int>(nArgs);
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qquicklayouts
  • tst_qquickworkerscript
  • tst_quicktestmainwithsetup
6590
116 }-
117 const Value *args() const {-
118 return locals.data() + locals.size;
executed 1963 times by 4 tests: return locals.data() + locals.size;
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qqmlecmascript
1963
119 }-
120 void setArg(uint index, Value v);-
121};-
122Q_STATIC_ASSERT(std::is_trivial< CallContext >::value);-
123Q_STATIC_ASSERT(std::is_standard_layout<CallContextData>::value);-
124Q_STATIC_ASSERT(offsetof(CallContextData, function) == 0);-
125//### The following size check fails on Win8. With the ValueArray at the end of the-
126// CallContextMembers, it doesn't look very useful.-
127//#if defined(Q_PROCESSOR_ARM_32) && !defined(Q_OS_IOS)-
128//Q_STATIC_ASSERT(sizeof(CallContext) == sizeof(ExecutionContext) + sizeof(CallContextData) + QT_POINTER_SIZE);-
129//#else-
130//Q_STATIC_ASSERT(sizeof(CallContext) == sizeof(ExecutionContext) + sizeof(CallContextData));-
131//#endif-
132-
133-
134}-
135-
136struct Q_QML_EXPORT ExecutionContext : public Managed-
137{-
138 enum {-
139 IsExecutionContext = true-
140 };-
141-
142 V4_MANAGED(ExecutionContext, Managed)
never executed: end of block
never executed: end of block
executed 198971 times by 154 tests: return &static_vtbl;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
executed 146347902 times by 154 tests: return static_cast<QV4::Heap::ExecutionContext *>(m());
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
executed 146379841 times by 154 tests: return dptr;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
0-146379841
143 Q_MANAGED_TYPE(ExecutionContext)-
144 V4_INTERNALCLASS(ExecutionContext)
executed 99511 times by 154 tests: return e->internalClasses(QV4::EngineBase::Class_ExecutionContext);
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
99511
145-
146 static Heap::CallContext *newBlockContext(QV4::CppStackFrame *frame, int blockIndex);-
147 static Heap::CallContext *cloneBlockContext(Heap::CallContext *context);-
148 static Heap::CallContext *newCallContext(QV4::CppStackFrame *frame);-
149 Heap::ExecutionContext *newWithContext(Heap::Object *with);-
150 static Heap::ExecutionContext *newCatchContext(CppStackFrame *frame, int blockIndex, Heap::String *exceptionVarName);-
151-
152 void createMutableBinding(String *name, bool deletable);-
153-
154 enum Error {-
155 NoError,-
156 TypeError,-
157 RangeError-
158 };-
159-
160 Error setProperty(String *name, const Value &value);-
161-
162 ReturnedValue getProperty(String *name);-
163 ReturnedValue getPropertyAndBase(String *name, Value *base);-
164 bool deleteProperty(String *name);-
165-
166 inline CallContext *asCallContext();-
167 inline const CallContext *asCallContext() const;-
168-
169protected:-
170 // vtable method required for compilation-
171 static bool virtualDeleteProperty(Managed *, PropertyKey) {-
172 Q_UNREACHABLE();-
173 }
never executed: end of block
0
174};-
175-
176struct Q_QML_EXPORT CallContext : public ExecutionContext-
177{-
178 V4_MANAGED(CallContext, ExecutionContext)
never executed: end of block
never executed: end of block
executed 4504952 times by 154 tests: return &static_vtbl;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
executed 13557 times by 12 tests: return static_cast<QV4::Heap::CallContext *>(m());
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qquicklayouts
  • tst_qquickworkerscript
  • tst_quicktestmainwithsetup
  • tst_qv4debugger
executed 13562 times by 12 tests: return dptr;
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qquicklayouts
  • tst_qquickworkerscript
  • tst_quicktestmainwithsetup
  • tst_qv4debugger
0-4504952
179 V4_INTERNALCLASS(CallContext)
never executed: return e->internalClasses(QV4::EngineBase::Class_CallContext);
0
180-
181 int argc() const {-
182 return d()->argc();
executed 4496 times by 11 tests: return d()->argc();
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qquicklayouts
  • tst_qquickworkerscript
  • tst_quicktestmainwithsetup
4496
183 }-
184 const Value *args() const {-
185 return d()->args();
never executed: return d()->args();
0
186 }-
187};-
188-
189inline CallContext *ExecutionContext::asCallContext()-
190{-
191 return d()->type == Heap::ExecutionContext::Type_CallContext ? static_cast<CallContext *>(this) : nullptr;
executed 232 times by 1 test: return d()->type == Heap::ExecutionContext::Type_CallContext ? static_cast<CallContext *>(this) : nullptr;
Executed by:
  • tst_qv4debugger
232
192}-
193-
194inline const CallContext *ExecutionContext::asCallContext() const-
195{-
196 return d()->type == Heap::ExecutionContext::Type_CallContext ? static_cast<const CallContext *>(this) : nullptr;
never executed: return d()->type == Heap::ExecutionContext::Type_CallContext ? static_cast<const CallContext *>(this) : nullptr;
0
197}-
198-
199} // namespace QV4-
200-
201QT_END_NAMESPACE-
202-
203#endif-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0