diff options
Diffstat (limited to 'src/qml/compiler')
-rw-r--r-- | src/qml/compiler/qv4compileddata.cpp | 4 | ||||
-rw-r--r-- | src/qml/compiler/qv4compileddata_p.h | 3 | ||||
-rw-r--r-- | src/qml/compiler/qv4compiler.cpp | 10 | ||||
-rw-r--r-- | src/qml/compiler/qv4compiler_p.h | 1 | ||||
-rw-r--r-- | src/qml/compiler/qv4isel_masm.cpp | 8 | ||||
-rw-r--r-- | src/qml/compiler/qv4isel_p.h | 1 |
6 files changed, 26 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index 9eac0e678d..717e7f4ba2 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -101,12 +101,16 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine) l->setter = QV4::Lookup::setterGeneric; else if (compiledLookups[i].type_and_flags == CompiledData::Lookup::Type_GlobalGetter) l->globalGetter = QV4::Lookup::globalGetterGeneric; + else if (compiledLookups[i].type_and_flags == CompiledData::Lookup::Type_IndexedGetter) + l->indexedGetter = QV4::Lookup::indexedGetterGeneric; for (int j = 0; j < QV4::Lookup::Size; ++j) l->classList[j] = 0; l->level = -1; l->index = UINT_MAX; l->name = runtimeStrings[compiledLookups[i].nameIndex].asString(); + if (compiledLookups[i].type_and_flags == CompiledData::Lookup::Type_IndexedGetter) + l->engine = engine; } } diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h index 83e8058be1..4208ec9441 100644 --- a/src/qml/compiler/qv4compileddata_p.h +++ b/src/qml/compiler/qv4compileddata_p.h @@ -102,7 +102,8 @@ struct Lookup enum Type { Type_Getter = 0x0, Type_Setter = 0x1, - Type_GlobalGetter = 2 + Type_GlobalGetter = 2, + Type_IndexedGetter = 3 }; quint32 type_and_flags; diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp index 9041b04837..d18c43a969 100644 --- a/src/qml/compiler/qv4compiler.cpp +++ b/src/qml/compiler/qv4compiler.cpp @@ -72,6 +72,15 @@ int QV4::Compiler::JSUnitGenerator::getStringId(const QString &string) const return stringToId.value(string); } +uint QV4::Compiler::JSUnitGenerator::registerIndexedGetterLookup() +{ + CompiledData::Lookup l; + l.type_and_flags = CompiledData::Lookup::Type_IndexedGetter; + l.nameIndex = 0; + lookups << l; + return lookups.size() - 1; +} + uint QV4::Compiler::JSUnitGenerator::registerGetterLookup(const QString &name) { CompiledData::Lookup l; @@ -81,6 +90,7 @@ uint QV4::Compiler::JSUnitGenerator::registerGetterLookup(const QString &name) return lookups.size() - 1; } + uint QV4::Compiler::JSUnitGenerator::registerSetterLookup(const QString &name) { CompiledData::Lookup l; diff --git a/src/qml/compiler/qv4compiler_p.h b/src/qml/compiler/qv4compiler_p.h index 1596fcb622..4779b5d3c4 100644 --- a/src/qml/compiler/qv4compiler_p.h +++ b/src/qml/compiler/qv4compiler_p.h @@ -70,6 +70,7 @@ struct Q_QML_EXPORT JSUnitGenerator { uint registerGetterLookup(const QString &name); uint registerSetterLookup(const QString &name); uint registerGlobalGetterLookup(const QString &name); + uint registerIndexedGetterLookup(); int registerRegExp(QQmlJS::V4IR::RegExp *regexp); diff --git a/src/qml/compiler/qv4isel_masm.cpp b/src/qml/compiler/qv4isel_masm.cpp index 415fdad8e9..6df94e713d 100644 --- a/src/qml/compiler/qv4isel_masm.cpp +++ b/src/qml/compiler/qv4isel_masm.cpp @@ -1015,6 +1015,14 @@ void InstructionSelection::setQObjectProperty(V4IR::Expr *source, V4IR::Expr *ta void InstructionSelection::getElement(V4IR::Expr *base, V4IR::Expr *index, V4IR::Temp *target) { + if (useFastLookups) { + uint lookup = registerIndexedGetterLookup(); + generateLookupCall(target, lookup, qOffsetOf(QV4::Lookup, indexedGetter), + Assembler::PointerToValue(base), + Assembler::PointerToValue(index)); + return; + } + #if 0 // QT_POINTER_SIZE == 8 V4IR::Temp *tbase = base->asTemp(); V4IR::Temp *tindex = index->asTemp(); diff --git a/src/qml/compiler/qv4isel_p.h b/src/qml/compiler/qv4isel_p.h index 5ddafc07ab..6f33098172 100644 --- a/src/qml/compiler/qv4isel_p.h +++ b/src/qml/compiler/qv4isel_p.h @@ -72,6 +72,7 @@ public: void setUseFastLookups(bool b) { useFastLookups = b; } int registerString(const QString &str) { return jsGenerator->registerString(str); } + uint registerIndexedGetterLookup() { return jsGenerator->registerIndexedGetterLookup(); } uint registerGetterLookup(const QString &name) { return jsGenerator->registerGetterLookup(name); } uint registerSetterLookup(const QString &name) { return jsGenerator->registerSetterLookup(name); } uint registerGlobalGetterLookup(const QString &name) { return jsGenerator->registerGlobalGetterLookup(name); } |