Closed Bug 1057750 Opened 10 years ago Closed 9 years ago

Extracted class methods should be of type MethodClosure

Categories

(Firefox Graveyard :: Shumway, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: till, Assigned: mbx)

References

Details

A method is auto-boxed into a MethodClosure once it's extracted. We do the effect of this, by auto-binding to the instance, but we don't give the function the correct class. This is script-visible in a few ways: 1. `Object(extractedMethod).constructor` returns the `MethodClosure` ctor (The cast to Object is required because otherwise the language doesn't think that the instance has a property `constructor`. Yup.) 2. `getQualifiedClassName(extractedMethod)` returns "builtin.as$0::MethodClosure" (instead of "Function" for `getQualifiedSuperclassName(function(){})` 3. `getQualifiedSuperclassName(extractedMethod)` returns "Function" (instead of "Object" for `getQualifiedSuperclassName(function(){})` I'm not sure whether this is important to get right, but we should at least have it on file.
Apparently extracted methods should already be of type ASMethodClosure, so maybe the traits aren't set up correctly for that? In any case, we should consider implementing the `bind` thing manually. In bug 1000780, I experimented with self-hosting SM's Function#bind, with excellent results. See bug 1000780 comment 8 for numbers. That uses the self-hosting intrinsic `callFunctions`, which is essentially syntax (that only looks like a function) for an as-fast-as-can-be Function#call. We don't have that, but using Function#call or Function#apply might still be fast because the JIT should detect those as the original functions and inline them.
Assignee: nobody → mbebenita
This is implemented since the redux branch landed.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WORKSFORME
Product: Firefox → Firefox Graveyard
You need to log in before you can comment on or make changes to this bug.