aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4context.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-11-15 22:40:07 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-04 09:45:35 +0100
commit9f4597dd7ae333f209c862e40c68a8f84255a63a (patch)
tree321fe649f1263be4ada9792968a1a83fa3c9ca4c /src/qml/jsruntime/qv4context.cpp
parent0fa9cf218bdd3054585f23abfb2b707e26ce987a (diff)
Optimize ExecutionContext::setProperty
No need to call hasProperty followed by put. Instead get the property descriptor and call putValue for it. Improves v8-bench by 5%. Change-Id: Ied047126c651c033f7ad4c27deaeec08e5fee7f9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4context.cpp')
-rw-r--r--src/qml/jsruntime/qv4context.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index 90e6850161..aea7827832 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -372,9 +372,18 @@ void ExecutionContext::setProperty(const StringRef name, const ValueRef value)
activation = static_cast<GlobalContext *>(ctx)->global;
}
- if (activation && (ctx->type == Type_QmlContext || activation->__hasProperty__(name))) {
- activation->put(name, value);
- return;
+ if (activation) {
+ if (ctx->type == Type_QmlContext) {
+ activation->put(name, value);
+ return;
+ } else {
+ PropertyAttributes attrs;
+ Property *p = activation->__getOwnProperty__(name, &attrs);
+ if (p) {
+ activation->putValue(p, attrs, value);
+ return;
+ }
+ }
}
}
}