Bug 1483869 Comment 21 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

List of follow-up optimization ideas I'll file bugs for and look into after this lands:

* In `BoundFunctionObject::call`, reuse incoming `args` if we're only binding `this`. Measure but probably common.
* If a `bind()` site is always binding a function with the same shape/name etc, we can probably avoid a VM call.
* In `tryAttachBoundFunction`, try to do a shape guard instead of a class guard with the optimistic class guard optimization.
* For megamorphic bound calls, consider using a loop that handles any `numBoundArgs`. Currently harder to implement in Ion.
* Bound function state is immutable. We could communicate this to `MLoadFixedSlot` so the JIT can optimize this better.
* Support constructor calls to bound functions in `tryAttachCallHook` and for call-bound-scripted.
* Look into bound-scripted `FunApply`, this shows up in Speedometer/React.
* Investigate trial-inlining for standard calls.
* Consider flattening chains of bound functions to enable easier call optimizations. React-TodoMVC has a lot of this.
List of follow-up optimization ideas I'll file bugs for and look into after this lands:

* In `BoundFunctionObject::call`, reuse incoming `args` if we're only binding `this`. Measure but probably common.
* If a `bind()` site is always binding a function with the same shape/name etc, we can probably avoid a VM call.
* In `tryAttachBoundFunction`, try to do a shape guard instead of a class guard with the optimistic class guard optimization.
* For megamorphic bound calls, consider using a loop that handles any `numBoundArgs`. Currently harder to implement in Ion.
* Bound function state is immutable. We could communicate this to `MLoadFixedSlot` so the JIT can optimize this better.
* Support constructor calls to bound functions in `tryAttachCallHook` and for call-bound-scripted.
* Look into bound-scripted `FunApply`, this shows up in Speedometer/React.
* Investigate trial-inlining for standard calls.
* Consider flattening chains of bound functions to enable easier call optimizations. React-TodoMVC has a lot of this.
* See if scalar replacement of `bind` would help.

Back to Bug 1483869 Comment 21