You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scala.js: Inline the target of Closure nodes in their js.Closures.
This is forward port of the Scala.js commit
scala-js/scala-js@0d16b42
The body of `Closure` nodes always has a simple shape that calls a
helper method. We previously generated that call in the body of the
`js.Closure`, and marked the target method `@inline` so that the
optimizer would always inline it.
Instead, we now directly "inline" it from the codegen, by
generating the `js.MethodDef` right inside the `js.Closure` scope.
As is, this does not change the generated code. However, it may
speed up (cold) linker runs, since it will have less work to do.
Notably, it performs two fewer knowledge queries to find and inline
the target method. It also reduces the total amount of methods to
manipulate in the incremental analysis.
More importantly, this will be necessary later if we want to add
support for `async/await` or `function*/yield`. Indeed, for those,
we will need `await`/`yield` expressions to be lexically scoped
in the body of their enclosing closure. That won't work if they are
in the body of a separate helper method.
0 commit comments