aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2012-02-07 13:33:22 +0000
committerQt by Nokia <qt-info@nokia.com>2012-02-20 08:34:28 +0100
commitd25ff859591c2450606c56cfc2cebd577165e1b6 (patch)
tree46bcdae5ccab6b85dc50c60c7cec8fa5bd701ec8 /src
parent6b775ffda38549bc9d76b6374dd9604115868a18 (diff)
Reduce size of QDeclarativePropertyData
Accessors cannot overload properties and are not available on value types so can be safely union'd together. Change-Id: Iae34f8b2935d010ca43365238a7514c0e26953f0 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/declarative/qml/qdeclarativepropertycache.cpp4
-rw-r--r--src/declarative/qml/qdeclarativepropertycache_p.h48
2 files changed, 29 insertions, 23 deletions
diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp
index fb9beee55a..c8bfd98363 100644
--- a/src/declarative/qml/qdeclarativepropertycache.cpp
+++ b/src/declarative/qml/qdeclarativepropertycache.cpp
@@ -534,8 +534,8 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb
QDeclarativeAccessorProperties::Property *accessorProperty = accessorProperties.property(str);
- // Fast properties may not be overrides
- Q_ASSERT(accessorProperty == 0 || old == 0);
+ // Fast properties may not be overrides or revisioned
+ Q_ASSERT(accessorProperty == 0 || (old == 0 && data->revision == 0));
if (accessorProperty) {
data->flags |= QDeclarativePropertyData::HasAccessors;
diff --git a/src/declarative/qml/qdeclarativepropertycache_p.h b/src/declarative/qml/qdeclarativepropertycache_p.h
index 9ba1940782..ef8cefd821 100644
--- a/src/declarative/qml/qdeclarativepropertycache_p.h
+++ b/src/declarative/qml/qdeclarativepropertycache_p.h
@@ -146,7 +146,9 @@ public:
bool isSignalHandler() const { return flags & IsSignalHandler; }
bool isOverload() const { return flags & IsOverload; }
- bool hasOverride() const { return !(flags & IsValueTypeVirtual) && overrideIndex >= 0; }
+ bool hasOverride() const { return !(flags & IsValueTypeVirtual) &&
+ !(flags & HasAccessors) &&
+ overrideIndex >= 0; }
// Returns -1 if not a value type virtual property
inline int getValueTypeCoreIndex() const;
@@ -160,28 +162,34 @@ public:
int notifyIndex; // When !IsFunction
void *arguments; // When IsFunction && HasArguments
};
+
union {
- struct { // When !IsValueTypeVirtual
- uint overrideIndexIsProperty : 1;
- signed int overrideIndex : 31;
+ struct { // When !HasAccessors
+ qint16 revision;
+ qint16 metaObjectOffset;
+
+ union {
+ struct { // When IsValueTypeVirtual
+ quint16 valueTypeFlags; // flags of the access property on the value type proxy
+ // object
+ quint8 valueTypePropType; // The QVariant::Type of access property on the value
+ // type proxy object
+ quint8 valueTypeCoreIndex; // The prop index of the access property on the value
+ // type proxy object
+ };
+
+ struct { // When !IsValueTypeVirtual
+ uint overrideIndexIsProperty : 1;
+ signed int overrideIndex : 31;
+ };
+ };
};
- struct { // When IsValueTypeVirtual
- quint16 valueTypeFlags; // flags of the access property on the value type proxy object
- quint8 valueTypePropType; // The QVariant::Type of access property on the value type
- // proxy object
- quint8 valueTypeCoreIndex; // The prop index of the access property on the value type
- //proxy object
+ struct { // When HasAccessors
+ QDeclarativeAccessors *accessors;
+ intptr_t accessorData;
};
};
- qint16 revision;
- qint16 metaObjectOffset;
-
- struct { // When HasAccessors
- QDeclarativeAccessors *accessors;
- intptr_t accessorData;
- };
-
private:
friend class QDeclarativePropertyData;
friend class QDeclarativePropertyCache;
@@ -306,8 +314,6 @@ QDeclarativePropertyData::QDeclarativePropertyData()
overrideIndex = -1;
revision = 0;
metaObjectOffset = -1;
- accessors = 0;
- accessorData = 0;
flags = 0;
}
@@ -347,7 +353,7 @@ QDeclarativePropertyCache::overrideData(QDeclarativePropertyData *data) const
bool QDeclarativePropertyCache::isAllowedInRevision(QDeclarativePropertyData *data) const
{
- return (data->metaObjectOffset == -1 && data->revision == 0) ||
+ return (data->hasAccessors() || data->metaObjectOffset == -1 && data->revision == 0) ||
(allowedRevisionCache[data->metaObjectOffset] >= data->revision);
}