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
qv4runtime_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#ifndef QMLJS_RUNTIME_H
5#define QMLJS_RUNTIME_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qv4global_p.h"
19#include "qv4value_p.h"
21#include <QtCore/qnumeric.h>
22
24
25#undef QV4_COUNT_RUNTIME_FUNCTIONS
26
27namespace QV4 {
28
29#ifdef QV4_COUNT_RUNTIME_FUNCTIONS
31{
32public:
35
37
38 void count(const char *func);
39 void count(const char *func, uint tag);
40 void count(const char *func, uint tag1, uint tag2);
41
42private:
43 struct Data;
44 Data *d;
45};
46
47# define TRACE0() RuntimeCounters::instance->count(Q_FUNC_INFO);
48# define TRACE1(x) RuntimeCounters::instance->count(Q_FUNC_INFO, x.type());
49# define TRACE2(x, y) RuntimeCounters::instance->count(Q_FUNC_INFO, x.type(), y.type());
50#else
51# define TRACE0()
52# define TRACE1(x)
53# define TRACE2(x, y)
54#endif // QV4_COUNT_RUNTIME_FUNCTIONS
55
61
62struct Q_QML_EXPORT RuntimeHelpers {
66
67 static double stringToNumber(const QString &s);
69 static double toNumber(const Value &value);
70 static void numberToString(QString *result, double num, int radix = 10);
71
74
75 static Bool equalHelper(const Value &x, const Value &y);
76 static Bool strictEqual(const Value &x, const Value &y);
77
79};
80
81
82// type conversion and testing
84{
85 if (!value.isObject())
86 return value.asReturnedValue();
87 return RuntimeHelpers::objectDefaultValue(&reinterpret_cast<const Object &>(value), typeHint);
88}
89
90inline double RuntimeHelpers::toNumber(const Value &value)
91{
92 return value.toNumber();
93}
94} // namespace QV4
95
96QT_END_NAMESPACE
97
98#endif // QMLJS_RUNTIME_H
Definition qjsvalue.h:23
@ STRING_HINT
@ PREFERREDTYPE_HINT
@ NUMBER_HINT
Q_STATIC_ASSERT(sizeof(SharedImageHeader) % 4==0)
DEFINE_MANAGED_VTABLE(ArrayData)