-
Benedikt Meurer authored
So far the JSCallReducer was only able to unfold constant JSBoundFunction targets for JSCall nodes, which is not the common case. With the introduction of JSCreateBoundFunction operator earlier, we can now also recognize calls to bound functions where the bind happens earlier in the function, i.e. as the example of a.map(f.bind(self)) in https://twitter.com/BenLesh/status/920700003974123520, which is a handy way to use Function#bind. So this transformation takes a node like JSCall(JSCreateBoundFunction(bound_target_function, bound_this, a1,...,aN), receiver, p1,...,pM) and turns that into JSCall(bound_target_function, bound_this, a1,...,aN,p1,...,pM) allowing TurboFan to further inline the bound_target_function at this call site if that's also inlinable (i.e. it's a known constant JSFunction or the result of a JSCreateClosure call). This improves the micro-benchmark from arrowCall: 55 ms. boundCall: 221 ms. arrowMap: 181 ms. boundMap: 806 ms. to arrowCall: 71 ms. boundCall: 76 ms. arrowMap: 188 ms. boundMap: 186 ms. so that Function#bind in this case is as fast as using closures, which is an up to 4.3x improvement in the Array#map example. Bug: v8:5257, v8:6961 Change-Id: Ibca650faad912bf9db1db6fbc48772e7551289a6 Reviewed-on: https://chromium-review.googlesource.com/727799Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#48713}
99100db4