[Webkit-unassigned] [Bug 145605] Function.prototype.bind: Bound functions must use the [[Prototype]] of their target function instead of Function.prototype

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Sep 11 10:45:30 PDT 2015


https://bugs.webkit.org/show_bug.cgi?id=145605

Geoffrey Garen <ggaren at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #260999|review?                     |review-
              Flags|                            |

--- Comment #32 from Geoffrey Garen <ggaren at apple.com> ---
Comment on attachment 260999
  --> https://bugs.webkit.org/attachment.cgi?id=260999
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=260999&action=review

> Source/JavaScriptCore/runtime/JSBoundFunction.cpp:81
> +    bool hasDefaultPrototype = targetPrototype.isObject() && asObject(targetPrototype) == (JSObject *)globalObject->functionPrototype();

There's no need to cast functionPrototype() to JSObject*: FunctionPrototype inherits from JSObject.

WebKit style uses C++ cast syntax rather than C syntax.

WebKit style puts the * next to the type name, as in "JSObject*".

The clearest and most efficient way to write this is "targetPrototype == globalObject->functionPrototype()". That's only one compare-and-branch instead of two.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150911/cb640f20/attachment.html>


More information about the webkit-unassigned mailing list