Bug 169030 - [JSC] Optimize generators and iterators with op_next
Summary: [JSC] Optimize generators and iterators with op_next
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
: 155146 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-03-01 04:19 PST by Yusuke Suzuki
Modified: 2017-03-07 10:43 PST (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 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.
Comment 1 Saam Barati 2017-03-04 17:28:34 PST
This would be sweet. It'd make iterating Map/Set really fast
Comment 2 Saam Barati 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
Comment 3 Saam Barati 2017-03-07 10:43:07 PST
*** Bug 155146 has been marked as a duplicate of this bug. ***