aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-03-26 08:55:45 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-27 20:39:59 +0100
commitb9bf708bf85ba062d009ccf5e13e3494dc88a5d1 (patch)
treea0641095030560b9086325cc282113117c483553 /src
parent56c5a21ccea2451e4878b9ceb7e420caa763965d (diff)
Optimize ExecutionContext::setProperty
Optimize the code in case the setProperty call tries to set something in the activation. Avoid resolving the property index twice. Change-Id: I60a4535adc014f7118bc3ab6773e10ed688ca0d6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/qml/jsruntime/qv4context.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index 0d8e57bdd5..b43b4893a3 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -319,9 +319,15 @@ void ExecutionContext::setProperty(const StringRef name, const ValueRef value)
}
if (activation) {
- if (ctx->type == Type_QmlContext || activation->hasOwnProperty(name)) {
+ if (ctx->type == Type_QmlContext) {
activation->put(name, value);
return;
+ } else {
+ uint member = activation->internalClass->find(name);
+ if (member < UINT_MAX) {
+ activation->putValue(activation->propertyAt(member), activation->internalClass->propertyData[member], value);
+ return;
+ }
}
}
}