Access the id objects through a specialized runtime method
authorLars Knoll <lars.knoll@theqtcompany.com>
Mon, 22 Jun 2015 14:33:40 +0000 (16:33 +0200)
committerLars Knoll <lars.knoll@theqtcompany.com>
Wed, 12 Aug 2015 07:29:44 +0000 (07:29 +0000)
This brings us one step closer to getting rid of the
QQmlContextWrapper.

Change-Id: Ied57f4c174c2ebd95096310a4ad4c0c28787e7a4
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
19 files changed:
src/qml/compiler/qqmlirbuilder.cpp
src/qml/compiler/qqmlirbuilder_p.h
src/qml/compiler/qqmltypecompiler.cpp
src/qml/compiler/qv4instr_moth_p.h
src/qml/compiler/qv4isel_moth.cpp
src/qml/compiler/qv4isel_moth_p.h
src/qml/compiler/qv4isel_p.cpp
src/qml/compiler/qv4isel_p.h
src/qml/compiler/qv4jsir.cpp
src/qml/compiler/qv4jsir_p.h
src/qml/compiler/qv4ssa.cpp
src/qml/jit/qv4isel_masm.cpp
src/qml/jit/qv4isel_masm_p.h
src/qml/jit/qv4regalloc.cpp
src/qml/jsruntime/qv4runtime.cpp
src/qml/jsruntime/qv4runtime_p.h
src/qml/jsruntime/qv4vme_moth.cpp
src/qml/qml/qqmlcontextwrapper.cpp
src/qml/qml/qqmlcontextwrapper_p.h

