aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-01-30 22:22:00 +0100
committerLars Knoll <lars.knoll@qt.io>2017-03-09 08:58:28 +0000
commit8b3cbc4403e3eac286613691c11aa1ded588da59 (patch)
tree48bc8592a69ce2585639f4e83258bb776c4f32ab /src/qml
parent2fbb5c93c765ea53c3bd5f30b8bf769ccc88874a (diff)
Refactor how we define Heap objects
Declare the type of Heap object in the Member() macro, instead of deducing it from templates. This allows us to encode the offset of the member in the second template argument to Pointer<> in a second step. Change-Id: I2cfb73785749d3fb991689b4e0554a72b3e5e13f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/jsruntime/qv4argumentsobject_p.h10
-rw-r--r--src/qml/jsruntime/qv4arraydata_p.h33
-rw-r--r--src/qml/jsruntime/qv4context_p.h18
-rw-r--r--src/qml/jsruntime/qv4dataview_p.h6
-rw-r--r--src/qml/jsruntime/qv4errorobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4functionobject_p.h10
-rw-r--r--src/qml/jsruntime/qv4global_p.h5
-rw-r--r--src/qml/jsruntime/qv4memberdata_p.h2
-rw-r--r--src/qml/jsruntime/qv4object.cpp3
-rw-r--r--src/qml/jsruntime/qv4object_p.h10
-rw-r--r--src/qml/jsruntime/qv4qmlcontext_p.h2
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper_p.h8
-rw-r--r--src/qml/jsruntime/qv4regexpobject_p.h12
-rw-r--r--src/qml/jsruntime/qv4stringobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4typedarray_p.h10
-rw-r--r--src/qml/jsruntime/qv4value_p.h1
-rw-r--r--src/qml/memory/qv4heap_p.h13
-rw-r--r--src/qml/memory/qv4mm.cpp8
-rw-r--r--src/qml/memory/qv4mmdefs_p.h29
-rw-r--r--src/qml/qml/qqmlcomponent.cpp10
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp2
21 files changed, 89 insertions, 107 deletions
diff --git a/src/qml/jsruntime/qv4argumentsobject_p.h b/src/qml/jsruntime/qv4argumentsobject_p.h
index f579afff14..46e1f884e8 100644
--- a/src/qml/jsruntime/qv4argumentsobject_p.h
+++ b/src/qml/jsruntime/qv4argumentsobject_p.h
@@ -60,7 +60,7 @@ namespace QV4 {
namespace Heap {
#define ArgumentsGetterFunctionMembers(class, Member) \
- Member(class, uint, index)
+ Member(class, NoMark, uint, index)
DECLARE_HEAP_OBJECT(ArgumentsGetterFunction, FunctionObject) {
DECLARE_MARK_TABLE(ArgumentsGetterFunction);
@@ -68,7 +68,7 @@ DECLARE_HEAP_OBJECT(ArgumentsGetterFunction, FunctionObject) {
};
#define ArgumentsSetterFunctionMembers(class, Member) \
- Member(class, uint, index)
+ Member(class, NoMark, uint, index)
DECLARE_HEAP_OBJECT(ArgumentsSetterFunction, FunctionObject) {
DECLARE_MARK_TABLE(ArgumentsSetterFunction);
@@ -76,9 +76,9 @@ DECLARE_HEAP_OBJECT(ArgumentsSetterFunction, FunctionObject) {
};
#define ArgumentsObjectMembers(class, Member) \
- Member(class, Pointer<CallContext>, context) \
- Member(class, Pointer<MemberData>, mappedArguments) \
- Member(class, bool, fullyCreated)
+ Member(class, Pointer, CallContext *, context) \
+ Member(class, Pointer, MemberData *, mappedArguments) \
+ Member(class, NoMark, bool, fullyCreated)
DECLARE_HEAP_OBJECT(ArgumentsObject, Object) {
DECLARE_MARK_TABLE(ArgumentsObject);
diff --git a/src/qml/jsruntime/qv4arraydata_p.h b/src/qml/jsruntime/qv4arraydata_p.h
index 882f8d1f8d..1ede463d6d 100644
--- a/src/qml/jsruntime/qv4arraydata_p.h
+++ b/src/qml/jsruntime/qv4arraydata_p.h
@@ -90,28 +90,19 @@ struct ArrayVTable
namespace Heap {
-struct ArrayDataData {
- enum Type {
- Simple = 0,
- Complex = 1,
- Sparse = 2,
- Custom = 3
- };
-
- Type type;
- uint offset;
- PropertyAttributes *attrs;
- ReturnedValue freeList;
- SparseArray *sparse;
- ValueArray values;
-};
-static Q_CONSTEXPR quint64 ArrayData_markTable = \
- (MarkFlagsForType<decltype(ArrayDataData::values)>::markFlags << (offsetof(ArrayDataData, values) >> 2)) \
- << (sizeof(Base) >> 2) | QV4::Heap::Base::markTable;
-
-struct ArrayData : public Base, ArrayDataData {
+#define ArrayDataMembers(class, Member) \
+ Member(class, NoMark, uint, type) \
+ Member(class, NoMark, uint, offset) \
+ Member(class, NoMark, PropertyAttributes *, attrs) \
+ Member(class, NoMark, ReturnedValue, freeList) \
+ Member(class, NoMark, SparseArray *, sparse) \
+ Member(class, ValueArray, ValueArray, values)
+
+DECLARE_HEAP_OBJECT(ArrayData, Base) {
DECLARE_MARK_TABLE(ArrayData);
+ enum Type { Simple = 0, Complex = 1, Sparse = 2, Custom = 3 };
+
bool isSparse() const { return type == Sparse; }
const ArrayVTable *vtable() const { return reinterpret_cast<const ArrayVTable *>(Base::vtable()); }
@@ -197,7 +188,7 @@ struct Q_QML_EXPORT ArrayData : public Managed
uint alloc() const { return d()->values.alloc; }
uint &alloc() { return d()->values.alloc; }
void setAlloc(uint a) { d()->values.alloc = a; }
- Type type() const { return d()->type; }
+ Type type() const { return static_cast<Type>(d()->type); }
void setType(Type t) { d()->type = t; }
PropertyAttributes *attrs() const { return d()->attrs; }
void setAttrs(PropertyAttributes *a) { d()->attrs = a; }
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index 3d4a9ba1d7..ccea1dbc80 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -97,7 +97,7 @@ namespace Heap {
struct QmlContext;
#define ExecutionContextMembers(class, Member) \
- Member(class, Pointer<ExecutionContext>, outer)
+ Member(class, Pointer, ExecutionContext *, outer)
DECLARE_HEAP_OBJECT(ExecutionContext, Base) {
DECLARE_MARK_TABLE(ExecutionContext);
@@ -133,8 +133,8 @@ DECLARE_HEAP_OBJECT(ExecutionContext, Base) {
V4_ASSERT_IS_TRIVIAL(ExecutionContext)
#define SimpleCallContextMembers(class, Member) \
- Member(class, Pointer<Object>, activation) \
- Member(class, QV4::Function *, v4Function)
+ Member(class, Pointer, Object *, activation) \
+ Member(class, NoMark, QV4::Function *, v4Function)
DECLARE_HEAP_OBJECT(SimpleCallContext, ExecutionContext) {
DECLARE_MARK_TABLE(SimpleCallContext);
@@ -150,8 +150,8 @@ DECLARE_HEAP_OBJECT(SimpleCallContext, ExecutionContext) {
V4_ASSERT_IS_TRIVIAL(SimpleCallContext)
#define CallContextMembers(class, Member) \
- Member(class, Pointer<FunctionObject>, function) \
- Member(class, ValueArray, locals) \
+ Member(class, Pointer, FunctionObject *, function) \
+ Member(class, ValueArray, ValueArray, locals) \
DECLARE_HEAP_OBJECT(CallContext, SimpleCallContext) {
DECLARE_MARK_TABLE(CallContext);
@@ -160,7 +160,7 @@ DECLARE_HEAP_OBJECT(CallContext, SimpleCallContext) {
};
#define GlobalContextMembers(class, Member) \
- Member(class, Pointer<Object>, global)
+ Member(class, Pointer, Object *, global)
DECLARE_HEAP_OBJECT(GlobalContext, ExecutionContext) {
DECLARE_MARK_TABLE(GlobalContext);
@@ -170,8 +170,8 @@ DECLARE_HEAP_OBJECT(GlobalContext, ExecutionContext) {
V4_ASSERT_IS_TRIVIAL(GlobalContext)
#define CatchContextMembers(class, Member) \
- Member(class, Pointer<String>, exceptionVarName) \
- Member(class, Value, exceptionValue)
+ Member(class, Pointer, String *, exceptionVarName) \
+ Member(class, Value, Value, exceptionValue)
DECLARE_HEAP_OBJECT(CatchContext, ExecutionContext) {
DECLARE_MARK_TABLE(CatchContext);
@@ -181,7 +181,7 @@ DECLARE_HEAP_OBJECT(CatchContext, ExecutionContext) {
V4_ASSERT_IS_TRIVIAL(CatchContext)
#define WithContextMembers(class, Member) \
- Member(class, Pointer<Object>, withObject)
+ Member(class, Pointer, Object *, withObject)
DECLARE_HEAP_OBJECT(WithContext, ExecutionContext) {
DECLARE_MARK_TABLE(WithContext);
diff --git a/src/qml/jsruntime/qv4dataview_p.h b/src/qml/jsruntime/qv4dataview_p.h
index f61a2a1780..5c50df4655 100644
--- a/src/qml/jsruntime/qv4dataview_p.h
+++ b/src/qml/jsruntime/qv4dataview_p.h
@@ -64,9 +64,9 @@ struct DataViewCtor : FunctionObject {
};
#define DataViewMembers(class, Member) \
- Member(class, Pointer<ArrayBuffer>, buffer) \
- Member(class, uint, byteLength) \
- Member(class, uint, byteOffset)
+ Member(class, Pointer, ArrayBuffer *, buffer) \
+ Member(class, NoMark, uint, byteLength) \
+ Member(class, NoMark, uint, byteOffset)
DECLARE_HEAP_OBJECT(DataView, Object) {
DECLARE_MARK_TABLE(DataView);
diff --git a/src/qml/jsruntime/qv4errorobject_p.h b/src/qml/jsruntime/qv4errorobject_p.h
index a5af0b6ab6..5afd9efcba 100644
--- a/src/qml/jsruntime/qv4errorobject_p.h
+++ b/src/qml/jsruntime/qv4errorobject_p.h
@@ -64,7 +64,7 @@ namespace Heap {
#define ErrorObjectMembers(class, Member) \
- Member(class, Pointer<String>, stack)
+ Member(class, Pointer, String *, stack)
DECLARE_HEAP_OBJECT(ErrorObject, Object) {
DECLARE_MARK_TABLE(ErrorObject);
diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h
index 083ff4343b..1fc40e6ff6 100644
--- a/src/qml/jsruntime/qv4functionobject_p.h
+++ b/src/qml/jsruntime/qv4functionobject_p.h
@@ -66,8 +66,8 @@ struct BuiltinFunction;
namespace Heap {
#define FunctionObjectMembers(class, Member) \
- Member(class, Pointer<ExecutionContext>, scope) \
- Member(class, Function *, function)
+ Member(class, Pointer, ExecutionContext *, scope) \
+ Member(class, NoMark, Function *, function)
DECLARE_HEAP_OBJECT(FunctionObject, Object) {
DECLARE_MARK_TABLE(FunctionObject);
@@ -122,9 +122,9 @@ struct ScriptFunction : FunctionObject {
};
#define BoundFunctionMembers(class, Member) \
- Member(class, Pointer<FunctionObject>, target) \
- Member(class, Value, boundThis) \
- Member(class, Pointer<MemberData>, boundArgs)
+ Member(class, Pointer, FunctionObject *, target) \
+ Member(class, Value, Value, boundThis) \
+ Member(class, Pointer, MemberData *, boundArgs)
DECLARE_HEAP_OBJECT(BoundFunction, FunctionObject) {
DECLARE_MARK_TABLE(BoundFunction);
diff --git a/src/qml/jsruntime/qv4global_p.h b/src/qml/jsruntime/qv4global_p.h
index 677f0ebea9..ea3e1d750e 100644
--- a/src/qml/jsruntime/qv4global_p.h
+++ b/src/qml/jsruntime/qv4global_p.h
@@ -184,7 +184,7 @@ namespace Heap {
struct DataView;
struct TypedArray;
- template <typename T> struct Pointer;
+ template <typename T, size_t> struct Pointer;
}
class MemoryManager;
@@ -199,10 +199,11 @@ struct ScriptFunction;
struct InternalClass;
struct Property;
struct Value;
-struct ValueArray;
+template<size_t> struct ValueArray;
struct Lookup;
struct ArrayData;
struct VTable;
+struct Function;
struct BooleanObject;
struct NumberObject;
diff --git a/src/qml/jsruntime/qv4memberdata_p.h b/src/qml/jsruntime/qv4memberdata_p.h
index a531d3303f..e486895754 100644
--- a/src/qml/jsruntime/qv4memberdata_p.h
+++ b/src/qml/jsruntime/qv4memberdata_p.h
@@ -60,7 +60,7 @@ namespace QV4 {
namespace Heap {
#define MemberDataMembers(class, Member) \
- Member(class, ValueArray, values)
+ Member(class, ValueArray, ValueArray, values)
DECLARE_HEAP_OBJECT(MemberData, Base) {
DECLARE_MARK_TABLE(MemberData);
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index 7886dd24fa..cb7ce03c5c 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -1132,7 +1132,8 @@ void Object::copyArrayData(Object *other)
;
} else {
Q_ASSERT(!arrayData() && other->arrayData());
- ArrayData::realloc(this, other->d()->arrayData->type, other->d()->arrayData->values.alloc, false);
+ ArrayData::realloc(this, static_cast<ArrayData::Type>(other->d()->arrayData->type),
+ other->d()->arrayData->values.alloc, false);
if (other->arrayType() == Heap::ArrayData::Sparse) {
Heap::ArrayData *od = other->d()->arrayData;
Heap::ArrayData *dd = d()->arrayData;
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h
index 2affcd1af9..5b43710c03 100644
--- a/src/qml/jsruntime/qv4object_p.h
+++ b/src/qml/jsruntime/qv4object_p.h
@@ -68,10 +68,10 @@ struct BuiltinFunction;
namespace Heap {
#define ObjectMembers(class, Member) \
- Member(class, InternalClass *, internalClass) \
- Member(class, Pointer<Object>, prototype) \
- Member(class, Pointer<MemberData>, memberData) \
- Member(class, Pointer<ArrayData>, arrayData)
+ Member(class, NoMark, InternalClass *, internalClass) \
+ Member(class, Pointer, Object *, prototype) \
+ Member(class, Pointer, MemberData *, memberData) \
+ Member(class, Pointer, ArrayData *, arrayData)
DECLARE_HEAP_OBJECT(Object, Base) {
DECLARE_MARK_TABLE(Object);
@@ -299,7 +299,7 @@ public:
void push_back(const Value &v);
ArrayData::Type arrayType() const {
- return arrayData() ? d()->arrayData->type : Heap::ArrayData::Simple;
+ return arrayData() ? static_cast<ArrayData::Type>(d()->arrayData->type) : Heap::ArrayData::Simple;
}
// ### remove me
void setArrayType(ArrayData::Type t) {
diff --git a/src/qml/jsruntime/qv4qmlcontext_p.h b/src/qml/jsruntime/qv4qmlcontext_p.h
index 73100807ae..835c9236fe 100644
--- a/src/qml/jsruntime/qv4qmlcontext_p.h
+++ b/src/qml/jsruntime/qv4qmlcontext_p.h
@@ -78,7 +78,7 @@ struct QmlContextWrapper : Object {
};
#define QmlContextMembers(class, Member) \
- Member(class, Pointer<QmlContextWrapper>, qml)
+ Member(class, Pointer, QmlContextWrapper *, qml)
DECLARE_HEAP_OBJECT(QmlContext, ExecutionContext) {
DECLARE_MARK_TABLE(QmlContext);
diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h
index 002e1f2eb0..c031a40211 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper_p.h
+++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h
@@ -96,10 +96,10 @@ private:
};
#define QObjectMethodMembers(class, Member) \
- Member(class, Pointer<QQmlValueTypeWrapper>, valueTypeWrapper) \
- Member(class, QQmlQPointer<QObject>, qObj) \
- Member(class, QQmlPropertyCache *, _propertyCache) \
- Member(class, int, index)
+ Member(class, Pointer, QQmlValueTypeWrapper *, valueTypeWrapper) \
+ Member(class, NoMark, QQmlQPointer<QObject>, qObj) \
+ Member(class, NoMark, QQmlPropertyCache *, _propertyCache) \
+ Member(class, NoMark, int, index)
DECLARE_HEAP_OBJECT(QObjectMethod, FunctionObject) {
DECLARE_MARK_TABLE(QObjectMethod);
diff --git a/src/qml/jsruntime/qv4regexpobject_p.h b/src/qml/jsruntime/qv4regexpobject_p.h
index 6726568eec..b429524b71 100644
--- a/src/qml/jsruntime/qv4regexpobject_p.h
+++ b/src/qml/jsruntime/qv4regexpobject_p.h
@@ -74,8 +74,8 @@ namespace QV4 {
namespace Heap {
#define RegExpObjectMembers(class, Member) \
- Member(class, Pointer<RegExp>, value) \
- Member(class, bool, global)
+ Member(class, Pointer, RegExp *, value) \
+ Member(class, NoMark, bool, global)
DECLARE_HEAP_OBJECT(RegExpObject, Object) {
DECLARE_MARK_TABLE(RegExpObject);
@@ -86,10 +86,10 @@ DECLARE_HEAP_OBJECT(RegExpObject, Object) {
};
#define RegExpCtorMembers(class, Member) \
- Member(class, Value, lastMatch) \
- Member(class, Pointer<String>, lastInput) \
- Member(class, int, lastMatchStart) \
- Member(class, int, lastMatchEnd)
+ Member(class, Value, Value, lastMatch) \
+ Member(class, Pointer, String *, lastInput) \
+ Member(class, NoMark, int, lastMatchStart) \
+ Member(class, NoMark, int, lastMatchEnd)
DECLARE_HEAP_OBJECT(RegExpCtor, FunctionObject) {
DECLARE_MARK_TABLE(RegExpCtor);
diff --git a/src/qml/jsruntime/qv4stringobject_p.h b/src/qml/jsruntime/qv4stringobject_p.h
index ae9377abb4..5ccee3335e 100644
--- a/src/qml/jsruntime/qv4stringobject_p.h
+++ b/src/qml/jsruntime/qv4stringobject_p.h
@@ -61,7 +61,7 @@ namespace QV4 {
namespace Heap {
#define StringObjectMembers(class, Member) \
- Member(class, Pointer<String>, string)
+ Member(class, Pointer, String *, string)
DECLARE_HEAP_OBJECT(StringObject, Object) {
DECLARE_MARK_TABLE(StringObject);
diff --git a/src/qml/jsruntime/qv4typedarray_p.h b/src/qml/jsruntime/qv4typedarray_p.h
index f6b302a396..96786c8231 100644
--- a/src/qml/jsruntime/qv4typedarray_p.h
+++ b/src/qml/jsruntime/qv4typedarray_p.h
@@ -73,11 +73,11 @@ struct TypedArrayOperations {
namespace Heap {
#define TypedArrayMembers(class, Member) \
- Member(class, Pointer<ArrayBuffer>, buffer) \
- Member(class, const TypedArrayOperations *, type) \
- Member(class, uint, byteLength) \
- Member(class, uint, byteOffset) \
- Member(class, uint, arrayType)
+ Member(class, Pointer, ArrayBuffer *, buffer) \
+ Member(class, NoMark, const TypedArrayOperations *, type) \
+ Member(class, NoMark, uint, byteLength) \
+ Member(class, NoMark, uint, byteOffset) \
+ Member(class, NoMark, uint, arrayType)
DECLARE_HEAP_OBJECT(TypedArray, Object) {
DECLARE_MARK_TABLE(TypedArray);
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h
index 6d25abba9a..771d28dce8 100644
--- a/src/qml/jsruntime/qv4value_p.h
+++ b/src/qml/jsruntime/qv4value_p.h
@@ -708,6 +708,7 @@ inline unsigned int Value::toUInt32() const
return (unsigned int)toInt32();
}
+template <size_t offset>
struct ValueArray {
uint size;
uint alloc;
diff --git a/src/qml/memory/qv4heap_p.h b/src/qml/memory/qv4heap_p.h
index 28d39b7fb7..febe4e6446 100644
--- a/src/qml/memory/qv4heap_p.h
+++ b/src/qml/memory/qv4heap_p.h
@@ -164,19 +164,20 @@ struct Q_QML_EXPORT Base {
};
V4_ASSERT_IS_TRIVIAL(Base)
-template <typename T>
+template <typename T, size_t>
struct Pointer {
- T *operator->() const { return ptr; }
- operator T *() const { return ptr; }
+ T operator->() const { return ptr; }
+ operator T () const { return ptr; }
- Pointer &operator =(T *t) { ptr = t; return *this; }
+ Pointer &operator =(T t) { ptr = t; return *this; }
template <typename Type>
Type *cast() { return static_cast<Type *>(ptr); }
- T *ptr;
+ T ptr;
};
-V4_ASSERT_IS_TRIVIAL(Pointer<void>)
+typedef Pointer<char *, 0> V4PointerCheck;
+V4_ASSERT_IS_TRIVIAL(V4PointerCheck)
}
diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp
index 259f221a86..89cf9caf9e 100644
--- a/src/qml/memory/qv4mm.cpp
+++ b/src/qml/memory/qv4mm.cpp
@@ -762,15 +762,15 @@ void MemoryManager::drainMarkStack(Value *markBase)
break;
case Mark_Pointer: {
// qDebug() << "marking pointer at " << mem;
- Heap::Pointer<Heap::Base> *p = reinterpret_cast<Heap::Pointer<Heap::Base> *>(mem);
- if (*p)
- (*p)->mark(engine);
+ Heap::Base *p = reinterpret_cast<Heap::Base *>(mem);
+ if (p)
+ p->mark(engine);
break;
}
case Mark_ValueArray: {
Q_ASSERT(m == Mark_ValueArray);
// qDebug() << "marking Value Array at offset" << hex << (mem - reinterpret_cast<void **>(h));
- ValueArray *a = reinterpret_cast<ValueArray *>(mem);
+ ValueArray<0> *a = reinterpret_cast<ValueArray<0> *>(mem);
Value *v = a->v;
const Value *end = v + a->alloc;
while (v < end) {
diff --git a/src/qml/memory/qv4mmdefs_p.h b/src/qml/memory/qv4mmdefs_p.h
index a987c3a200..e4d5ce9da2 100644
--- a/src/qml/memory/qv4mmdefs_p.h
+++ b/src/qml/memory/qv4mmdefs_p.h
@@ -265,27 +265,16 @@ enum MarkFlags {
Mark_ValueArray = 3
};
-template<typename T>
-struct MarkFlagsForType {
- static const quint64 markFlags = Mark_NoMark;
-};
-template<typename T>
-struct MarkFlagsForType<Heap::Pointer<T>> {
- static const quint64 markFlags = Mark_Pointer;
-};
-template<>
-struct MarkFlagsForType<Value> {
- static const quint64 markFlags = Mark_Value;
-};
-template<>
-struct MarkFlagsForType<ValueArray> {
- static const quint64 markFlags = Mark_ValueArray;
-};
+#define HEAP_OBJECT_MEMBER_EXPANSION(c, gcType, type, name) \
+ HEAP_OBJECT_MEMBER_EXPANSION_##gcType(c, type, name)
-#define HEAP_OBJECT_MEMBER_EXPANSION(c, type, name) type name;
+#define HEAP_OBJECT_MEMBER_EXPANSION_Pointer(c, type, name) Pointer<type, 0> name;
+#define HEAP_OBJECT_MEMBER_EXPANSION_NoMark(c, type, name) type name;
+#define HEAP_OBJECT_MEMBER_EXPANSION_Value(c, type, name) type name;
+#define HEAP_OBJECT_MEMBER_EXPANSION_ValueArray(c, type, name) ValueArray<0> name;
-#define HEAP_OBJECT_MARK_EXPANSION(class, type, name) \
- (MarkFlagsForType<decltype(class::name)>::markFlags << (offsetof(class, name) >> 2)) |
+#define HEAP_OBJECT_MARK_EXPANSION(class, gcType, type, name) \
+ (Mark_##gcType << (offsetof(class, name) >> 2)) |
#define DECLARE_HEAP_OBJECT(name, base) \
struct name##Data { \
@@ -299,8 +288,6 @@ struct name : base, name##Data
#define DECLARE_MARK_TABLE(class) static Q_CONSTEXPR quint64 markTable = class##_markTable
-
-
}
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 487846f610..79e52f3914 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -1047,11 +1047,11 @@ namespace QV4 {
namespace Heap {
#define QmlIncubatorObjectMembers(class, Member) \
- Member(class, Value, valuemap) \
- Member(class, Value, statusChanged) \
- Member(class, Pointer<QmlContext>, qmlContext) \
- Member(class, QQmlComponentIncubator *, incubator) \
- Member(class, QQmlQPointer<QObject>, parent)
+ Member(class, Value, Value, valuemap) \
+ Member(class, Value, Value, statusChanged) \
+ Member(class, Pointer, QmlContext *, qmlContext) \
+ Member(class, NoMark, QQmlComponentIncubator *, incubator) \
+ Member(class, NoMark, QQmlQPointer<QObject>, parent)
DECLARE_HEAP_OBJECT(QmlIncubatorObject, Object) {
DECLARE_MARK_TABLE(QmlIncubatorObject);
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index 868120a2f6..502a693d5c 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -1598,7 +1598,7 @@ struct QQmlXMLHttpRequestWrapper : Object {
};
#define QQmlXMLHttpRequestCtorMembers(class, Member) \
- Member(class, Pointer<Object>, proto)
+ Member(class, Pointer, Object *, proto)
DECLARE_HEAP_OBJECT(QQmlXMLHttpRequestCtor, FunctionObject) {
DECLARE_MARK_TABLE(QQmlXMLHttpRequestCtor);