| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/3rdparty/masm/wtf/BumpPointerAllocator.h |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | namespace WTF { | - | ||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | class BumpPointerPool { | - | ||||||||||||||||||||||||
| 8 | public: | - | ||||||||||||||||||||||||
| 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)
| 0-2972 | ||||||||||||||||||||||||
| 14 | return executed 2972 times by 1 test: this;return this;Executed by:
executed 2972 times by 1 test: return this;Executed by:
| 2972 | ||||||||||||||||||||||||
| 15 | return never executed: ensureCapacityCrossPool(this, size);return 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: current;return current;Executed by:
executed 2972 times by 1 test: return current;Executed by:
| 2972 | ||||||||||||||||||||||||
| 28 | } | - | ||||||||||||||||||||||||
| 29 | BumpPointerPool* dealloc(void* position) | - | ||||||||||||||||||||||||
| 30 | { | - | ||||||||||||||||||||||||
| 31 | if ((
| 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: this;return this;Executed by:
executed 2492 times by 1 test: return this;Executed by:
| 2492 | ||||||||||||||||||||||||
| 35 | } | - | ||||||||||||||||||||||||
| 36 | return never executed: deallocCrossPool(this, position);return deallocCrossPool(this, position);never executed: return deallocCrossPool(this, position); | 0 | ||||||||||||||||||||||||
| 37 | } | - | ||||||||||||||||||||||||
| 38 | - | |||||||||||||||||||||||||
| 39 | private: | - | ||||||||||||||||||||||||
| 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: reinterpret_cast<char*>(reinterpret_cast<intptr_t>(allocation.base()) + allocation.size()) - size;return reinterpret_cast<char*>(reinterpret_cast<intptr_t>(allocation.base()) + allocation.size()) - size;Executed by:
executed 148 times by 1 test: return reinterpret_cast<char*>(reinterpret_cast<intptr_t>(allocation.base()) + allocation.size()) - size;Executed by:
| 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 blockExecuted by:
| 148 | ||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||
| 56 | static BumpPointerPool* create(size_t minimumCapacity = 0) | - | ||||||||||||||||||||||||
| 57 | { | - | ||||||||||||||||||||||||
| 58 | - | |||||||||||||||||||||||||
| 59 | minimumCapacity += sizeof(BumpPointerPool); | - | ||||||||||||||||||||||||
| 60 | if (minimumCapacity < sizeof(BumpPointerPool)
| 0-146 | ||||||||||||||||||||||||
| 61 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||
| 63 | size_t poolSize = std::max(static_cast<size_t>(0x1000), WTF::pageSize()); | - | ||||||||||||||||||||||||
| 64 | while (poolSize < minimumCapacity
| 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
| 0 | ||||||||||||||||||||||||
| 69 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 70 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 71 | - | |||||||||||||||||||||||||
| 72 | PageAllocation allocation = PageAllocation::allocate(poolSize); | - | ||||||||||||||||||||||||
| 73 | if (!!allocation
| 0-148 | ||||||||||||||||||||||||
| 74 | return executed 148 times by 1 test: new (allocation) BumpPointerPool(allocation);return new (allocation) BumpPointerPool(allocation);Executed by:
executed 148 times by 1 test: return new (allocation) BumpPointerPool(allocation);Executed by:
| 148 | ||||||||||||||||||||||||
| 75 | return never executed: 0;return 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
| 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 blockExecuted by:
| 216 | ||||||||||||||||||||||||
| 88 | - | |||||||||||||||||||||||||
| 89 | void destroy() | - | ||||||||||||||||||||||||
| 90 | { | - | ||||||||||||||||||||||||
| 91 | m_allocation.deallocate(); | - | ||||||||||||||||||||||||
| 92 | } executed 148 times by 1 test: end of blockExecuted by:
| 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
| 0 | ||||||||||||||||||||||||
| 104 | - | |||||||||||||||||||||||||
| 105 | pool = BumpPointerPool::create(size); | - | ||||||||||||||||||||||||
| 106 | previousPool->m_next = pool; | - | ||||||||||||||||||||||||
| 107 | pool->m_previous = previousPool; | - | ||||||||||||||||||||||||
| 108 | return never executed: pool;return 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)
| 0 | ||||||||||||||||||||||||
| 116 | return never executed: pool;return 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
| 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 ((
| 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: pool;return 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 | }; | - | ||||||||||||||||||||||||
| 150 | class BumpPointerAllocator { | - | ||||||||||||||||||||||||
| 151 | public: | - | ||||||||||||||||||||||||
| 152 | BumpPointerAllocator() | - | ||||||||||||||||||||||||
| 153 | : m_head(0) | - | ||||||||||||||||||||||||
| 154 | { | - | ||||||||||||||||||||||||
| 155 | } executed 99164 times by 153 tests: end of blockExecuted by:
| 99164 | ||||||||||||||||||||||||
| 156 | - | |||||||||||||||||||||||||
| 157 | ~BumpPointerAllocator() | - | ||||||||||||||||||||||||
| 158 | { | - | ||||||||||||||||||||||||
| 159 | if (m_head
| 148-99044 | ||||||||||||||||||||||||
| 160 | m_head->destroy(); executed 148 times by 1 test: m_head->destroy();Executed by:
| 148 | ||||||||||||||||||||||||
| 161 | } executed 99192 times by 153 tests: end of blockExecuted by:
| 99192 | ||||||||||||||||||||||||
| 162 | - | |||||||||||||||||||||||||
| 163 | BumpPointerPool* startAllocator() | - | ||||||||||||||||||||||||
| 164 | { | - | ||||||||||||||||||||||||
| 165 | if (!m_head
| 68-147 | ||||||||||||||||||||||||
| 166 | m_head = BumpPointerPool::create(); executed 147 times by 1 test: m_head = BumpPointerPool::create();Executed by:
| 147 | ||||||||||||||||||||||||
| 167 | return executed 216 times by 1 test: m_head;return m_head;Executed by:
executed 216 times by 1 test: return m_head;Executed by:
| 216 | ||||||||||||||||||||||||
| 168 | } | - | ||||||||||||||||||||||||
| 169 | - | |||||||||||||||||||||||||
| 170 | void stopAllocator() | - | ||||||||||||||||||||||||
| 171 | { | - | ||||||||||||||||||||||||
| 172 | if (m_head
| 0-216 | ||||||||||||||||||||||||
| 173 | m_head->shrink(); executed 216 times by 1 test: m_head->shrink();Executed by:
| 216 | ||||||||||||||||||||||||
| 174 | } executed 216 times by 1 test: end of blockExecuted by:
| 216 | ||||||||||||||||||||||||
| 175 | - | |||||||||||||||||||||||||
| 176 | private: | - | ||||||||||||||||||||||||
| 177 | BumpPointerPool* m_head; | - | ||||||||||||||||||||||||
| 178 | }; | - | ||||||||||||||||||||||||
| 179 | - | |||||||||||||||||||||||||
| 180 | } | - | ||||||||||||||||||||||||
| 181 | - | |||||||||||||||||||||||||
| 182 | using WTF::BumpPointerAllocator; | - | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |