diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2016-07-12 15:11:03 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-07-14 08:49:45 +0000 |
commit | cc7cf5f5705553b625c1b28b49c41587b587bb38 (patch) | |
tree | 48f88de93edc2acc79601dfa2e38102b040f8db3 /src | |
parent | be491913c036b148cd4f90fa0132e269a507dbad (diff) |
Revert "QML: When available, use QQmlAccessors to read properties."
This reverts commit f6fee09942de7901a708c4e16db0c7c82550e8c5. The accessor
pointers were embedded in the generated machine/byte code, which makes it
non-relocatable. As discussed, for the moment the ability to have relocatable
code is prioritized. But the goal is to re-enable accessor accelerated property
access through lookups.
Change-Id: I18ec9ce31901c1fae3e58ac0c41bc87791e8c380
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/compiler/qv4instr_moth_p.h | 90 | ||||
-rw-r--r-- | src/qml/compiler/qv4isel_moth.cpp | 104 | ||||
-rw-r--r-- | src/qml/compiler/qv4isel_moth_p.h | 4 | ||||
-rw-r--r-- | src/qml/compiler/qv4isel_p.cpp | 7 | ||||
-rw-r--r-- | src/qml/compiler/qv4isel_p.h | 5 | ||||
-rw-r--r-- | src/qml/compiler/qv4jsir.cpp | 12 | ||||
-rw-r--r-- | src/qml/jit/qv4isel_masm.cpp | 79 | ||||
-rw-r--r-- | src/qml/jit/qv4isel_masm_p.h | 4 | ||||
-rw-r--r-- | src/qml/jit/qv4regalloc.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper_p.h | 1 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4runtime.cpp | 172 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4runtime_p.h | 5 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4runtimeapi_p.h | 21 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4vme_moth.cpp | 40 | ||||
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 1 |
15 files changed, 22 insertions, 527 deletions
diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h index 93043135a4..93a7170e68 100644 --- a/src/qml/compiler/qv4instr_moth_p.h +++ b/src/qml/compiler/qv4instr_moth_p.h @@ -81,19 +81,9 @@ QT_BEGIN_NAMESPACE F(SetLookup, setLookup) \ F(StoreQObjectProperty, storeQObjectProperty) \ F(LoadQObjectProperty, loadQObjectProperty) \ - F(LoadQRealQObjectPropertyDirectly, loadQRealQObjectPropertyDirectly) \ - F(LoadQObjectQObjectPropertyDirectly, loadQObjectQObjectPropertyDirectly) \ - F(LoadIntQObjectPropertyDirectly, loadIntQObjectPropertyDirectly) \ - F(LoadBoolQObjectPropertyDirectly, loadBoolQObjectPropertyDirectly) \ - F(LoadQStringQObjectPropertyDirectly, loadQStringQObjectPropertyDirectly) \ F(StoreScopeObjectProperty, storeScopeObjectProperty) \ F(StoreContextObjectProperty, storeContextObjectProperty) \ F(LoadScopeObjectProperty, loadScopeObjectProperty) \ - F(LoadScopeObjectQRealPropertyDirectly, loadScopeObjectQRealPropertyDirectly) \ - F(LoadScopeObjectQObjectPropertyDirectly, loadScopeObjectQObjectPropertyDirectly) \ - F(LoadScopeObjectIntPropertyDirectly, loadScopeObjectIntPropertyDirectly) \ - F(LoadScopeObjectBoolPropertyDirectly, loadScopeObjectBoolPropertyDirectly) \ - F(LoadScopeObjectQStringPropertyDirectly, loadScopeObjectQStringPropertyDirectly) \ F(LoadContextObjectProperty, loadContextObjectProperty) \ F(LoadIdObject, loadIdObject) \ F(LoadAttachedQObjectProperty, loadAttachedQObjectProperty) \ @@ -333,36 +323,6 @@ union Instr Param base; Param result; }; - struct instr_loadScopeObjectQRealPropertyDirectly { - MOTH_INSTR_HEADER - Param base; - Param result; - QQmlAccessors *accessors; - }; - struct instr_loadScopeObjectQObjectPropertyDirectly { - MOTH_INSTR_HEADER - Param base; - Param result; - QQmlAccessors *accessors; - }; - struct instr_loadScopeObjectIntPropertyDirectly { - MOTH_INSTR_HEADER - Param base; - Param result; - QQmlAccessors *accessors; - }; - struct instr_loadScopeObjectBoolPropertyDirectly { - MOTH_INSTR_HEADER - Param base; - Param result; - QQmlAccessors *accessors; - }; - struct instr_loadScopeObjectQStringPropertyDirectly { - MOTH_INSTR_HEADER - Param base; - Param result; - QQmlAccessors *accessors; - }; struct instr_loadContextObjectProperty { MOTH_INSTR_HEADER int propertyIndex; @@ -382,46 +342,6 @@ union Instr Param result; bool captureRequired; }; - struct instr_loadQRealQObjectPropertyDirectly { - MOTH_INSTR_HEADER - Param base; - Param result; - QQmlAccessors *accessors; - int coreIndex; - int notifyIndex; - }; - struct instr_loadQObjectQObjectPropertyDirectly { - MOTH_INSTR_HEADER - Param base; - Param result; - QQmlAccessors *accessors; - int coreIndex; - int notifyIndex; - }; - struct instr_loadIntQObjectPropertyDirectly { - MOTH_INSTR_HEADER - Param base; - Param result; - QQmlAccessors *accessors; - int coreIndex; - int notifyIndex; - }; - struct instr_loadBoolQObjectPropertyDirectly { - MOTH_INSTR_HEADER - Param base; - Param result; - QQmlAccessors *accessors; - int coreIndex; - int notifyIndex; - }; - struct instr_loadQStringQObjectPropertyDirectly { - MOTH_INSTR_HEADER - Param base; - Param result; - QQmlAccessors *accessors; - int coreIndex; - int notifyIndex; - }; struct instr_loadAttachedQObjectProperty { MOTH_INSTR_HEADER int propertyIndex; @@ -880,19 +800,9 @@ union Instr instr_loadProperty loadProperty; instr_getLookup getLookup; instr_loadScopeObjectProperty loadScopeObjectProperty; - instr_loadScopeObjectQRealPropertyDirectly loadScopeObjectQRealPropertyDirectly; - instr_loadScopeObjectQObjectPropertyDirectly loadScopeObjectQObjectPropertyDirectly; - instr_loadScopeObjectIntPropertyDirectly loadScopeObjectIntPropertyDirectly; - instr_loadScopeObjectBoolPropertyDirectly loadScopeObjectBoolPropertyDirectly; - instr_loadScopeObjectQStringPropertyDirectly loadScopeObjectQStringPropertyDirectly; instr_loadContextObjectProperty loadContextObjectProperty; instr_loadIdObject loadIdObject; instr_loadQObjectProperty loadQObjectProperty; - instr_loadQRealQObjectPropertyDirectly loadQRealQObjectPropertyDirectly; - instr_loadQObjectQObjectPropertyDirectly loadQObjectQObjectPropertyDirectly; - instr_loadIntQObjectPropertyDirectly loadIntQObjectPropertyDirectly; - instr_loadBoolQObjectPropertyDirectly loadBoolQObjectPropertyDirectly; - instr_loadQStringQObjectPropertyDirectly loadQStringQObjectPropertyDirectly; instr_loadAttachedQObjectProperty loadAttachedQObjectProperty; instr_storeProperty storeProperty; instr_setLookup setLookup; diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp index 967dca13a1..8814ad8a78 100644 --- a/src/qml/compiler/qv4isel_moth.cpp +++ b/src/qml/compiler/qv4isel_moth.cpp @@ -46,8 +46,6 @@ #include <private/qv4regexpobject_p.h> #include <private/qv4compileddata_p.h> #include <private/qqmlengine_p.h> -#include "qml/qqmlaccessors_p.h" -#include "qml/qqmlpropertycache_p.h" #undef USE_TYPE_INFO @@ -739,51 +737,8 @@ void InstructionSelection::setQObjectProperty(IR::Expr *source, IR::Expr *target addInstruction(store); } -void InstructionSelection::getQmlContextProperty(IR::Expr *source, IR::Member::MemberKind kind, - QQmlPropertyData *property, int index, - IR::Expr *target) -{ - if (property && property->hasAccessors() && property->isFullyResolved()) { - if (kind == IR::Member::MemberOfQmlScopeObject) { - if (property->propType == QMetaType::QReal) { - Instruction::LoadScopeObjectQRealPropertyDirectly load; - load.base = getParam(source); - load.accessors = property->accessors; - load.result = getResultParam(target); - addInstruction(load); - return; - } else if (property->isQObject()) { - Instruction::LoadScopeObjectQObjectPropertyDirectly load; - load.base = getParam(source); - load.accessors = property->accessors; - load.result = getResultParam(target); - addInstruction(load); - return; - } else if (property->propType == QMetaType::Int) { - Instruction::LoadScopeObjectIntPropertyDirectly load; - load.base = getParam(source); - load.accessors = property->accessors; - load.result = getResultParam(target); - addInstruction(load); - return; - } else if (property->propType == QMetaType::Bool) { - Instruction::LoadScopeObjectBoolPropertyDirectly load; - load.base = getParam(source); - load.accessors = property->accessors; - load.result = getResultParam(target); - addInstruction(load); - return; - } else if (property->propType == QMetaType::QString) { - Instruction::LoadScopeObjectQStringPropertyDirectly load; - load.base = getParam(source); - load.accessors = property->accessors; - load.result = getResultParam(target); - addInstruction(load); - return; - } - } - } - +void InstructionSelection::getQmlContextProperty(IR::Expr *source, IR::Member::MemberKind kind, int index, IR::Expr *target) +{ if (kind == IR::Member::MemberOfQmlScopeObject) { Instruction::LoadScopeObjectProperty load; load.base = getParam(source); @@ -807,59 +762,8 @@ void InstructionSelection::getQmlContextProperty(IR::Expr *source, IR::Member::M } } -void InstructionSelection::getQObjectProperty(IR::Expr *base, QQmlPropertyData *property, bool captureRequired, bool isSingletonProperty, int attachedPropertiesId, IR::Expr *target) -{ - if (property && property->hasAccessors() && property->isFullyResolved()) { - if (!attachedPropertiesId && !isSingletonProperty) { - if (property->propType == QMetaType::QReal) { - Instruction::LoadQRealQObjectPropertyDirectly load; - load.base = getParam(base); - load.accessors = property->accessors; - load.coreIndex = property->coreIndex; - load.notifyIndex = captureRequired ? property->notifyIndex : -1; - load.result = getResultParam(target); - addInstruction(load); - return; - } else if (property->isQObject()) { - Instruction::LoadQObjectQObjectPropertyDirectly load; - load.base = getParam(base); - load.accessors = property->accessors; - load.coreIndex = property->coreIndex; - load.notifyIndex = captureRequired ? property->notifyIndex : -1; - load.result = getResultParam(target); - addInstruction(load); - return; - } else if (property->propType == QMetaType::Int) { - Instruction::LoadIntQObjectPropertyDirectly load; - load.base = getParam(base); - load.accessors = property->accessors; - load.coreIndex = property->coreIndex; - load.notifyIndex = captureRequired ? property->notifyIndex : -1; - load.result = getResultParam(target); - addInstruction(load); - return; - } else if (property->propType == QMetaType::Bool) { - Instruction::LoadBoolQObjectPropertyDirectly load; - load.base = getParam(base); - load.accessors = property->accessors; - load.coreIndex = property->coreIndex; - load.notifyIndex = captureRequired ? property->notifyIndex : -1; - load.result = getResultParam(target); - addInstruction(load); - return; - } else if (property->propType == QMetaType::QString) { - Instruction::LoadQStringQObjectPropertyDirectly load; - load.base = getParam(base); - load.accessors = property->accessors; - load.coreIndex = property->coreIndex; - load.notifyIndex = captureRequired ? property->notifyIndex : -1; - load.result = getResultParam(target); - addInstruction(load); - return; - } - } - } - const int propertyIndex = property->coreIndex; +void InstructionSelection::getQObjectProperty(IR::Expr *base, int propertyIndex, bool captureRequired, bool isSingletonProperty, int attachedPropertiesId, IR::Expr *target) +{ if (attachedPropertiesId != 0) { Instruction::LoadAttachedQObjectProperty load; load.propertyIndex = propertyIndex; diff --git a/src/qml/compiler/qv4isel_moth_p.h b/src/qml/compiler/qv4isel_moth_p.h index bf3909682d..29d117af38 100644 --- a/src/qml/compiler/qv4isel_moth_p.h +++ b/src/qml/compiler/qv4isel_moth_p.h @@ -134,8 +134,8 @@ protected: virtual void setProperty(IR::Expr *source, IR::Expr *targetBase, const QString &targetName); virtual void setQmlContextProperty(IR::Expr *source, IR::Expr *targetBase, IR::Member::MemberKind kind, int propertyIndex); virtual void setQObjectProperty(IR::Expr *source, IR::Expr *targetBase, int propertyIndex); - virtual void getQmlContextProperty(IR::Expr *source, IR::Member::MemberKind kind, QQmlPropertyData *property, int index, IR::Expr *target); - virtual void getQObjectProperty(IR::Expr *base, QQmlPropertyData *property, bool captureRequired, bool isSingleton, int attachedPropertiesId, IR::Expr *target); + virtual void getQmlContextProperty(IR::Expr *source, IR::Member::MemberKind kind, int index, IR::Expr *target); + virtual void getQObjectProperty(IR::Expr *base, int propertyIndex, bool captureRequired, bool isSingleton, int attachedPropertiesId, IR::Expr *target); virtual void getElement(IR::Expr *base, IR::Expr *index, IR::Expr *target); virtual void setElement(IR::Expr *source, IR::Expr *targetBase, IR::Expr *targetIndex); virtual void copyValue(IR::Expr *source, IR::Expr *target); diff --git a/src/qml/compiler/qv4isel_p.cpp b/src/qml/compiler/qv4isel_p.cpp index 6ba23a0951..0ae08160ab 100644 --- a/src/qml/compiler/qv4isel_p.cpp +++ b/src/qml/compiler/qv4isel_p.cpp @@ -156,15 +156,14 @@ void IRDecoder::visitMove(IR::Move *s) } } if (m->kind == IR::Member::MemberOfQmlScopeObject || m->kind == IR::Member::MemberOfQmlContextObject) { - getQmlContextProperty(m->base, (IR::Member::MemberKind)m->kind, m->property, - m->property->coreIndex, s->target); + getQmlContextProperty(m->base, (IR::Member::MemberKind)m->kind, m->property->coreIndex, s->target); return; } - getQObjectProperty(m->base, m->property, captureRequired, isSingletonProperty, attachedPropertiesId, s->target); + getQObjectProperty(m->base, m->property->coreIndex, captureRequired, isSingletonProperty, attachedPropertiesId, s->target); #endif // V4_BOOTSTRAP return; } else if (m->kind == IR::Member::MemberOfIdObjectsArray) { - getQmlContextProperty(m->base, (IR::Member::MemberKind)m->kind, nullptr, m->idIndex, s->target); + getQmlContextProperty(m->base, (IR::Member::MemberKind)m->kind, m->idIndex, s->target); return; } else if (m->base->asTemp() || m->base->asConst() || m->base->asArgLocal()) { getProperty(m->base, *m->name, s->target); diff --git a/src/qml/compiler/qv4isel_p.h b/src/qml/compiler/qv4isel_p.h index 61fd11c435..ecafafcea1 100644 --- a/src/qml/compiler/qv4isel_p.h +++ b/src/qml/compiler/qv4isel_p.h @@ -61,7 +61,6 @@ QT_BEGIN_NAMESPACE -class QQmlAccessors; class QQmlEnginePrivate; namespace QV4 { @@ -183,8 +182,8 @@ public: // to implement by subclasses: virtual void setActivationProperty(IR::Expr *source, const QString &targetName) = 0; virtual void initClosure(IR::Closure *closure, IR::Expr *target) = 0; virtual void getProperty(IR::Expr *base, const QString &name, IR::Expr *target) = 0; - virtual void getQObjectProperty(IR::Expr *base, QQmlPropertyData *property, bool captureRequired, bool isSingletonProperty, int attachedPropertiesId, IR::Expr *target) = 0; - virtual void getQmlContextProperty(IR::Expr *source, IR::Member::MemberKind kind, QQmlPropertyData *property, int index, IR::Expr *target) = 0; + virtual void getQObjectProperty(IR::Expr *base, int propertyIndex, bool captureRequired, bool isSingletonProperty, int attachedPropertiesId, IR::Expr *target) = 0; + virtual void getQmlContextProperty(IR::Expr *source, IR::Member::MemberKind kind, int index, IR::Expr *target) = 0; virtual void setProperty(IR::Expr *source, IR::Expr *targetBase, const QString &targetName) = 0; virtual void setQmlContextProperty(IR::Expr *source, IR::Expr *targetBase, IR::Member::MemberKind kind, int propertyIndex) = 0; virtual void setQObjectProperty(IR::Expr *source, IR::Expr *targetBase, int propertyIndex) = 0; diff --git a/src/qml/compiler/qv4jsir.cpp b/src/qml/compiler/qv4jsir.cpp index 583311d1ae..b6c5226894 100644 --- a/src/qml/compiler/qv4jsir.cpp +++ b/src/qml/compiler/qv4jsir.cpp @@ -910,16 +910,12 @@ void IRPrinter::visitMember(Member *e) visit(e->base); *out << '.' << *e->name; #ifndef V4_BOOTSTRAP - if (e->property) { + if (e->property) *out << " (meta-property " << e->property->coreIndex - << " <" << QMetaType::typeName(e->property->propType) << ">"; - if (e->property->hasAccessors() && e->property->isFullyResolved()) { - *out << ", accessible"; - } - *out << ")"; - } else if (e->kind == Member::MemberOfIdObjectsArray) { + << " <" << QMetaType::typeName(e->property->propType) + << ">)"; + else if (e->kind == Member::MemberOfIdObjectsArray) *out << "(id object " << e->idIndex << ")"; - } #endif } diff --git a/src/qml/jit/qv4isel_masm.cpp b/src/qml/jit/qv4isel_masm.cpp index d3c624ff60..a45d74bb4c 100644 --- a/src/qml/jit/qv4isel_masm.cpp +++ b/src/qml/jit/qv4isel_masm.cpp @@ -49,7 +49,6 @@ #include "qv4assembler_p.h" #include "qv4unop_p.h" #include "qv4binop_p.h" -#include <private/qqmlpropertycache_p.h> #include <QtCore/QBuffer> #include <QtCore/QCoreApplication> @@ -754,39 +753,8 @@ void InstructionSelection::getProperty(IR::Expr *base, const QString &name, IR:: } } -void InstructionSelection::getQmlContextProperty(IR::Expr *base, IR::Member::MemberKind kind, QQmlPropertyData *property, int index, IR::Expr *target) +void InstructionSelection::getQmlContextProperty(IR::Expr *base, IR::Member::MemberKind kind, int index, IR::Expr *target) { - if (property && property->hasAccessors() && property->isFullyResolved()) { - if (kind == IR::Member::MemberOfQmlScopeObject) { - if (property->propType == QMetaType::QReal) { - generateRuntimeCall(target, accessQmlScopeObjectQRealProperty, - Assembler::PointerToValue(base), - Assembler::TrustedImmPtr(property->accessors)); - return; - } else if (property->isQObject()) { - generateRuntimeCall(target, accessQmlScopeObjectQObjectProperty, - Assembler::PointerToValue(base), - Assembler::TrustedImmPtr(property->accessors)); - return; - } else if (property->propType == QMetaType::Int) { - generateRuntimeCall(target, accessQmlScopeObjectIntProperty, - Assembler::PointerToValue(base), - Assembler::TrustedImmPtr(property->accessors)); - return; - } else if (property->propType == QMetaType::Bool) { - generateRuntimeCall(target, accessQmlScopeObjectBoolProperty, - Assembler::PointerToValue(base), - Assembler::TrustedImmPtr(property->accessors)); - return; - } else if (property->propType == QMetaType::QString) { - generateRuntimeCall(target, accessQmlScopeObjectQStringProperty, - Assembler::PointerToValue(base), - Assembler::TrustedImmPtr(property->accessors)); - return; - } - } - } - if (kind == IR::Member::MemberOfQmlScopeObject) generateRuntimeCall(target, getQmlScopeObjectProperty, Assembler::EngineRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(index)); else if (kind == IR::Member::MemberOfQmlContextObject) @@ -797,51 +765,8 @@ void InstructionSelection::getQmlContextProperty(IR::Expr *base, IR::Member::Mem Q_ASSERT(false); } -void InstructionSelection::getQObjectProperty(IR::Expr *base, QQmlPropertyData *property, bool captureRequired, bool isSingleton, int attachedPropertiesId, IR::Expr *target) +void InstructionSelection::getQObjectProperty(IR::Expr *base, int propertyIndex, bool captureRequired, bool isSingleton, int attachedPropertiesId, IR::Expr *target) { - if (property && property->hasAccessors() && property->isFullyResolved()) { - if (!attachedPropertiesId && !isSingleton) { - const int notifyIndex = captureRequired ? property->notifyIndex : -1; - if (property->propType == QMetaType::QReal) { - generateRuntimeCall(target, accessQObjectQRealProperty, - Assembler::EngineRegister, Assembler::PointerToValue(base), - Assembler::TrustedImmPtr(property->accessors), - Assembler::TrustedImm32(property->coreIndex), - Assembler::TrustedImm32(notifyIndex)); - return; - } else if (property->isQObject()) { - generateRuntimeCall(target, accessQObjectQObjectProperty, - Assembler::EngineRegister, Assembler::PointerToValue(base), - Assembler::TrustedImmPtr(property->accessors), - Assembler::TrustedImm32(property->coreIndex), - Assembler::TrustedImm32(notifyIndex)); - return; - } else if (property->propType == QMetaType::Int) { - generateRuntimeCall(target, accessQObjectIntProperty, - Assembler::EngineRegister, Assembler::PointerToValue(base), - Assembler::TrustedImmPtr(property->accessors), - Assembler::TrustedImm32(property->coreIndex), - Assembler::TrustedImm32(notifyIndex)); - return; - } else if (property->propType == QMetaType::Bool) { - generateRuntimeCall(target, accessQObjectBoolProperty, - Assembler::EngineRegister, Assembler::PointerToValue(base), - Assembler::TrustedImmPtr(property->accessors), - Assembler::TrustedImm32(property->coreIndex), - Assembler::TrustedImm32(notifyIndex)); - return; - } else if (property->propType == QMetaType::QString) { - generateRuntimeCall(target, accessQObjectQStringProperty, - Assembler::EngineRegister, Assembler::PointerToValue(base), - Assembler::TrustedImmPtr(property->accessors), - Assembler::TrustedImm32(property->coreIndex), - Assembler::TrustedImm32(notifyIndex)); - return; - } - } - } - - const int propertyIndex = property->coreIndex; if (attachedPropertiesId != 0) generateRuntimeCall(target, getQmlAttachedProperty, Assembler::EngineRegister, Assembler::TrustedImm32(attachedPropertiesId), Assembler::TrustedImm32(propertyIndex)); else if (isSingleton) diff --git a/src/qml/jit/qv4isel_masm_p.h b/src/qml/jit/qv4isel_masm_p.h index db9d440e83..a92196f5f7 100644 --- a/src/qml/jit/qv4isel_masm_p.h +++ b/src/qml/jit/qv4isel_masm_p.h @@ -124,8 +124,8 @@ protected: virtual void setActivationProperty(IR::Expr *source, const QString &targetName); virtual void initClosure(IR::Closure *closure, IR::Expr *target); virtual void getProperty(IR::Expr *base, const QString &name, IR::Expr *target); - virtual void getQmlContextProperty(IR::Expr *source, IR::Member::MemberKind kind, QQmlPropertyData *property, int index, IR::Expr *target); - virtual void getQObjectProperty(IR::Expr *base, QQmlPropertyData *property, bool captureRequired, bool isSingleton, int attachedPropertiesId, IR::Expr *target); + virtual void getQmlContextProperty(IR::Expr *source, IR::Member::MemberKind kind, int index, IR::Expr *target); + virtual void getQObjectProperty(IR::Expr *base, int propertyIndex, bool captureRequired, bool isSingleton, int attachedPropertiesId, IR::Expr *target); virtual void setProperty(IR::Expr *source, IR::Expr *targetBase, const QString &targetName); virtual void setQmlContextProperty(IR::Expr *source, IR::Expr *targetBase, IR::Member::MemberKind kind, int propertyIndex); virtual void setQObjectProperty(IR::Expr *source, IR::Expr *targetBase, int propertyIndex); diff --git a/src/qml/jit/qv4regalloc.cpp b/src/qml/jit/qv4regalloc.cpp index 04b8b83b4a..deef719b67 100644 --- a/src/qml/jit/qv4regalloc.cpp +++ b/src/qml/jit/qv4regalloc.cpp @@ -528,14 +528,14 @@ protected: // IRDecoder addCall(); } - virtual void getQmlContextProperty(IR::Expr *base, IR::Member::MemberKind /*kind*/, QQmlPropertyData * /*property*/, int /*index*/, IR::Expr *target) + virtual void getQmlContextProperty(IR::Expr *base, IR::Member::MemberKind /*kind*/, int /*index*/, IR::Expr *target) { addDef(target); addUses(base->asTemp(), Use::CouldHaveRegister); addCall(); } - virtual void getQObjectProperty(IR::Expr *base, QQmlPropertyData * /*property*/, bool /*captureRequired*/, bool /*isSingleton*/, int /*attachedPropertiesId*/, IR::Expr *target) + virtual void getQObjectProperty(IR::Expr *base, int /*propertyIndex*/, bool /*captureRequired*/, bool /*isSingleton*/, int /*attachedPropertiesId*/, IR::Expr *target) { addDef(target); addUses(base->asTemp(), Use::CouldHaveRegister); diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h index dab59886de..8ab5c96c3a 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper_p.h +++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h @@ -59,7 +59,6 @@ #include <private/qqmldata_p.h> #include <private/qqmlpropertycache_p.h> #include <private/qintrusivelist_p.h> -#include <private/qqmlaccessors_p.h> #include <private/qv4value_p.h> #include <private/qv4functionobject_p.h> diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 66ea6b33d3..a69874cacb 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -1443,116 +1443,6 @@ ReturnedValue Runtime::method_getQmlQObjectProperty(ExecutionEngine *engine, con return QV4::QObjectWrapper::getProperty(scope.engine, wrapper->object(), propertyIndex, captureRequired); } -template <typename PropertyType> -static inline PropertyType getQObjectProperty(QObject *object, ExecutionEngine *engine, QQmlAccessors *accessors, int coreIndex, int notifyIndex) -{ - PropertyType t; - accessors->read(object, &t); - if (notifyIndex != -1) { - QQmlEnginePrivate *ep = engine->qmlEngine() ? QQmlEnginePrivate::get(engine->qmlEngine()) : 0; - if (ep && ep->propertyCapture) { - if (accessors->notifier) { - QQmlNotifier *n = nullptr; - accessors->notifier(object, &n); - if (n) { - ep->propertyCapture->captureProperty(n); - } - } else { - ep->propertyCapture->captureProperty(object, coreIndex, notifyIndex); - } - } - } - - return t; -} - -ReturnedValue Runtime::method_accessQObjectQRealProperty(ExecutionEngine *engine, - const Value &object, - QQmlAccessors *accessors, int coreIndex, - int notifyIndex) -{ - auto casted = object.as<QObjectWrapper>(); - QObject *o = casted ? casted->object() : nullptr; - if (Q_LIKELY(o)) { - return QV4::Encode(getQObjectProperty<qreal>(o, engine, accessors, coreIndex, notifyIndex)); - } - engine->throwTypeError(QStringLiteral("Cannot read property of null")); - return Encode::undefined(); -} - -ReturnedValue Runtime::method_accessQObjectQObjectProperty(ExecutionEngine *engine, - const Value &object, - QQmlAccessors *accessors, int coreIndex, - int notifyIndex) -{ - auto casted = object.as<QObjectWrapper>(); - QObject *o = casted ? casted->object() : nullptr; - if (Q_LIKELY(o)) { - return QV4::QObjectWrapper::wrap(engine, getQObjectProperty<QObject *>(o, engine, accessors, - coreIndex, - notifyIndex)); - } - - engine->throwTypeError(QStringLiteral("Cannot read property of null")); - return Encode::undefined(); -} - -ReturnedValue Runtime::method_accessQObjectIntProperty(ExecutionEngine *engine, const Value &object, - QQmlAccessors *accessors, int coreIndex, - int notifyIndex) -{ - auto casted = object.as<QObjectWrapper>(); - QObject *o = casted ? casted->object() : nullptr; - if (Q_LIKELY(o)) { - return QV4::Encode(getQObjectProperty<int>(o, engine, accessors, coreIndex, notifyIndex)); - } - engine->throwTypeError(QStringLiteral("Cannot read property of null")); - return Encode::undefined(); -} - -ReturnedValue Runtime::method_accessQObjectBoolProperty(ExecutionEngine *engine, const Value &object, - QQmlAccessors *accessors, int coreIndex, - int notifyIndex) -{ - auto casted = object.as<QObjectWrapper>(); - QObject *o = casted ? casted->object() : nullptr; - if (Q_LIKELY(o)) { - return QV4::Encode(getQObjectProperty<bool>(o, engine, accessors, coreIndex, notifyIndex)); - } - engine->throwTypeError(QStringLiteral("Cannot read property of null")); - return Encode::undefined(); -} - -ReturnedValue Runtime::method_accessQObjectQStringProperty(ExecutionEngine *engine, - const Value &object, - QQmlAccessors *accessors, int coreIndex, - int notifyIndex) -{ - auto casted = object.as<QObjectWrapper>(); - QObject *o = casted ? casted->object() : nullptr; - if (Q_LIKELY(o)) { - return QV4::Encode(engine->newString(getQObjectProperty<QString>(o, engine, accessors, - coreIndex, notifyIndex))); - } - engine->throwTypeError(QStringLiteral("Cannot read property of null")); - return Encode::undefined(); -} - -ReturnedValue Runtime::method_accessQmlScopeObjectQObjectProperty(const Value &context, - QQmlAccessors *accessors) -{ -#ifndef V4_BOOTSTRAP - const QmlContext &c = static_cast<const QmlContext &>(context); - QObject *rv = 0; - accessors->read(c.d()->qml->scopeObject, &rv); - return QV4::QObjectWrapper::wrap(c.engine(), rv); -#else - Q_UNUSED(context); - Q_UNUSED(accessors); - return QV4::Encode::undefined(); -#endif -} - QV4::ReturnedValue Runtime::method_getQmlAttachedProperty(ExecutionEngine *engine, int attachedPropertiesId, int propertyIndex) { QObject *scopeObject = engine->qmlScopeObject(); @@ -1934,68 +1824,6 @@ Bool Runtime::method_toBoolean(const Value &value) return value.toBoolean(); } -ReturnedValue Runtime::method_accessQmlScopeObjectQRealProperty(const Value &context, - QQmlAccessors *accessors) -{ -#ifndef V4_BOOTSTRAP - const QmlContext &c = static_cast<const QmlContext &>(context); - qreal rv = 0; - accessors->read(c.d()->qml->scopeObject, &rv); - return QV4::Encode(rv); -#else - Q_UNUSED(context); - Q_UNUSED(accessors); - return QV4::Encode::undefined(); -#endif -} - -ReturnedValue Runtime::method_accessQmlScopeObjectIntProperty(const Value &context, - QQmlAccessors *accessors) -{ -#ifndef V4_BOOTSTRAP - const QmlContext &c = static_cast<const QmlContext &>(context); - int rv = 0; - accessors->read(c.d()->qml->scopeObject, &rv); - return QV4::Encode(rv); -#else - Q_UNUSED(context); - Q_UNUSED(accessors); - return QV4::Encode::undefined(); -#endif -} - -ReturnedValue Runtime::method_accessQmlScopeObjectBoolProperty(const Value &context, - QQmlAccessors *accessors) -{ -#ifndef V4_BOOTSTRAP - const QmlContext &c = static_cast<const QmlContext &>(context); - bool rv = false; - accessors->read(c.d()->qml->scopeObject, &rv); - return QV4::Encode(rv); -#else - Q_UNUSED(context); - Q_UNUSED(accessors); - return QV4::Encode::undefined(); -#endif -} - -ReturnedValue Runtime::method_accessQmlScopeObjectQStringProperty(ExecutionEngine *engine, - const Value &context, - QQmlAccessors *accessors) -{ -#ifndef V4_BOOTSTRAP - const QmlContext &c = static_cast<const QmlContext &>(context); - QString rv; - accessors->read(c.d()->qml->scopeObject, &rv); - return QV4::Encode(engine->newString(rv)); -#else - Q_UNUSED(engine); - Q_UNUSED(context); - Q_UNUSED(accessors); - return QV4::Encode::undefined(); -#endif -} - #endif // V4_BOOTSTRAP } // namespace QV4 diff --git a/src/qml/jsruntime/qv4runtime_p.h b/src/qml/jsruntime/qv4runtime_p.h index 975d100ef4..88c09ec5f9 100644 --- a/src/qml/jsruntime/qv4runtime_p.h +++ b/src/qml/jsruntime/qv4runtime_p.h @@ -56,11 +56,6 @@ #include "qv4engine_p.h" #include "qv4math_p.h" #include "qv4runtimeapi_p.h" -#ifndef V4_BOOTSTRAP -#include <private/qqmlaccessors_p.h> -#include <private/qqmlcontextwrapper_p.h> -#endif - #include <QtCore/qnumeric.h> QT_BEGIN_NAMESPACE diff --git a/src/qml/jsruntime/qv4runtimeapi_p.h b/src/qml/jsruntime/qv4runtimeapi_p.h index ded2b541dc..cbc7a2ddc1 100644 --- a/src/qml/jsruntime/qv4runtimeapi_p.h +++ b/src/qml/jsruntime/qv4runtimeapi_p.h @@ -167,16 +167,6 @@ struct Q_QML_PRIVATE_EXPORT Runtime { , INIT_RUNTIME_METHOD(setQmlScopeObjectProperty) , INIT_RUNTIME_METHOD(setQmlContextObjectProperty) , INIT_RUNTIME_METHOD(setQmlQObjectProperty) - , INIT_RUNTIME_METHOD(accessQObjectQRealProperty) - , INIT_RUNTIME_METHOD(accessQObjectQObjectProperty) - , INIT_RUNTIME_METHOD(accessQObjectIntProperty) - , INIT_RUNTIME_METHOD(accessQObjectBoolProperty) - , INIT_RUNTIME_METHOD(accessQObjectQStringProperty) - , INIT_RUNTIME_METHOD(accessQmlScopeObjectQRealProperty) - , INIT_RUNTIME_METHOD(accessQmlScopeObjectQObjectProperty) - , INIT_RUNTIME_METHOD(accessQmlScopeObjectIntProperty) - , INIT_RUNTIME_METHOD(accessQmlScopeObjectBoolProperty) - , INIT_RUNTIME_METHOD(accessQmlScopeObjectQStringProperty) { } // call @@ -313,17 +303,6 @@ struct Q_QML_PRIVATE_EXPORT Runtime { RUNTIME_METHOD(void, setQmlScopeObjectProperty, (ExecutionEngine *engine, const Value &context, int propertyIndex, const Value &value)); RUNTIME_METHOD(void, setQmlContextObjectProperty, (ExecutionEngine *engine, const Value &context, int propertyIndex, const Value &value)); RUNTIME_METHOD(void, setQmlQObjectProperty, (ExecutionEngine *engine, const Value &object, int propertyIndex, const Value &value)); - - RUNTIME_METHOD(ReturnedValue, accessQObjectQRealProperty, (ExecutionEngine *engine, const Value &object, QQmlAccessors *accessors, int coreIndex, int notifyIndex)); - RUNTIME_METHOD(ReturnedValue, accessQObjectQObjectProperty, (ExecutionEngine *engine, const Value &object, QQmlAccessors *accessors, int coreIndex, int notifyIndex)); - RUNTIME_METHOD(ReturnedValue, accessQObjectIntProperty, (ExecutionEngine *engine, const Value &object, QQmlAccessors *accessors, int coreIndex, int notifyIndex)); - RUNTIME_METHOD(ReturnedValue, accessQObjectBoolProperty, (ExecutionEngine *engine, const Value &object, QQmlAccessors *accessors, int coreIndex, int notifyIndex)); - RUNTIME_METHOD(ReturnedValue, accessQObjectQStringProperty, (ExecutionEngine *engine, const Value &object, QQmlAccessors *accessors, int coreIndex, int notifyIndex)); - RUNTIME_METHOD(ReturnedValue, accessQmlScopeObjectQRealProperty, (const Value &context, QQmlAccessors *accessors)); - RUNTIME_METHOD(ReturnedValue, accessQmlScopeObjectQObjectProperty, (const Value &context, QQmlAccessors *accessors)); - RUNTIME_METHOD(ReturnedValue, accessQmlScopeObjectIntProperty, (const Value &context, QQmlAccessors *accessors)); - RUNTIME_METHOD(ReturnedValue, accessQmlScopeObjectBoolProperty, (const Value &context, QQmlAccessors *accessors)); - RUNTIME_METHOD(ReturnedValue, accessQmlScopeObjectQStringProperty, (ExecutionEngine *engine, const Value &context, QQmlAccessors *accessors)); }; #undef RUNTIME_METHOD diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index 99aa0ef652..b83bae8a38 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -519,26 +519,6 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code STOREVALUE(instr.result, engine->runtime.getQmlQObjectProperty(engine, VALUE(instr.base), instr.propertyIndex, instr.captureRequired)); MOTH_END_INSTR(LoadQObjectProperty) - MOTH_BEGIN_INSTR(LoadQRealQObjectPropertyDirectly) - STOREVALUE(instr.result, engine->runtime.accessQObjectQRealProperty(engine, VALUE(instr.base), instr.accessors, instr.coreIndex, instr.notifyIndex)); - MOTH_END_INSTR(LoadQRealQObjectPropertyDirectly) - - MOTH_BEGIN_INSTR(LoadQObjectQObjectPropertyDirectly) - STOREVALUE(instr.result, engine->runtime.accessQObjectQObjectProperty(engine, VALUE(instr.base), instr.accessors, instr.coreIndex, instr.notifyIndex)); - MOTH_END_INSTR(LoadQObjectQObjectPropertyDirectly) - - MOTH_BEGIN_INSTR(LoadIntQObjectPropertyDirectly) - STOREVALUE(instr.result, engine->runtime.accessQObjectIntProperty(engine, VALUE(instr.base), instr.accessors, instr.coreIndex, instr.notifyIndex)); - MOTH_END_INSTR(LoadIntQObjectPropertyDirectly) - - MOTH_BEGIN_INSTR(LoadBoolQObjectPropertyDirectly) - STOREVALUE(instr.result, engine->runtime.accessQObjectBoolProperty(engine, VALUE(instr.base), instr.accessors, instr.coreIndex, instr.notifyIndex)); - MOTH_END_INSTR(LoadQRealQObjectPropertyDirectly) - - MOTH_BEGIN_INSTR(LoadQStringQObjectPropertyDirectly) - STOREVALUE(instr.result, engine->runtime.accessQObjectQStringProperty(engine, VALUE(instr.base), instr.accessors, instr.coreIndex, instr.notifyIndex)); - MOTH_END_INSTR(LoadQStringQObjectPropertyDirectly) - MOTH_BEGIN_INSTR(StoreScopeObjectProperty) engine->runtime.setQmlScopeObjectProperty(engine, VALUE(instr.base), instr.propertyIndex, VALUE(instr.source)); CHECK_EXCEPTION; @@ -548,26 +528,6 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code STOREVALUE(instr.result, engine->runtime.getQmlScopeObjectProperty(engine, VALUE(instr.base), instr.propertyIndex)); MOTH_END_INSTR(LoadScopeObjectProperty) - MOTH_BEGIN_INSTR(LoadScopeObjectQRealPropertyDirectly) - STOREVALUE(instr.result, engine->runtime.accessQmlScopeObjectQRealProperty(VALUE(instr.base), instr.accessors)); - MOTH_END_INSTR(LoadScopeObjectQRealPropertyDirectly) - - MOTH_BEGIN_INSTR(LoadScopeObjectQObjectPropertyDirectly) - STOREVALUE(instr.result, engine->runtime.accessQmlScopeObjectQObjectProperty(VALUE(instr.base), instr.accessors)); - MOTH_END_INSTR(LoadScopeObjectQObjectPropertyDirectly) - - MOTH_BEGIN_INSTR(LoadScopeObjectIntPropertyDirectly) - STOREVALUE(instr.result, engine->runtime.accessQmlScopeObjectIntProperty(VALUE(instr.base), instr.accessors)); - MOTH_END_INSTR(LoadScopeObjectIntPropertyDirectly) - - MOTH_BEGIN_INSTR(LoadScopeObjectBoolPropertyDirectly) - STOREVALUE(instr.result, engine->runtime.accessQmlScopeObjectBoolProperty(VALUE(instr.base), instr.accessors)); - MOTH_END_INSTR(LoadScopeObjectBoolPropertyDirectly) - - MOTH_BEGIN_INSTR(LoadScopeObjectQStringPropertyDirectly) - STOREVALUE(instr.result, engine->runtime.accessQmlScopeObjectQStringProperty(engine, VALUE(instr.base), instr.accessors)); - MOTH_END_INSTR(LoadScopeObjectQStringPropertyDirectly) - MOTH_BEGIN_INSTR(StoreContextObjectProperty) engine->runtime.setQmlContextObjectProperty(engine, VALUE(instr.base), instr.propertyIndex, VALUE(instr.source)); CHECK_EXCEPTION; diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index 3d2c143295..7cb7047b04 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -54,6 +54,7 @@ #include <private/qqmlscriptstring_p.h> #include <private/qqmlpropertyvalueinterceptor_p.h> #include <private/qqmlvaluetypeproxybinding_p.h> +#include <private/qqmlaccessors_p.h> QT_USE_NAMESPACE |