This is required to properly mark pointers to other heap
objects, as well as to have a single point where to implement
a write barrier later on.
Change-Id: I7d57044f1a306ca8da8183793635ed49a3637146
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Property *propertyAt(uint index) { return reinterpret_cast<Property *>(memberData->data + index); }
InternalClass *internalClass;
- Heap::Object *prototype;
+ Pointer<Object> prototype;
MemberData *memberData;
ArrayData *arrayData;
};
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