Revision: 6226
Author: [email protected]
Date: Fri Jan  7 05:21:34 2011
Log: Aviod double checking IS_STRING when joining arrays.
Review URL: http://codereview.chromium.org/5977013
http://code.google.com/p/v8/source/detail?r=6226

Modified:
 /branches/bleeding_edge/src/array.js
 /branches/bleeding_edge/src/v8natives.js

=======================================
--- /branches/bleeding_edge/src/array.js        Mon Dec 20 06:57:51 2010
+++ /branches/bleeding_edge/src/array.js        Fri Jan  7 05:21:34 2011
@@ -121,6 +121,7 @@
         if (IS_STRING(e)) return e;
         return convert(e);
       }
+      return '';
     }

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


 function ConvertToString(x) {
-  if (IS_STRING(x)) return x;
+  // Assumes x is a non-string.
   if (IS_NUMBER(x)) return %_NumberToString(x);
   if (IS_BOOLEAN(x)) return x ? 'true' : 'false';
   return (IS_NULL_OR_UNDEFINED(x)) ? '' : %ToString(%DefaultString(x));
=======================================
--- /branches/bleeding_edge/src/v8natives.js    Fri Jan  7 03:49:09 2011
+++ /branches/bleeding_edge/src/v8natives.js    Fri Jan  7 05:21:34 2011
@@ -1183,7 +1183,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.

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to