diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-08-07 12:15:23 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-08-10 08:18:34 +0000 |
commit | 2ad213cc02094e003802530757fa4010720a22e6 (patch) | |
tree | c01c50c5563c79cd838f45e02b96c7cff602cdac /src/qml/jsruntime/qv4lookup.cpp | |
parent | 026ec5feee4d6fac4d7b0530fce6da649a1ee27d (diff) |
Remove unused lookup types
The indexed getters and setters haven't been used for a while and
don't offer any performance benefits currently.
Change-Id: Ifd5e1fab934e6e9940c4f1ad67f8850f04597504
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4lookup.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4lookup.cpp | 134 |
1 files changed, 0 insertions, 134 deletions
diff --git a/src/qml/jsruntime/qv4lookup.cpp b/src/qml/jsruntime/qv4lookup.cpp index 1d32d453ac..ae74e0d14c 100644 --- a/src/qml/jsruntime/qv4lookup.cpp +++ b/src/qml/jsruntime/qv4lookup.cpp @@ -116,140 +116,6 @@ ReturnedValue Lookup::lookup(const Object *thisObject, PropertyAttributes *attrs return Primitive::emptyValue().asReturnedValue(); } -ReturnedValue Lookup::indexedGetterGeneric(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &index) -{ - uint idx; - if (object.isObject() && index.asArrayIndex(idx)) { - l->indexedGetter = indexedGetterObjectInt; - return indexedGetterObjectInt(l, engine, object, index); - } - return indexedGetterFallback(l, engine, object, index); -} - -ReturnedValue Lookup::indexedGetterFallback(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &index) -{ - Q_UNUSED(l); - Scope scope(engine); - uint idx = 0; - bool isInt = index.asArrayIndex(idx); - - ScopedObject o(scope, object); - if (!o) { - if (isInt) { - if (const String *str = object.as<String>()) { - if (idx >= (uint)str->toQString().length()) { - return Encode::undefined(); - } - const QString s = str->toQString().mid(idx, 1); - return scope.engine->newString(s)->asReturnedValue(); - } - } - - if (object.isNullOrUndefined()) { - QString message = QStringLiteral("Cannot read property '%1' of %2").arg(index.toQStringNoThrow()).arg(object.toQStringNoThrow()); - return engine->throwTypeError(message); - } - - o = RuntimeHelpers::convertToObject(scope.engine, object); - if (!o) // type error - return Encode::undefined(); - } - - if (isInt) { - if (o->d()->arrayData && !o->d()->arrayData->attrs) { - ScopedValue v(scope, Scoped<ArrayData>(scope, o->arrayData())->get(idx)); - if (!v->isEmpty()) - return v->asReturnedValue(); - } - - return o->getIndexed(idx); - } - - ScopedString name(scope, index.toString(scope.engine)); - if (scope.hasException()) - return Encode::undefined(); - return o->get(name); - -} - - -ReturnedValue Lookup::indexedGetterObjectInt(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &index) -{ - uint idx; - if (index.asArrayIndex(idx)) { - if (Heap::Base *b = object.heapObject()) { - if (b->vtable()->isObject) { - Heap::Object *o = static_cast<Heap::Object *>(b); - if (o->arrayData && o->arrayData->type == Heap::ArrayData::Simple) { - Heap::SimpleArrayData *s = o->arrayData.cast<Heap::SimpleArrayData>(); - if (idx < s->values.size) - if (!s->data(idx).isEmpty()) - return s->data(idx).asReturnedValue(); - } - } - } - } - - return indexedGetterFallback(l, engine, object, index); -} - -void Lookup::indexedSetterGeneric(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &index, const Value &v) -{ - if (Object *o = object.objectValue()) { - uint idx; - if (o->d()->arrayData && o->d()->arrayData->type == Heap::ArrayData::Simple && index.asArrayIndex(idx)) { - l->indexedSetter = indexedSetterObjectInt; - indexedSetterObjectInt(l, engine, object, index, v); - return; - } - } - indexedSetterFallback(l, engine, object, index, v); -} - -void Lookup::indexedSetterFallback(Lookup *, ExecutionEngine *engine, const Value &object, const Value &index, const Value &value) -{ - Scope scope(engine); - ScopedObject o(scope, object.toObject(scope.engine)); - if (scope.engine->hasException) - return; - - uint idx; - if (index.asArrayIndex(idx)) { - if (o->d()->arrayData && o->d()->arrayData->type == Heap::ArrayData::Simple) { - Heap::SimpleArrayData *s = o->d()->arrayData.cast<Heap::SimpleArrayData>(); - if (idx < s->values.size) { - s->setData(engine, idx, value); - return; - } - } - o->putIndexed(idx, value); - return; - } - - ScopedString name(scope, index.toString(scope.engine)); - o->put(name, value); -} - -void Lookup::indexedSetterObjectInt(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &index, const Value &v) -{ - uint idx; - if (index.asArrayIndex(idx)) { - if (Heap::Base *b = object.heapObject()) { - if (b->vtable()->isObject) { - Heap::Object *o = static_cast<Heap::Object *>(b); - if (o->arrayData && o->arrayData->type == Heap::ArrayData::Simple) { - Heap::SimpleArrayData *s = o->arrayData.cast<Heap::SimpleArrayData>(); - if (idx < s->values.size) { - s->setData(engine, idx, v); - return; - } - } - } - } - } - indexedSetterFallback(l, engine, object, index, v); -} - ReturnedValue Lookup::getterGeneric(Lookup *l, ExecutionEngine *engine, const Value &object) { if (const Object *o = object.as<Object>()) |