Closed Bug 1093158 Opened 10 years ago Closed 9 years ago

Functions created with .bind use a lot of stack space

Categories

(Core :: JavaScript Engine, defect)

32 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: khuey, Assigned: till)

References

Details

Yes, our bind implementation is pretty terrible atm for multiple reasons. Bug 1000780 will hopefully fix this...
Depends on: 1000780
Oh and we use more stack space because we have to call into C++ (see CallOrConstructBoundFunction) and then back into JIT code for every function call. Entering and leaving JIT code involves various trampolines and pushing more C++ frames. Normal function calls will stay in JIT code or are even inlined in Ion, meaning there's a lot less overhead. Bug 1000780 (self-hosting bind) should also keep us in JIT code.
I just tested this with a new patch in bug 1000780: at least in the OS X shell, I get about 10x as many iterations as before (~2300 instead of 210, with the unbound case varying wildly between 4600 and 6500; the OS X shell stack limit is laughably low).
Blocks: 1167883
This was indeed fixed by bug 1000780. I get 67k iterations for the bound function vs 95k for the unbound one in the browser and 5942 / 6813 in the shell. While there's still a delta between the two, there's not much we can do about that, since the stack frames just contain more data. Other browsers: Chrome Canary 8956 / 9844 (!) Safari 9.0.2 5640 / 28156
Assignee: nobody → till
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.