mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 10:22:55 +00:00
drop bogus fast declarative properties support
This commit is contained in:
parent
c621a6fa08
commit
289cbb7dd1
4 changed files with 13 additions and 202 deletions
|
@ -130,7 +130,6 @@ set(DECLARATIVE_HEADERS
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/qml/qpodvector_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/qml/qdeclarativevaluetype_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/qml/qdeclarativecompiledbindings_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/qml/qdeclarativefastproperties_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/qml/qmetaobjectbuilder_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/qml/qdeclarativecleanup_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/qml/qdeclarativepropertycache_p.h
|
||||
|
@ -260,7 +259,6 @@ set(DECLARATIVE_SOURCES
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/qml/qdeclarativerewrite.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/qml/qdeclarativevaluetype.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/qml/qdeclarativecompiledbindings.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/qml/qdeclarativefastproperties.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/qml/qmetaobjectbuilder.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/qml/qdeclarativecleanup.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/qml/qdeclarativepropertycache.cpp
|
||||
|
|
|
@ -34,15 +34,11 @@
|
|||
#include <QtCore/qnumeric.h>
|
||||
#include "qdeclarativeanchors_p_p.h"
|
||||
#include "qdeclarativeglobal_p.h"
|
||||
#include "qdeclarativefastproperties_p.h"
|
||||
#include "qdeclarativecommon_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
DEFINE_BOOL_CONFIG_OPTION(qmlDisableOptimizer, QML_DISABLE_OPTIMIZER)
|
||||
DEFINE_BOOL_CONFIG_OPTION(qmlDisableFastProperties, QML_DISABLE_FAST_PROPERTIES)
|
||||
|
||||
Q_GLOBAL_STATIC(QDeclarativeFastProperties, fastProperties)
|
||||
|
||||
#define QML_BEGIN_INSTR(I) case Instr::I:
|
||||
#define QML_END_INSTR(I) break;
|
||||
|
@ -345,7 +341,6 @@ struct Instr {
|
|||
BindingId, /* id */ \
|
||||
Subscribe, /* subscribe */ \
|
||||
SubscribeId, /* subscribe */ \
|
||||
FetchAndSubscribe, /* fetchAndSubscribe */ \
|
||||
LoadId, /* load */ \
|
||||
LoadScope, /* load */ \
|
||||
LoadRoot, /* load */ \
|
||||
|
@ -426,14 +421,6 @@ struct Instr {
|
|||
quint8 exceptionId;
|
||||
quint32 index;
|
||||
} store;
|
||||
struct {
|
||||
quint8 type;
|
||||
qint8 output;
|
||||
qint8 objectReg;
|
||||
quint8 exceptionId;
|
||||
quint16 subscription;
|
||||
quint16 function;
|
||||
} fetchAndSubscribe;
|
||||
struct {
|
||||
quint8 type;
|
||||
qint8 output;
|
||||
|
@ -911,9 +898,6 @@ static void dumpInstruction(const Instr *instr)
|
|||
case Instr::SubscribeId:
|
||||
qWarning().nospace() << "\t" << "SubscribeId" << "\t\t" << instr->subscribe.offset << "\t" << instr->subscribe.reg << "\t" << instr->subscribe.index;
|
||||
break;
|
||||
case Instr::FetchAndSubscribe:
|
||||
qWarning().nospace() << "\t" << "FetchAndSubscribe" << "\t" << instr->fetchAndSubscribe.output << "\t" << instr->fetchAndSubscribe.objectReg << "\t" << instr->fetchAndSubscribe.subscription;
|
||||
break;
|
||||
case Instr::LoadId:
|
||||
qWarning().nospace() << "\t" << "LoadId" << "\t\t\t" << instr->load.index << "\t" << instr->load.reg;
|
||||
break;
|
||||
|
@ -1070,32 +1054,6 @@ void QDeclarativeCompiledBindingsPrivate::run(int instrIndex,
|
|||
}
|
||||
QML_END_INSTR(Subscribe)
|
||||
|
||||
QML_BEGIN_INSTR(FetchAndSubscribe)
|
||||
{
|
||||
const Register &input = registers[instr->fetchAndSubscribe.objectReg];
|
||||
Register &output = registers[instr->fetchAndSubscribe.output];
|
||||
|
||||
if (input.isUndefined()) {
|
||||
throwException(instr->fetchAndSubscribe.exceptionId, error, program, context);
|
||||
return;
|
||||
}
|
||||
|
||||
QObject *object = input.getQObject();
|
||||
if (!object) {
|
||||
output.setUndefined();
|
||||
} else {
|
||||
int subIdx = instr->fetchAndSubscribe.subscription;
|
||||
QDeclarativeCompiledBindingsPrivate::Subscription *sub = 0;
|
||||
if (subIdx != -1) {
|
||||
sub = (subscriptions + subIdx);
|
||||
sub->target = q;
|
||||
sub->targetMethod = methodCount + subIdx;
|
||||
}
|
||||
fastProperties()->accessor(instr->fetchAndSubscribe.function)(object, output.typeDataPtr(), sub);
|
||||
}
|
||||
}
|
||||
QML_END_INSTR(FetchAndSubscribe)
|
||||
|
||||
QML_BEGIN_INSTR(LoadId)
|
||||
registers[instr->load.reg].setQObject(context->idValues[instr->load.index].data());
|
||||
QML_END_INSTR(LoadId)
|
||||
|
@ -2224,34 +2182,23 @@ bool QDeclarativeBindingCompilerPrivate::fetch(Result &rv, const QMetaObject *mo
|
|||
if (prop.revision() > 0)
|
||||
return false;
|
||||
|
||||
int fastFetchIndex = fastProperties()->accessorIndexForProperty(mo, idx);
|
||||
|
||||
Instr fetch;
|
||||
|
||||
if (!qmlDisableFastProperties() && fastFetchIndex != -1) {
|
||||
fetch.common.type = Instr::FetchAndSubscribe;
|
||||
fetch.fetchAndSubscribe.objectReg = reg;
|
||||
fetch.fetchAndSubscribe.output = reg;
|
||||
fetch.fetchAndSubscribe.function = fastFetchIndex;
|
||||
fetch.fetchAndSubscribe.subscription = subscriptionIndex(subName);
|
||||
fetch.fetchAndSubscribe.exceptionId = exceptionId(node);
|
||||
} else {
|
||||
if (subscription(subName, &rv) && prop.hasNotifySignal() && prop.notifySignalIndex() != -1) {
|
||||
Instr sub;
|
||||
sub.common.type = Instr::Subscribe;
|
||||
sub.subscribe.offset = subscriptionIndex(subName);
|
||||
sub.subscribe.reg = reg;
|
||||
sub.subscribe.index = prop.notifySignalIndex();
|
||||
bytecode << sub;
|
||||
}
|
||||
|
||||
fetch.common.type = Instr::Fetch;
|
||||
fetch.fetch.objectReg = reg;
|
||||
fetch.fetch.index = idx;
|
||||
fetch.fetch.output = reg;
|
||||
fetch.fetch.exceptionId = exceptionId(node);
|
||||
if (subscription(subName, &rv) && prop.hasNotifySignal() && prop.notifySignalIndex() != -1) {
|
||||
Instr sub;
|
||||
sub.common.type = Instr::Subscribe;
|
||||
sub.subscribe.offset = subscriptionIndex(subName);
|
||||
sub.subscribe.reg = reg;
|
||||
sub.subscribe.index = prop.notifySignalIndex();
|
||||
bytecode << sub;
|
||||
}
|
||||
|
||||
fetch.common.type = Instr::Fetch;
|
||||
fetch.fetch.objectReg = reg;
|
||||
fetch.fetch.index = idx;
|
||||
fetch.fetch.output = reg;
|
||||
fetch.fetch.exceptionId = exceptionId(node);
|
||||
|
||||
rv.type = prop.userType();
|
||||
rv.metaObject = engine->metaObjectForType(rv.type);
|
||||
rv.reg = reg;
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the QtDeclarative module of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qdeclarativefastproperties_p.h"
|
||||
|
||||
#include "qdeclarativeitem_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
// Adding entries to the QDeclarativeFastProperties class allows the QML
|
||||
// binding optimizer to bypass Qt's meta system and read and, more
|
||||
// importantly, subscribe to properties directly. Any property that is
|
||||
// primarily read from bindings is a candidate for inclusion as a fast
|
||||
// property.
|
||||
|
||||
static void QObject_objectName(QObject *object, void *output, QDeclarativeNotifierEndpoint *endpoint)
|
||||
{
|
||||
if (endpoint)
|
||||
endpoint->connect(QDeclarativeData::get(object, true)->objectNameNotifier());
|
||||
*((QString *)output) = object->objectName();
|
||||
}
|
||||
|
||||
QDeclarativeFastProperties::QDeclarativeFastProperties()
|
||||
{
|
||||
add(&QDeclarativeItem::staticMetaObject, QDeclarativeItem::staticMetaObject.indexOfProperty("parent"),
|
||||
QDeclarativeItemPrivate::parentProperty);
|
||||
add(&QObject::staticMetaObject, QObject::staticMetaObject.indexOfProperty("objectName"),
|
||||
QObject_objectName);
|
||||
}
|
||||
|
||||
int QDeclarativeFastProperties::accessorIndexForProperty(const QMetaObject *metaObject, int propertyIndex)
|
||||
{
|
||||
Q_ASSERT(metaObject);
|
||||
Q_ASSERT(propertyIndex >= 0);
|
||||
|
||||
// Find the "real" metaObject
|
||||
while (metaObject->propertyOffset() > propertyIndex)
|
||||
metaObject = metaObject->superClass();
|
||||
|
||||
QHash<QPair<const QMetaObject *, int>, int>::Iterator iter =
|
||||
m_index.find(qMakePair(metaObject, propertyIndex));
|
||||
if (iter != m_index.end())
|
||||
return *iter;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
void QDeclarativeFastProperties::add(const QMetaObject *metaObject, int propertyIndex, Accessor accessor)
|
||||
{
|
||||
Q_ASSERT(metaObject);
|
||||
Q_ASSERT(propertyIndex >= 0);
|
||||
|
||||
// Find the "real" metaObject
|
||||
while (metaObject->propertyOffset() > propertyIndex)
|
||||
metaObject = metaObject->superClass();
|
||||
|
||||
QPair<const QMetaObject *, int> data = qMakePair(metaObject, propertyIndex);
|
||||
int accessorIndex = m_accessors.count();
|
||||
m_accessors.append(accessor);
|
||||
m_index.insert(data, accessorIndex);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
|
@ -1,53 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the QtDeclarative module of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QDECLARATIVEFASTPROPERTIES_P_H
|
||||
#define QDECLARATIVEFASTPROPERTIES_P_H
|
||||
|
||||
#include <QtCore/qvector.h>
|
||||
#include <QtCore/qhash.h>
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QObject;
|
||||
class QDeclarativeNotifierEndpoint;
|
||||
class QDeclarativeFastProperties
|
||||
{
|
||||
public:
|
||||
typedef void (*Accessor)(QObject *object, void *output, QDeclarativeNotifierEndpoint *endpoint);
|
||||
|
||||
QDeclarativeFastProperties();
|
||||
|
||||
Accessor accessor(int index) const { return m_accessors.at(index); }
|
||||
int accessorIndexForProperty(const QMetaObject *, int);
|
||||
|
||||
private:
|
||||
void add(const QMetaObject *, int, Accessor);
|
||||
|
||||
QHash<QPair<const QMetaObject *, int>, int> m_index;
|
||||
QVector<Accessor> m_accessors;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
#endif // QDECLARATIVEFASTPROPERTIES_P_H
|
Loading…
Add table
Reference in a new issue