NEW 169030
[JSC] Optimize generators and iterators with op_next
https://bugs.webkit.org/show_bug.cgi?id=169030
Summary [JSC] Optimize generators and iterators with op_next
Yusuke Suzuki
Reported 2017-03-01 04:19:10 PST
Simple idea: we have op_next for for-of statement. And op_next usually works as similar to `call` to the next() function. But it records the iterator/generator (IC). In DFG / FTL tiers, if we can ensure that this op_next still calls the same generator functions, we can skip Generator.prototype.next() function. Generator.prototype.next() is costly because all the generators use this one function. It is inherently polymorphic. But if we can skip this and if the IC tells DFG which generator function is called, we can inline the generator function in the call site! If it is done in FTL layer, we have a chance to drop the lexical environment creation for the generators by using object allocation sinking.
Attachments
Saam Barati
Comment 1 2017-03-04 17:28:34 PST
This would be sweet. It'd make iterating Map/Set really fast
Saam Barati
Comment 2 2017-03-07 10:42:50 PST
Let's make sure this also speeds up array destructuring. See Joe's example program in: https://bugs.webkit.org/show_bug.cgi?id=155146
Saam Barati
Comment 3 2017-03-07 10:43:07 PST
*** Bug 155146 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.