diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-05-12 15:01:07 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-05-19 06:23:19 +0000 |
commit | cdbc4b83d59e08189d6ece9ccd88a646be155c08 (patch) | |
tree | ffd52e753313d8c3528fdab5a37bc089545b48aa /src/qml | |
parent | 70a49fe042dd244926cc4a9cb6affb8b4f3d9b7f (diff) |
Properly encapsulate all accesses to the vtable
Change-Id: I3f6ae59d01c7b6c898e98d3b6f65b84a19b8851a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/jsruntime/qv4internalclass.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4lookup.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4object.cpp | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4object_p.h | 16 |
4 files changed, 15 insertions, 15 deletions
diff --git a/src/qml/jsruntime/qv4internalclass.cpp b/src/qml/jsruntime/qv4internalclass.cpp index 162de0b9f7..f310b6f551 100644 --- a/src/qml/jsruntime/qv4internalclass.cpp +++ b/src/qml/jsruntime/qv4internalclass.cpp @@ -129,7 +129,7 @@ InternalClass::InternalClass(const QV4::InternalClass &other) static void insertHoleIntoPropertyData(Object *object, int idx) { - int inlineSize = object->d()->vt->nInlineProperties; + int inlineSize = object->d()->vtable()->nInlineProperties; int icSize = object->internalClass()->size; int from = qMax(idx, inlineSize); int to = from + 1; @@ -151,7 +151,7 @@ static void insertHoleIntoPropertyData(Object *object, int idx) static void removeFromPropertyData(Object *object, int idx, bool accessor = false) { - int inlineSize = object->d()->vt->nInlineProperties; + int inlineSize = object->d()->vtable()->nInlineProperties; int delta = (accessor ? 2 : 1); int oldSize = object->internalClass()->size + delta; int to = idx; diff --git a/src/qml/jsruntime/qv4lookup.cpp b/src/qml/jsruntime/qv4lookup.cpp index 0d467098fe..f8ac0cb650 100644 --- a/src/qml/jsruntime/qv4lookup.cpp +++ b/src/qml/jsruntime/qv4lookup.cpp @@ -287,7 +287,7 @@ ReturnedValue Lookup::getterGeneric(Lookup *l, ExecutionEngine *engine, const Va l->proto = proto->d(); if (attrs.isData()) { if (l->level == 0) { - uint nInline = l->proto->vt->nInlineProperties; + uint nInline = l->proto->vtable()->nInlineProperties; if (l->index < nInline) l->getter = Lookup::primitiveGetter0Inline; else { @@ -696,7 +696,7 @@ ReturnedValue Lookup::globalGetterGeneric(Lookup *l, ExecutionEngine *engine) if (v != Primitive::emptyValue().asReturnedValue()) { if (attrs.isData()) { if (l->level == 0) { - uint nInline = o->d()->vt->nInlineProperties; + uint nInline = o->d()->vtable()->nInlineProperties; if (l->index < nInline) l->globalGetter = globalGetter0Inline; else { diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index 3d8e8f3ddf..f5dafa7914 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -266,7 +266,7 @@ void Object::markObjects(Heap::Base *that, ExecutionEngine *e) if (o->prototype) o->prototype->mark(e); uint nInline = o->vtable()->nInlineProperties; - Value *v = reinterpret_cast<Value *>(o) + o->vt->inlinePropertyOffset; + Value *v = reinterpret_cast<Value *>(o) + o->vtable()->inlinePropertyOffset; const Value *end = v + nInline; while (v < end) { v->mark(e); @@ -507,7 +507,7 @@ ReturnedValue Object::getLookup(const Managed *m, Lookup *l) if (v != Primitive::emptyValue().asReturnedValue()) { if (attrs.isData()) { if (l->level == 0) { - uint nInline = o->d()->vt->nInlineProperties; + uint nInline = o->d()->vtable()->nInlineProperties; if (l->index < nInline) l->getter = Lookup::getter0Inline; else { @@ -549,7 +549,7 @@ void Object::setLookup(Managed *m, Lookup *l, const Value &value) if (idx != UINT_MAX && o->internalClass()->propertyData[idx].isData() && o->internalClass()->propertyData[idx].isWritable()) { l->classList[0] = o->internalClass(); l->index = idx; - l->setter = idx < o->d()->vt->nInlineProperties ? Lookup::setter0Inline : Lookup::setter0; + l->setter = idx < o->d()->vtable()->nInlineProperties ? Lookup::setter0Inline : Lookup::setter0; *o->propertyData(idx) = value; return; } diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h index e1b2a40b94..78ee263c80 100644 --- a/src/qml/jsruntime/qv4object_p.h +++ b/src/qml/jsruntime/qv4object_p.h @@ -72,25 +72,25 @@ struct Object : Base { void destroy() { Base::destroy(); } const Value *inlinePropertyData(uint index) const { - Q_ASSERT(index < vt->nInlineProperties); - return reinterpret_cast<const Value *>(this) + vt->inlinePropertyOffset + index; + Q_ASSERT(index < vtable()->nInlineProperties); + return reinterpret_cast<const Value *>(this) + vtable()->inlinePropertyOffset + index; } Value *inlinePropertyData(uint index) { - Q_ASSERT(index < vt->nInlineProperties); - return reinterpret_cast<Value *>(this) + vt->inlinePropertyOffset + index; + Q_ASSERT(index < vtable()->nInlineProperties); + return reinterpret_cast<Value *>(this) + vtable()->inlinePropertyOffset + index; } const Value *propertyData(uint index) const { - uint nInline = vt->nInlineProperties; + uint nInline = vtable()->nInlineProperties; if (index < nInline) - return reinterpret_cast<const Value *>(this) + vt->inlinePropertyOffset + index; + return reinterpret_cast<const Value *>(this) + vtable()->inlinePropertyOffset + index; index -= nInline; return memberData->data + index; } Value *propertyData(uint index) { - uint nInline = vt->nInlineProperties; + uint nInline = vtable()->nInlineProperties; if (index < nInline) - return reinterpret_cast<Value *>(this) + vt->inlinePropertyOffset + index; + return reinterpret_cast<Value *>(this) + vtable()->inlinePropertyOffset + index; index -= nInline; return memberData->data + index; } |