[webkit-reviews] review granted: [Bug 68851] De-virtualize JSCell::getPrimitiveNumber : [Attachment 108770] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Sep 27 10:16:48 PDT 2011


Darin Adler <darin at apple.com> has granted Mark Hahnenberg
<mhahnenberg at apple.com>'s request for review:
Bug 68851: De-virtualize JSCell::getPrimitiveNumber
https://bugs.webkit.org/show_bug.cgi?id=68851

Attachment 108770: Patch
https://bugs.webkit.org/attachment.cgi?id=108770&action=review

------- Additional Comments from Darin Adler <darin at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=108770&action=review


> Source/JavaScriptCore/runtime/JSCell.cpp:135
> -bool JSCell::getPrimitiveNumber(ExecState*, double&, JSValue&)
> +bool JSCell::getPrimitiveNumber(ExecState* exec, double& number, JSValue&
value) const
>  {
> -    ASSERT_NOT_REACHED();
> -    return false;
> +    if (isString())
> +	   return static_cast<const JSString*>(this)->getPrimitiveNumber(exec,
number, value);
> +    return static_cast<const JSObject*>(this)->getPrimitiveNumber(exec,
number, value);
>  }

This turns a single virtual function call into two levels of non-virtual
function call. Did you do speed testing? Does this function need to be inlined
in JSString.h?


More information about the webkit-reviews mailing list