RESOLVED FIXED Bug 65799
String replace with the empty string means string removal
https://bugs.webkit.org/show_bug.cgi?id=65799
Summary String replace with the empty string means string removal
Gavin Barraclough
Reported 2011-08-05 17:19:22 PDT
Optimization for String.prototype.replace([RegExp], ""), this improves v8-regexp by ~3%.
Attachments
The patch (4.29 KB, patch)
2011-08-05 17:22 PDT, Gavin Barraclough
sam: review+
Gavin Barraclough
Comment 1 2011-08-05 17:22:11 PDT
Created attachment 103133 [details] The patch
WebKit Review Bot
Comment 2 2011-08-05 17:26:32 PDT
Attachment 103133 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/ChangeLog', u'Source..." exit_code: 1 Source/JavaScriptCore/runtime/StringPrototype.cpp:267: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5] Source/JavaScriptCore/runtime/StringPrototype.cpp:271: Local variables should never be PassRefPtr (see http://webkit.org/coding/RefPtr.html). [readability/pass_ptr] [5] Source/JavaScriptCore/runtime/StringPrototype.cpp:380: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5] Total errors found: 3 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
Sam Weinig
Comment 3 2011-08-05 17:34:29 PDT
Comment on attachment 103133 [details] The patch View in context: https://bugs.webkit.org/attachment.cgi?id=103133&action=review >> Source/JavaScriptCore/runtime/StringPrototype.cpp:271 >> + PassRefPtr<StringImpl> impl = StringImpl::tryCreateUninitialized(totalLength, buffer); > > Local variables should never be PassRefPtr (see http://webkit.org/coding/RefPtr.html). [readability/pass_ptr] [5] This is copy and pasted, but very wrong. Please us a RefPtr and fix the other spot.
Gavin Barraclough
Comment 4 2011-08-05 19:18:15 PDT
Fixed in r92540
Note You need to log in before you can comment on or make changes to this bug.