aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/memory/qv4mm_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-08-27 22:47:23 +0200
committerLars Knoll <lars.knoll@theqtcompany.com>2015-09-22 08:20:04 +0000
commit6190b10d1cb8b450c7429d35dc8efbe7c7f630b2 (patch)
tree498b892fbb3a0b66029bda3678334b96ecd0d891 /src/qml/memory/qv4mm_p.h
parentd7e535e99babae46d01311059f5ef6080dc90751 (diff)
move error objects over to new construction scheme
Change-Id: I533c7bf90d49aee10b5661fd15a98e013b1169bd Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/memory/qv4mm_p.h')
-rw-r--r--src/qml/memory/qv4mm_p.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/qml/memory/qv4mm_p.h b/src/qml/memory/qv4mm_p.h
index d2071766e8..f21e96beb0 100644
--- a/src/qml/memory/qv4mm_p.h
+++ b/src/qml/memory/qv4mm_p.h
@@ -156,6 +156,34 @@ public:
return t->d();
}
+ template <typename ObjectType, typename Arg1, typename Arg2, typename Arg3>
+ typename ObjectType::Data *allocObject(InternalClass *ic, Object *prototype, Arg1 arg1, Arg2 arg2, Arg3 arg3)
+ {
+ 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()->prototype = prototype->d();
+ t->d()->inlineMemberSize = ic->size;
+ t->d()->inlineMemberOffset = size/sizeof(Value);
+ (void)new (t->d()) typename ObjectType::Data(arg1, arg2, arg3);
+ return t->d();
+ }
+
+ template <typename ObjectType, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
+ typename ObjectType::Data *allocObject(InternalClass *ic, Object *prototype, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
+ {
+ 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()->prototype = prototype->d();
+ t->d()->inlineMemberSize = ic->size;
+ t->d()->inlineMemberOffset = size/sizeof(Value);
+ (void)new (t->d()) typename ObjectType::Data(arg1, arg2, arg3, arg4);
+ return t->d();
+ }
+
template <typename ManagedType>
typename ManagedType::Data *alloc()
{