Commit 552a9c24 authored by yangguo@chromium.org's avatar yangguo@chromium.org

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=yangguo@chromium.org

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

Patch from Fadi Meawad <fmeawad@chromium.org>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24334 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 85d7140d
......@@ -378,6 +378,14 @@ function ArrayJoin(separator) {
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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment