Closed rhuanjl closed 6 months ago
I think it is a pretty good idea.
I've moved all generator JIT test cases into a new folder and added additional test cases for testing loop body jit.
Note, with this PR we now have:
Default behaviour (no flag): do not Jit generator (or async functions) BUT do jit hot loops inside them that don't contain yield
or await
.
Flagged behaviour -JitEs6Generators
: turns back on attempting to JIT the generator/async functions AND disables this loop body Jit, having both working together may be a distant goal BUT for now the function jit is going to be disabled; and their interaction has additional bugs vs just the function jit on its own.
Jitting of generator and async functions is buggy and has some potential performance cliffs. As an alternative this PR enables Jitting of loops that don't contain await or yield.
e.g. In this examples if the profiler found them to be hot loop 2 and loop 4 would be jitted:
Whilst jitting the whole function may in theory offer better performance it's not actually clear that it would in light of the overheads of yielding out of jitted code AND the problems yield brings to optimising jitted code.
This alternative is much simpler; hopefully far more stable AND should target the most optimisable parts of these functions.