[JSC] Optimize Array#lastIndexOf
authoryusukesuzuki@slowstart.org <yusukesuzuki@slowstart.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Sep 2018 05:16:22 +0000 (05:16 +0000)
committeryusukesuzuki@slowstart.org <yusukesuzuki@slowstart.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Sep 2018 05:16:22 +0000 (05:16 +0000)
commita5ee36b7d673cb4f43661672bb75446552b27886
tree306b36c18c327e900cc48dc5c519d58bfffb8135
parent987aa0f93aab70b46964ec02e4fb2446227ef65c
[JSC] Optimize Array#lastIndexOf
https://bugs.webkit.org/show_bug.cgi?id=189780

Reviewed by Saam Barati.

JSTests:

* stress/array-lastindexof-array-prototype-trap.js: Added.
(shouldBe):
(AncestorArray.prototype.get 2):
(AncestorArray):
* stress/array-lastindexof-have-a-bad-time-c-runtime.js: Added.
(shouldBe):
* stress/array-lastindexof-hole-nan.js: Added.
(shouldBe):
(throw.new.Error):
* stress/array-lastindexof-infinity.js: Added.
(shouldBe):
(throw.new.Error):
* stress/array-lastindexof-negative-zero.js: Added.
(shouldBe):
(throw.new.Error):
* stress/array-lastindexof-own-getter.js: Added.
(shouldBe):
(throw.new.Error.get array):
(get array):
* stress/array-lastindexof-prototype-trap.js: Added.
(shouldBe):
(DerivedArray.prototype.get 2):
(DerivedArray):

Source/JavaScriptCore:

Optimize Array#lastIndexOf as the same to Array#indexOf. We add a fast path
for JSArray with contiguous storage.

* runtime/ArrayPrototype.cpp:
(JSC::arrayProtoFuncLastIndexOf):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236496 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
JSTests/ChangeLog
JSTests/stress/array-lastindexof-array-prototype-trap.js [new file with mode: 0644]
JSTests/stress/array-lastindexof-cached-length.js [new file with mode: 0644]
JSTests/stress/array-lastindexof-fast-path-effects.js [new file with mode: 0644]
JSTests/stress/array-lastindexof-have-a-bad-time-c-runtime.js [new file with mode: 0644]
JSTests/stress/array-lastindexof-hole-nan.js [new file with mode: 0644]
JSTests/stress/array-lastindexof-infinity.js [new file with mode: 0644]
JSTests/stress/array-lastindexof-negative-zero.js [new file with mode: 0644]
JSTests/stress/array-lastindexof-own-getter.js [new file with mode: 0644]
JSTests/stress/array-lastindexof-prototype-trap.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/ArrayPrototype.cpp