v8/test/mjsunit/es9
Benedikt Meurer 4995c85f28 [runtime] Optimize general object spread.
This adds a new %_CopyDataProperties intrinsic, that reuses most of the
existing machinery that we already have in place for Object.assign() and
computed property names in object literals. This speeds up the general
case for object spread (where the spread is not the first item in an
object literal) and brings it on par with Object.assign() at least - in
most cases it's significantly faster than Object.assign().

In the test case [1] referenced from the bug, the performance goes from

  objectSpreadLast: 3624 ms.
  objectAssignLast: 1938 ms.

to

  objectSpreadLast: 646 ms.
  objectAssignLast: 1944 ms.

which corresponds to a **5-6x performance boost**, making object spread
faster than Object.assign() in general.

Drive-by-fix: This refactors the Object.assign() fast-path in a way that
it can be reused appropriately for object spread, and adds another new
builtin SetDataProperties, which does the core of the Object.assign()
work. We can teach TurboFan to inline Object.assign() based on the new
SetDataProperties builtin at some later point to further optimize
Object.assign().

[1]: https://gist.github.com/bmeurer/0dae4a6b0e23f43d5a22d7c91476b6c0

Bug: v8:9167
Change-Id: I57bea7a8781c4a1e8ff3d394873c3cd4c5d73834
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1587376
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61100}
2019-04-29 18:47:19 +00:00
..
regress [cloneobjectic] initialize property array before filling it 2018-11-27 17:24:21 +00:00
object-rest-basic.js [esnext] Remove --harmony-object-rest-spread flag 2017-10-25 19:47:29 +00:00
object-spread-basic.js [runtime] Optimize general object spread. 2019-04-29 18:47:19 +00:00
object-spread-ic-dontenum-transition.js [CloneObjectIC] add CSA implementation of slow case 2018-09-11 20:43:53 +00:00
object-spread-ic-multiple-transitions.js [CloneObjectIC] add CSA implementation of slow case 2018-09-11 20:43:53 +00:00
object-spread-ic.js [CloneObjectIC] clone MutableHeapNumbers instead of referencing them 2018-11-07 03:15:45 +00:00
regexp-lookbehind.js [regexp] make lookbehind assertions non-quantifiable. 2018-02-20 11:24:32 +00:00
template-escapes.js Remove always-on --harmony-template-escapes flag 2017-11-28 18:36:41 +00:00