Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4engine_p.h |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
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 QV4ENGINE_H | - | ||||||
40 | #define QV4ENGINE_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 | #include "qv4context_p.h" | - | ||||||
56 | #include <private/qintrusivelist_p.h> | - | ||||||
57 | #include "qv4enginebase_p.h" | - | ||||||
58 | - | |||||||
59 | #ifndef V4_BOOTSTRAP | - | ||||||
60 | # include "qv4function_p.h" | - | ||||||
61 | # include <private/qv8engine_p.h> | - | ||||||
62 | # include <private/qv4compileddata_p.h> | - | ||||||
63 | #endif | - | ||||||
64 | - | |||||||
65 | namespace WTF { | - | ||||||
66 | class BumpPointerAllocator; | - | ||||||
67 | class PageAllocation; | - | ||||||
68 | } | - | ||||||
69 | - | |||||||
70 | QT_BEGIN_NAMESPACE | - | ||||||
71 | - | |||||||
72 | class QV8Engine; | - | ||||||
73 | class QQmlError; | - | ||||||
74 | class QJSEngine; | - | ||||||
75 | class QQmlEngine; | - | ||||||
76 | class QQmlContextData; | - | ||||||
77 | - | |||||||
78 | namespace QV4 { | - | ||||||
79 | namespace Debugging { | - | ||||||
80 | class Debugger; | - | ||||||
81 | } // namespace Debugging | - | ||||||
82 | namespace Profiling { | - | ||||||
83 | class Profiler; | - | ||||||
84 | } // namespace Profiling | - | ||||||
85 | namespace CompiledData { | - | ||||||
86 | struct CompilationUnit; | - | ||||||
87 | } | - | ||||||
88 | - | |||||||
89 | struct Function; | - | ||||||
90 | - | |||||||
91 | - | |||||||
92 | struct Q_QML_EXPORT ExecutionEngine : public EngineBase | - | ||||||
93 | { | - | ||||||
94 | private: | - | ||||||
95 | static qint32 maxCallDepth; | - | ||||||
96 | - | |||||||
97 | friend struct ExecutionContextSaver; | - | ||||||
98 | friend struct ExecutionContext; | - | ||||||
99 | friend struct Heap::ExecutionContext; | - | ||||||
100 | public: | - | ||||||
101 | ExecutableAllocator *executableAllocator; | - | ||||||
102 | ExecutableAllocator *regExpAllocator; | - | ||||||
103 | - | |||||||
104 | WTF::BumpPointerAllocator *bumperPointerAllocator; // Used by Yarr Regex engine. | - | ||||||
105 | - | |||||||
106 | enum { | - | ||||||
107 | JSStackLimit = 4*1024*1024, | - | ||||||
108 | GCStackLimit = 2*1024*1024 | - | ||||||
109 | }; | - | ||||||
110 | WTF::PageAllocation *jsStack; | - | ||||||
111 | - | |||||||
112 | WTF::PageAllocation *gcStack; | - | ||||||
113 | - | |||||||
114 | QML_NEARLY_ALWAYS_INLINE Value *jsAlloca(int nValues) { | - | ||||||
115 | Value *ptr = jsStackTop; | - | ||||||
116 | jsStackTop = ptr + nValues; | - | ||||||
117 | return ptr; executed 1100442100 times by 154 tests: return ptr; Executed by:
| 1100442100 | ||||||
118 | } | - | ||||||
119 | - | |||||||
120 | Function *globalCode; | - | ||||||
121 | - | |||||||
122 | #ifdef V4_BOOTSTRAP | - | ||||||
123 | QJSEngine *jsEngine() const; | - | ||||||
124 | QQmlEngine *qmlEngine() const; | - | ||||||
125 | #else // !V4_BOOTSTRAP | - | ||||||
126 | QJSEngine *jsEngine() const { return publicEngine; } | - | ||||||
127 | QQmlEngine *qmlEngine() const { return v8Engine ? v8Engine->engine() : nullptr; } | - | ||||||
128 | #endif // V4_BOOTSTRAP | - | ||||||
129 | QV8Engine *v8Engine; | - | ||||||
130 | QJSEngine *publicEngine; | - | ||||||
131 | - | |||||||
132 | enum JSObjects { | - | ||||||
133 | RootContext, | - | ||||||
134 | ScriptContext, | - | ||||||
135 | IntegerNull, // Has to come after the RootContext to make the context stack safe | - | ||||||
136 | ObjectProto, | - | ||||||
137 | SymbolProto, | - | ||||||
138 | ArrayProto, | - | ||||||
139 | ArrayProtoValues, | - | ||||||
140 | PropertyListProto, | - | ||||||
141 | StringProto, | - | ||||||
142 | NumberProto, | - | ||||||
143 | BooleanProto, | - | ||||||
144 | DateProto, | - | ||||||
145 | FunctionProto, | - | ||||||
146 | GeneratorProto, | - | ||||||
147 | RegExpProto, | - | ||||||
148 | ErrorProto, | - | ||||||
149 | EvalErrorProto, | - | ||||||
150 | RangeErrorProto, | - | ||||||
151 | ReferenceErrorProto, | - | ||||||
152 | SyntaxErrorProto, | - | ||||||
153 | TypeErrorProto, | - | ||||||
154 | URIErrorProto, | - | ||||||
155 | VariantProto, | - | ||||||
156 | #if QT_CONFIG(qml_sequence_object) | - | ||||||
157 | SequenceProto, | - | ||||||
158 | #endif | - | ||||||
159 | ArrayBufferProto, | - | ||||||
160 | DataViewProto, | - | ||||||
161 | SetProto, | - | ||||||
162 | MapProto, | - | ||||||
163 | IntrinsicTypedArrayProto, | - | ||||||
164 | ValueTypeProto, | - | ||||||
165 | SignalHandlerProto, | - | ||||||
166 | IteratorProto, | - | ||||||
167 | ForInIteratorProto, | - | ||||||
168 | SetIteratorProto, | - | ||||||
169 | MapIteratorProto, | - | ||||||
170 | ArrayIteratorProto, | - | ||||||
171 | StringIteratorProto, | - | ||||||
172 | - | |||||||
173 | Object_Ctor, | - | ||||||
174 | String_Ctor, | - | ||||||
175 | Symbol_Ctor, | - | ||||||
176 | Number_Ctor, | - | ||||||
177 | Boolean_Ctor, | - | ||||||
178 | Array_Ctor, | - | ||||||
179 | Function_Ctor, | - | ||||||
180 | GeneratorFunction_Ctor, | - | ||||||
181 | Date_Ctor, | - | ||||||
182 | RegExp_Ctor, | - | ||||||
183 | Error_Ctor, | - | ||||||
184 | EvalError_Ctor, | - | ||||||
185 | RangeError_Ctor, | - | ||||||
186 | ReferenceError_Ctor, | - | ||||||
187 | SyntaxError_Ctor, | - | ||||||
188 | TypeError_Ctor, | - | ||||||
189 | URIError_Ctor, | - | ||||||
190 | ArrayBuffer_Ctor, | - | ||||||
191 | DataView_Ctor, | - | ||||||
192 | Set_Ctor, | - | ||||||
193 | Map_Ctor, | - | ||||||
194 | IntrinsicTypedArray_Ctor, | - | ||||||
195 | - | |||||||
196 | GetSymbolSpecies, | - | ||||||
197 | - | |||||||
198 | Eval_Function, | - | ||||||
199 | GetStack_Function, | - | ||||||
200 | ThrowerObject, | - | ||||||
201 | NJSObjects | - | ||||||
202 | }; | - | ||||||
203 | Value *jsObjects; | - | ||||||
204 | enum { NTypedArrayTypes = 9 }; // == TypedArray::NValues, avoid header dependency | - | ||||||
205 | - | |||||||
206 | ExecutionContext *rootContext() const { return reinterpret_cast<ExecutionContext *>(jsObjects + RootContext); } executed 39237110 times by 154 tests: return reinterpret_cast<ExecutionContext *>(jsObjects + RootContext); Executed by:
| 39237110 | ||||||
207 | ExecutionContext *scriptContext() const { return reinterpret_cast<ExecutionContext *>(jsObjects + ScriptContext); } executed 993 times by 2 tests: return reinterpret_cast<ExecutionContext *>(jsObjects + ScriptContext); Executed by:
| 993 | ||||||
208 | void setScriptContext(ReturnedValue c) { jsObjects[ScriptContext] = c; } executed 9484 times by 2 tests: end of block Executed by:
| 9484 | ||||||
209 | FunctionObject *objectCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + Object_Ctor); } executed 198101 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + Object_Ctor); Executed by:
| 198101 | ||||||
210 | FunctionObject *stringCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + String_Ctor); } executed 197654 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + String_Ctor); Executed by:
| 197654 | ||||||
211 | FunctionObject *symbolCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + Symbol_Ctor); } executed 197796 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + Symbol_Ctor); Executed by:
| 197796 | ||||||
212 | FunctionObject *numberCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + Number_Ctor); } executed 206728 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + Number_Ctor); Executed by:
| 206728 | ||||||
213 | FunctionObject *booleanCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + Boolean_Ctor); } executed 197972 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + Boolean_Ctor); Executed by:
| 197972 | ||||||
214 | FunctionObject *arrayCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + Array_Ctor); } executed 198089 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + Array_Ctor); Executed by:
| 198089 | ||||||
215 | FunctionObject *functionCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + Function_Ctor); } executed 197906 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + Function_Ctor); Executed by:
| 197906 | ||||||
216 | FunctionObject *generatorFunctionCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + GeneratorFunction_Ctor); } executed 108385 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + GeneratorFunction_Ctor); Executed by:
| 108385 | ||||||
217 | FunctionObject *dateCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + Date_Ctor); } executed 232796 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + Date_Ctor); Executed by:
| 232796 | ||||||
218 | FunctionObject *regExpCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + RegExp_Ctor); } executed 206474 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + RegExp_Ctor); Executed by:
| 206474 | ||||||
219 | FunctionObject *errorCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + Error_Ctor); } executed 197958 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + Error_Ctor); Executed by:
| 197958 | ||||||
220 | FunctionObject *evalErrorCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + EvalError_Ctor); } executed 197535 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + EvalError_Ctor); Executed by:
| 197535 | ||||||
221 | FunctionObject *rangeErrorCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + RangeError_Ctor); } executed 198199 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + RangeError_Ctor); Executed by:
| 198199 | ||||||
222 | FunctionObject *referenceErrorCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + ReferenceError_Ctor); } executed 198335 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + ReferenceError_Ctor); Executed by:
| 198335 | ||||||
223 | FunctionObject *syntaxErrorCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + SyntaxError_Ctor); } executed 198308 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + SyntaxError_Ctor); Executed by:
| 198308 | ||||||
224 | FunctionObject *typeErrorCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + TypeError_Ctor); } executed 198292 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + TypeError_Ctor); Executed by:
| 198292 | ||||||
225 | FunctionObject *uRIErrorCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + URIError_Ctor); } executed 198237 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + URIError_Ctor); Executed by:
| 198237 | ||||||
226 | FunctionObject *arrayBufferCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + ArrayBuffer_Ctor); } executed 197879 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + ArrayBuffer_Ctor); Executed by:
| 197879 | ||||||
227 | FunctionObject *dataViewCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + DataView_Ctor); } executed 197854 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + DataView_Ctor); Executed by:
| 197854 | ||||||
228 | FunctionObject *setCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + Set_Ctor); } executed 197938 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + Set_Ctor); Executed by:
| 197938 | ||||||
229 | FunctionObject *mapCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + Map_Ctor); } executed 198165 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + Map_Ctor); Executed by:
| 198165 | ||||||
230 | FunctionObject *intrinsicTypedArrayCtor() const { return reinterpret_cast<FunctionObject *>(jsObjects + IntrinsicTypedArray_Ctor); } executed 990316 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + IntrinsicTypedArray_Ctor); Executed by:
| 990316 | ||||||
231 | FunctionObject *typedArrayCtors; | - | ||||||
232 | - | |||||||
233 | FunctionObject *getSymbolSpecies() const { return reinterpret_cast<FunctionObject *>(jsObjects + GetSymbolSpecies); } executed 594526 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + GetSymbolSpecies); Executed by:
| 594526 | ||||||
234 | - | |||||||
235 | Object *objectPrototype() const { return reinterpret_cast<Object *>(jsObjects + ObjectProto); } executed 14770280 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + ObjectProto); Executed by:
| 14770280 | ||||||
236 | Object *symbolPrototype() const { return reinterpret_cast<Object *>(jsObjects + SymbolProto); } executed 296401 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + SymbolProto); Executed by:
| 296401 | ||||||
237 | Object *arrayPrototype() const { return reinterpret_cast<Object *>(jsObjects + ArrayProto); } executed 375908 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + ArrayProto); Executed by:
| 375908 | ||||||
238 | Object *arrayProtoValues() const { return reinterpret_cast<Object *>(jsObjects + ArrayProtoValues); } executed 8331 times by 11 tests: return reinterpret_cast<Object *>(jsObjects + ArrayProtoValues); Executed by:
| 8331 | ||||||
239 | Object *propertyListPrototype() const { return reinterpret_cast<Object *>(jsObjects + PropertyListProto); } executed 114441 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + PropertyListProto); Executed by:
| 114441 | ||||||
240 | Object *stringPrototype() const { return reinterpret_cast<Object *>(jsObjects + StringProto); } executed 453081 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + StringProto); Executed by:
| 453081 | ||||||
241 | Object *numberPrototype() const { return reinterpret_cast<Object *>(jsObjects + NumberProto); } executed 123224 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + NumberProto); Executed by:
| 123224 | ||||||
242 | Object *booleanPrototype() const { return reinterpret_cast<Object *>(jsObjects + BooleanProto); } executed 102100 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + BooleanProto); Executed by:
| 102100 | ||||||
243 | Object *datePrototype() const { return reinterpret_cast<Object *>(jsObjects + DateProto); } executed 211532 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + DateProto); Executed by:
| 211532 | ||||||
244 | Object *functionPrototype() const { return reinterpret_cast<Object *>(jsObjects + FunctionProto); } executed 39823848 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + FunctionProto); Executed by:
| 39823848 | ||||||
245 | Object *generatorPrototype() const { return reinterpret_cast<Object *>(jsObjects + GeneratorProto); } executed 207386 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + GeneratorProto); Executed by:
| 207386 | ||||||
246 | Object *regExpPrototype() const { return reinterpret_cast<Object *>(jsObjects + RegExpProto); } executed 1253123 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + RegExpProto); Executed by:
| 1253123 | ||||||
247 | Object *errorPrototype() const { return reinterpret_cast<Object *>(jsObjects + ErrorProto); } executed 199142 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + ErrorProto); Executed by:
| 199142 | ||||||
248 | Object *evalErrorPrototype() const { return reinterpret_cast<Object *>(jsObjects + EvalErrorProto); } executed 98868 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + EvalErrorProto); Executed by:
| 98868 | ||||||
249 | Object *rangeErrorPrototype() const { return reinterpret_cast<Object *>(jsObjects + RangeErrorProto); } executed 100397 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + RangeErrorProto); Executed by:
| 100397 | ||||||
250 | Object *referenceErrorPrototype() const { return reinterpret_cast<Object *>(jsObjects + ReferenceErrorProto); } executed 106881 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + ReferenceErrorProto); Executed by:
| 106881 | ||||||
251 | Object *syntaxErrorPrototype() const { return reinterpret_cast<Object *>(jsObjects + SyntaxErrorProto); } executed 108998 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + SyntaxErrorProto); Executed by:
| 108998 | ||||||
252 | Object *typeErrorPrototype() const { return reinterpret_cast<Object *>(jsObjects + TypeErrorProto); } executed 130204 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + TypeErrorProto); Executed by:
| 130204 | ||||||
253 | Object *uRIErrorPrototype() const { return reinterpret_cast<Object *>(jsObjects + URIErrorProto); } executed 4313544 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + URIErrorProto); Executed by:
| 4313544 | ||||||
254 | Object *variantPrototype() const { return reinterpret_cast<Object *>(jsObjects + VariantProto); } executed 227178 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + VariantProto); Executed by:
| 227178 | ||||||
255 | #if QT_CONFIG(qml_sequence_object) | - | ||||||
256 | Object *sequencePrototype() const { return reinterpret_cast<Object *>(jsObjects + SequenceProto); } executed 98725 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + SequenceProto); Executed by:
| 98725 | ||||||
257 | #endif | - | ||||||
258 | - | |||||||
259 | Object *arrayBufferPrototype() const { return reinterpret_cast<Object *>(jsObjects + ArrayBufferProto); } executed 120205 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + ArrayBufferProto); Executed by:
| 120205 | ||||||
260 | Object *dataViewPrototype() const { return reinterpret_cast<Object *>(jsObjects + DataViewProto); } executed 100051 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + DataViewProto); Executed by:
| 100051 | ||||||
261 | Object *setPrototype() const { return reinterpret_cast<Object *>(jsObjects + SetProto); } executed 99345 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + SetProto); Executed by:
| 99345 | ||||||
262 | Object *mapPrototype() const { return reinterpret_cast<Object *>(jsObjects + MapProto); } executed 99444 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + MapProto); Executed by:
| 99444 | ||||||
263 | Object *intrinsicTypedArrayPrototype() const { return reinterpret_cast<Object *>(jsObjects + IntrinsicTypedArrayProto); } executed 990592 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + IntrinsicTypedArrayProto); Executed by:
| 990592 | ||||||
264 | Object *typedArrayPrototype; | - | ||||||
265 | - | |||||||
266 | Object *valueTypeWrapperPrototype() const { return reinterpret_cast<Object *>(jsObjects + ValueTypeProto); } executed 737996 times by 44 tests: return reinterpret_cast<Object *>(jsObjects + ValueTypeProto); Executed by:
| 737996 | ||||||
267 | Object *signalHandlerPrototype() const { return reinterpret_cast<Object *>(jsObjects + SignalHandlerProto); } executed 28 times by 1 test: return reinterpret_cast<Object *>(jsObjects + SignalHandlerProto); Executed by:
| 28 | ||||||
268 | Object *iteratorPrototype() const { return reinterpret_cast<Object *>(jsObjects + IteratorProto); } executed 693235 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + IteratorProto); Executed by:
| 693235 | ||||||
269 | Object *forInIteratorPrototype() const { return reinterpret_cast<Object *>(jsObjects + ForInIteratorProto); } executed 108075 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + ForInIteratorProto); Executed by:
| 108075 | ||||||
270 | Object *setIteratorPrototype() const { return reinterpret_cast<Object *>(jsObjects + SetIteratorProto); } executed 99167 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + SetIteratorProto); Executed by:
| 99167 | ||||||
271 | Object *mapIteratorPrototype() const { return reinterpret_cast<Object *>(jsObjects + MapIteratorProto); } executed 99146 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + MapIteratorProto); Executed by:
| 99146 | ||||||
272 | Object *arrayIteratorPrototype() const { return reinterpret_cast<Object *>(jsObjects + ArrayIteratorProto); } executed 110156 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + ArrayIteratorProto); Executed by:
| 110156 | ||||||
273 | Object *stringIteratorPrototype() const { return reinterpret_cast<Object *>(jsObjects + StringIteratorProto); } executed 99174 times by 154 tests: return reinterpret_cast<Object *>(jsObjects + StringIteratorProto); Executed by:
| 99174 | ||||||
274 | - | |||||||
275 | EvalFunction *evalFunction() const { return reinterpret_cast<EvalFunction *>(jsObjects + Eval_Function); } executed 1679067 times by 154 tests: return reinterpret_cast<EvalFunction *>(jsObjects + Eval_Function); Executed by:
| 1679067 | ||||||
276 | FunctionObject *getStackFunction() const { return reinterpret_cast<FunctionObject *>(jsObjects + GetStack_Function); } never executed: return reinterpret_cast<FunctionObject *>(jsObjects + GetStack_Function); | 0 | ||||||
277 | FunctionObject *thrower() const { return reinterpret_cast<FunctionObject *>(jsObjects + ThrowerObject); } executed 206428 times by 154 tests: return reinterpret_cast<FunctionObject *>(jsObjects + ThrowerObject); Executed by:
| 206428 | ||||||
278 | - | |||||||
279 | Property *argumentsAccessors; | - | ||||||
280 | int nArgumentsAccessors; | - | ||||||
281 | - | |||||||
282 | enum JSStrings { | - | ||||||
283 | String_Empty, | - | ||||||
284 | String_undefined, | - | ||||||
285 | String_null, | - | ||||||
286 | String_true, | - | ||||||
287 | String_false, | - | ||||||
288 | String_boolean, | - | ||||||
289 | String_number, | - | ||||||
290 | String_string, | - | ||||||
291 | String_default, | - | ||||||
292 | String_symbol, | - | ||||||
293 | String_object, | - | ||||||
294 | String_function, | - | ||||||
295 | String_length, | - | ||||||
296 | String_prototype, | - | ||||||
297 | String_constructor, | - | ||||||
298 | String_arguments, | - | ||||||
299 | String_caller, | - | ||||||
300 | String_callee, | - | ||||||
301 | String_this, | - | ||||||
302 | String___proto__, | - | ||||||
303 | String_enumerable, | - | ||||||
304 | String_configurable, | - | ||||||
305 | String_writable, | - | ||||||
306 | String_value, | - | ||||||
307 | String_get, | - | ||||||
308 | String_set, | - | ||||||
309 | String_eval, | - | ||||||
310 | String_uintMax, | - | ||||||
311 | String_name, | - | ||||||
312 | String_index, | - | ||||||
313 | String_input, | - | ||||||
314 | String_toString, | - | ||||||
315 | String_destroy, | - | ||||||
316 | String_valueOf, | - | ||||||
317 | String_byteLength, | - | ||||||
318 | String_byteOffset, | - | ||||||
319 | String_buffer, | - | ||||||
320 | String_lastIndex, | - | ||||||
321 | String_next, | - | ||||||
322 | String_done, | - | ||||||
323 | String_return, | - | ||||||
324 | - | |||||||
325 | NJSStrings | - | ||||||
326 | }; | - | ||||||
327 | Value *jsStrings; | - | ||||||
328 | - | |||||||
329 | enum JSSymbols { | - | ||||||
330 | Symbol_hasInstance, | - | ||||||
331 | Symbol_isConcatSpreadable, | - | ||||||
332 | Symbol_iterator, | - | ||||||
333 | Symbol_match, | - | ||||||
334 | Symbol_replace, | - | ||||||
335 | Symbol_search, | - | ||||||
336 | Symbol_species, | - | ||||||
337 | Symbol_split, | - | ||||||
338 | Symbol_toPrimitive, | - | ||||||
339 | Symbol_toStringTag, | - | ||||||
340 | Symbol_unscopables, | - | ||||||
341 | Symbol_revokableProxy, | - | ||||||
342 | NJSSymbols | - | ||||||
343 | }; | - | ||||||
344 | Value *jsSymbols; | - | ||||||
345 | - | |||||||
346 | String *id_empty() const { return reinterpret_cast<String *>(jsStrings + String_Empty); } executed 304666 times by 154 tests: return reinterpret_cast<String *>(jsStrings + String_Empty); Executed by:
| 304666 | ||||||
347 | String *id_undefined() const { return reinterpret_cast<String *>(jsStrings + String_undefined); } executed 3271 times by 5 tests: return reinterpret_cast<String *>(jsStrings + String_undefined); Executed by:
| 3271 | ||||||
348 | String *id_null() const { return reinterpret_cast<String *>(jsStrings + String_null); } executed 152 times by 1 test: return reinterpret_cast<String *>(jsStrings + String_null); Executed by:
| 152 | ||||||
349 | String *id_true() const { return reinterpret_cast<String *>(jsStrings + String_true); } executed 579 times by 3 tests: return reinterpret_cast<String *>(jsStrings + String_true); Executed by:
| 579 | ||||||
350 | String *id_false() const { return reinterpret_cast<String *>(jsStrings + String_false); } executed 652 times by 2 tests: return reinterpret_cast<String *>(jsStrings + String_false); Executed by:
| 652 | ||||||
351 | String *id_boolean() const { return reinterpret_cast<String *>(jsStrings + String_boolean); } executed 148 times by 4 tests: return reinterpret_cast<String *>(jsStrings + String_boolean); Executed by:
| 148 | ||||||
352 | String *id_number() const { return reinterpret_cast<String *>(jsStrings + String_number); } executed 99455 times by 32 tests: return reinterpret_cast<String *>(jsStrings + String_number); Executed by:
| 99455 | ||||||
353 | String *id_string() const { return reinterpret_cast<String *>(jsStrings + String_string); } executed 18425 times by 28 tests: return reinterpret_cast<String *>(jsStrings + String_string); Executed by:
| 18425 | ||||||
354 | String *id_default() const { return reinterpret_cast<String *>(jsStrings + String_default); } executed 23330 times by 30 tests: return reinterpret_cast<String *>(jsStrings + String_default); Executed by:
| 23330 | ||||||
355 | String *id_symbol() const { return reinterpret_cast<String *>(jsStrings + String_symbol); } executed 212 times by 1 test: return reinterpret_cast<String *>(jsStrings + String_symbol); Executed by:
| 212 | ||||||
356 | String *id_object() const { return reinterpret_cast<String *>(jsStrings + String_object); } executed 39442 times by 8 tests: return reinterpret_cast<String *>(jsStrings + String_object); Executed by:
| 39442 | ||||||
357 | String *id_function() const { return reinterpret_cast<String *>(jsStrings + String_function); } executed 37162 times by 5 tests: return reinterpret_cast<String *>(jsStrings + String_function); Executed by:
| 37162 | ||||||
358 | String *id_length() const { return reinterpret_cast<String *>(jsStrings + String_length); } executed 38960420 times by 154 tests: return reinterpret_cast<String *>(jsStrings + String_length); Executed by:
| 38960420 | ||||||
359 | String *id_prototype() const { return reinterpret_cast<String *>(jsStrings + String_prototype); } executed 5558745 times by 154 tests: return reinterpret_cast<String *>(jsStrings + String_prototype); Executed by:
| 5558745 | ||||||
360 | String *id_constructor() const { return reinterpret_cast<String *>(jsStrings + String_constructor); } executed 3022417 times by 154 tests: return reinterpret_cast<String *>(jsStrings + String_constructor); Executed by:
| 3022417 | ||||||
361 | String *id_arguments() const { return reinterpret_cast<String *>(jsStrings + String_arguments); } executed 99769 times by 154 tests: return reinterpret_cast<String *>(jsStrings + String_arguments); Executed by:
| 99769 | ||||||
362 | String *id_caller() const { return reinterpret_cast<String *>(jsStrings + String_caller); } executed 99249 times by 154 tests: return reinterpret_cast<String *>(jsStrings + String_caller); Executed by:
| 99249 | ||||||
363 | String *id_callee() const { return reinterpret_cast<String *>(jsStrings + String_callee); } executed 206675 times by 154 tests: return reinterpret_cast<String *>(jsStrings + String_callee); Executed by:
| 206675 | ||||||
364 | String *id_this() const { return reinterpret_cast<String *>(jsStrings + String_this); } never executed: return reinterpret_cast<String *>(jsStrings + String_this); | 0 | ||||||
365 | String *id___proto__() const { return reinterpret_cast<String *>(jsStrings + String___proto__); } executed 99021 times by 154 tests: return reinterpret_cast<String *>(jsStrings + String___proto__); Executed by:
| 99021 | ||||||
366 | String *id_enumerable() const { return reinterpret_cast<String *>(jsStrings + String_enumerable); } executed 25266 times by 3 tests: return reinterpret_cast<String *>(jsStrings + String_enumerable); Executed by:
| 25266 | ||||||
367 | String *id_configurable() const { return reinterpret_cast<String *>(jsStrings + String_configurable); } executed 30099 times by 3 tests: return reinterpret_cast<String *>(jsStrings + String_configurable); Executed by:
| 30099 | ||||||
368 | String *id_writable() const { return reinterpret_cast<String *>(jsStrings + String_writable); } executed 23695 times by 3 tests: return reinterpret_cast<String *>(jsStrings + String_writable); Executed by:
| 23695 | ||||||
369 | String *id_value() const { return reinterpret_cast<String *>(jsStrings + String_value); } executed 60165 times by 13 tests: return reinterpret_cast<String *>(jsStrings + String_value); Executed by:
| 60165 | ||||||
370 | String *id_get() const { return reinterpret_cast<String *>(jsStrings + String_get); } executed 30836 times by 3 tests: return reinterpret_cast<String *>(jsStrings + String_get); Executed by:
| 30836 | ||||||
371 | String *id_set() const { return reinterpret_cast<String *>(jsStrings + String_set); } executed 24492 times by 3 tests: return reinterpret_cast<String *>(jsStrings + String_set); Executed by:
| 24492 | ||||||
372 | String *id_eval() const { return reinterpret_cast<String *>(jsStrings + String_eval); } executed 1679041 times by 154 tests: return reinterpret_cast<String *>(jsStrings + String_eval); Executed by:
| 1679041 | ||||||
373 | String *id_uintMax() const { return reinterpret_cast<String *>(jsStrings + String_uintMax); } never executed: return reinterpret_cast<String *>(jsStrings + String_uintMax); | 0 | ||||||
374 | String *id_name() const { return reinterpret_cast<String *>(jsStrings + String_name); } executed 40268329 times by 154 tests: return reinterpret_cast<String *>(jsStrings + String_name); Executed by:
| 40268329 | ||||||
375 | String *id_index() const { return reinterpret_cast<String *>(jsStrings + String_index); } executed 99029 times by 154 tests: return reinterpret_cast<String *>(jsStrings + String_index); Executed by:
| 99029 | ||||||
376 | String *id_input() const { return reinterpret_cast<String *>(jsStrings + String_input); } executed 99182 times by 154 tests: return reinterpret_cast<String *>(jsStrings + String_input); Executed by:
| 99182 | ||||||
377 | String *id_toString() const { return reinterpret_cast<String *>(jsStrings + String_toString); } executed 12261681 times by 154 tests: return reinterpret_cast<String *>(jsStrings + String_toString); Executed by:
| 12261681 | ||||||
378 | String *id_destroy() const { return reinterpret_cast<String *>(jsStrings + String_destroy); } executed 11615806 times by 103 tests: return reinterpret_cast<String *>(jsStrings + String_destroy); Executed by:
| 11615806 | ||||||
379 | String *id_valueOf() const { return reinterpret_cast<String *>(jsStrings + String_valueOf); } executed 447692 times by 154 tests: return reinterpret_cast<String *>(jsStrings + String_valueOf); Executed by:
| 447692 | ||||||
380 | String *id_byteLength() const { return reinterpret_cast<String *>(jsStrings + String_byteLength); } never executed: return reinterpret_cast<String *>(jsStrings + String_byteLength); | 0 | ||||||
381 | String *id_byteOffset() const { return reinterpret_cast<String *>(jsStrings + String_byteOffset); } never executed: return reinterpret_cast<String *>(jsStrings + String_byteOffset); | 0 | ||||||
382 | String *id_buffer() const { return reinterpret_cast<String *>(jsStrings + String_buffer); } never executed: return reinterpret_cast<String *>(jsStrings + String_buffer); | 0 | ||||||
383 | String *id_lastIndex() const { return reinterpret_cast<String *>(jsStrings + String_lastIndex); } executed 109014 times by 154 tests: return reinterpret_cast<String *>(jsStrings + String_lastIndex); Executed by:
| 109014 | ||||||
384 | String *id_next() const { return reinterpret_cast<String *>(jsStrings + String_next); } executed 51209 times by 12 tests: return reinterpret_cast<String *>(jsStrings + String_next); Executed by:
| 51209 | ||||||
385 | String *id_done() const { return reinterpret_cast<String *>(jsStrings + String_done); } executed 50443 times by 12 tests: return reinterpret_cast<String *>(jsStrings + String_done); Executed by:
| 50443 | ||||||
386 | String *id_return() const { return reinterpret_cast<String *>(jsStrings + String_return); } executed 3597 times by 1 test: return reinterpret_cast<String *>(jsStrings + String_return); Executed by:
| 3597 | ||||||
387 | - | |||||||
388 | Symbol *symbol_hasInstance() const { return reinterpret_cast<Symbol *>(jsSymbols + Symbol_hasInstance); } executed 4444815 times by 154 tests: return reinterpret_cast<Symbol *>(jsSymbols + Symbol_hasInstance); Executed by:
| 4444815 | ||||||
389 | Symbol *symbol_isConcatSpreadable() const { return reinterpret_cast<Symbol *>(jsSymbols + Symbol_isConcatSpreadable); } executed 99025 times by 154 tests: return reinterpret_cast<Symbol *>(jsSymbols + Symbol_isConcatSpreadable); Executed by:
| 99025 | ||||||
390 | Symbol *symbol_iterator() const { return reinterpret_cast<Symbol *>(jsSymbols + Symbol_iterator); } executed 814120 times by 154 tests: return reinterpret_cast<Symbol *>(jsSymbols + Symbol_iterator); Executed by:
| 814120 | ||||||
391 | Symbol *symbol_match() const { return reinterpret_cast<Symbol *>(jsSymbols + Symbol_match); } executed 98913 times by 154 tests: return reinterpret_cast<Symbol *>(jsSymbols + Symbol_match); Executed by:
| 98913 | ||||||
392 | Symbol *symbol_replace() const { return reinterpret_cast<Symbol *>(jsSymbols + Symbol_replace); } executed 98978 times by 154 tests: return reinterpret_cast<Symbol *>(jsSymbols + Symbol_replace); Executed by:
| 98978 | ||||||
393 | Symbol *symbol_search() const { return reinterpret_cast<Symbol *>(jsSymbols + Symbol_search); } executed 98859 times by 154 tests: return reinterpret_cast<Symbol *>(jsSymbols + Symbol_search); Executed by:
| 98859 | ||||||
394 | Symbol *symbol_species() const { return reinterpret_cast<Symbol *>(jsSymbols + Symbol_species); } executed 692962 times by 154 tests: return reinterpret_cast<Symbol *>(jsSymbols + Symbol_species); Executed by:
| 692962 | ||||||
395 | Symbol *symbol_split() const { return reinterpret_cast<Symbol *>(jsSymbols + Symbol_split); } executed 98717 times by 154 tests: return reinterpret_cast<Symbol *>(jsSymbols + Symbol_split); Executed by:
| 98717 | ||||||
396 | Symbol *symbol_toPrimitive() const { return reinterpret_cast<Symbol *>(jsSymbols + Symbol_toPrimitive); } executed 250254 times by 154 tests: return reinterpret_cast<Symbol *>(jsSymbols + Symbol_toPrimitive); Executed by:
| 250254 | ||||||
397 | Symbol *symbol_toStringTag() const { return reinterpret_cast<Symbol *>(jsSymbols + Symbol_toStringTag); } executed 1390351 times by 154 tests: return reinterpret_cast<Symbol *>(jsSymbols + Symbol_toStringTag); Executed by:
| 1390351 | ||||||
398 | Symbol *symbol_unscopables() const { return reinterpret_cast<Symbol *>(jsSymbols + Symbol_unscopables); } executed 98830 times by 154 tests: return reinterpret_cast<Symbol *>(jsSymbols + Symbol_unscopables); Executed by:
| 98830 | ||||||
399 | Symbol *symbol_revokableProxy() const { return reinterpret_cast<Symbol *>(jsSymbols + Symbol_revokableProxy); } executed 268 times by 1 test: return reinterpret_cast<Symbol *>(jsSymbols + Symbol_revokableProxy); Executed by:
| 268 | ||||||
400 | - | |||||||
401 | #ifndef V4_BOOTSTRAP | - | ||||||
402 | QIntrusiveList<CompiledData::CompilationUnit, &CompiledData::CompilationUnit::nextCompilationUnit> compilationUnits; | - | ||||||
403 | #endif | - | ||||||
404 | - | |||||||
405 | quint32 m_engineId; | - | ||||||
406 | - | |||||||
407 | RegExpCache *regExpCache; | - | ||||||
408 | - | |||||||
409 | // Scarce resources are "exceptionally high cost" QVariant types where allowing the | - | ||||||
410 | // normal JavaScript GC to clean them up is likely to lead to out-of-memory or other | - | ||||||
411 | // out-of-resource situations. When such a resource is passed into JavaScript we | - | ||||||
412 | // add it to the scarceResources list and it is destroyed when we return from the | - | ||||||
413 | // JavaScript execution that created it. The user can prevent this behavior by | - | ||||||
414 | // calling preserve() on the object which removes it from this scarceResource list. | - | ||||||
415 | class ScarceResourceData { | - | ||||||
416 | public: | - | ||||||
417 | ScarceResourceData(const QVariant &data = QVariant()) : data(data) {} executed 128797 times by 154 tests: end of block Executed by:
| 128797 | ||||||
418 | QVariant data; | - | ||||||
419 | QIntrusiveListNode node; | - | ||||||
420 | }; | - | ||||||
421 | QIntrusiveList<ScarceResourceData, &ScarceResourceData::node> scarceResources; | - | ||||||
422 | - | |||||||
423 | // Normally the JS wrappers for QObjects are stored in the QQmlData/QObjectPrivate, | - | ||||||
424 | // but any time a QObject is wrapped a second time in another engine, we have to do | - | ||||||
425 | // bookkeeping. | - | ||||||
426 | MultiplyWrappedQObjectMap *m_multiplyWrappedQObjects; | - | ||||||
427 | #if defined(V4_ENABLE_JIT) && !defined(V4_BOOTSTRAP) | - | ||||||
428 | const bool m_canAllocateExecutableMemory; | - | ||||||
429 | #endif | - | ||||||
430 | - | |||||||
431 | quintptr protoIdCount = 1; | - | ||||||
432 | - | |||||||
433 | ExecutionEngine(QJSEngine *jsEngine = nullptr); | - | ||||||
434 | ~ExecutionEngine(); | - | ||||||
435 | - | |||||||
436 | #if !QT_CONFIG(qml_debug) | - | ||||||
437 | QV4::Debugging::Debugger *debugger() const { return nullptr; } never executed: return nullptr; | 0 | ||||||
438 | QV4::Profiling::Profiler *profiler() const { return nullptr; } never executed: return nullptr; | 0 | ||||||
439 | - | |||||||
440 | void setDebugger(Debugging::Debugger *) {} | - | ||||||
441 | void setProfiler(Profiling::Profiler *) {} | - | ||||||
442 | #else | - | ||||||
443 | QV4::Debugging::Debugger *debugger() const { return m_debugger.data(); } | - | ||||||
444 | QV4::Profiling::Profiler *profiler() const { return m_profiler.data(); } | - | ||||||
445 | - | |||||||
446 | void setDebugger(Debugging::Debugger *debugger); | - | ||||||
447 | void setProfiler(Profiling::Profiler *profiler); | - | ||||||
448 | #endif // QT_CONFIG(qml_debug) | - | ||||||
449 | - | |||||||
450 | ExecutionContext *currentContext() const; | - | ||||||
451 | - | |||||||
452 | // ensure we always get odd prototype IDs. This helps make marking in QV4::Lookup fast | - | ||||||
453 | quintptr newProtoId() { return (protoIdCount += 2); } executed 252354455 times by 154 tests: return (protoIdCount += 2); Executed by:
| 252354455 | ||||||
454 | - | |||||||
455 | Heap::InternalClass *newInternalClass(const VTable *vtable, Object *prototype); | - | ||||||
456 | - | |||||||
457 | Heap::Object *newObject(); | - | ||||||
458 | Heap::Object *newObject(Heap::InternalClass *internalClass); | - | ||||||
459 | - | |||||||
460 | Heap::String *newString(const QString &s = QString()); | - | ||||||
461 | Heap::String *newIdentifier(const QString &text); | - | ||||||
462 | - | |||||||
463 | Heap::Object *newStringObject(const String *string); | - | ||||||
464 | Heap::Object *newSymbolObject(const Symbol *symbol); | - | ||||||
465 | Heap::Object *newNumberObject(double value); | - | ||||||
466 | Heap::Object *newBooleanObject(bool b); | - | ||||||
467 | - | |||||||
468 | Heap::ArrayObject *newArrayObject(int count = 0); | - | ||||||
469 | Heap::ArrayObject *newArrayObject(const Value *values, int length); | - | ||||||
470 | Heap::ArrayObject *newArrayObject(const QStringList &list); | - | ||||||
471 | Heap::ArrayObject *newArrayObject(Heap::InternalClass *ic); | - | ||||||
472 | - | |||||||
473 | Heap::ArrayBuffer *newArrayBuffer(const QByteArray &array); | - | ||||||
474 | Heap::ArrayBuffer *newArrayBuffer(size_t length); | - | ||||||
475 | - | |||||||
476 | Heap::DateObject *newDateObject(const Value &value); | - | ||||||
477 | Heap::DateObject *newDateObject(const QDateTime &dt); | - | ||||||
478 | Heap::DateObject *newDateObjectFromTime(const QTime &t); | - | ||||||
479 | - | |||||||
480 | Heap::RegExpObject *newRegExpObject(const QString &pattern, int flags); | - | ||||||
481 | Heap::RegExpObject *newRegExpObject(RegExp *re); | - | ||||||
482 | Heap::RegExpObject *newRegExpObject(const QRegExp &re); | - | ||||||
483 | - | |||||||
484 | Heap::Object *newErrorObject(const Value &value); | - | ||||||
485 | Heap::Object *newSyntaxErrorObject(const QString &message, const QString &fileName, int line, int column); | - | ||||||
486 | Heap::Object *newSyntaxErrorObject(const QString &message); | - | ||||||
487 | Heap::Object *newReferenceErrorObject(const QString &message); | - | ||||||
488 | Heap::Object *newReferenceErrorObject(const QString &message, const QString &fileName, int line, int column); | - | ||||||
489 | Heap::Object *newTypeErrorObject(const QString &message); | - | ||||||
490 | Heap::Object *newRangeErrorObject(const QString &message); | - | ||||||
491 | Heap::Object *newURIErrorObject(const Value &message); | - | ||||||
492 | - | |||||||
493 | Heap::Object *newVariantObject(const QVariant &v); | - | ||||||
494 | - | |||||||
495 | Heap::Object *newForInIteratorObject(Object *o); | - | ||||||
496 | Heap::Object *newSetIteratorObject(Object *o); | - | ||||||
497 | Heap::Object *newMapIteratorObject(Object *o); | - | ||||||
498 | Heap::Object *newArrayIteratorObject(Object *o); | - | ||||||
499 | - | |||||||
500 | Heap::QmlContext *qmlContext() const; | - | ||||||
501 | QObject *qmlScopeObject() const; | - | ||||||
502 | QQmlContextData *callingQmlContext() const; | - | ||||||
503 | - | |||||||
504 | - | |||||||
505 | StackTrace stackTrace(int frameLimit = -1) const; | - | ||||||
506 | QUrl resolvedUrl(const QString &file); | - | ||||||
507 | - | |||||||
508 | void requireArgumentsAccessors(int n); | - | ||||||
509 | - | |||||||
510 | void markObjects(MarkStack *markStack); | - | ||||||
511 | - | |||||||
512 | void initRootContext(); | - | ||||||
513 | - | |||||||
514 | Heap::InternalClass *newClass(Heap::InternalClass *other); | - | ||||||
515 | - | |||||||
516 | StackTrace exceptionStackTrace; | - | ||||||
517 | - | |||||||
518 | ReturnedValue throwError(const Value &value); | - | ||||||
519 | ReturnedValue catchException(StackTrace *trace = nullptr); | - | ||||||
520 | - | |||||||
521 | ReturnedValue throwError(const QString &message); | - | ||||||
522 | ReturnedValue throwSyntaxError(const QString &message); | - | ||||||
523 | ReturnedValue throwSyntaxError(const QString &message, const QString &fileName, int lineNumber, int column); | - | ||||||
524 | ReturnedValue throwTypeError(); | - | ||||||
525 | ReturnedValue throwTypeError(const QString &message); | - | ||||||
526 | ReturnedValue throwReferenceError(const Value &value); | - | ||||||
527 | ReturnedValue throwReferenceError(const QString &value, const QString &fileName, int lineNumber, int column); | - | ||||||
528 | ReturnedValue throwRangeError(const Value &value); | - | ||||||
529 | ReturnedValue throwRangeError(const QString &message); | - | ||||||
530 | ReturnedValue throwURIError(const Value &msg); | - | ||||||
531 | ReturnedValue throwUnimplemented(const QString &message); | - | ||||||
532 | - | |||||||
533 | // Use only inside catch(...) -- will re-throw if no JS exception | - | ||||||
534 | QQmlError catchExceptionAsQmlError(); | - | ||||||
535 | - | |||||||
536 | // variant conversions | - | ||||||
537 | QVariant toVariant(const QV4::Value &value, int typeHint, bool createJSValueForObjects = true); | - | ||||||
538 | QV4::ReturnedValue fromVariant(const QVariant &); | - | ||||||
539 | - | |||||||
540 | QVariantMap variantMapFromJS(const QV4::Object *o); | - | ||||||
541 | - | |||||||
542 | bool metaTypeFromJS(const Value *value, int type, void *data); | - | ||||||
543 | QV4::ReturnedValue metaTypeToJS(int type, const void *data); | - | ||||||
544 | - | |||||||
545 | bool checkStackLimits(); | - | ||||||
546 | - | |||||||
547 | bool canJIT(Function *f = nullptr) | - | ||||||
548 | { | - | ||||||
549 | #if defined(V4_ENABLE_JIT) && !defined(V4_BOOTSTRAP) | - | ||||||
550 | if (!m_canAllocateExecutableMemory) | - | ||||||
551 | return false; | - | ||||||
552 | if (f) | - | ||||||
553 | return !f->isGenerator() && f->interpreterCallCount >= jitCallCountThreshold; | - | ||||||
554 | return true; | - | ||||||
555 | #else | - | ||||||
556 | Q_UNUSED(f); | - | ||||||
557 | return false; never executed: return false; | 0 | ||||||
558 | #endif | - | ||||||
559 | } | - | ||||||
560 | - | |||||||
561 | QV4::ReturnedValue global(); | - | ||||||
562 | - | |||||||
563 | double localTZA = 0.0; // local timezone, initialized at startup | - | ||||||
564 | private: | - | ||||||
565 | #if QT_CONFIG(qml_debug) | - | ||||||
566 | QScopedPointer<QV4::Debugging::Debugger> m_debugger; | - | ||||||
567 | QScopedPointer<QV4::Profiling::Profiler> m_profiler; | - | ||||||
568 | #endif | - | ||||||
569 | int jitCallCountThreshold; | - | ||||||
570 | }; | - | ||||||
571 | - | |||||||
572 | // This is a trick to tell the code generators that functions taking a NoThrowContext won't | - | ||||||
573 | // throw exceptions and therefore don't need a check after the call. | - | ||||||
574 | #ifndef V4_BOOTSTRAP | - | ||||||
575 | struct NoThrowEngine : public ExecutionEngine | - | ||||||
576 | { | - | ||||||
577 | }; | - | ||||||
578 | #else | - | ||||||
579 | struct NoThrowEngine; | - | ||||||
580 | #endif | - | ||||||
581 | - | |||||||
582 | - | |||||||
583 | #define CHECK_STACK_LIMITS(v4) if ((v4)->checkStackLimits()) return Encode::undefined(); \ | - | ||||||
584 | ExecutionEngineCallDepthRecorder _executionEngineCallDepthRecorder(v4); | - | ||||||
585 | - | |||||||
586 | struct ExecutionEngineCallDepthRecorder | - | ||||||
587 | { | - | ||||||
588 | ExecutionEngine *ee; | - | ||||||
589 | - | |||||||
590 | ExecutionEngineCallDepthRecorder(ExecutionEngine *e): ee(e) { ++ee->callDepth; } executed 17713721 times by 135 tests: end of block Executed by:
| 17713721 | ||||||
591 | ~ExecutionEngineCallDepthRecorder() { --ee->callDepth; } executed 17702610 times by 135 tests: end of block Executed by:
| 17702610 | ||||||
592 | }; | - | ||||||
593 | - | |||||||
594 | inline bool ExecutionEngine::checkStackLimits() | - | ||||||
595 | { | - | ||||||
596 | if (Q_UNLIKELY((jsStackTop > jsStackLimit) || (callDepth >= maxCallDepth))) {
| 66-17738738 | ||||||
597 | throwRangeError(QStringLiteral("Maximum call stack size exceeded.")); executed 66 times by 2 tests: return qstring_literal_temp; Executed by:
| 66 | ||||||
598 | return true; executed 66 times by 2 tests: return true; Executed by:
| 66 | ||||||
599 | } | - | ||||||
600 | - | |||||||
601 | return false; executed 17727900 times by 135 tests: return false; Executed by:
| 17727900 | ||||||
602 | } | - | ||||||
603 | - | |||||||
604 | } // namespace QV4 | - | ||||||
605 | - | |||||||
606 | QT_END_NAMESPACE | - | ||||||
607 | - | |||||||
608 | #endif // QV4ENGINE_H | - | ||||||
Source code | Switch to Preprocessed file |