index 079ab95f00ceb4e227b8fd0d43ab7fb55a0ef7d1..4b1e3601dc19dd16ccc1bdb5c653bd44c2352083 100644 (file)
@@ -1458,7 +1458,6 @@ JSCodeGen::JSCodeGen(const QString &fileName, const QString &sourceCode, QV4::IR
     , _scopeObject(0)
     , _qmlContextTemp(-1)
     , _importedScriptsTemp(-1)
-    , _idArrayTemp(-1)
 {
     _module = jsModule;
     _module->setFileName(fileName);
@@ -1765,14 +1764,12 @@ void JSCodeGen::beginFunctionBodyHook()
 {
     _qmlContextTemp = _block->newTemp();
     _importedScriptsTemp = _block->newTemp();
-    _idArrayTemp = _block->newTemp();
 
 #ifndef V4_BOOTSTRAP
     QV4::IR::Temp *temp = _block->TEMP(_qmlContextTemp);
     move(temp, _block->NAME(QV4::IR::Name::builtin_qml_context, 0, 0));
 
     move(_block->TEMP(_importedScriptsTemp), _block->NAME(QV4::IR::Name::builtin_qml_imported_scripts_object, 0, 0));
-    move(_block->TEMP(_idArrayTemp), _block->NAME(QV4::IR::Name::builtin_qml_id_array, 0, 0));
 #endif
 }
 
@@ -1798,7 +1795,7 @@ QV4::IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int
     foreach (const IdMapping &mapping, _idObjects)
         if (name == mapping.name) {
             _function->idObjectDependencies.insert(mapping.idIndex);
-            QV4::IR::Expr *s = subscript(_block->TEMP(_idArrayTemp), _block->CONST(QV4::IR::SInt32Type, mapping.idIndex));
+            QV4::IR::Expr *s = _block->MEMBER(_block->TEMP(_qmlContextTemp), _function->newString(name), 0, QV4::IR::Member::MemberOfIdObjectsArray, mapping.idIndex);
             QV4::IR::Temp *result = _block->TEMP(_block->newTemp());
             _block->MOVE(result, s);
             result = _block->TEMP(result->index);
index 8d8978d94795708527e13ab5b288525b0a4d0e44..5617912081f1f7786a460afa870cd6d6137009f1 100644 (file)
@@ -497,7 +497,6 @@ private:
     QQmlPropertyCache *_scopeObject;
     int _qmlContextTemp;
     int _importedScriptsTemp;
-    int _idArrayTemp;
 };
 
 } // namespace QmlIR
index cf37806d7c70131361c1eb655e5b1f7be9e7666c..911be238b9d46dff1927d791c7f948a26b6684ba 100644 (file)
@@ -2624,7 +2624,6 @@ void QQmlJavaScriptBindingExpressionSimplificationPass::visitMove(QV4::IR::Move
 
     if (QV4::IR::Name *n = move->source->asName()) {
         if (n->builtin == QV4::IR::Name::builtin_qml_context
-            || n->builtin == QV4::IR::Name::builtin_qml_id_array
             || n->builtin == QV4::IR::Name::builtin_qml_imported_scripts_object) {
             // these are free of side-effects
             return;
index 886ff99ce782d122074a66f3957b4eae0fddf7c7..6839c7f6091140bab1c86a9ec6473b5a4f5d7dbe 100644 (file)
@@ -68,6 +68,7 @@ QT_BEGIN_NAMESPACE
     F(StoreContextObjectProperty, storeContextObjectProperty) \
     F(LoadScopeObjectProperty, loadScopeObjectProperty) \
     F(LoadContextObjectProperty, loadContextObjectProperty) \
+    F(LoadIdObject, loadIdObject) \
     F(LoadAttachedQObjectProperty, loadAttachedQObjectProperty) \
     F(LoadSingletonQObjectProperty, loadQObjectProperty) \
     F(Push, push) \
@@ -132,7 +133,6 @@ QT_BEGIN_NAMESPACE
     F(BinopContext, binopContext) \
     F(LoadThis, loadThis) \
     F(LoadQmlContext, loadQmlContext) \
-    F(LoadQmlIdArray, loadQmlIdArray) \
     F(LoadQmlImportedScripts, loadQmlImportedScripts) \
     F(LoadQmlSingleton, loadQmlSingleton)
 
@@ -310,6 +310,12 @@ union Instr
         Param base;
         Param result;
     };
+    struct instr_loadIdObject {
+        MOTH_INSTR_HEADER
+        int index;
+        Param base;
+        Param result;
+    };
     struct instr_loadQObjectProperty {
         MOTH_INSTR_HEADER
         int propertyIndex;
@@ -733,10 +739,6 @@ union Instr
         MOTH_INSTR_HEADER
         Param result;
     };
-    struct instr_loadQmlIdArray {
-        MOTH_INSTR_HEADER
-        Param result;
-    };
     struct instr_loadQmlImportedScripts {
         MOTH_INSTR_HEADER
         Param result;
@@ -768,6 +770,7 @@ union Instr
     instr_getLookup getLookup;
     instr_loadScopeObjectProperty loadScopeObjectProperty;
     instr_loadContextObjectProperty loadContextObjectProperty;
+    instr_loadIdObject loadIdObject;
     instr_loadQObjectProperty loadQObjectProperty;
     instr_loadAttachedQObjectProperty loadAttachedQObjectProperty;
     instr_storeProperty storeProperty;
@@ -837,7 +840,6 @@ union Instr
     instr_binopContext binopContext;
     instr_loadThis loadThis;
     instr_loadQmlContext loadQmlContext;
-    instr_loadQmlIdArray loadQmlIdArray;
     instr_loadQmlImportedScripts loadQmlImportedScripts;
     instr_loadQmlSingleton loadQmlSingleton;
 
index 4830f01152832bbc7026a138d295548b63ea70df..ede1e6938fd2a598084349c46c419271041b92ec 100644 (file)
@@ -595,13 +595,6 @@ void InstructionSelection::loadQmlContext(IR::Expr *e)
     addInstruction(load);
 }
 
-void InstructionSelection::loadQmlIdArray(IR::Expr *e)
-{
-    Instruction::LoadQmlIdArray load;
-    load.result = getResultParam(e);
-    addInstruction(load);
-}
-
 void InstructionSelection::loadQmlImportedScripts(IR::Expr *e)
 {
     Instruction::LoadQmlImportedScripts load;
@@ -752,6 +745,12 @@ void InstructionSelection::getQmlContextProperty(IR::Expr *source, IR::Member::M
         load.propertyIndex = index;
         load.result = getResultParam(target);
         addInstruction(load);
+    } else if (kind == IR::Member::MemberOfIdObjectsArray) {
+        Instruction::LoadIdObject load;
+        load.base = getParam(source);
+        load.index = index;
+        load.result = getResultParam(target);
+        addInstruction(load);
     } else {
         Q_ASSERT(false);
     }
index 64e12489ca01312df4a5daa870e51ce37ed7c703..ac1eaba740278198ec7682d7119c314d9d146e80 100644 (file)
@@ -104,7 +104,6 @@ protected:
     virtual void constructValue(IR::Expr *value, IR::ExprList *args, IR::Expr *result);
     virtual void loadThisObject(IR::Expr *e);
     virtual void loadQmlContext(IR::Expr *e);
-    virtual void loadQmlIdArray(IR::Expr *e);
     virtual void loadQmlImportedScripts(IR::Expr *e);
     virtual void loadQmlSingleton(const QString &name, IR::Expr *e);
     virtual void loadConst(IR::Const *sourceConst, IR::Expr *e);
index 4ed321b00627daea9b9fcfcd186e894b376123aa..9d172b12233546bbbfa8ebd222dbec524f5932a0 100644 (file)
@@ -93,8 +93,6 @@ void IRDecoder::visitMove(IR::Move *s)
                 loadThisObject(s->target);
             else if (n->builtin == IR::Name::builtin_qml_context)
                 loadQmlContext(s->target);
-            else if (n->builtin == IR::Name::builtin_qml_id_array)
-                loadQmlIdArray(s->target);
             else if (n->builtin == IR::Name::builtin_qml_imported_scripts_object)
                 loadQmlImportedScripts(s->target);
             else if (n->qmlSingleton)
@@ -138,8 +136,8 @@ void IRDecoder::visitMove(IR::Move *s)
 #else
                 bool captureRequired = true;
 
-                Q_ASSERT(m->kind != IR::Member::MemberOfEnum);
-                const int attachedPropertiesId = m->attachedPropertiesIdOrEnumValue;
+                Q_ASSERT(m->kind != IR::Member::MemberOfEnum && m->kind != IR::Member::MemberOfIdObjectsArray);
+                const int attachedPropertiesId = m->attachedPropertiesId;
                 const bool isSingletonProperty = m->kind == IR::Member::MemberOfSingletonObject;
 
                 if (_function && attachedPropertiesId == 0 && !m->property->isConstant()) {
@@ -158,6 +156,9 @@ void IRDecoder::visitMove(IR::Move *s)
                 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, m->idIndex, s->target);
+                return;
             } else if (m->base->asTemp() || m->base->asConst() || m->base->asArgLocal()) {
                 getProperty(m->base, *m->name, s->target);
                 return;
@@ -177,6 +178,7 @@ void IRDecoder::visitMove(IR::Move *s)
                 return;
             } else if (Member *member = c->base->asMember()) {
 #ifndef V4_BOOTSTRAP
+                Q_ASSERT(member->kind != IR::Member::MemberOfIdObjectsArray);
                 if (member->kind == IR::Member::MemberOfQmlScopeObject || member->kind == IR::Member::MemberOfQmlContextObject) {
                     callQmlContextProperty(member->base, (IR::Member::MemberKind)member->kind, member->property->coreIndex, c->args, s->target);
                     return;
@@ -200,7 +202,8 @@ void IRDecoder::visitMove(IR::Move *s)
         if (m->base->asTemp() || m->base->asConst() || m->base->asArgLocal()) {
             if (s->source->asTemp() || s->source->asConst() || s->source->asArgLocal()) {
                 Q_ASSERT(m->kind != IR::Member::MemberOfEnum);
-                const int attachedPropertiesId = m->attachedPropertiesIdOrEnumValue;
+                Q_ASSERT(m->kind != IR::Member::MemberOfIdObjectsArray);
+                const int attachedPropertiesId = m->attachedPropertiesId;
                 if (m->property && attachedPropertiesId == 0) {
 #ifdef V4_BOOTSTRAP
                     Q_UNIMPLEMENTED();
@@ -251,6 +254,7 @@ void IRDecoder::visitExp(IR::Exp *s)
         } else if (Member *member = c->base->asMember()) {
             Q_ASSERT(member->base->asTemp() || member->base->asArgLocal());
 #ifndef V4_BOOTSTRAP
+            Q_ASSERT(member->kind != IR::Member::MemberOfIdObjectsArray);
             if (member->kind == IR::Member::MemberOfQmlScopeObject || member->kind == IR::Member::MemberOfQmlContextObject) {
                 callQmlContextProperty(member->base, (IR::Member::MemberKind)member->kind, member->property->coreIndex, c->args, 0);
                 return;
index 80040da1852b19ce224c3c9bfb9480611327f9cd..2b8aa7eb333ea505b7d06cdd3ff834147028c562 100644 (file)
@@ -138,7 +138,6 @@ public: // to implement by subclasses:
     virtual void constructValue(IR::Expr *value, IR::ExprList *args, IR::Expr *result) = 0;
     virtual void loadThisObject(IR::Expr *target) = 0;
     virtual void loadQmlContext(IR::Expr *target) = 0;
-    virtual void loadQmlIdArray(IR::Expr *target) = 0;
     virtual void loadQmlImportedScripts(IR::Expr *target) = 0;
     virtual void loadQmlSingleton(const QString &name, IR::Expr *target) = 0;
     virtual void loadConst(IR::Const *sourceConst, IR::Expr *target) = 0;
index 841a1aefcc54a97d29f0903cfb7b356d8bb1b7e5..98b53c6b3b3b806a0eb3415bbd8736ccfd80fd57 100644 (file)
@@ -343,8 +343,6 @@ const char *builtin_to_string(Name::Builtin b)
         return "builtin_convert_this_to_object";
     case IR::Name::builtin_qml_context:
         return "builtin_qml_context";
-    case IR::Name::builtin_qml_id_array:
-        return "builtin_qml_id_array";
     case IR::Name::builtin_qml_imported_scripts_object:
         return "builtin_qml_imported_scripts_object";
     }
@@ -933,7 +931,7 @@ void CloneExpr::visitSubscript(Subscript *e)
 void CloneExpr::visitMember(Member *e)
 {
     Expr *clonedBase = clone(e->base);
-    cloned = block->MEMBER(clonedBase, e->name, e->property, e->kind, e->attachedPropertiesIdOrEnumValue);
+    cloned = block->MEMBER(clonedBase, e->name, e->property, e->kind, e->idIndex);
 }
 
 IRPrinter::IRPrinter(QTextStream *out)
@@ -1237,9 +1235,9 @@ void IRPrinter::visitSubscript(Subscript *e)
 
 void IRPrinter::visitMember(Member *e)
 {
-    if (e->kind != Member::MemberOfEnum
-            && e->attachedPropertiesIdOrEnumValue != 0 && !e->base->asTemp())
-        *out << "[[attached property from " << e->attachedPropertiesIdOrEnumValue << "]]";
+    if (e->kind != Member::MemberOfEnum && e->kind != Member::MemberOfIdObjectsArray
+            && e->attachedPropertiesId != 0 && !e->base->asTemp())
+        *out << "[[attached property from " << e->attachedPropertiesId << "]]";
     else
         e->base->accept(this);
     *out << '.' << *e->name;
@@ -1248,6 +1246,8 @@ void IRPrinter::visitMember(Member *e)
         *out << " (meta-property " << e->property->coreIndex
             << " <" << QMetaType::typeName(e->property->propType)
             << ">)";
+    else if (e->kind == Member::MemberOfIdObjectsArray)
+        *out << "(id object " << e->idIndex << ")";
 #endif
 }
 
index a4fb5246d016372737ead824bd9727ad549e5b15..568ded5337d51ea308d4f81dba45612d382aa678 100644 (file)
@@ -338,7 +338,6 @@ struct Name: Expr {
         builtin_setup_argument_object,
         builtin_convert_this_to_object,
         builtin_qml_context,
-        builtin_qml_id_array,
         builtin_qml_imported_scripts_object
     };
 
@@ -557,13 +556,18 @@ struct Member: Expr {
         MemberOfEnum,
         MemberOfQmlScopeObject,
         MemberOfQmlContextObject,
-        MemberOfSingletonObject
+        MemberOfIdObjectsArray,
+        MemberOfSingletonObject,
     };
 
     Expr *base;
     const QString *name;
     QQmlPropertyData *property;
-    int attachedPropertiesIdOrEnumValue; // depending on kind
+    union {  // depending on kind
+        int attachedPropertiesId;
+        int enumValue;
+        int idIndex;
+    };
     uchar freeOfSideEffects : 1;
 
     // This is set for example for for QObject properties. All sorts of extra behavior
@@ -576,20 +580,20 @@ struct Member: Expr {
 
     void setEnumValue(int value) {
         kind = MemberOfEnum;
-        attachedPropertiesIdOrEnumValue = value;
+        enumValue = value;
     }
 
     void setAttachedPropertiesId(int id) {
-        Q_ASSERT(kind != MemberOfEnum);
-        attachedPropertiesIdOrEnumValue = id;
+        Q_ASSERT(kind != MemberOfEnum && kind != MemberOfIdObjectsArray);
+        attachedPropertiesId = id;
     }
 
-    void init(Expr *base, const QString *name, QQmlPropertyData *property = 0, uchar kind = UnspecifiedMember, int attachedPropertiesIdOrEnumValue = 0)
+    void init(Expr *base, const QString *name, QQmlPropertyData *property = 0, uchar kind = UnspecifiedMember, int index = 0)
     {
         this->base = base;
         this->name = name;
         this->property = property;
-        this->attachedPropertiesIdOrEnumValue = attachedPropertiesIdOrEnumValue;
+        this->idIndex = index;
         this->freeOfSideEffects = false;
         this->inhibitTypeConversionOnWrite = property != 0;
         this->kind = kind;
index e61a602e64c5a3f236d956c31863c7e22fb1d114..cc60dde4cc30ef55c1b0cef7a788f31f174240d2 100644 (file)
@@ -4020,14 +4020,14 @@ void optimizeSSA(StatementWorklist &W, DefUses &defUses, DominatorTree &df)
                 if (Member *member = m->source->asMember()) {
                     if (member->kind == Member::MemberOfEnum) {
                         Const *c = function->New<Const>();
-                        const int enumValue = member->attachedPropertiesIdOrEnumValue;
+                        const int enumValue = member->enumValue;
                         c->init(SInt32Type, enumValue);
                         replaceUses(targetTemp, c, W);
                         defUses.removeDef(*targetTemp);
                         W.remove(s);
                         defUses.removeUse(s, *member->base->asTemp());
                         continue;
-                    } else if (member->attachedPropertiesIdOrEnumValue != 0 && member->property && member->base->asTemp()) {
+                    } else if (member->kind != IR::Member::MemberOfIdObjectsArray && member->attachedPropertiesId != 0 && member->property && member->base->asTemp()) {
                         // Attached properties have no dependency on their base. Isel doesn't
                         // need it and we can eliminate the temp used to initialize it.
                         defUses.removeUse(s, *member->base->asTemp());
index 4bf2753ae41c1b5c60fe4fb9838814530ba95997..acead2088b1c984c9cf51da6a5dad28d7e0ba68c 100644 (file)
@@ -579,11 +579,6 @@ void InstructionSelection::loadQmlContext(IR::Expr *temp)
     generateFunctionCall(temp, Runtime::getQmlContext, Assembler::EngineRegister);
 }
 
-void InstructionSelection::loadQmlIdArray(IR::Expr *temp)
-{
-    generateFunctionCall(temp, Runtime::getQmlIdArray, Assembler::EngineRegister);
-}
-
 void InstructionSelection::loadQmlImportedScripts(IR::Expr *temp)
 {
     generateFunctionCall(temp, Runtime::getQmlImportedScripts, Assembler::EngineRegister);
@@ -681,6 +676,8 @@ void InstructionSelection::getQmlContextProperty(IR::Expr *base, IR::Member::Mem
         generateFunctionCall(target, Runtime::getQmlScopeObjectProperty, Assembler::EngineRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(index));
     else if (kind == IR::Member::MemberOfQmlContextObject)
         generateFunctionCall(target, Runtime::getQmlContextObjectProperty, Assembler::EngineRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(index));
+    else if (kind == IR::Member::MemberOfIdObjectsArray)
+        generateFunctionCall(target, Runtime::getQmlIdObject, Assembler::EngineRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(index));
     else
         Q_ASSERT(false);
 }
index 61aeb2025f2993a4b74c85c0477803642224f806..6e842f5fb482eb2614bba7bd16739973b4a033fb 100644 (file)
@@ -97,7 +97,6 @@ protected:
     virtual void convertType(IR::Expr *source, IR::Expr *target);
     virtual void loadThisObject(IR::Expr *temp);
     virtual void loadQmlContext(IR::Expr *target);
-    virtual void loadQmlIdArray(IR::Expr *target);
     virtual void loadQmlImportedScripts(IR::Expr *target);
     virtual void loadQmlSingleton(const QString &name, IR::Expr *target);
     virtual void loadConst(IR::Const *sourceConst, IR::Expr *target);
index 2d85d2ccc4563e94b974e0421c60adcb6630cc10..b9178c0ea012785b928aff026165353114270eef 100644 (file)
@@ -437,12 +437,6 @@ protected: // IRDecoder
         addCall();
     }
 
-    virtual void loadQmlIdArray(IR::Expr *temp)
-    {
-        addDef(temp);
-        addCall();
-    }
-
     virtual void loadQmlImportedScripts(IR::Expr *temp)
     {
         addDef(temp);
index e9311cf7f303d6d6e6a98d2977f51dd7fdfbf126..089922d03e97f2691f4eedea5372a91599f513a4 100644 (file)
@@ -47,6 +47,8 @@
 #include "qv4scopedvalue_p.h"
 #include <private/qqmlcontextwrapper_p.h>
 #include <private/qqmltypewrapper_p.h>
+#include <private/qqmlengine_p.h>
+#include <private/qqmljavascriptexpression_p.h>
 #include "qv4qobjectwrapper_p.h"
 #include <private/qv8engine_p.h>
 #endif
@@ -1361,12 +1363,6 @@ ReturnedValue Runtime::regexpLiteral(ExecutionEngine *engine, int id)
     return engine->currentContext()->compilationUnit->runtimeRegularExpressions[id].asReturnedValue();
 }
 
-ReturnedValue Runtime::getQmlIdArray(NoThrowEngine *engine)
-{
-    Q_ASSERT(engine->qmlContextObject());
-    return engine->qmlContextObject()->asReturnedValue();
-}
-
 ReturnedValue Runtime::getQmlQObjectProperty(ExecutionEngine *engine, const Value &object, int propertyIndex, bool captureRequired)
 {
     Scope scope(engine);
@@ -1411,6 +1407,21 @@ ReturnedValue Runtime::getQmlSingletonQObjectProperty(ExecutionEngine *engine, c
     return QV4::QObjectWrapper::getProperty(scope.engine, wrapper->singletonObject(), propertyIndex, captureRequired);
 }
 
+ReturnedValue Runtime::getQmlIdObject(ExecutionEngine *engine, const Value &c, uint index)
+{
+    Scope scope(engine);
+    const QmlContext &qmlContext = static_cast<const QmlContext &>(c);
+    QQmlContextData *context = qmlContext.d()->qml->context;
+    if (!context || index >= (uint)context->idValueCount)
+        return Encode::undefined();
+
+    QQmlEnginePrivate *ep = engine->qmlEngine() ? QQmlEnginePrivate::get(engine->qmlEngine()) : 0;
+    if (ep && ep->propertyCapture)
+        ep->propertyCapture->captureProperty(&context->idValues[index].bindings);
+
+    return QObjectWrapper::wrap(engine, context->idValues[index].data());
+}
+
 void Runtime::setQmlScopeObjectProperty(ExecutionEngine *engine, const Value &context, int propertyIndex, const Value &value)
 {
     const QmlContext &c = static_cast<const QmlContext &>(context);
index cdf7f018ffe98cc030d91b45d856c34957dfab41..f597e4b2e3cb5108ab7fbf4e253577a8cbb9a152 100644 (file)
@@ -210,7 +210,6 @@ struct Q_QML_PRIVATE_EXPORT Runtime {
 
     // qml
     static ReturnedValue getQmlContext(NoThrowEngine *engine);
-    static ReturnedValue getQmlIdArray(NoThrowEngine *engine);
     static ReturnedValue getQmlImportedScripts(NoThrowEngine *engine);
     static ReturnedValue getQmlSingleton(NoThrowEngine *engine, int nameIndex);
     static ReturnedValue getQmlAttachedProperty(ExecutionEngine *engine, int attachedPropertiesId, int propertyIndex);
@@ -218,6 +217,8 @@ struct Q_QML_PRIVATE_EXPORT Runtime {
     static ReturnedValue getQmlContextObjectProperty(ExecutionEngine *engine, const Value &context, int propertyIndex);
     static ReturnedValue getQmlQObjectProperty(ExecutionEngine *engine, const Value &object, int propertyIndex, bool captureRequired);
     static ReturnedValue getQmlSingletonQObjectProperty(ExecutionEngine *engine, const Value &object, int propertyIndex, bool captureRequired);
+    static ReturnedValue getQmlIdObject(ExecutionEngine *engine, const Value &context, uint index);
+
     static void setQmlScopeObjectProperty(ExecutionEngine *engine, const Value &context, int propertyIndex, const Value &value);
     static void setQmlContextObjectProperty(ExecutionEngine *engine, const Value &context, int propertyIndex, const Value &value);
     static void setQmlQObjectProperty(ExecutionEngine *engine, const Value &object, int propertyIndex, const Value &value);
index 7caebe33b616e00e63fd5cb2a2a5c4b7c8ab26f1..d0ae44cceae81a17dd5ff010b5c54db221e112a0 100644 (file)
@@ -531,6 +531,10 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code
         STOREVALUE(instr.result, Runtime::getQmlContextObjectProperty(engine, VALUE(instr.base), instr.propertyIndex));
     MOTH_END_INSTR(LoadContextObjectProperty)
 
+    MOTH_BEGIN_INSTR(LoadIdObject)
+        STOREVALUE(instr.result, Runtime::getQmlIdObject(engine, VALUE(instr.base), instr.index));
+    MOTH_END_INSTR(LoadIdObject)
+
     MOTH_BEGIN_INSTR(LoadAttachedQObjectProperty)
         STOREVALUE(instr.result, Runtime::getQmlAttachedProperty(engine, instr.attachedPropertiesId, instr.propertyIndex));
     MOTH_END_INSTR(LoadAttachedQObjectProperty)
@@ -907,10 +911,6 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code
         VALUE(instr.result) = Runtime::getQmlContext(static_cast<QV4::NoThrowEngine*>(engine));
     MOTH_END_INSTR(LoadQmlContext)
 
-    MOTH_BEGIN_INSTR(LoadQmlIdArray)
-        VALUE(instr.result) = Runtime::getQmlIdArray(static_cast<QV4::NoThrowEngine*>(engine));
-    MOTH_END_INSTR(LoadQmlIdArray)
-
     MOTH_BEGIN_INSTR(LoadQmlImportedScripts)
         VALUE(instr.result) = Runtime::getQmlImportedScripts(static_cast<QV4::NoThrowEngine*>(engine));
     MOTH_END_INSTR(LoadQmlImportedScripts)
index fd85b64ad1990206b64c2059a0464237e2f8cc95..02e4e8c7d3477cf879a4a877fcd165f09db3a9a4 100644 (file)
@@ -387,30 +387,4 @@ ReturnedValue QmlContextWrapper::qmlSingletonWrapper(ExecutionEngine *v4, String
     return QJSValuePrivate::convertedToValue(engine(), siinfo->scriptApi(e));
 }
 
-ReturnedValue QmlContextWrapper::getIndexed(const Managed *m, uint index, bool *hasProperty)
-{
-    const QV4::QmlContextWrapper *This = static_cast<const QV4::QmlContextWrapper *>(m);
-    Scope scope(This->engine());
-    QQmlContextData *context = This->getContext();
-    if (!context) {
-        if (hasProperty)
-            *hasProperty = false;
-        return Encode::undefined();
-    }
-    if (index >= (uint)context->idValueCount) {
-        if (hasProperty)
-            *hasProperty = false;
-        return Encode::undefined();
-    }
-
-    if (hasProperty)
-        *hasProperty = true;
-
-    QQmlEnginePrivate *ep = scope.engine->qmlEngine() ? QQmlEnginePrivate::get(scope.engine->qmlEngine()) : 0;
-    if (ep && ep->propertyCapture)
-        ep->propertyCapture->captureProperty(&context->idValues[index].bindings);
-
-    return QObjectWrapper::wrap(This->engine(), context->idValues[index].data());
-}
-
 QT_END_NAMESPACE
index e80607732691277e04585e8d4380beb2ea8f8b34..7b5d3216df77a508dba95e656e7e0d084c174ac3 100644 (file)
@@ -102,8 +102,6 @@ struct Q_QML_EXPORT QmlContextWrapper : Object
     static void registerQmlDependencies(ExecutionEngine *context, const CompiledData::Function *compiledFunction);
 
     ReturnedValue qmlSingletonWrapper(ExecutionEngine *e, String *name);
-
-    static ReturnedValue getIndexed(const Managed *m, uint index, bool *hasProperty);
 };
 
 }