New issue
Advanced search Search tips
Starred by 3 users
Status: Assigned
HW: All
NextAction: ----
OS: All
Priority: 2
Type: FeatureRequest

issue 6936

Sign in to add a comment
Generalize Function Context Specialization
Project Member Reported by, Oct 24 Back to list
Currently function context specialization is fairly limited, it can only kick in if the function that we optimize has only exactly one closure, and then we specialize to that closures' context. We could generalize it a bit to allow specialization to outer contexts, such that we can benefit from it, even for local closures, i.e. arrow functions that are passed as callbacks. Currently these local functions suffer from a lot of hole checks if they refer to const declarations outside.

For this we'd need to have a way to record the specialization depth on the code object and share the code object if the specialization depth is compatible (within the native context).

This was found to be an issue with  for example, where the right-hand side of the instanceof wasn't a constant known to TurboFan. This was fixed in a more general way for instanceof, but that still leaves us with code that has to perform all kinds of checks that it wouldn't need to with generalized function context specialization.
Sign in to add a comment