Remove unneeded ToString calls. We call ToString if necessary
authorkasperl@chromium.org <kasperl@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 3 Jul 2009 12:08:00 +0000 (12:08 +0000)
committerkasperl@chromium.org <kasperl@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 3 Jul 2009 12:08:00 +0000 (12:08 +0000)
when the result of calling the replace function is added to the
ReplaceResultBuilder.
Review URL: http://codereview.chromium.org/149179

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2353 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/string.js

index 6164eb8..263fac5 100644 (file)
@@ -433,7 +433,7 @@ function ApplyReplacementFunction(replace, lastMatchInfo, subject) {
   if (m == 1) {
     var s = CaptureString(subject, lastMatchInfo, 0);
     // Don't call directly to avoid exposing the built-in global object.
-    return ToString(replace.call(null, s, index, subject));
+    return replace.call(null, s, index, subject);
   }
   var parameters = $Array(m + 2);
   for (var j = 0; j < m; j++) {
@@ -441,7 +441,7 @@ function ApplyReplacementFunction(replace, lastMatchInfo, subject) {
   }
   parameters[j] = index;
   parameters[j + 1] = subject;
-  return ToString(replace.apply(null, parameters));
+  return replace.apply(null, parameters);
 }