aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/v8/qv8typewrapper.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2011-06-14 11:52:30 +1000
committerAaron Kennedy <aaron.kennedy@nokia.com>2011-06-14 11:52:30 +1000
commit49cc32e6c91b0ebe935810f3d5d581e6e8dfcc46 (patch)
treed60553b9c17c424a264333ff2183d0db39d40ab2 /src/declarative/qml/v8/qv8typewrapper.cpp
parent797be6d11b0bfe6c46b4e69cd6933990925b6093 (diff)
Add QHashedV8String to improve lookup performance
Also inline QV8QObjectWrapper::getProperty() which significantly improves context lookups which contain a lot of QObject property lookup misses.
Diffstat (limited to 'src/declarative/qml/v8/qv8typewrapper.cpp')
-rw-r--r--src/declarative/qml/v8/qv8typewrapper.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/declarative/qml/v8/qv8typewrapper.cpp b/src/declarative/qml/v8/qv8typewrapper.cpp
index 70af6037de..9aac7a30d7 100644
--- a/src/declarative/qml/v8/qv8typewrapper.cpp
+++ b/src/declarative/qml/v8/qv8typewrapper.cpp
@@ -130,6 +130,8 @@ v8::Handle<v8::Value> QV8TypeWrapper::Getter(v8::Local<v8::String> property,
QV8Engine *v8engine = resource->engine;
QObject *object = resource->object;
+ QHashedV8String propertystring(property);
+
if (resource->type) {
QDeclarativeType *type = resource->type;
@@ -153,7 +155,8 @@ v8::Handle<v8::Value> QV8TypeWrapper::Getter(v8::Local<v8::String> property,
} else if (resource->object) {
QObject *ao = qmlAttachedPropertiesObjectById(type->attachedPropertiesId(), object);
if (ao)
- return v8engine->qobjectWrapper()->getProperty(ao, property, QV8QObjectWrapper::IgnoreRevision);
+ return v8engine->qobjectWrapper()->getProperty(ao, propertystring,
+ QV8QObjectWrapper::IgnoreRevision);
// Fall through to undefined
}
@@ -163,7 +166,7 @@ v8::Handle<v8::Value> QV8TypeWrapper::Getter(v8::Local<v8::String> property,
} else if (resource->typeNamespace) {
QDeclarativeTypeNameCache *typeNamespace = resource->typeNamespace;
- QDeclarativeTypeNameCache::Data *d = typeNamespace->data(property);
+ QDeclarativeTypeNameCache::Data *d = typeNamespace->data(propertystring);
Q_ASSERT(!d || !d->typeNamespace); // Nested namespaces not supported
if (d && d->type) {
@@ -197,12 +200,15 @@ v8::Handle<v8::Value> QV8TypeWrapper::Setter(v8::Local<v8::String> property,
// XXX TODO: Implement writes to module API objects
+ QHashedV8String propertystring(property);
+
if (resource->type && resource->object) {
QDeclarativeType *type = resource->type;
QObject *object = resource->object;
QObject *ao = qmlAttachedPropertiesObjectById(type->attachedPropertiesId(), object);
if (ao)
- v8engine->qobjectWrapper()->setProperty(ao, property, value, QV8QObjectWrapper::IgnoreRevision);
+ v8engine->qobjectWrapper()->setProperty(ao, propertystring, value,
+ QV8QObjectWrapper::IgnoreRevision);
}
return value;