Revision: 24334
Author:   yang...@chromium.org
Date:     Tue Sep 30 15:07:21 2014 UTC
Log:      Add a fast case for one-element arrays in ArrayJoin

This case handles all one-element arrays that were not handled by _FastOneByteArrayJoin

BUG=
R=yang...@chromium.org

Review URL: https://codereview.chromium.org/607503004

Patch from Fadi Meawad <fmea...@chromium.org>.
https://code.google.com/p/v8/source/detail?r=24334

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

=======================================
--- /branches/bleeding_edge/src/array.js        Wed Sep 17 14:01:25 2014 UTC
+++ /branches/bleeding_edge/src/array.js        Tue Sep 30 15:07:21 2014 UTC
@@ -377,6 +377,14 @@

   var result = %_FastOneByteArrayJoin(array, separator);
   if (!IS_UNDEFINED(result)) return result;
+
+  // Fast case for one-element arrays.
+  if (length === 1) {
+    var e = array[0];
+    if (IS_STRING(e)) return e;
+    if (IS_NULL_OR_UNDEFINED(e)) return '';
+    return NonStringToString(e);
+  }

   return Join(array, length, separator, ConvertToString);
 }

--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to