From e5f06d60245b75dd31daa2f212619236e6808cd3 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Fri, 20 Nov 2020 16:50:54 +0100 Subject: Unify overload resolution code and introduce a cache With this approach we can also avoid passing the property cache around. Original-patch-by: Lars Knoll Task-number: QTBUG-82931 Change-Id: I88f770d5d9a31b2f5071ad457d9a830900130a85 Reviewed-by: Ulf Hermann --- src/qml/jsruntime/qv4qobjectwrapper_p.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/qml/jsruntime/qv4qobjectwrapper_p.h') diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h index bc6fa09d4f..896de97c56 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper_p.h +++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h @@ -104,9 +104,15 @@ private: DECLARE_HEAP_OBJECT(QObjectMethod, FunctionObject) { DECLARE_MARKOBJECTS(QObjectMethod); + QQmlPropertyData *methods; + int methodCount; + alignas(alignof(QQmlPropertyData)) std::byte _singleMethod[sizeof(QQmlPropertyData)]; + void init(QV4::ExecutionContext *scope); void destroy() { + if (methods != reinterpret_cast(&_singleMethod)) + delete[] methods; setPropertyCache(nullptr); qObj.destroy(); FunctionObject::destroy(); @@ -121,6 +127,8 @@ DECLARE_HEAP_OBJECT(QObjectMethod, FunctionObject) { _propertyCache = c; } + void ensureMethodsCache(); + const QMetaObject *metaObject(); QObject *object() const { return qObj.data(); } void setObject(QObject *o) { qObj = o; } @@ -317,9 +325,6 @@ protected: private: void init(ExecutionEngine *engine); ReturnedValue constructInternal(const Value *argv, int argc) const; - ReturnedValue callConstructor(const QQmlPropertyData &data, QV4::ExecutionEngine *engine, QV4::CallData *callArgs) const; - ReturnedValue callOverloadedConstructor(QV4::ExecutionEngine *engine, QV4::CallData *callArgs) const; - }; struct Q_QML_EXPORT QmlSignalHandler : public QV4::Object -- cgit v1.2.3