From: yangguo@chromium.org Date: Thu, 17 Jul 2014 10:54:25 +0000 (+0000) Subject: Change String.prototype.concat to be more like similar functions. X-Git-Tag: upstream/4.7.83~8183 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f58318ef16baa401fd9e24be879a25adfb623319;p=platform%2Fupstream%2Fv8.git Change String.prototype.concat to be more like similar functions. This is just cosmetic: We usually avoid using %FunctionSetLength. R=dslomov@chromium.org Review URL: https://codereview.chromium.org/400583002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22447 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/string.js b/src/string.js index 9719df4..0d5ed0f 100644 --- a/src/string.js +++ b/src/string.js @@ -61,13 +61,13 @@ function StringCharCodeAt(pos) { // ECMA-262, section 15.5.4.6 -function StringConcat() { +function StringConcat(other /* and more */) { // length == 1 CHECK_OBJECT_COERCIBLE(this, "String.prototype.concat"); var len = %_ArgumentsLength(); var this_as_string = TO_STRING_INLINE(this); if (len === 1) { - return this_as_string + %_Arguments(0); + return this_as_string + other; } var parts = new InternalArray(len + 1); parts[0] = this_as_string; @@ -78,9 +78,6 @@ function StringConcat() { return %StringBuilderConcat(parts, len + 1, ""); } -// Match ES3 and Safari -%FunctionSetLength(StringConcat, 1); - // ECMA-262 section 15.5.4.7 function StringIndexOfJS(pattern /* position */) { // length == 1