3fe7d698b8
This CL introduces type narrowing and constant folding reducers to constant fold code that comes out of inlined destructuring of arrays. In particular, array iterator introduces code that contains a phi of a temporary array that blocks escape analysis. The phi comes from conditional that can be evaluated statically (i.e., constant folded), so with better constant folding we allow escape analysis to get rid of the temporary array. On a quick micro-benchmark below, we see more than 6x improvement. This is close to the hand-optimized version - if we replace body of f with 'return b + a', we get 220ms (versus 218ms with destructuring). function f(a, b) { [b, a] = [a, b]; return a + b; } function sum(count) { let s = 0; for (let i = 0; i < count; i++) { s += f(1, 2); } return s; } // Warm up sum(1e5); sum(1e5); console.time("destructure array"); sum(1e8); console.timeEnd("destructure array"); console.timeEnd: destructure array, 213.526000 console.timeEnd: destructure array, 1503.537000 Bug: v8:7728 Change-Id: Ib7aec1d5897989e6adb1af1eddd516d8b3866db5 Reviewed-on: https://chromium-review.googlesource.com/1047672 Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#53048} |
||
---|---|---|
.. | ||
api | ||
asmjs | ||
base | ||
compiler | ||
compiler-dispatcher | ||
heap | ||
interpreter | ||
libplatform | ||
parser | ||
wasm | ||
zone | ||
allocation-unittest.cc | ||
bigint-unittest.cc | ||
BUILD.gn | ||
cancelable-tasks-unittest.cc | ||
char-predicates-unittest.cc | ||
code-stub-assembler-unittest.cc | ||
code-stub-assembler-unittest.h | ||
counters-unittest.cc | ||
DEPS | ||
detachable-vector-unittest.cc | ||
eh-frame-iterator-unittest.cc | ||
eh-frame-writer-unittest.cc | ||
locked-queue-unittest.cc | ||
object-unittest.cc | ||
register-configuration-unittest.cc | ||
run-all-unittests.cc | ||
source-position-table-unittest.cc | ||
strings-storage-unittest.cc | ||
test-helpers.cc | ||
test-helpers.h | ||
test-utils.cc | ||
test-utils.h | ||
testcfg.py | ||
unicode-unittest.cc | ||
unittests.status | ||
utils-unittest.cc | ||
value-serializer-unittest.cc |