[es2015] Handle proxies in GetProperty builtin.
Teach the GetProperty builtin how to perform [[Get]] on JSProxy instances by calling into the dedicated ProxyGetProperty builtin that we already use for the LOAD_IC / KEYED_LOAD_IC. This is important when proxies are used in places were GetProperty builtin is used like for example as iterables in for..of loops or in spreads. On a simple micro-benchmark like the following ```js const proxy = new Proxy([1, 2, 3], { get(target, property) { return target[property]; } }); const TESTS = [ function testForOfProxy() { for (const x of proxy) {} }, function testSpreadProxy() { return [...proxy]; } ]; function test(fn) { var result; for (var i = 0; i < 1e6; ++i) result = fn(); return result; } test(x => x); for (var j = 0; j < TESTS.length; ++j) test(TESTS[j]); for (var j = 0; j < TESTS.length; ++j) { var startTime = Date.now(); test(TESTS[j]); print(TESTS[j].name + ':', (Date.now() - startTime), 'ms.'); } ``` improves from around testForOfProxy: 1672.6 ms. testSpreadProxy: 1956.6 ms. to testForOfProxy: 408.4 ms. testSpreadProxy: 530.8 ms. on average, which corresponds to a 4-5x performance improvement, even for small arrays. On the ARES-6 Air benchmark this completely eliminates all calls to the %GetProperty runtime function, and thereby improves the steady state mean by 2-3%. Bug: v8:6344, v8:6557, v8:6559 Change-Id: Ifebdaff8f3ae5899a33ce408ecd54655247f3a02 Reviewed-on: https://chromium-review.googlesource.com/1199023Reviewed-by: Maya Lekova <mslekova@chromium.org> Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#55539}
Showing
Please
register
or
sign in
to comment