aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/memory
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-08-08 21:55:06 +0200
committerLars Knoll <lars.knoll@qt.io>2017-08-10 08:19:34 +0000
commitd5cacaf6b2adb269b9e24b518e1496bca935bc34 (patch)
treee95631610e46956f24aa6284526645a25b86ab9a /src/qml/memory
parent7c0dbaa3db649fb348af533820ac0550bc144d96 (diff)
Remove stuff related to simple call contexts
Those are not being used anymore. Change-Id: Ia33dd7c3c7ea7828caef0fbf397253249580a4e1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/memory')
-rw-r--r--src/qml/memory/qv4mm.cpp47
-rw-r--r--src/qml/memory/qv4mm_p.h59
2 files changed, 0 insertions, 106 deletions
diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp
index de97918fb0..b9bc2c34a3 100644
--- a/src/qml/memory/qv4mm.cpp
+++ b/src/qml/memory/qv4mm.cpp
@@ -553,51 +553,6 @@ void Chunk::sortIntoBins(HeapItem **bins, uint nBins)
#endif
}
-
-template<typename T>
-StackAllocator<T>::StackAllocator(ChunkAllocator *chunkAlloc)
- : chunkAllocator(chunkAlloc)
-{
- chunks.push_back(chunkAllocator->allocate());
- firstInChunk = chunks.back()->first();
- nextFree = firstInChunk;
- lastInChunk = firstInChunk + (Chunk::AvailableSlots - 1)/requiredSlots*requiredSlots;
-}
-
-template<typename T>
-void StackAllocator<T>::freeAll()
-{
- for (auto c : chunks)
- chunkAllocator->free(c);
-}
-
-template<typename T>
-void StackAllocator<T>::nextChunk() {
- Q_ASSERT(nextFree == lastInChunk);
- ++currentChunk;
- if (currentChunk >= chunks.size()) {
- Chunk *newChunk = chunkAllocator->allocate();
- chunks.push_back(newChunk);
- }
- firstInChunk = chunks.at(currentChunk)->first();
- nextFree = firstInChunk;
- lastInChunk = firstInChunk + (Chunk::AvailableSlots - 1)/requiredSlots*requiredSlots;
-}
-
-template<typename T>
-void QV4::StackAllocator<T>::prevChunk() {
- Q_ASSERT(nextFree == firstInChunk);
- Q_ASSERT(chunks.at(currentChunk) == nextFree->chunk());
- Q_ASSERT(currentChunk > 0);
- --currentChunk;
- firstInChunk = chunks.at(currentChunk)->first();
- lastInChunk = firstInChunk + (Chunk::AvailableSlots - 1)/requiredSlots*requiredSlots;
- nextFree = lastInChunk;
-}
-
-template struct StackAllocator<Heap::CallContext>;
-
-
HeapItem *BlockAllocator::allocate(size_t size, bool forceAllocation) {
Q_ASSERT((size % Chunk::SlotSize) == 0);
size_t slotsRequired = size >> Chunk::SlotSizeShift;
@@ -836,7 +791,6 @@ void HugeItemAllocator::freeAll()
MemoryManager::MemoryManager(ExecutionEngine *engine)
: engine(engine)
, chunkAllocator(new ChunkAllocator)
- , stackAllocator(chunkAllocator)
, blockAllocator(chunkAllocator)
, hugeItemAllocator(chunkAllocator)
, m_persistentValues(new PersistentValueStorage(engine))
@@ -1261,7 +1215,6 @@ MemoryManager::~MemoryManager()
sweep(/*lastSweep*/true);
blockAllocator.freeAll();
hugeItemAllocator.freeAll();
- stackAllocator.freeAll();
delete m_weakValues;
#ifdef V4_USE_VALGRIND
diff --git a/src/qml/memory/qv4mm_p.h b/src/qml/memory/qv4mm_p.h
index b4f2d0492c..921fea3956 100644
--- a/src/qml/memory/qv4mm_p.h
+++ b/src/qml/memory/qv4mm_p.h
@@ -72,51 +72,6 @@ namespace QV4 {
struct ChunkAllocator;
-template<typename T>
-struct StackAllocator {
- Q_STATIC_ASSERT(sizeof(T) < Chunk::DataSize);
- static const uint requiredSlots = (sizeof(T) + sizeof(HeapItem) - 1)/sizeof(HeapItem);
-
- StackAllocator(ChunkAllocator *chunkAlloc);
-
- T *allocate() {
- HeapItem *m = nextFree;
- if (Q_UNLIKELY(nextFree == lastInChunk)) {
- nextChunk();
- } else {
- nextFree += requiredSlots;
- }
-#if MM_DEBUG || !defined(QT_NO_DEBUG) || defined(QT_FORCE_ASSERTS)
- Chunk *c = m->chunk();
- Chunk::setBit(c->objectBitmap, m - c->realBase());
-#endif
- return m->as<T>();
- }
- void free() {
- if (Q_UNLIKELY(nextFree == firstInChunk)) {
- prevChunk();
- } else {
- nextFree -= requiredSlots;
- }
-#if MM_DEBUG || !defined(QT_NO_DEBUG) || defined(QT_FORCE_ASSERTS)
- Chunk *c = nextFree->chunk();
- Chunk::clearBit(c->objectBitmap, nextFree - c->realBase());
-#endif
- }
-
- void nextChunk();
- void prevChunk();
-
- void freeAll();
-
- ChunkAllocator *chunkAllocator;
- HeapItem *nextFree = 0;
- HeapItem *firstInChunk = 0;
- HeapItem *lastInChunk = 0;
- std::vector<Chunk *> chunks;
- uint currentChunk = 0;
-};
-
struct BlockAllocator {
BlockAllocator(ChunkAllocator *chunkAllocator)
: chunkAllocator(chunkAllocator)
@@ -211,19 +166,6 @@ public:
Q_DECL_CONSTEXPR static inline std::size_t align(std::size_t size)
{ return (size + Chunk::SlotSize - 1) & ~(Chunk::SlotSize - 1); }
- QV4::Heap::CallContext *allocSimpleCallContext()
- {
- Heap::CallContext *ctxt = stackAllocator.allocate();
- memset(ctxt, 0, sizeof(Heap::CallContext));
- ctxt->internalClass = CallContext::defaultInternalClass(engine);
- Q_ASSERT(ctxt->internalClass && ctxt->internalClass->vtable);
- ctxt->init();
- return ctxt;
-
- }
- void freeSimpleCallContext()
- { stackAllocator.free(); }
-
template<typename ManagedType>
inline typename ManagedType::Data *allocManaged(std::size_t size)
{
@@ -477,7 +419,6 @@ private:
public:
QV4::ExecutionEngine *engine;
ChunkAllocator *chunkAllocator;
- StackAllocator<Heap::CallContext> stackAllocator;
BlockAllocator blockAllocator;
HugeItemAllocator hugeItemAllocator;
PersistentValueStorage *m_persistentValues;