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
This commit is contained in:
parent
85d7140de0
commit
552a9c2447
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user