From cd148a1fd4959daac669581df35f91104fab7b8b Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 12 Sep 2018 20:08:54 +0200 Subject: Optimize Object::virtualGet() Optimize virtualGet() for the common case where the proto chain are all regular objects. Change-Id: I51eea9a4b96033be4effc2072fedc5b9b08e8440 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4object_p.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/qml/jsruntime/qv4object_p.h') diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h index 41484660ab..991c0591a5 100644 --- a/src/qml/jsruntime/qv4object_p.h +++ b/src/qml/jsruntime/qv4object_p.h @@ -185,12 +185,17 @@ struct Q_QML_EXPORT Object: Managed { // // helpers // - static ReturnedValue getValue(const Value &thisObject, const Value &v, PropertyAttributes attrs); + static ReturnedValue getValue(const Value &thisObject, const Value &v, PropertyAttributes attrs) { + if (attrs.isData()) + return v.asReturnedValue(); + return getValueAccessor(thisObject, v, attrs); + } ReturnedValue getValue(const Value &v, PropertyAttributes attrs) const { Scope scope(this->engine()); ScopedValue t(scope, const_cast(this)); return getValue(t, v, attrs); } + static ReturnedValue getValueAccessor(const Value &thisObject, const Value &v, PropertyAttributes attrs); bool putValue(uint memberIndex, const Value &value); -- cgit v1.2.3