aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4object.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-09-11 14:58:57 +0200
committerLars Knoll <lars.knoll@qt.io>2018-09-16 17:00:30 +0000
commitd89d5cffe79bd060a1b04a2c47a3d728bffbe195 (patch)
treef1f0f54aae8ce93533c29402d907926fe2487fa1 /src/qml/jsruntime/qv4object.cpp
parentcd148a1fd4959daac669581df35f91104fab7b8b (diff)
Some more optimizations to Object::internalPut()
Change-Id: Ib1b224ad27428ca37450f269b491cfa9d82e559a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4object.cpp')
-rw-r--r--src/qml/jsruntime/qv4object.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index e58b9d8168..4c36d24c1a 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -553,6 +553,18 @@ bool Object::internalPut(PropertyKey id, const Value &value, Value *receiver)
attrs = Attr_Data;
}
+ if (r->internalClass()->vtable->defineOwnProperty == virtualDefineOwnProperty) {
+ // standard object, we can avoid some more checks
+ uint index = id.asArrayIndex();
+ if (index == UINT_MAX) {
+ ScopedStringOrSymbol s(scope, id.asStringOrSymbol());
+ r->insertMember(s, value);
+ } else {
+ r->arraySet(index, value);
+ }
+ return true;
+ }
+
p->value = value;
return r->defineOwnProperty(id, p, attrs);
}