Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qv4bytecodehandler_p.h
Go to the documentation of this file.
1
// Copyright (C) 2018 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
QV4BYTECODEHANDLER_P_H
6
#
define
QV4BYTECODEHANDLER_P_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
<
private
/
qtqmlcompilerglobal_p
.
h
>
20
#
include
<
private
/
qv4instr_moth_p
.
h
>
21
22
QT_BEGIN_NAMESPACE
23
24
namespace
QV4
{
25
namespace
Moth
{
26
27
#
define
BYTECODE_HANDLER_DEFINE_ARGS
(
nargs
,
...
)
28
MOTH_EXPAND_FOR_MSVC
(
BYTECODE_HANDLER_DEFINE_ARGS
##
nargs
(
__VA_ARGS__
)
)
29
30
#
define
BYTECODE_HANDLER_DEFINE_ARGS0
(
)
31
#
define
BYTECODE_HANDLER_DEFINE_ARGS1
(
arg
)
32
int
arg
33
#
define
BYTECODE_HANDLER_DEFINE_ARGS2
(
arg1
,
arg2
)
34
int
arg1
,
35
int
arg2
36
#
define
BYTECODE_HANDLER_DEFINE_ARGS3
(
arg1
,
arg2
,
arg3
)
37
int
arg1
,
38
int
arg2
,
39
int
arg3
40
#
define
BYTECODE_HANDLER_DEFINE_ARGS4
(
arg1
,
arg2
,
arg3
,
arg4
)
41
int
arg1
,
42
int
arg2
,
43
int
arg3
,
44
int
arg4
45
#
define
BYTECODE_HANDLER_DEFINE_ARGS5
(
arg1
,
arg2
,
arg3
,
arg4
,
arg5
)
46
int
arg1
,
47
int
arg2
,
48
int
arg3
,
49
int
arg4
,
50
int
arg5
51
52
#
define
BYTECODE_HANDLER_DEFINE_VIRTUAL_BYTECODE_HANDLER_INSTRUCTION
(
name
,
nargs
,
...
)
53
virtual
void
generate_
##
name
(
54
BYTECODE_HANDLER_DEFINE_ARGS
(
nargs
,
__VA_ARGS__
)
55
)
=
0
;
56
57
#
define
BYTECODE_HANDLER_DEFINE_VIRTUAL_BYTECODE_HANDLER
(
instr
)
58
INSTR_
##
instr
(
BYTECODE_HANDLER_DEFINE_VIRTUAL_BYTECODE_HANDLER
)
59
60
class
Q_QML_COMPILER_EXPORT
ByteCodeHandler
61
{
62
Q_DISABLE_COPY_MOVE
(
ByteCodeHandler
)
63
public
:
64
ByteCodeHandler
() =
default
;
65
virtual
~
ByteCodeHandler
();
66
67
void
decode
(
const
char
*code, uint len);
68
void
reset
() { _currentOffset = _nextOffset = 0; }
69
70
int
currentInstructionOffset
()
const
{
return
_currentOffset; }
71
int
nextInstructionOffset
()
const
{
return
_nextOffset; }
72
int
absoluteOffset
(
int
relativeOffset)
const
73
{
return
nextInstructionOffset
(
)
+ relativeOffset; }
74
75
protected
:
76
FOR_EACH_MOTH_INSTR
(
BYTECODE_HANDLER_DEFINE_VIRTUAL_BYTECODE_HANDLER
)
77
78
enum
Verdict
{
ProcessInstruction
,
SkipInstruction
};
79
virtual
Verdict
startInstruction
(Moth::Instr::Type instr) = 0;
80
virtual
void
endInstruction
(Moth::Instr::Type instr) = 0;
81
82
private
:
83
int
_currentOffset
= 0;
84
int
_nextOffset = 0;
85
};
86
87
}
// Moth namespace
88
}
// QV4 namespace
89
90
QT_END_NAMESPACE
91
92
#
endif
// QV4BYTECODEHANDLER_P_H
QV4::Moth::ByteCodeHandler
Definition
qv4bytecodehandler_p.h:61
QV4::Moth::ByteCodeHandler::endInstruction
virtual void endInstruction(Moth::Instr::Type instr)=0
QV4::Moth::ByteCodeHandler::reset
void reset()
Definition
qv4bytecodehandler_p.h:68
QV4::Moth::ByteCodeHandler::currentInstructionOffset
int currentInstructionOffset() const
Definition
qv4bytecodehandler_p.h:70
QV4::Moth::ByteCodeHandler::absoluteOffset
int absoluteOffset(int relativeOffset) const
Definition
qv4bytecodehandler_p.h:72
QV4::Moth::ByteCodeHandler::decode
void decode(const char *code, uint len)
Definition
qv4bytecodehandler.cpp:33
QV4::Moth::ByteCodeHandler::startInstruction
virtual Verdict startInstruction(Moth::Instr::Type instr)=0
QV4::Moth::ByteCodeHandler::nextInstructionOffset
int nextInstructionOffset() const
Definition
qv4bytecodehandler_p.h:71
QV4::Moth
Definition
qv4codegen_p.h:38
QV4
Definition
qjsvalue.h:24
BYTECODE_HANDLER_DEFINE_VIRTUAL_BYTECODE_HANDLER
#define BYTECODE_HANDLER_DEFINE_VIRTUAL_BYTECODE_HANDLER(instr)
Definition
qv4bytecodehandler_p.h:57
BYTECODE_HANDLER_DEFINE_ARGS
#define BYTECODE_HANDLER_DEFINE_ARGS(nargs,...)
Definition
qv4bytecodehandler_p.h:27
qtdeclarative
src
qml
compiler
qv4bytecodehandler_p.h
Generated on
for Qt by
1.18.0