Chromium Code Reviews| Index: src/string.js |
| diff --git a/src/string.js b/src/string.js |
| index e858b0fd526e7c8b8995981460bf7130b5974228..2d6896120e5c7c2633fd550a085b1624eb62ada6 100644 |
| --- a/src/string.js |
| +++ b/src/string.js |
| @@ -245,8 +245,12 @@ function StringReplace(search, replace) { |
| // Convert the search argument to a string and search for it. |
| search = TO_STRING_INLINE(search); |
| if (search.length == 1 && |
| + subject.length > 0xFF && |
|
Yang
2012/01/17 13:07:34
Dealing with short cons string the old way is bett
|
| IS_STRING(replace) && |
| %StringIndexOf(replace, '$', 0) < 0) { |
| + // Searching by traversing a cons string tree and replace with cons of |
| + // slices works only when the replaced string is a single character, being |
| + // replaced by a simple string and only pays off for long strings. |
| return %StringReplaceOneCharWithString(subject, search, replace); |
| } |
| var start = %StringIndexOf(subject, search, 0); |