diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-11-02 20:35:33 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-12 18:20:30 +0100 |
commit | 7a092000169a8e9d537f3d341ef48277397f997d (patch) | |
tree | f29f189d57e4923dff2decfd073b8e04f4a211a8 /src/qml/jsruntime/qv4qobjectwrapper.cpp | |
parent | 7c6d2d78fe0997dfebba5569f097bdacbba5a861 (diff) |
Fix property dependency generation for accelerated QML QObject properties
The previous approach of collecting the dependencies through an IR visitor
doesn't work, because it relies on a fixed structure - for example MEMBER(NAME,
prop) - which we can't guarantee (it's usually MEMBER(TEMP, prop)). But it
turns out that we can only pre-calculate dependencies for context, scope or id
properties, so we can do that right away in the QML specific JS codegen, store
that information in the IR function and use it from there in the data structure
generator as well as in the isel as a parameter to getQObjectProperty to tell
the run-time whether capture is required or not.
Change-Id: I33711c3420d6534c653c2a6a4284f0fc12e941cf
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4qobjectwrapper.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 578c7310f2..f9c7b5ac6c 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -334,7 +334,7 @@ ReturnedValue QObjectWrapper::getQmlProperty(ExecutionContext *ctx, QQmlContextD return getProperty(ctx, result); } -ReturnedValue QObjectWrapper::getProperty(ExecutionContext *ctx, QQmlPropertyData *property) +ReturnedValue QObjectWrapper::getProperty(ExecutionContext *ctx, QQmlPropertyData *property, bool captureRequired) { QV4::Scope scope(ctx); @@ -371,17 +371,19 @@ ReturnedValue QObjectWrapper::getProperty(ExecutionContext *ctx, QQmlPropertyDat QV4::ScopedValue rv(scope, LoadProperty<ReadAccessor::Accessor>(ctx->engine->v8Engine, m_object, *property, nptr)); - if (property->accessors->notifier) { - if (n) - ep->captureProperty(n); - } else { - ep->captureProperty(m_object, property->coreIndex, property->notifyIndex); + if (captureRequired) { + if (property->accessors->notifier) { + if (n) + ep->captureProperty(n); + } else { + ep->captureProperty(m_object, property->coreIndex, property->notifyIndex); + } } return rv.asReturnedValue(); } - if (ep && !property->isConstant()) + if (captureRequired && ep && !property->isConstant()) ep->captureProperty(m_object, property->coreIndex, property->notifyIndex); if (property->isVarProperty()) { @@ -614,7 +616,7 @@ ReturnedValue QObjectWrapper::wrap(ExecutionEngine *engine, QObject *object) } } -ReturnedValue QObjectWrapper::getProperty(ExecutionContext *ctx, int propertyIndex) +ReturnedValue QObjectWrapper::getProperty(ExecutionContext *ctx, int propertyIndex, bool captureRequired) { if (QQmlData::wasDeleted(m_object)) return QV4::Encode::null(); @@ -626,7 +628,7 @@ ReturnedValue QObjectWrapper::getProperty(ExecutionContext *ctx, int propertyInd Q_ASSERT(cache); QQmlPropertyData *property = cache->property(propertyIndex); Q_ASSERT(property); // We resolved this property earlier, so it better exist! - return getProperty(ctx, property); + return getProperty(ctx, property, captureRequired); } void QObjectWrapper::setProperty(ExecutionContext *ctx, int propertyIndex, const ValueRef value) |