aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4executableallocator_p.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-09-12 08:44:09 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-12 23:00:48 +0200
commit8c2201e2e51e9a6c09b4f91c4b4fc09b2c82f4af (patch)
tree6c42cf0bb73da85c1d303cf7e53672c292ae7172 /src/qml/jsruntime/qv4executableallocator_p.h
parent53d005693eaba49b90fb636dd420d8993b698b66 (diff)
Implement plain simple locking in the executable memory allocator
Memory allocations may now also happen to come from a separate thread, the QML loader thread where we also compile the JavaScript code and (likely) use the JIT. Commonly that will be the only place where the allocator will be used. The main thread uses the allocator only when an exception is thrown (to look up platform unwind info) or when the garbage collector runs and decides to delete objects that also hold the last reference to executable memory. Change-Id: I8bb710184164cd8d32168449f48d09f7ee828e6e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4executableallocator_p.h')
-rw-r--r--src/qml/jsruntime/qv4executableallocator_p.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4executableallocator_p.h b/src/qml/jsruntime/qv4executableallocator_p.h
index 2a304baf9c..feba5d7e3d 100644
--- a/src/qml/jsruntime/qv4executableallocator_p.h
+++ b/src/qml/jsruntime/qv4executableallocator_p.h
@@ -48,6 +48,7 @@
#include <QHash>
#include <QVector>
#include <QByteArray>
+#include <QMutex>
namespace WTF {
class PageAllocation;
@@ -63,6 +64,7 @@ public:
struct ChunkOfPages;
struct Allocation;
+ ExecutableAllocator();
~ExecutableAllocator();
Allocation *allocate(size_t size);
@@ -125,6 +127,7 @@ public:
private:
QMultiMap<size_t, Allocation*> freeAllocations;
QMap<quintptr, ChunkOfPages*> chunks;
+ mutable QMutex mutex;
};
}