Bug 75114 - Refactored String.prototype.replace
Summary: Refactored String.prototype.replace
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Geoffrey Garen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-22 12:46 PST by Geoffrey Garen
Modified: 2011-12-23 07:39 PST (History)
0 users

See Also:


Attachments
Patch (24.54 KB, patch)
2011-12-22 13:00 PST, Geoffrey Garen
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Geoffrey Garen 2011-12-22 12:46:53 PST
Refactored String.prototype.replace
Comment 1 Geoffrey Garen 2011-12-22 13:00:44 PST
Created attachment 120368 [details]
Patch
Comment 2 Darin Adler 2011-12-22 14:48:33 PST
Comment on attachment 120368 [details]
Patch

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

> Source/JavaScriptCore/ChangeLog:15
> +        * runtime/JSString.h: Removed the single-character case because it's no
> +        different from the normal case. (If we do come up with a single-character
> +        optimization in future, it probably doesn't belong in JSString, anyway.)

What do you mean by no different from the normal case? Isn’t the find for a single character a different, faster function?
Comment 3 Geoffrey Garen 2011-12-23 07:32:23 PST
> What do you mean by no different from the normal case? Isn’t the find for a single character a different, faster function?

Find for a single character is faster, but the general find knows to delegate to the single-character find if possible. So, we were just duplicating logic in the general find. I'll make the ChangeLog clearer on this point.
Comment 4 Geoffrey Garen 2011-12-23 07:39:01 PST
Committed r103626: <http://trac.webkit.org/changeset/103626>