-
Benedikt Meurer authored
In Promise.all we used to allocate a fresh closure plus a fresh context for each individual element, which is quite a lot of overhead, especially since this could be shared in a single context for all elements. The only bit of information that is needed for each resolve element closure is the index under which to store the resulting value. With this change we move this index to the "identity hash" field of the JSFunction, which doesn't care about the concrete value anyways, as long as it's not zero (the "no hash" sentinel), and share the rest of the fields in a single outer context for all resolve element closures. This limits the maximum number of elements for Promise.all to 2^21 for now, but that should be fine. Shall we ever see the need for more than this, we can add machinery to overflow to separate context for indices larger than 2^21. This significantly reduces the overhead due to Promise.all on the parallel-async-es2017-native test, with execution time dropping from around 148ms to 133ms, so overall a steady 10% improvement on this benchmark. Bug: v8:7253 Change-Id: I1092da771c4919f3db7129d2b0a244fc26a7b144 Reviewed-on: https://chromium-review.googlesource.com/973283Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#52134}
d8658177