diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2011-11-28 16:04:33 +0000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-05 15:33:30 +0100 |
commit | 5ac2990688c7da6ce872bccc5c08129267887d68 (patch) | |
tree | 4099c1f9e415dc3efda5ea97385a5a76824375c6 /src/declarative/qml/v4 | |
parent | 5c9179b19776808acecab4805b10932dc4f9511a (diff) |
Introduce more generic fast property handling
Also reduce the number of direct calls to qt_metacall().
Change-Id: I04cd6e516a3e61058548309a19fe0b830f15c93f
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'src/declarative/qml/v4')
-rw-r--r-- | src/declarative/qml/v4/qv4bindings.cpp | 14 | ||||
-rw-r--r-- | src/declarative/qml/v4/qv4compiler.cpp | 7 | ||||
-rw-r--r-- | src/declarative/qml/v4/qv4instruction.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/v4/qv4instruction_p.h | 7 |
4 files changed, 22 insertions, 8 deletions
diff --git a/src/declarative/qml/v4/qv4bindings.cpp b/src/declarative/qml/v4/qv4bindings.cpp index 835b7e7752..2dc812f47b 100644 --- a/src/declarative/qml/v4/qv4bindings.cpp +++ b/src/declarative/qml/v4/qv4bindings.cpp @@ -46,7 +46,7 @@ #include "qv4compiler_p.h" #include "qv4compiler_p_p.h" -#include <private/qdeclarativefastproperties_p.h> +#include <private/qdeclarativeaccessors_p.h> #include <private/qdeclarativedebugtrace_p.h> #include <private/qdeclarativemetatype_p.h> @@ -760,7 +760,17 @@ void QV4Bindings::run(int instrIndex, quint32 &executedBlocks, reg.init((Register::Type)instr->fetchAndSubscribe.valueType); if (instr->fetchAndSubscribe.valueType >= FirstCleanupType) MARK_REGISTER(instr->fetchAndSubscribe.reg); - QDeclarativeFastProperties::instance()->accessor(instr->fetchAndSubscribe.function)(object, reg.typeDataPtr(), sub); + QDeclarativeAccessors *accessors = instr->fetchAndSubscribe.property.accessors; + accessors->read(object, instr->fetchAndSubscribe.property.accessorData, + reg.typeDataPtr()); + + if (accessors->notifier) { + QDeclarativeNotifier *notifier = 0; + accessors->notifier(object, instr->fetchAndSubscribe.property.accessorData, ¬ifier); + if (notifier) sub->connect(notifier); + } else if (instr->fetchAndSubscribe.property.notifyIndex != -1) { + sub->connect(object, instr->fetchAndSubscribe.property.notifyIndex); + } } } QML_V4_END_INSTR(FetchAndSubscribe, fetchAndSubscribe) diff --git a/src/declarative/qml/v4/qv4compiler.cpp b/src/declarative/qml/v4/qv4compiler.cpp index 1d6cd30a99..e091ce2731 100644 --- a/src/declarative/qml/v4/qv4compiler.cpp +++ b/src/declarative/qml/v4/qv4compiler.cpp @@ -46,7 +46,7 @@ #include "qv4irbuilder_p.h" #include <private/qdeclarativejsast_p.h> -#include <private/qdeclarativefastproperties_p.h> +#include <private/qdeclarativeaccessors_p.h> #include <private/qdeclarativejsengine_p.h> QT_BEGIN_NAMESPACE @@ -323,7 +323,6 @@ void QV4CompilerPrivate::visitName(IR::Name *e) QMetaProperty prop; e->property->load(prop, QDeclarativeEnginePrivate::get(engine)); } - int fastFetchIndex = QDeclarativeFastProperties::instance()->accessorIndexForProperty(e->meta, e->property->coreIndex); const int propTy = e->property->propType; QDeclarativeRegisterType regType; @@ -359,13 +358,13 @@ void QV4CompilerPrivate::visitName(IR::Name *e) break; } // switch - if (fastFetchIndex != -1) { + if (e->property->hasAccessors()) { Instr::FetchAndSubscribe fetch; fetch.reg = currentReg; - fetch.function = fastFetchIndex; fetch.subscription = subscriptionIndex(_subscribeName); fetch.exceptionId = exceptionId(e->line, e->column); fetch.valueType = regType; + fetch.property = *e->property; gen(fetch); } else { if (blockNeedsSubscription(_subscribeName) && e->property->notifyIndex != -1) { diff --git a/src/declarative/qml/v4/qv4instruction.cpp b/src/declarative/qml/v4/qv4instruction.cpp index 411e96b137..ccf91d567b 100644 --- a/src/declarative/qml/v4/qv4instruction.cpp +++ b/src/declarative/qml/v4/qv4instruction.cpp @@ -103,7 +103,7 @@ void Bytecode::dump(const V4Instr *i, int address) const INSTR_DUMP << "\t" << "SubscribeId" << "\t\t" << "Id_Offset(" << i->subscribeop.index << ") -> Subscribe_Slot(" << i->subscribeop.offset << ")"; break; case V4Instr::FetchAndSubscribe: - INSTR_DUMP << "\t" << "FetchAndSubscribe" << "\t" << "Object_Reg(" << i->fetchAndSubscribe.reg << ") Fast_Accessor(" << i->fetchAndSubscribe.function << ") -> Output_Reg(" << i->fetchAndSubscribe.reg << ") Subscription_Slot(" << i->fetchAndSubscribe.subscription << ")"; + INSTR_DUMP << "\t" << "FetchAndSubscribe" << "\t" << "Object_Reg(" << i->fetchAndSubscribe.reg << ") Fast_Accessor(" << i->fetchAndSubscribe.property.accessors << ") -> Output_Reg(" << i->fetchAndSubscribe.reg << ") Subscription_Slot(" << i->fetchAndSubscribe.subscription << ")"; break; case V4Instr::LoadId: INSTR_DUMP << "\t" << "LoadId" << "\t\t\t" << "Id_Offset(" << i->load.index << ") -> Output_Reg(" << i->load.reg << ")"; diff --git a/src/declarative/qml/v4/qv4instruction_p.h b/src/declarative/qml/v4/qv4instruction_p.h index 343df809b4..6f90117c7c 100644 --- a/src/declarative/qml/v4/qv4instruction_p.h +++ b/src/declarative/qml/v4/qv4instruction_p.h @@ -58,6 +58,8 @@ #include <QtCore/qvector.h> #include <QtCore/qvarlengtharray.h> +#include <private/qdeclarativepropertycache_p.h> + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -166,6 +168,9 @@ QT_BEGIN_NAMESPACE # define QML_V4_INSTR_HEADER quint8 type; #endif +class QObject; +class QDeclarativeNotifier; + namespace QDeclarativeJS { union V4Instr { @@ -232,7 +237,7 @@ union V4Instr { quint8 exceptionId; quint8 valueType; quint16 subscription; - quint16 function; + QDeclarativePropertyRawData property; }; struct instr_fetch{ |