Bug 213715 - %TypedArray%.prototype.{indexOf,lastIndexOf} are not spec-perfect
Summary: %TypedArray%.prototype.{indexOf,lastIndexOf} are not spec-perfect
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Minor
Assignee: Alexey Shvayka
URL:
Keywords: InRadar
: 216817 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-06-29 01:52 PDT by Alexey Shvayka
Modified: 2020-09-22 16:08 PDT (History)
9 users (show)

See Also:


Attachments
Patch (8.83 KB, patch)
2020-06-29 01:54 PDT, Alexey Shvayka
no flags Details | Formatted Diff | Diff
Patch (10.92 KB, patch)
2020-07-04 11:38 PDT, Alexey Shvayka
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Shvayka 2020-06-29 01:52:52 PDT
%TypedArray%.prototype.{indexOf,lastIndexOf} are not spec-perfect
Comment 1 Alexey Shvayka 2020-06-29 01:54:22 PDT
Created attachment 403037 [details]
Patch
Comment 2 Alexey Shvayka 2020-06-29 01:57:41 PDT
(In reply to Alexey Shvayka from comment #1)
> Created attachment 403037 [details]
> Patch

Warmed-up runs, --outer 48:

                                   r263638                    patch                                       

array-indexOf-empty            221.3595+-2.9548     ^    108.8428+-1.7148        ^ definitely 2.0338x faster
typed-array-indexOf-empty      146.0446+-2.7547     ^    115.9307+-1.8323        ^ definitely 1.2598x faster

<geometric>                    179.6698+-2.0843     ^    112.2352+-1.1371        ^ definitely 1.6008x faster
Comment 3 Yusuke Suzuki 2020-06-29 07:32:27 PDT
Comment on attachment 403037 [details]
Patch

r=me. Can you also ensure that DFG/FTL ArrayIndexOf follows to this?
Comment 4 Alexey Shvayka 2020-07-04 11:38:32 PDT
Created attachment 403530 [details]
Patch

Add DFG/FTL stress test.
Comment 5 Alexey Shvayka 2020-07-04 11:38:48 PDT
(In reply to Yusuke Suzuki from comment #3)
> Comment on attachment 403037 [details]
> Patch
> 
> r=me. Can you also ensure that DFG/FTL ArrayIndexOf follows to this?

ArrayIndexOf OSR exit via SpeculateInt32Operand at SpeculativeJIT::emitPopulateSliceIndex() if `fromIndex` parameter is an object.
That's the reason of such performance boost.
I've added a stress test to ensure ToInteger() after "length" order.
Comment 6 EWS 2020-07-04 13:06:59 PDT
Committed r263944: <https://trac.webkit.org/changeset/263944>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 403530 [details].
Comment 7 Radar WebKit Bug Importer 2020-07-04 13:07:30 PDT
<rdar://problem/65098390>
Comment 8 Keith Miller 2020-09-22 16:08:23 PDT
*** Bug 216817 has been marked as a duplicate of this bug. ***