diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-11-20 16:50:54 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-12-02 12:54:51 +0100 |
commit | e5f06d60245b75dd31daa2f212619236e6808cd3 (patch) | |
tree | 391e4acc7168bc0abbab60c9fe406fe4823ddf18 /src/qml/jsruntime/qv4qobjectwrapper_p.h | |
parent | 9e81149dd88848b3dc9b6c66d77b41f7ff0e1cf6 (diff) |
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 <lars.knoll@qt.io>
Task-number: QTBUG-82931
Change-Id: I88f770d5d9a31b2f5071ad457d9a830900130a85
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4qobjectwrapper_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper_p.h | 11 |
1 files changed, 8 insertions, 3 deletions
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<QQmlPropertyData *>(&_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 |