Bug 217115 - [JSC] Implement item method proposal
Summary: [JSC] Implement item method proposal
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ross Kirsling
URL:
Keywords: InRadar
Depends on:
Blocks: 217139
  Show dependency treegraph
 
Reported: 2020-09-29 18:33 PDT by Ross Kirsling
Modified: 2020-10-01 15:36 PDT (History)
10 users (show)

See Also:


Attachments
Patch (11.50 KB, patch)
2020-09-29 18:44 PDT, Ross Kirsling
no flags Details | Formatted Diff | Diff
Patch (19.61 KB, patch)
2020-09-29 19:22 PDT, Ross Kirsling
no flags Details | Formatted Diff | Diff
Patch for landing (19.74 KB, patch)
2020-09-30 12:09 PDT, Ross Kirsling
no flags Details | Formatted Diff | Diff
Patch for landing (19.70 KB, patch)
2020-09-30 16:53 PDT, Ross Kirsling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>