Skip to content

Commit

Permalink
[compiler] General-purpose function outlining
Browse files Browse the repository at this point in the history
Implements general-purpose function outlining. Specifically, anonymous function expressions which have no dependencies/context variables are extracted into named top-level functions. The original function expression is replaced with a `LoadGlobal` of the generated name.

Note that the architecture is designed to allow very general purpose forms of outlining, though we currently are very conservative in what we outline. Specifically, the outlining allows annotating functions with an optional ReactiveFunctionType, which if set will cause the outlined function to get compiled as that type. So we could for example outline a helper hook or helper component, set the type, and then have the hook/component get memoized as well. For now though we just outline with no type set, and generate the function as-is without running it through compilation.

ghstack-source-id: 2a7da6c8e85c3f8becb22d3869d9b6200f7db126
Pull Request resolved: facebook#30331
  • Loading branch information
felixshiftellecon committed Jul 24, 2024
1 parent 9d7f02d commit 8f99a72
Show file tree
Hide file tree
Showing 2 changed files with 366 additions and 332 deletions.
Loading

0 comments on commit 8f99a72

Please sign in to comment.