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"
20
#
include
"qv4runtimeapi_p.h"
21
#
include
<
QtCore
/
qnumeric
.
h
>
22
23
QT_BEGIN_NAMESPACE
24
25
#
undef
QV4_COUNT_RUNTIME_FUNCTIONS
26
27
namespace
QV4
{
28
29
#
ifdef
QV4_COUNT_RUNTIME_FUNCTIONS
30
class
RuntimeCounters
31
{
32
public
:
33
RuntimeCounters
();
34
~
RuntimeCounters
();
35
36
static
RuntimeCounters
*
instance
;
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
42
private
:
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
56
enum
TypeHint
{
57
PREFERREDTYPE_HINT
,
58
NUMBER_HINT
,
59
STRING_HINT
60
};
61
62
struct
Q_QML_EXPORT
RuntimeHelpers
{
63
static
ReturnedValue
objectDefaultValue
(
const
Object
*
object
,
int
typeHint
);
64
static
ReturnedValue
toPrimitive
(
const
Value
&
value
,
TypeHint
typeHint
);
65
static
ReturnedValue
ordinaryToPrimitive
(
ExecutionEngine
*
engine
,
const
Object
*
object
,
String
*
typeHint
);
66
67
static
double
stringToNumber
(
const
QString
&
s
);
68
static
Heap
::
String
*
stringFromNumber
(
ExecutionEngine
*
engine
,
double
number
);
69
static
double
toNumber
(
const
Value
&
value
);
70
static
void
numberToString
(
QString
*
result
,
double
num
,
int
radix
= 10);
71
72
static
Heap
::
String
*
convertToString
(
ExecutionEngine
*
engine
,
Value
value
,
TypeHint
=
STRING_HINT
);
73
static
Heap
::
Object
*
convertToObject
(
ExecutionEngine
*
engine
,
const
Value
&
value
);
74
75
static
Bool
equalHelper
(
const
Value
&
x
,
const
Value
&
y
);
76
static
Bool
strictEqual
(
const
Value
&
x
,
const
Value
&
y
);
77
78
static
ReturnedValue
addHelper
(
ExecutionEngine
*
engine
,
const
Value
&
left
,
const
Value
&
right
);
79
};
80
81
82
// type conversion and testing
83
inline
ReturnedValue
RuntimeHelpers
::
toPrimitive
(
const
Value
&
value
,
TypeHint
typeHint
)
84
{
85
if
(!
value
.
isObject
())
86
return
value
.
asReturnedValue
();
87
return
RuntimeHelpers
::
objectDefaultValue
(&
reinterpret_cast
<
const
Object
&>(
value
),
typeHint
);
88
}
89
90
inline
double
RuntimeHelpers
::
toNumber
(
const
Value
&
value
)
91
{
92
return
value
.
toNumber
();
93
}
94
}
// namespace QV4
95
96
QT_END_NAMESPACE
97
98
#
endif
// QMLJS_RUNTIME_H
QPlatformGraphicsBufferHelper
\inmodule QtGui
QV4
Definition
qjsvalue.h:23
QV4::TypeHint
TypeHint
Definition
qv4runtime_p.h:56
QV4::STRING_HINT
@ STRING_HINT
Definition
qv4runtime_p.h:59
QV4::PREFERREDTYPE_HINT
@ PREFERREDTYPE_HINT
Definition
qv4runtime_p.h:57
QV4::NUMBER_HINT
@ NUMBER_HINT
Definition
qv4runtime_p.h:58
Q_STATIC_ASSERT
Q_STATIC_ASSERT(sizeof(SharedImageHeader) % 4==0)
DEFINE_MANAGED_VTABLE
DEFINE_MANAGED_VTABLE(ArrayData)
QV4::RuntimeHelpers
Definition
qv4runtime_p.h:62
qtdeclarative
src
qml
jsruntime
qv4runtime_p.h
Generated on
for Qt by
1.14.0