aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4internalclass_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-09-24 09:09:47 +0200
committerLars Knoll <lars.knoll@qt.io>2018-09-27 08:34:02 +0000
commitb6f2b4308b024a92d18bdb81db9fa7dc37213eb3 (patch)
tree678d634000f9f0b946eb7ad8adc4d875948a1a8c /src/qml/jsruntime/qv4internalclass_p.h
parent7cc66a996e70c52bc274ae9f15f65e8a638894d9 (diff)
Don't move any property slots in Objects anymore
Until now, changing an existing property into an accessor property would cause the slots in the object to get re-arranged to make space for the additional setter required. Change this by dropping the requirement that getter and setter slot have to be next to each other. This has the advantage, that any slot we define to be at a certain position in the internal class/object will stay there and we can use that assumption to optimize accesses to the slot. Change-Id: Ib37c2a49fc6aae42ea4b2da36ac1dc3036540c12 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4internalclass_p.h')
-rw-r--r--src/qml/jsruntime/qv4internalclass_p.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4internalclass_p.h b/src/qml/jsruntime/qv4internalclass_p.h
index febc1561f9..2d60a0048f 100644
--- a/src/qml/jsruntime/qv4internalclass_p.h
+++ b/src/qml/jsruntime/qv4internalclass_p.h
@@ -76,6 +76,7 @@ struct PropertyHash
struct Entry {
PropertyKey identifier;
uint index;
+ uint setterIndex;
};
PropertyHashData *d;
@@ -377,7 +378,7 @@ struct InternalClass : Base {
PropertyHash::Entry *e = propertyTable.lookup(id);
if (e && e->index < size) {
PropertyAttributes a = propertyData.at(e->index);
- return { e->index, (a.isAccessor() ? e->index + 1 : UINT_MAX), a };
+ return { e->index, e->setterIndex, a };
}
return { UINT_MAX, UINT_MAX, Attr_Invalid };
@@ -407,7 +408,11 @@ struct InternalClass : Base {
PropertyHash::Entry *e = propertyTable.lookup(id);
if (e && e->index < size) {
PropertyAttributes a = propertyData.at(e->index);
- return { a.isAccessor() ? e->index + 1 : e->index, a };
+ if (a.isAccessor()) {
+ Q_ASSERT(e->setterIndex != UINT_MAX);
+ return { e->setterIndex, a };
+ }
+ return { e->index, a };
}
return { UINT_MAX, Attr_Invalid };