OpenCoverage

qv4compiler_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/compiler/qv4compiler_p.h
Source codeSwitch to Preprocessed file
LineSourceCount
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-
60QT_BEGIN_NAMESPACE-
61-
62class QQmlPropertyData;-
63-
64namespace QV4 {-
65-
66namespace CompiledData {-
67struct Unit;-
68struct Lookup;-
69struct RegExp;-
70struct JSClassMember;-
71}-
72-
73namespace Compiler {-
74-
75struct Class;-
76-
77struct 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:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • ...
905260
83 uint stringCount() const { return strings.size(); }
executed 2288967 times by 31 tests: return strings.size();
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlxmlhttprequest
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • ...
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:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlxmlhttprequest
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • ...
2289500
86-
87 void clear();-
88-
89 void serialize(CompiledData::Unit *unit);-
90-
91private:-
92 QHash<QString, int> stringToId;-
93 QStringList strings;-
94 uint stringDataSize;-
95};-
96-
97struct 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:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • ...
25636598
106 int getStringId(const QString &string) const { return stringTable.getStringId(string); }
executed 10212533 times by 147 tests: return stringTable.getStringId(string);
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • ...
10212533
107 QString stringForIndex(int index) const { return stringTable.stringForIndex(index); }
executed 752926 times by 143 tests: return stringTable.stringForIndex(index);
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • ...
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;-
135private:-
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-
151QT_END_NAMESPACE-
152-
153#endif-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0