Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qv4global_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant
4
5#ifndef QV4GLOBAL_H
6#define QV4GLOBAL_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/qglobal.h>
20#include <private/qv4compilerglobal_p.h>
21#include <QString>
22
23#include <qtqmlglobal.h>
24#include <private/qtqmlglobal_p.h>
25
26// Do certain things depending on whether the JIT is enabled or disabled
27
28#if QT_CONFIG(qml_jit)
29#define ENABLE_YARR_JIT 1
30#define ENABLE_JIT 1
31#define ENABLE_ASSEMBLER 1
32#else
33#define ENABLE_YARR_JIT 0
34#define ENABLE_ASSEMBLER 0
35#define ENABLE_JIT 0
36#endif
37
38#if defined(Q_OS_QNX) && defined(_CPPLIB_VER)
39#include <math.h>
40#undef isnan
41#undef isfinite
42#undef isinf
43#undef signbit
44#endif
45
46QT_BEGIN_NAMESPACE
47
48namespace QV4 {
49
50namespace Compiler {
51 struct Module;
52 struct Context;
53 struct JSUnitGenerator;
54 class Codegen;
55}
56
57namespace Moth {
59
60 // Inserts the instructions a debugger needs into the generated code. A debugger provides it.
61 using DebugInstructionPass = void (*)(BytecodeGenerator *generator);
62}
63
64namespace Heap {
65 struct Base;
66 struct MemberData;
67 struct ArrayData;
68
69 struct StringOrSymbol;
70 struct String;
71 struct Symbol;
72 struct Object;
73 struct ObjectPrototype;
74
75 struct ExecutionContext;
76 struct CallContext;
77 struct QmlContext;
78 struct ScriptFunction;
79 struct InternalClass;
80
81 struct BooleanObject;
82 struct NumberObject;
83 struct StringObject;
84 struct ArrayObject;
85 struct DateObject;
86 struct FunctionObject;
87 struct JavaScriptFunctionObject;
88 struct ErrorObject;
89 struct ArgumentsObject;
90 struct QObjectWrapper;
91 struct RegExpObject;
92 struct UrlObject;
93 struct UrlSearchParamsObject;
94 struct RegExp;
95 struct EvalFunction;
96
97 struct SharedArrayBuffer;
98 struct ArrayBuffer;
99 struct DataView;
100 struct TypedArray;
101
102 struct MapObject;
103 struct SetObject;
104
105 struct PromiseObject;
106 struct PromiseCapability;
107
108 template <typename T, size_t> struct Pointer;
109}
110
111struct CppStackFrame;
112struct JSTypesStackFrame;
113struct MetaTypesStackFrame;
114class MemoryManager;
115class ExecutableAllocator;
116struct PropertyKey;
117struct StringOrSymbol;
118struct String;
119struct Symbol;
120struct Object;
121struct ObjectPrototype;
122struct ObjectIterator;
123struct ExecutionContext;
124struct CallContext;
125struct QmlContext;
126struct ScriptFunction;
127struct InternalClass;
128struct Property;
129struct Value;
130template<size_t> struct HeapValue;
131template<size_t> struct ValueArray;
132struct Lookup;
133struct ArrayData;
134struct VTable;
135struct Function;
136
137struct BooleanObject;
138struct NumberObject;
139struct StringObject;
140struct ArrayObject;
141struct DateObject;
142struct FunctionObject;
143struct ErrorObject;
144struct ArgumentsObject;
145struct Managed;
146struct ExecutionEngine;
147struct QObjectWrapper;
148struct RegExpObject;
149struct RegExp;
150struct EvalFunction;
151
152struct SharedArrayBuffer;
153struct ArrayBuffer;
154struct DataView;
155struct TypedArray;
156
157struct MapObject;
158struct SetMapObject;
159
160struct PromiseObject;
161struct PromiseCapability;
162
163struct CallData;
164struct Scope;
165struct ScopedValue;
166template<typename T> struct Scoped;
167typedef Scoped<String> ScopedString;
168typedef Scoped<StringOrSymbol> ScopedStringOrSymbol;
169typedef Scoped<Object> ScopedObject;
170typedef Scoped<ArrayObject> ScopedArrayObject;
171typedef Scoped<FunctionObject> ScopedFunctionObject;
172typedef Scoped<ExecutionContext> ScopedContext;
173
174struct PersistentValueStorage;
175class PersistentValue;
176class WeakValue;
177struct MarkStack;
178
179struct IdentifierTable;
180class RegExpCache;
182
193
196
198{
200 QT_WARNING_DISABLE_MSVC(4201) // nonstandard extension used: nameless struct/union
201 union {
202 uchar m_all;
203 struct {
204 uchar m_flags : 4;
205 uchar m_mask : 4;
206 };
207 struct {
208 uchar m_type : 1;
209 uchar m_writable : 1;
212 uchar type_set : 1;
216 };
217 };
219
220 enum Type {
221 Data = 0,
224 };
225
245
246 void setType(Type t) { m_type = t; type_set = true; }
247 Type type() const { return type_set ? (Type)m_type : Generic; }
248
249 bool isData() const { return type() == PropertyAttributes::Data || writable_set; }
250 bool isAccessor() const { return type() == PropertyAttributes::Accessor; }
251 bool isGeneric() const { return type() == PropertyAttributes::Generic && !writable_set; }
252
253 bool hasType() const { return type_set; }
254 bool hasWritable() const { return writable_set; }
255 bool hasConfigurable() const { return configurable_set; }
256 bool hasEnumerable() const { return enumerable_set; }
257
258 void setWritable(bool b) { m_writable = b; writable_set = true; }
260 void setEnumerable(bool b) { m_enumerable = b; enumerable_set = true; }
261
262 void resolve() { m_mask = 0xf; if (m_type == Accessor) { m_writable = false; writable_set = false; } }
263
264 bool isWritable() const { return m_type != Data || m_writable; }
265 bool isEnumerable() const { return m_enumerable; }
266 bool isConfigurable() const { return m_configurable; }
267
268 void clearType() { m_type = Data; type_set = false; }
269 void clearWritable() { m_writable = false; writable_set = false; }
270 void clearEnumerable() { m_enumerable = false; enumerable_set = false; }
272
273 void clear() { m_all = 0; }
274 bool isEmpty() const { return !m_all; }
275
276 uint all() const { return m_all; }
277
279 return m_all == other.m_all;
280 }
282 return m_all != other.m_all;
283 }
284};
285
286struct Q_QML_EXPORT StackFrame {
289 int line = -1;
290 int column = -1;
291};
293
294namespace JIT {
295
300
301} // JIT namespace
302
303} // QV4 namespace
304
306
307QT_END_NAMESPACE
308
309#endif // QV4GLOBAL_H
Combined button and popup list for selecting options.
DECLARE_HEAP_OBJECT(StrictArgumentsObject, Object)
DECLARE_EXPORTED_HEAP_OBJECT(Object, Base)
Definition qv4object_p.h:37
DECLARE_HEAP_OBJECT(ArgumentsObject, Object)
CallResultDestination
void(*)(BytecodeGenerator *generator) DebugInstructionPass
Definition qv4global_p.h:61
Definition qjsvalue.h:24
Scoped< FunctionObject > ScopedFunctionObject
int qYouForgotTheQ_MANAGED_Macro(T, T)
QList< StackFrame > StackTrace
Scoped< Object > ScopedObject
Scoped< ArrayObject > ScopedArrayObject
Scoped< String > ScopedString
Scoped< StringOrSymbol > ScopedStringOrSymbol
void qYouForgotTheQ_MANAGED_Macro(T1, T2)
PropertyFlag
@ Attr_Invalid
@ Attr_NotConfigurable
@ Attr_Data
@ Attr_NotEnumerable
@ Attr_ReadOnly
@ Attr_NotWritable
@ Attr_ReadOnly_ButConfigurable
@ Attr_Accessor
Scoped< ExecutionContext > ScopedContext
Q_DECLARE_TYPEINFO(QDateTime::Data, Q_RELOCATABLE_TYPE)
DEFINE_OBJECT_VTABLE(StrictArgumentsObject)
DEFINE_OBJECT_VTABLE(ArgumentsObject)
#define V4_MANAGED_SIZE_TEST
#define V4_NEEDS_DESTROY
#define V4_MANAGED_ITSELF(DataClass, superClass)
#define Q_MANAGED_TYPE(type)
#define V4_INTERNALCLASS(c)
#define Q_MANAGED_CHECK
static qint64 virtualGetLength(const Managed *m)
static bool virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *desc, PropertyAttributes attrs)
Heap::CallContext * context() const
static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty)
static OwnPropertyKeyIterator * virtualOwnPropertyKeys(const Object *m, Value *target)
static bool isNonStrictArgumentsObject(Managed *m)
static bool virtualDeleteProperty(Managed *m, PropertyKey id)
static PropertyAttributes virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p)
bool isMapped(uint arg) const
static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver)
static bool virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs)
static qint64 virtualGetLength(const Managed *m)
QStringList toQStringList() const
void init(ExecutionEngine *engine)
bool value() const
void init(const QStringList &list)
void init(double val)
double value() const
PropertyKey next(const Object *o, Property *pd=nullptr, PropertyAttributes *attrs=nullptr) override