Bug 213715

Summary: %TypedArray%.prototype.{indexOf,lastIndexOf} are not spec-perfect
Product: WebKit Reporter: Alexey Shvayka <ashvayka>
Component: JavaScriptCoreAssignee: Alexey Shvayka <ashvayka>
Status: RESOLVED FIXED    
Severity: Minor CC: ews-watchlist, keith_miller, mark.lam, msaboff, nisl_grammarly1, saam, tzagallo, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch none

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. ***