aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4object.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-11-13 15:00:20 +0100
committerLars Knoll <lars.knoll@qt.io>2017-11-27 11:09:53 +0000
commitd31304eab9e7424edc20fb83a8a19cd979458029 (patch)
tree027bdee6f8a64ff59def96a52a88bdeff9053ca5 /src/qml/jsruntime/qv4object.cpp
parent71f0bc8ce6244d4544dcd35a62ed8f163bb5b092 (diff)
Refactor getter lookups
Use the new id of InternalClass to simplify out lookup code for getters. Now all lookups in the prototype chain can be done at the same speed independent of the depth within the prototype chain with only two checks. Change-Id: I7d8451cc54c0ac50c1bcb4ae3bf386fd5f2a84aa Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4object.cpp')
-rw-r--r--src/qml/jsruntime/qv4object.cpp54
1 files changed, 0 insertions, 54 deletions
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index 44414ad85a..e7368edad2 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -528,47 +528,6 @@ bool Object::deleteIndexedProperty(Managed *m, uint index)
return static_cast<Object *>(m)->internalDeleteIndexedProperty(index);
}
-ReturnedValue Object::getLookup(const Managed *m, Lookup *l)
-{
- const Object *o = static_cast<const Object *>(m);
- PropertyAttributes attrs;
- ReturnedValue v = l->lookup(o, &attrs);
- if (v != Primitive::emptyValue().asReturnedValue()) {
- l->proto = l->classList[0]->prototype;
- if (attrs.isData()) {
- Q_ASSERT(l->classList[0] == o->internalClass());
- if (l->level == 0) {
- uint nInline = o->d()->vtable()->nInlineProperties;
- if (l->index < nInline) {
- l->index += o->d()->vtable()->inlinePropertyOffset;
- l->getter = Lookup::getter0Inline;
- } else {
- l->index -= nInline;
- l->getter = Lookup::getter0MemberData;
- }
- }
- else if (l->level == 1)
- l->getter = Lookup::getter1;
- else if (l->level == 2)
- l->getter = Lookup::getter2;
- else
- l->getter = Lookup::getterFallback;
- return v;
- } else {
- if (l->level == 0)
- l->getter = Lookup::getterAccessor0;
- else if (l->level == 1)
- l->getter = Lookup::getterAccessor1;
- else if (l->level == 2)
- l->getter = Lookup::getterAccessor2;
- else
- l->getter = Lookup::getterFallback;
- return v;
- }
- }
- return Encode::undefined();
-}
-
bool Object::setLookup(Managed *m, Lookup *l, const Value &value)
{
Scope scope(static_cast<Object *>(m)->engine());
@@ -1280,19 +1239,6 @@ void Heap::ArrayObject::init(const QStringList &list)
a->setArrayLengthUnchecked(len);
}
-ReturnedValue ArrayObject::getLookup(const Managed *m, Lookup *l)
-{
- Scope scope(static_cast<const Object *>(m)->engine());
- ScopedString name(scope, scope.engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[l->nameIndex]);
- if (name->equals(scope.engine->id_length())) {
- // special case, as the property is on the object itself
- l->getter = Lookup::arrayLengthGetter;
- const ArrayObject *a = static_cast<const ArrayObject *>(m);
- return a->propertyData(Heap::ArrayObject::LengthPropertyIndex)->asReturnedValue();
- }
- return Object::getLookup(m, l);
-}
-
uint ArrayObject::getLength(const Managed *m)
{
const ArrayObject *a = static_cast<const ArrayObject *>(m);