Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/compiler/qv4compiler_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 QV4COMPILER_P_H | - |
40 | #define QV4COMPILER_P_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 <QtCore/qstring.h> | - |
54 | #include <QtCore/qhash.h> | - |
55 | #include <QtCore/qstringlist.h> | - |
56 | #include <private/qv4global_p.h> | - |
57 | #include <private/qqmljsastfwd_p.h> | - |
58 | #include <private/qv4compileddata_p.h> | - |
59 | - | |
60 | QT_BEGIN_NAMESPACE | - |
61 | - | |
62 | class QQmlPropertyData; | - |
63 | - | |
64 | namespace QV4 { | - |
65 | - | |
66 | namespace CompiledData { | - |
67 | struct Unit; | - |
68 | struct Lookup; | - |
69 | struct RegExp; | - |
70 | struct JSClassMember; | - |
71 | } | - |
72 | - | |
73 | namespace Compiler { | - |
74 | - | |
75 | struct Class; | - |
76 | - | |
77 | struct Q_QML_PRIVATE_EXPORT StringTableGenerator { | - |
78 | StringTableGenerator(); | - |
79 | - | |
80 | int registerString(const QString &str); | - |
81 | int getStringId(const QString &string) const; | - |
82 | QString stringForIndex(int index) const { return strings.at(index); } executed 905260 times by 143 tests: return strings.at(index); Executed by:
| 905260 |
83 | uint stringCount() const { return strings.size(); } executed 2288967 times by 31 tests: return strings.size(); Executed by:
| 2288967 |
84 | - | |
85 | uint sizeOfTableAndData() const { return stringDataSize + strings.count() * sizeof(uint); } executed 2289500 times by 31 tests: return stringDataSize + strings.count() * sizeof(uint); Executed by:
| 2289500 |
86 | - | |
87 | void clear(); | - |
88 | - | |
89 | void serialize(CompiledData::Unit *unit); | - |
90 | - | |
91 | private: | - |
92 | QHash<QString, int> stringToId; | - |
93 | QStringList strings; | - |
94 | uint stringDataSize; | - |
95 | }; | - |
96 | - | |
97 | struct Q_QML_PRIVATE_EXPORT JSUnitGenerator { | - |
98 | struct MemberInfo { | - |
99 | QString name; | - |
100 | bool isAccessor; | - |
101 | }; | - |
102 | - | |
103 | JSUnitGenerator(Module *module); | - |
104 | - | |
105 | int registerString(const QString &str) { return stringTable.registerString(str); } executed 25636598 times by 147 tests: return stringTable.registerString(str); Executed by:
| 25636598 |
106 | int getStringId(const QString &string) const { return stringTable.getStringId(string); } executed 10212533 times by 147 tests: return stringTable.getStringId(string); Executed by:
| 10212533 |
107 | QString stringForIndex(int index) const { return stringTable.stringForIndex(index); } executed 752926 times by 143 tests: return stringTable.stringForIndex(index); Executed by:
| 752926 |
108 | - | |
109 | int registerGetterLookup(const QString &name); | - |
110 | int registerGetterLookup(int nameIndex); | - |
111 | int registerSetterLookup(const QString &name); | - |
112 | int registerSetterLookup(int nameIndex); | - |
113 | int registerGlobalGetterLookup(const QString &name); | - |
114 | int registerGlobalGetterLookup(int nameIndex); | - |
115 | - | |
116 | int registerRegExp(QQmlJS::AST::RegExpLiteral *regexp); | - |
117 | - | |
118 | int registerConstant(ReturnedValue v); | - |
119 | ReturnedValue constant(int idx); | - |
120 | - | |
121 | int registerJSClass(const QStringList &members); | - |
122 | - | |
123 | enum GeneratorOption { | - |
124 | GenerateWithStringTable, | - |
125 | GenerateWithoutStringTable | - |
126 | }; | - |
127 | - | |
128 | QV4::CompiledData::Unit *generateUnit(GeneratorOption option = GenerateWithStringTable); | - |
129 | void writeFunction(char *f, Context *irFunction) const; | - |
130 | void writeClass(char *f, const Class &c); | - |
131 | void writeBlock(char *f, Context *irBlock) const; | - |
132 | - | |
133 | StringTableGenerator stringTable; | - |
134 | QString codeGeneratorName; | - |
135 | private: | - |
136 | CompiledData::Unit generateHeader(GeneratorOption option, quint32_le *functionOffsets, uint *jsClassDataOffset); | - |
137 | - | |
138 | Module *module; | - |
139 | - | |
140 | QList<CompiledData::Lookup> lookups; | - |
141 | QVector<CompiledData::RegExp> regexps; | - |
142 | QVector<ReturnedValue> constants; | - |
143 | QByteArray jsClassData; | - |
144 | QVector<int> jsClassOffsets; | - |
145 | }; | - |
146 | - | |
147 | } | - |
148 | - | |
149 | } | - |
150 | - | |
151 | QT_END_NAMESPACE | - |
152 | - | |
153 | #endif | - |
Source code | Switch to Preprocessed file |