[Webkit-unassigned] [Bug 26382] [ES5] Implement Function.prototype.bind

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Apr 25 11:21:40 PDT 2010


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


Oliver Hunt <oliver at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |oliver at apple.com
     Ever Confirmed|0                           |1




--- Comment #9 from Oliver Hunt <oliver at apple.com>  2010-04-25 11:21:38 PST ---
Okay, here's my thought for getting a non-reentrant version of bind, it only
works for non-partially applied bound functions (but according to Caio's
numbers the native impl of partially applied bind is faster than the js
version).  Basically we do this:
    DEFINE_OPCODE(op_call) {
...
    call_start:
        JSValue v = callFrame->r(func).jsValue();

        CallData callData;
        CallType callType = v.getCallData(callData);

        if (callType == CallTypeJS) {
...

        if (callType == CallTypeHost) {
             if (callData.boundFunction) {
                  callFrame->r(func) = callData.boundFunction;
                  // we actually need to work out what thisRegister is :D
                  callFrame->r(thisRegister) =
static_cast<JSBoundFunction*>(v.asCell())->thisArgument();
                  goto call_start;
             }
             ...

That should save the reentry cost -- in the jit we'd probably just want to do
the handling on return from host call stub.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list