aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4value_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-02-12 21:16:42 +0100
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-03-02 16:34:16 +0000
commitfeebac8e705513d14f3d210541ee5127c2f2ff46 (patch)
tree1c3462f6f115359e1b50ba1d41bd58016e9036b3 /src/qml/jsruntime/qv4value_p.h
parent69fe583cbebcbd593cb0cee266ffc8b0b647235c (diff)
Move memory management related functionality into it's own folder
Start moving the memory related functionality into it's own folder. This will simplify refactoring of the GC related functionality later on. Change-Id: I70ec6f512af7a7897625afb84d914c17572b0ccd Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime/qv4value_p.h')
-rw-r--r--src/qml/jsruntime/qv4value_p.h63
1 files changed, 1 insertions, 62 deletions
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h
index 93cbe9b52d..ea98adc0c8 100644
--- a/src/qml/jsruntime/qv4value_p.h
+++ b/src/qml/jsruntime/qv4value_p.h
@@ -37,6 +37,7 @@
#include <QtCore/QString>
#include "qv4global_p.h"
+#include <private/qv4heap_p.h>
QT_BEGIN_NAMESPACE
@@ -44,68 +45,6 @@ namespace QV4 {
typedef uint Bool;
-namespace Heap {
-
-struct Q_QML_EXPORT Base {
- union {
- const ManagedVTable *vtable;
- quintptr mm_data;
- };
-
- inline ReturnedValue asReturnedValue() const;
- inline void mark(QV4::ExecutionEngine *engine);
-
- enum {
- MarkBit = 0x1,
- NotInUse = 0x2,
- PointerMask = ~0x3
- };
-
- ManagedVTable *gcGetVtable() const {
- return reinterpret_cast<ManagedVTable *>(mm_data & PointerMask);
- }
- inline bool isMarked() const {
- return mm_data & MarkBit;
- }
- inline void setMarkBit() {
- mm_data |= MarkBit;
- }
- inline void clearMarkBit() {
- mm_data &= ~MarkBit;
- }
-
- inline bool inUse() const {
- return !(mm_data & NotInUse);
- }
-
- Base *nextFree() {
- return reinterpret_cast<Base *>(mm_data & PointerMask);
- }
- void setNextFree(Base *m) {
- mm_data = (reinterpret_cast<quintptr>(m) | NotInUse);
- }
-
- void *operator new(size_t, Managed *m) { return m; }
- void *operator new(size_t, Heap::Base *m) { return m; }
- void operator delete(void *, Heap::Base *) {}
-};
-
-template <typename T>
-struct Pointer {
- Pointer() {}
- Pointer(T *t) : ptr(t) {}
-
- T *operator->() const { return static_cast<T *>(ptr); }
- operator T *() const { return static_cast<T *>(ptr); }
-
- Pointer &operator =(T *t) { ptr = t; return *this; }
-
- // Use Base, not T here, to ensure T inherits from ptr
- Base *ptr;
-};
-
-}
-
struct Q_QML_PRIVATE_EXPORT Value
{
/*