Commit 24a9b881 authored by caitpotter88's avatar caitpotter88 Committed by Commit bot

[es5] call ToString() on argument in String.prototype.concat() fast case

15.5.4.6 5.b requires each part to be converted using ToString(). This also needs to occur in the single argument fast-case.

BUG=v8:3981
R=arv@chromium.org
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#27372}
parent 79c5948b
......@@ -72,11 +72,10 @@ function StringCharCodeAtJS(pos) {
// ECMA-262, section 15.5.4.6
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 + other;
return this_as_string + TO_STRING_INLINE(other);
}
var parts = new InternalArray(len + 1);
parts[0] = this_as_string;
......
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
function Stringified(toString) {
var valueOf = "-" + toString + "-";
return {
toString: function() { return toString; },
valueOf: function() { return valueOf; }
};
}
assertEquals("a.b.", "a.".concat(Stringified("b.")));
assertEquals("a.b.c.", "a.".concat(Stringified("b."), Stringified("c.")));
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