Bug 217115

Summary: [JSC] Implement item method proposal
Product: WebKit Reporter: Ross Kirsling <ross.kirsling>
Component: New BugsAssignee: Ross Kirsling <ross.kirsling>
Status: RESOLVED FIXED    
Severity: Normal CC: ews-watchlist, hi, joepeck, keith_miller, mark.lam, msaboff, saam, tzagallo, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=217193
Bug Depends on:    
Bug Blocks: 217139    
Attachments:
Description Flags
Patch
none
Patch
none
Patch for landing
none
Patch for landing none

Description Ross Kirsling 2020-09-29 18:33:45 PDT
[JSC] Implement item method proposal
Comment 1 Ross Kirsling 2020-09-29 18:44:32 PDT
Created attachment 410083 [details]
Patch
Comment 2 Ross Kirsling 2020-09-29 19:22:45 PDT
Created attachment 410087 [details]
Patch
Comment 3 Yusuke Suzuki 2020-09-30 10:59:49 PDT
Comment on attachment 410087 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=410087&action=review

> Source/JavaScriptCore/builtins/StringPrototype.js:358
> +function item(index)
> +{
> +    "use strict";
> +
> +    if (@isUndefinedOrNull(this))
> +        @throwTypeError("String.prototype.item requires that |this| not be null or undefined");
> +
> +    var string = @toString(this);
> +    var length = string.length;
> +
> +    var k = @toInteger(index);
> +    if (k < 0)
> +        k += length;
> +
> +    return (k >= 0 && k < length) ? string[k] : @undefined;
> +}

Can you file a bug making String#item accelerated like String#charAt? And can you add FIXME to that bug here?
I think item and charAt are super similar.
Comment 4 Ross Kirsling 2020-09-30 12:09:09 PDT
Created attachment 410144 [details]
Patch for landing
Comment 5 EWS 2020-09-30 14:32:00 PDT
Found 1 new test failure: inspector/console/queryHolders.html
Comment 6 Ross Kirsling 2020-09-30 16:53:38 PDT Comment hidden (obsolete)
Comment 7 EWS 2020-09-30 17:40:11 PDT
Committed r267814: <https://trac.webkit.org/changeset/267814>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 410144 [details].
Comment 8 Radar WebKit Bug Importer 2020-09-30 17:41:19 PDT
<rdar://problem/69816255>