Reviewers: Lasse Reichstein,

Description:
Aviod double checking IS_STRING when joining arrays.

Please review this at http://codereview.chromium.org/5977013/

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     src/array.js
  M     src/v8natives.js


Index: src/v8natives.js
===================================================================
--- src/v8natives.js    (revision 6219)
+++ src/v8natives.js    (working copy)
@@ -1156,7 +1156,7 @@
   if (n > 1) {
     p = new $Array(n - 1);
     for (var i = 0; i < n - 1; i++) p[i] = %_Arguments(i);
-    p = Join(p, n - 1, ',', ToString);
+    p = Join(p, n - 1, ',', NonStringToString);
     // If the formal parameters string include ) - an illegal
     // character - it may make the combined function expression
     // compile. We avoid this problem by checking for this early on.
Index: src/array.js
===================================================================
--- src/array.js        (revision 6219)
+++ src/array.js        (working copy)
@@ -121,6 +121,7 @@
         if (IS_STRING(e)) return e;
         return convert(e);
       }
+      return '';
     }

     // Construct an array for the elements.
@@ -160,7 +161,6 @@


 function ConvertToString(x) {
-  if (IS_STRING(x)) return x;
   if (IS_NUMBER(x)) return %_NumberToString(x);
   if (IS_BOOLEAN(x)) return x ? 'true' : 'false';
   return (IS_NULL_OR_UNDEFINED(x)) ? '' : %ToString(%DefaultString(x));


--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev

Reply via email to