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
This commit is contained in:
yangguo@chromium.org 2014-07-17 10:54:25 +00:00
parent 51a6b0fd9d
commit f58318ef16

View File

@ -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