OpenCoverage

BumpPointerAllocator.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/3rdparty/masm/wtf/BumpPointerAllocator.h
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3namespace WTF {-
4-
5-
6-
7class BumpPointerPool {-
8public:-
9 BumpPointerPool* ensureCapacity(size_t size)-
10 {-
11 void* allocationEnd = static_cast<char*>(m_current) + size;-
12 (!(allocationEnd > m_current) ? (qmlWTFReportAssertionFailure(__FILE__, 50, __PRETTY_FUNCTION__, "allocationEnd > m_current"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0);-
13 if (allocationEnd <= static_cast<void*>(this)
allocationEnd ...t<void*>(this)Description
TRUEevaluated 2972 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
)
0-2972
14 return
executed 2972 times by 1 test: return this;
Executed by:
  • tst_ecmascripttests
this;
executed 2972 times by 1 test: return this;
Executed by:
  • tst_ecmascripttests
2972
15 return
never executed: return ensureCapacityCrossPool(this, size);
ensureCapacityCrossPool(this, size);
never executed: return ensureCapacityCrossPool(this, size);
0
16 }-
17-
18-
19-
20 void* alloc(size_t size)-
21 {-
22 void* current = m_current;-
23 void* allocationEnd = static_cast<char*>(current) + size;-
24 (!(allocationEnd > current) ? (qmlWTFReportAssertionFailure(__FILE__, 62, __PRETTY_FUNCTION__, "allocationEnd > current"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0);-
25 (!(allocationEnd <= static_cast<void*>(this)) ? (qmlWTFReportAssertionFailure(__FILE__, 63, __PRETTY_FUNCTION__, "allocationEnd <= static_cast<void*>(this)"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0);-
26 m_current = allocationEnd;-
27 return
executed 2972 times by 1 test: return current;
Executed by:
  • tst_ecmascripttests
current;
executed 2972 times by 1 test: return current;
Executed by:
  • tst_ecmascripttests
2972
28 }-
29 BumpPointerPool* dealloc(void* position)-
30 {-
31 if ((
(position >= m_start)Description
TRUEevaluated 2492 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
position >= m_start)
(position >= m_start)Description
TRUEevaluated 2492 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
&& (
(position <= s...<void*>(this))Description
TRUEevaluated 2492 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
position <= static_cast<void*>(this))
(position <= s...<void*>(this))Description
TRUEevaluated 2492 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
) {
0-2492
32 (!(position <= m_current) ? (qmlWTFReportAssertionFailure(__FILE__, 84, __PRETTY_FUNCTION__, "position <= m_current"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0);-
33 m_current = position;-
34 return
executed 2492 times by 1 test: return this;
Executed by:
  • tst_ecmascripttests
this;
executed 2492 times by 1 test: return this;
Executed by:
  • tst_ecmascripttests
2492
35 }-
36 return
never executed: return deallocCrossPool(this, position);
deallocCrossPool(this, position);
never executed: return deallocCrossPool(this, position);
0
37 }-
38-
39private:-
40-
41 void* operator new(size_t size, const PageAllocation& allocation)-
42 {-
43 (!(size < allocation.size()) ? (qmlWTFReportAssertionFailure(__FILE__, 95, __PRETTY_FUNCTION__, "size < allocation.size()"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0);-
44 return
executed 148 times by 1 test: return reinterpret_cast<char*>(reinterpret_cast<intptr_t>(allocation.base()) + allocation.size()) - size;
Executed by:
  • tst_ecmascripttests
reinterpret_cast<char*>(reinterpret_cast<intptr_t>(allocation.base()) + allocation.size()) - size;
executed 148 times by 1 test: return reinterpret_cast<char*>(reinterpret_cast<intptr_t>(allocation.base()) + allocation.size()) - size;
Executed by:
  • tst_ecmascripttests
148
45 }-
46-
47 BumpPointerPool(const PageAllocation& allocation)-
48 : m_current(allocation.base())-
49 , m_start(allocation.base())-
50 , m_next(0)-
51 , m_previous(0)-
52 , m_allocation(allocation)-
53 {-
54 }
executed 148 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
148
55-
56 static BumpPointerPool* create(size_t minimumCapacity = 0)-
57 {-
58-
59 minimumCapacity += sizeof(BumpPointerPool);-
60 if (minimumCapacity < sizeof(BumpPointerPool)
minimumCapacit...mpPointerPool)Description
TRUEnever evaluated
FALSEevaluated 146 times by 1 test
Evaluated by:
  • tst_ecmascripttests
)
0-146
61 return
never executed: return 0;
0;
never executed: return 0;
0
62-
63 size_t poolSize = std::max(static_cast<size_t>(0x1000), WTF::pageSize());-
64 while (poolSize < minimumCapacity
poolSize < minimumCapacityDescription
TRUEnever evaluated
FALSEevaluated 146 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
0-146
65 poolSize <<= 1;-
66-
67 (!(!(0x1000 & (0x1000 - 1))) ? (qmlWTFReportAssertionFailure(__FILE__, 119, __PRETTY_FUNCTION__, "!(MINIMUM_BUMP_POOL_SIZE & (MINIMUM_BUMP_POOL_SIZE - 1))"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0);-
68 if (!poolSize
!poolSizeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
69 return
never executed: return 0;
0;
never executed: return 0;
0
70 }
never executed: end of block
0
71-
72 PageAllocation allocation = PageAllocation::allocate(poolSize);-
73 if (!!allocation
!!allocationDescription
TRUEevaluated 148 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
)
0-148
74 return
executed 148 times by 1 test: return new (allocation) BumpPointerPool(allocation);
Executed by:
  • tst_ecmascripttests
new (allocation) BumpPointerPool(allocation);
executed 148 times by 1 test: return new (allocation) BumpPointerPool(allocation);
Executed by:
  • tst_ecmascripttests
148
75 return
never executed: return 0;
0;
never executed: return 0;
0
76 }-
77-
78 void shrink()-
79 {-
80 (!(!m_previous) ? (qmlWTFReportAssertionFailure(__FILE__, 132, __PRETTY_FUNCTION__, "!m_previous"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0);-
81 m_current = m_start;-
82 while (m_next
m_nextDescription
TRUEnever evaluated
FALSEevaluated 216 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
0-216
83 BumpPointerPool* nextNext = m_next->m_next;-
84 m_next->destroy();-
85 m_next = nextNext;-
86 }
never executed: end of block
0
87 }
executed 216 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
216
88-
89 void destroy()-
90 {-
91 m_allocation.deallocate();-
92 }
executed 148 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
148
93-
94 static BumpPointerPool* ensureCapacityCrossPool(BumpPointerPool* previousPool, size_t size)-
95 {-
96-
97 (!(previousPool) ? (qmlWTFReportAssertionFailure(__FILE__, 149, __PRETTY_FUNCTION__, "previousPool"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0);-
98 (!((static_cast<char*>(previousPool->m_current) + size) > previousPool->m_current) ? (qmlWTFReportAssertionFailure(__FILE__, 150, __PRETTY_FUNCTION__, "(static_cast<char*>(previousPool->m_current) + size) > previousPool->m_current"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0);-
99 (!((static_cast<char*>(previousPool->m_current) + size) > static_cast<void*>(previousPool)) ? (qmlWTFReportAssertionFailure(__FILE__, 151, __PRETTY_FUNCTION__, "(static_cast<char*>(previousPool->m_current) + size) > static_cast<void*>(previousPool)"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0);-
100 BumpPointerPool* pool = previousPool->m_next;-
101-
102 while (true) {-
103 if (!pool
!poolDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
104-
105 pool = BumpPointerPool::create(size);-
106 previousPool->m_next = pool;-
107 pool->m_previous = previousPool;-
108 return
never executed: return pool;
pool;
never executed: return pool;
0
109 }-
110-
111-
112 void* current = pool->m_current;-
113 void* allocationEnd = static_cast<char*>(current) + size;-
114 (!(allocationEnd > current) ? (qmlWTFReportAssertionFailure(__FILE__, 166, __PRETTY_FUNCTION__, "allocationEnd > current"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0);-
115 if (allocationEnd <= static_cast<void*>(pool)
allocationEnd ...t<void*>(pool)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
116 return
never executed: return pool;
pool;
never executed: return pool;
0
117 }
never executed: end of block
0
118 }
never executed: end of block
0
119-
120 static BumpPointerPool* deallocCrossPool(BumpPointerPool* pool, void* position)-
121 {-
122-
123 (!((position < pool->m_start) || (position > static_cast<void*>(pool))) ? (qmlWTFReportAssertionFailure(__FILE__, 175, __PRETTY_FUNCTION__, "(position < pool->m_start) || (position > static_cast<void*>(pool))"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0);-
124-
125 while (true) {-
126-
127 pool->m_current = pool->m_start;-
128 pool = pool->m_previous;-
129-
130-
131 if (!pool
!poolDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
132 (
never executed: (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap());
qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap());
never executed: (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap());
0
133-
134 if ((
(position >= pool->m_start)Description
TRUEnever evaluated
FALSEnever evaluated
position >= pool->m_start)
(position >= pool->m_start)Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(position <= s...<void*>(pool))Description
TRUEnever evaluated
FALSEnever evaluated
position <= static_cast<void*>(pool))
(position <= s...<void*>(pool))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
135 (!(position <= pool->m_current) ? (qmlWTFReportAssertionFailure(__FILE__, 187, __PRETTY_FUNCTION__, "position <= pool->m_current"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0);-
136 pool->m_current = position;-
137 return
never executed: return pool;
pool;
never executed: return pool;
0
138 }-
139 }
never executed: end of block
0
140 }
never executed: end of block
0
141-
142 void* m_current;-
143 void* m_start;-
144 BumpPointerPool* m_next;-
145 BumpPointerPool* m_previous;-
146 PageAllocation m_allocation;-
147-
148 friend class BumpPointerAllocator;-
149};-
150class BumpPointerAllocator {-
151public:-
152 BumpPointerAllocator()-
153 : m_head(0)-
154 {-
155 }
executed 99164 times by 153 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
  • ...
99164
156-
157 ~BumpPointerAllocator()-
158 {-
159 if (m_head
m_headDescription
TRUEevaluated 148 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 99044 times by 153 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
  • ...
)
148-99044
160 m_head->destroy();
executed 148 times by 1 test: m_head->destroy();
Executed by:
  • tst_ecmascripttests
148
161 }
executed 99192 times by 153 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
  • ...
99192
162-
163 BumpPointerPool* startAllocator()-
164 {-
165 if (!m_head
!m_headDescription
TRUEevaluated 147 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 68 times by 1 test
Evaluated by:
  • tst_ecmascripttests
)
68-147
166 m_head = BumpPointerPool::create();
executed 147 times by 1 test: m_head = BumpPointerPool::create();
Executed by:
  • tst_ecmascripttests
147
167 return
executed 216 times by 1 test: return m_head;
Executed by:
  • tst_ecmascripttests
m_head;
executed 216 times by 1 test: return m_head;
Executed by:
  • tst_ecmascripttests
216
168 }-
169-
170 void stopAllocator()-
171 {-
172 if (m_head
m_headDescription
TRUEevaluated 216 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
)
0-216
173 m_head->shrink();
executed 216 times by 1 test: m_head->shrink();
Executed by:
  • tst_ecmascripttests
216
174 }
executed 216 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
216
175-
176private:-
177 BumpPointerPool* m_head;-
178};-
179-
180}-
181-
182using WTF::BumpPointerAllocator;-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0