OpenCoverage

qv4mmdefs_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/memory/qv4mmdefs_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 QV4MMDEFS_P_H-
40#define QV4MMDEFS_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 <private/qv4global_p.h>-
54#include <private/qv4runtimeapi_p.h>-
55#include <QtCore/qalgorithms.h>-
56#include <qdebug.h>-
57-
58QT_BEGIN_NAMESPACE-
59-
60namespace QV4 {-
61-
62struct MarkStack;-
63-
64typedef void(*ClassDestroyStatsCallback)(const char *);-
65-
66/*-
67 * Chunks are the basic structure containing GC managed objects.-
68 *-
69 * Chunks are 64k aligned in memory, so that retrieving the Chunk pointer from a Heap object-
70 * is a simple masking operation. Each Chunk has 4 bitmaps for managing purposes,-
71 * and 32byte wide slots for the objects following afterwards.-
72 *-
73 * The gray and black bitmaps are used for mark/sweep.-
74 * The object bitmap has a bit set if this location represents the start of a Heap object.-
75 * The extends bitmap denotes the extend of an object. It has a cleared bit at the start of the object-
76 * and a set bit for all following slots used by the object.-
77 *-
78 * Free memory has both used and extends bits set to 0.-
79 *-
80 * This gives the following operations when allocating an object of size s:-
81 * Find s/Alignment consecutive free slots in the chunk. Set the object bit for the first-
82 * slot to 1. Set the extends bits for all following slots to 1.-
83 *-
84 * All used slots can be found by object|extents.-
85 *-
86 * When sweeping, simply copy the black bits over to the object bits.-
87 *-
88 */-
89struct HeapItem;-
90struct Chunk {-
91 enum {-
92 ChunkSize = 64*1024,-
93 ChunkShift = 16,-
94 SlotSize = 32,-
95 SlotSizeShift = 5,-
96 NumSlots = ChunkSize/SlotSize,-
97 BitmapSize = NumSlots/8,-
98 HeaderSize = 4*BitmapSize,-
99 DataSize = ChunkSize - HeaderSize,-
100 AvailableSlots = DataSize/SlotSize,-
101#if QT_POINTER_SIZE == 8-
102 Bits = 64,-
103 BitShift = 6,-
104#else-
105 Bits = 32,-
106 BitShift = 5,-
107#endif-
108 EntriesInBitmap = BitmapSize/sizeof(quintptr)-
109 };-
110 quintptr grayBitmap[BitmapSize/sizeof(quintptr)];-
111 quintptr blackBitmap[BitmapSize/sizeof(quintptr)];-
112 quintptr objectBitmap[BitmapSize/sizeof(quintptr)];-
113 quintptr extendsBitmap[BitmapSize/sizeof(quintptr)];-
114 char data[ChunkSize - HeaderSize];-
115-
116 HeapItem *realBase();-
117 HeapItem *first();-
118-
119 static Q_ALWAYS_INLINE size_t bitmapIndex(size_t index) {-
120 return index >> BitShift;
executed 2147483647 times by 154 tests: return index >> BitShift;
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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
Inf
121 }-
122 static Q_ALWAYS_INLINE quintptr bitForIndex(size_t index) {-
123 return static_cast<quintptr>(1) << (index & (Bits - 1));
executed 2147483647 times by 154 tests: return static_cast<quintptr>(1) << (index & (Bits - 1));
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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
Inf
124 }-
125-
126 static void setBit(quintptr *bitmap, size_t index) {-
127// Q_ASSERT(index >= HeaderSize/SlotSize && index < ChunkSize/SlotSize);-
128 bitmap += bitmapIndex(index);-
129 quintptr bit = bitForIndex(index);-
130 *bitmap |= bit;-
131 }
executed 380093966 times by 154 tests: end of block
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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
380093966
132 static void clearBit(quintptr *bitmap, size_t index) {-
133// Q_ASSERT(index >= HeaderSize/SlotSize && index < ChunkSize/SlotSize);-
134 bitmap += bitmapIndex(index);-
135 quintptr bit = bitForIndex(index);-
136 *bitmap &= ~bit;-
137 }
executed 5094499 times by 154 tests: end of block
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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
5094499
138 static bool testBit(quintptr *bitmap, size_t index) {-
139// Q_ASSERT(index >= HeaderSize/SlotSize && index < ChunkSize/SlotSize);-
140 bitmap += bitmapIndex(index);-
141 quintptr bit = bitForIndex(index);-
142 return (*bitmap & bit);
executed 2147483647 times by 154 tests: return (*bitmap & bit);
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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
Inf
143 }-
144 static void setBits(quintptr *bitmap, size_t index, size_t nBits) {-
145// Q_ASSERT(index >= HeaderSize/SlotSize && index + nBits <= ChunkSize/SlotSize);-
146 if (!nBits)
!nBitsDescription
TRUEevaluated 177165990 times by 154 tests
Evaluated 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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
FALSEevaluated 199107247 times by 154 tests
Evaluated 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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
177165990-199107247
147 return;
executed 177673117 times by 154 tests: return;
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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
177673117
148 bitmap += index >> BitShift;-
149 index &= (Bits - 1);-
150 while (1) {-
151 size_t bitsToSet = qMin(nBits, Bits - index);-
152 quintptr mask = static_cast<quintptr>(-1) >> (Bits - bitsToSet) << index;-
153 *bitmap |= mask;-
154 nBits -= bitsToSet;-
155 if (!nBits)
!nBitsDescription
TRUEevaluated 199594535 times by 154 tests
Evaluated 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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
FALSEevaluated 912592 times by 154 tests
Evaluated 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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
912592-199594535
156 return;
executed 199369516 times by 154 tests: return;
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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
199369516
157 index = 0;-
158 ++bitmap;-
159 }
executed 912410 times by 154 tests: end of block
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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
912410
160 }
never executed: end of block
0
161 static bool hasNonZeroBit(quintptr *bitmap) {-
162 for (uint i = 0; i < EntriesInBitmap; ++i)
i < EntriesInBitmapDescription
TRUEnever evaluated
FALSEnever evaluated
0
163 if (bitmap[i])
bitmap[i]Description
TRUEnever evaluated
FALSEnever evaluated
0
164 return true;
never executed: return true;
0
165 return false;
never executed: return false;
0
166 }-
167 static uint lowestNonZeroBit(quintptr *bitmap) {-
168 for (uint i = 0; i < EntriesInBitmap; ++i) {
i < EntriesInBitmapDescription
TRUEnever evaluated
FALSEnever evaluated
0
169 if (bitmap[i]) {
bitmap[i]Description
TRUEnever evaluated
FALSEnever evaluated
0
170 quintptr b = bitmap[i];-
171 return i*Bits + qCountTrailingZeroBits(b);
never executed: return i*Bits + qCountTrailingZeroBits(b);
0
172 }-
173 }
never executed: end of block
0
174 return 0;
never executed: return 0;
0
175 }-
176-
177 uint nFreeSlots() const {-
178 return AvailableSlots - nUsedSlots();
never executed: return AvailableSlots - nUsedSlots();
0
179 }-
180 uint nUsedSlots() const {-
181 uint usedSlots = 0;-
182 for (uint i = 0; i < EntriesInBitmap; ++i) {
i < EntriesInBitmapDescription
TRUEevaluated 3032359 times by 28 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qqmlcomponent
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlnotifier
  • tst_qqmlprofilerservice
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
  • tst_qquickwindow
  • tst_quicktestmainwithsetup
  • ...
FALSEevaluated 94762 times by 28 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qqmlcomponent
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlnotifier
  • tst_qqmlprofilerservice
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
  • tst_qquickwindow
  • tst_quicktestmainwithsetup
  • ...
94762-3032359
183 quintptr used = objectBitmap[i] | extendsBitmap[i];-
184 usedSlots += qPopulationCount(used);-
185 }
executed 3032357 times by 28 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qqmlcomponent
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlnotifier
  • tst_qqmlprofilerservice
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
  • tst_qquickwindow
  • tst_quicktestmainwithsetup
  • ...
3032357
186 return usedSlots;
executed 94762 times by 28 tests: return usedSlots;
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qqmlcomponent
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlnotifier
  • tst_qqmlprofilerservice
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
  • tst_qquickwindow
  • tst_quicktestmainwithsetup
  • ...
94762
187 }-
188-
189 bool sweep(ClassDestroyStatsCallback classCountPtr);-
190 void resetBlackBits();-
191 void collectGrayItems(QV4::MarkStack *markStack);-
192 bool sweep(ExecutionEngine *engine);-
193 void freeAll(ExecutionEngine *engine);-
194-
195 void sortIntoBins(HeapItem **bins, uint nBins);-
196};-
197-
198struct HeapItem {-
199 union {-
200 struct {-
201 HeapItem *next;-
202 size_t availableSlots;-
203 } freeData;-
204 quint64 payload[Chunk::SlotSize/sizeof(quint64)];-
205 };-
206 operator Heap::Base *() { return reinterpret_cast<Heap::Base *>(this); }
executed 751721189 times by 154 tests: return reinterpret_cast<Heap::Base *>(this);
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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
751721189
207-
208 template<typename T>-
209 T *as() { return static_cast<T *>(reinterpret_cast<Heap::Base *>(this)); }
executed 5049475 times by 154 tests: return static_cast<T *>(reinterpret_cast<Heap::Base *>(this));
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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
5049475
210-
211 Chunk *chunk() const {-
212 return reinterpret_cast<Chunk *>(reinterpret_cast<quintptr>(this) >> Chunk::ChunkShift << Chunk::ChunkShift);
executed 2147483647 times by 154 tests: return reinterpret_cast<Chunk *>(reinterpret_cast<quintptr>(this) >> Chunk::ChunkShift << Chunk::ChunkShift);
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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
Inf
213 }-
214-
215 bool isGray() const {-
216 Chunk *c = chunk();-
217 uint index = this - c->realBase();-
218 return Chunk::testBit(c->grayBitmap, index);
never executed: return Chunk::testBit(c->grayBitmap, index);
0
219 }-
220 bool isBlack() const {-
221 Chunk *c = chunk();-
222 uint index = this - c->realBase();-
223 return Chunk::testBit(c->blackBitmap, index);
never executed: return Chunk::testBit(c->blackBitmap, index);
0
224 }-
225 bool isInUse() const {-
226 Chunk *c = chunk();-
227 uint index = this - c->realBase();-
228 return Chunk::testBit(c->objectBitmap, index);
never executed: return Chunk::testBit(c->objectBitmap, index);
0
229 }-
230-
231 void setAllocatedSlots(size_t nSlots) {-
232// Q_ASSERT(size && !(size % sizeof(HeapItem)));-
233 Chunk *c = chunk();-
234 size_t index = this - c->realBase();-
235// Q_ASSERT(!Chunk::testBit(c->objectBitmap, index));-
236 Chunk::setBit(c->objectBitmap, index);-
237 Chunk::setBits(c->extendsBitmap, index + 1, nSlots - 1);-
238// for (uint i = index + 1; i < nBits - 1; ++i)-
239// Q_ASSERT(Chunk::testBit(c->extendsBitmap, i));-
240// Q_ASSERT(!Chunk::testBit(c->extendsBitmap, index));-
241 }
executed 375330220 times by 154 tests: end of block
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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
375330220
242-
243 // Doesn't report correctly for huge items-
244 size_t size() const {-
245 Chunk *c = chunk();-
246 uint index = this - c->realBase();-
247 Q_ASSERT(Chunk::testBit(c->objectBitmap, index));-
248 // ### optimize me-
249 uint end = index + 1;-
250 while (end < Chunk::NumSlots && Chunk::testBit(c->extendsBitmap, end))
end < Chunk::NumSlotsDescription
TRUEnever evaluated
FALSEnever evaluated
Chunk::testBit...dsBitmap, end)Description
TRUEnever evaluated
FALSEnever evaluated
0
251 ++end;
never executed: ++end;
0
252 return (end - index)*sizeof(HeapItem);
never executed: return (end - index)*sizeof(HeapItem);
0
253 }-
254};-
255-
256inline HeapItem *Chunk::realBase()-
257{-
258 return reinterpret_cast<HeapItem *>(this);
executed 2147483647 times by 154 tests: return reinterpret_cast<HeapItem *>(this);
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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
Inf
259}-
260-
261inline HeapItem *Chunk::first()-
262{-
263 return reinterpret_cast<HeapItem *>(data);
executed 499219 times by 154 tests: return reinterpret_cast<HeapItem *>(data);
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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
499219
264}-
265-
266Q_STATIC_ASSERT(sizeof(Chunk) == Chunk::ChunkSize);-
267Q_STATIC_ASSERT((1 << Chunk::ChunkShift) == Chunk::ChunkSize);-
268Q_STATIC_ASSERT(1 << Chunk::SlotSizeShift == Chunk::SlotSize);-
269Q_STATIC_ASSERT(sizeof(HeapItem) == Chunk::SlotSize);-
270Q_STATIC_ASSERT(QT_POINTER_SIZE*8 == Chunk::Bits);-
271Q_STATIC_ASSERT((1 << Chunk::BitShift) == Chunk::Bits);-
272-
273struct MarkStack {-
274 MarkStack(ExecutionEngine *engine);-
275 Heap::Base **top = nullptr;-
276 Heap::Base **base = nullptr;-
277 Heap::Base **limit = nullptr;-
278 ExecutionEngine *engine;-
279 void push(Heap::Base *m) {-
280 *top = m;-
281 ++top;-
282 }
executed 38945208 times by 27 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qqmlcomponent
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlnotifier
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
  • tst_qquickwindow
  • tst_quicktestmainwithsetup
  • tst_qv4mm
  • ...
38945208
283 Heap::Base *pop() {-
284 --top;-
285 return *top;
executed 38952512 times by 27 tests: return *top;
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qqmlcomponent
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlnotifier
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltypeloader
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
  • tst_qquickwindow
  • tst_quicktestmainwithsetup
  • tst_qv4mm
  • ...
38952512
286 }-
287 void drain();-
288-
289};-
290-
291// Some helper to automate the generation of our-
292// functions used for marking objects-
293-
294#define HEAP_OBJECT_OFFSET_MEMBER_EXPANSION(c, gcType, type, name) \-
295 HEAP_OBJECT_OFFSET_MEMBER_EXPANSION_##gcType(c, type, name)-
296-
297#define HEAP_OBJECT_OFFSET_MEMBER_EXPANSION_Pointer(c, type, name) Pointer<type, 0> name;-
298#define HEAP_OBJECT_OFFSET_MEMBER_EXPANSION_NoMark(c, type, name) type name;-
299#define HEAP_OBJECT_OFFSET_MEMBER_EXPANSION_HeapValue(c, type, name) HeapValue<0> name;-
300#define HEAP_OBJECT_OFFSET_MEMBER_EXPANSION_ValueArray(c, type, name) type<0> name;-
301-
302#define HEAP_OBJECT_MEMBER_EXPANSION(c, gcType, type, name) \-
303 HEAP_OBJECT_MEMBER_EXPANSION_##gcType(c, type, name)-
304-
305#define HEAP_OBJECT_MEMBER_EXPANSION_Pointer(c, type, name) \-
306 Pointer<type, offsetof(c##OffsetStruct, name) + baseOffset> name;-
307#define HEAP_OBJECT_MEMBER_EXPANSION_NoMark(c, type, name) \-
308 type name;-
309#define HEAP_OBJECT_MEMBER_EXPANSION_HeapValue(c, type, name) \-
310 HeapValue<offsetof(c##OffsetStruct, name) + baseOffset> name;-
311#define HEAP_OBJECT_MEMBER_EXPANSION_ValueArray(c, type, name) \-
312 type<offsetof(c##OffsetStruct, name) + baseOffset> name;-
313-
314#define HEAP_OBJECT_MARKOBJECTS_EXPANSION(c, gcType, type, name) \-
315 HEAP_OBJECT_MARKOBJECTS_EXPANSION_##gcType(c, type, name)-
316#define HEAP_OBJECT_MARKOBJECTS_EXPANSION_Pointer(c, type, name) \-
317 if (o->name) o->name.heapObject()->mark(stack);-
318#define HEAP_OBJECT_MARKOBJECTS_EXPANSION_NoMark(c, type, name)-
319#define HEAP_OBJECT_MARKOBJECTS_EXPANSION_HeapValue(c, type, name) \-
320 o->name.mark(stack);-
321#define HEAP_OBJECT_MARKOBJECTS_EXPANSION_ValueArray(c, type, name) \-
322 o->name.mark(stack);-
323-
324-
325#define DECLARE_HEAP_OBJECT_BASE(name, base) \-
326 struct name##OffsetStruct { \-
327 name##Members(name, HEAP_OBJECT_OFFSET_MEMBER_EXPANSION) \-
328 }; \-
329 struct name##SizeStruct : base, name##OffsetStruct {}; \-
330 struct name##Data { \-
331 typedef base SuperClass; \-
332 static Q_CONSTEXPR size_t baseOffset = sizeof(name##SizeStruct) - sizeof(name##OffsetStruct); \-
333 name##Members(name, HEAP_OBJECT_MEMBER_EXPANSION) \-
334 }; \-
335 Q_STATIC_ASSERT(sizeof(name##SizeStruct) == sizeof(name##Data) + name##Data::baseOffset); \-
336-
337#define DECLARE_HEAP_OBJECT(name, base) \-
338 DECLARE_HEAP_OBJECT_BASE(name, base) \-
339 struct name : base, name##Data-
340#define DECLARE_EXPORTED_HEAP_OBJECT(name, base) \-
341 DECLARE_HEAP_OBJECT_BASE(name, base) \-
342 struct Q_QML_EXPORT name : base, name##Data-
343-
344#define DECLARE_MARKOBJECTS(class) \-
345 static void markObjects(Heap::Base *b, MarkStack *stack) { \-
346 class *o = static_cast<class *>(b); \-
347 class##Data::SuperClass::markObjects(o, stack); \-
348 class##Members(class, HEAP_OBJECT_MARKOBJECTS_EXPANSION) \-
349 }-
350-
351}-
352-
353QT_END_NAMESPACE-
354-
355#endif-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0