| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var $stringCharAt; | 5 var $stringCharAt; |
| 6 var $stringIndexOf; | 6 var $stringIndexOf; |
| 7 var $stringSubstring; | 7 var $stringSubstring; |
| 8 | 8 |
| 9 (function() { | 9 (function() { |
| 10 | 10 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 if (!%_IsSmi(result)) { | 65 if (!%_IsSmi(result)) { |
| 66 result = %_StringCharCodeAt(TO_STRING_INLINE(this), TO_INTEGER(pos)); | 66 result = %_StringCharCodeAt(TO_STRING_INLINE(this), TO_INTEGER(pos)); |
| 67 } | 67 } |
| 68 return result; | 68 return result; |
| 69 } | 69 } |
| 70 | 70 |
| 71 | 71 |
| 72 // ECMA-262, section 15.5.4.6 | 72 // ECMA-262, section 15.5.4.6 |
| 73 function StringConcat(other /* and more */) { // length == 1 | 73 function StringConcat(other /* and more */) { // length == 1 |
| 74 CHECK_OBJECT_COERCIBLE(this, "String.prototype.concat"); | 74 CHECK_OBJECT_COERCIBLE(this, "String.prototype.concat"); |
| 75 | |
| 76 var len = %_ArgumentsLength(); | 75 var len = %_ArgumentsLength(); |
| 77 var this_as_string = TO_STRING_INLINE(this); | 76 var this_as_string = TO_STRING_INLINE(this); |
| 78 if (len === 1) { | 77 if (len === 1) { |
| 79 return this_as_string + other; | 78 return this_as_string + TO_STRING_INLINE(other); |
| 80 } | 79 } |
| 81 var parts = new InternalArray(len + 1); | 80 var parts = new InternalArray(len + 1); |
| 82 parts[0] = this_as_string; | 81 parts[0] = this_as_string; |
| 83 for (var i = 0; i < len; i++) { | 82 for (var i = 0; i < len; i++) { |
| 84 var part = %_Arguments(i); | 83 var part = %_Arguments(i); |
| 85 parts[i + 1] = TO_STRING_INLINE(part); | 84 parts[i + 1] = TO_STRING_INLINE(part); |
| 86 } | 85 } |
| 87 return %StringBuilderConcat(parts, len + 1, ""); | 86 return %StringBuilderConcat(parts, len + 1, ""); |
| 88 } | 87 } |
| 89 | 88 |
| (...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 "strike", StringStrike, | 1175 "strike", StringStrike, |
| 1177 "sub", StringSub, | 1176 "sub", StringSub, |
| 1178 "sup", StringSup | 1177 "sup", StringSup |
| 1179 )); | 1178 )); |
| 1180 | 1179 |
| 1181 $stringCharAt = StringCharAtJS; | 1180 $stringCharAt = StringCharAtJS; |
| 1182 $stringIndexOf = StringIndexOfJS; | 1181 $stringIndexOf = StringIndexOfJS; |
| 1183 $stringSubstring = StringSubstring; | 1182 $stringSubstring = StringSubstring; |
| 1184 | 1183 |
| 1185 })(); | 1184 })(); |
| OLD | NEW |