From: Lars Knoll Date: Tue, 29 Jan 2013 21:07:48 +0000 (+0100) Subject: Optimise callProperty for Strings. X-Git-Tag: upstream/5.2.1~669^2~659^2~350 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=27d9ded1bed732514fdf607ab0d422dd69aade99;p=platform%2Fupstream%2Fqtdeclarative.git Optimise callProperty for Strings. Don't convert the String to a StringOject, just to call a method on it's prototype. The result would in any case be the same. Change-Id: I74cea392b20b6c5642d010287ebf6e27c91eea83 Reviewed-by: Simon Hausmann --- diff --git a/qmljs_runtime.cpp b/qmljs_runtime.cpp index 682f025..9e50217 100644 --- a/qmljs_runtime.cpp +++ b/qmljs_runtime.cpp @@ -45,6 +45,7 @@ #include "qv4ir_p.h" #include "qv4objectproto.h" #include "qv4globalobject.h" +#include "qv4stringobject.h" #include "private/qlocale_tools_p.h" #include @@ -747,14 +748,18 @@ Value __qmljs_call_activation_property(ExecutionContext *context, String *name, return o->call(context, thisObject, args, argc); } -Value __qmljs_call_property(ExecutionContext *context, Value that, String *name, Value *args, int argc) +Value __qmljs_call_property(ExecutionContext *context, Value thisObject, String *name, Value *args, int argc) { - Value thisObject = that; - if (!thisObject.isObject()) - thisObject = __qmljs_to_object(thisObject, context); + Object *baseObject; + if (thisObject.isString()) { + baseObject = context->engine->stringPrototype; + } else { + if (!thisObject.isObject()) + thisObject = __qmljs_to_object(thisObject, context); - assert(thisObject.isObject()); - Object *baseObject = thisObject.objectValue(); + assert(thisObject.isObject()); + baseObject = thisObject.objectValue(); + } Value func = baseObject->__get__(context, name); FunctionObject *o = func.asFunctionObject();