[JSC] Add fast path for Object.assign
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Jun 2017 21:32:52 +0000 (21:32 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Jun 2017 21:32:52 +0000 (21:32 +0000)
commitbd22e43c020b9507c230c7f09e1e64cebe2b5b06
tree076a14ad1a53b82e31d7a1b2074a8694fd438759
parentc43938fe5af7d3228a6cd1243584ccf0fea08ba3
[JSC] Add fast path for Object.assign
https://bugs.webkit.org/show_bug.cgi?id=173416

Reviewed by Mark Lam.

JSTests:

* stress/object-assign-changing-properties.js: Added.
(shouldBe):
(throw.new.Error.let.source.get x):
(throw.new.Error):
(shouldBe.let.source.get x):
(shouldBe.let.target.set x):
(shouldBe.let.target.get x):
* stress/object-assign-proxy.js: Added.
(shouldBe):
(throw.new.Error.let.handler.get order):

Source/JavaScriptCore:

In Object.assign implementation, we need to ensure that given key is still enumerable own key.
This seems duplicate look up. And we want to avoid this. However, we still need to perform this
check in the face of Proxy. Proxy can observe that this check is done correctly.

In almost all the cases, the above check is duplicate to the subsequent [[Get]] operation.
In this patch, we perform this check. But at that time, we investigate `isTaintedByOpaqueObject()`.
If it is false, we can say that getOwnPropertySlot is pure. In that case, we can just retrieve the
value by calling `slot.getValue()`.

This further improves performance of Object.assign.

                                baseline                  patched

    object-assign.es6      363.6706+-6.4381     ^    324.1769+-6.9624        ^ definitely 1.1218x faster

* runtime/ObjectConstructor.cpp:
(JSC::objectConstructorAssign):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@218415 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSTests/ChangeLog
JSTests/stress/object-assign-changing-properties.js [new file with mode: 0644]
JSTests/stress/object-assign-proxy.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/ObjectConstructor.cpp