aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/memory/qv4mm_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/memory/qv4mm_p.h')
-rw-r--r--src/qml/memory/qv4mm_p.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/qml/memory/qv4mm_p.h b/src/qml/memory/qv4mm_p.h
index 6b6b502b95..d2071766e8 100644
--- a/src/qml/memory/qv4mm_p.h
+++ b/src/qml/memory/qv4mm_p.h
@@ -102,6 +102,19 @@ public:
}
template <typename ObjectType>
+ typename ObjectType::Data *allocObject(InternalClass *ic)
+ {
+ Scope scope(engine());
+ const int size = (sizeof(typename ObjectType::Data) + (sizeof(Value) - 1)) & ~(sizeof(Value) - 1);
+ Scoped<ObjectType> t(scope, allocManaged<ObjectType>(size + ic->size*sizeof(Value)));
+ t->d()->internalClass = ic;
+ t->d()->inlineMemberSize = ic->size;
+ t->d()->inlineMemberOffset = size/sizeof(Value);
+ (void)new (t->d()) typename ObjectType::Data();
+ return t->d();
+ }
+
+ template <typename ObjectType>
typename ObjectType::Data *allocObject(InternalClass *ic, Object *prototype)
{
Scope scope(engine());