PromiseWalker#scheduleWalkerLoop() seems to create unnecessary bound and arrow functions

NEW
Unassigned

Status

()

Toolkit
Async Tooling
6 months ago
5 months ago

People

(Reporter: anba, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 months ago
http://searchfox.org/mozilla-central/rev/1a054419976437d0778a2b89be1b00207a744e94/toolkit/modules/Promise-backend.js#742-743 binds |walkerLoop| to the this-value, but, assuming this is the same |walkerLoop| from here http://searchfox.org/mozilla-central/rev/1a054419976437d0778a2b89be1b00207a744e94/toolkit/modules/Promise-backend.js#787, |walkerLoop| is already bound to the PromiseWalker object here http://searchfox.org/mozilla-central/rev/1a054419976437d0778a2b89be1b00207a744e94/toolkit/modules/Promise-backend.js#812. Rebinding the function creates unnecessary objects and forces the js-engine to atomize the bound function names repeatedly. 

Similarly, this arrow function http://searchfox.org/mozilla-central/rev/1a054419976437d0778a2b89be1b00207a744e94/toolkit/modules/Promise-backend.js#746 could be removed, because |this.walkerLoop| is already bound to the PromiseWalker.
You need to log in before you can comment on or make changes to this bug.