| 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 11 matching lines...) Expand all Loading... |
| 22 } else { | 22 } else { |
| 23 return IS_SYMBOL(x) ? | 23 return IS_SYMBOL(x) ? |
| 24 %_CallFunction(x, $symbolToString) : TO_STRING_INLINE(x); | 24 %_CallFunction(x, $symbolToString) : TO_STRING_INLINE(x); |
| 25 } | 25 } |
| 26 } | 26 } |
| 27 | 27 |
| 28 | 28 |
| 29 // ECMA-262 section 15.5.4.2 | 29 // ECMA-262 section 15.5.4.2 |
| 30 function StringToString() { | 30 function StringToString() { |
| 31 if (!IS_STRING(this) && !IS_STRING_WRAPPER(this)) { | 31 if (!IS_STRING(this) && !IS_STRING_WRAPPER(this)) { |
| 32 throw new $TypeError('String.prototype.toString is not generic'); | 32 throw MakeTypeError(kNotGeneric, 'String.prototype.toString'); |
| 33 } | 33 } |
| 34 return %_ValueOf(this); | 34 return %_ValueOf(this); |
| 35 } | 35 } |
| 36 | 36 |
| 37 | 37 |
| 38 // ECMA-262 section 15.5.4.3 | 38 // ECMA-262 section 15.5.4.3 |
| 39 function StringValueOf() { | 39 function StringValueOf() { |
| 40 if (!IS_STRING(this) && !IS_STRING_WRAPPER(this)) { | 40 if (!IS_STRING(this) && !IS_STRING_WRAPPER(this)) { |
| 41 throw new $TypeError('String.prototype.valueOf is not generic'); | 41 throw MakeTypeError(kNotGeneric, 'String.prototype.valueOf'); |
| 42 } | 42 } |
| 43 return %_ValueOf(this); | 43 return %_ValueOf(this); |
| 44 } | 44 } |
| 45 | 45 |
| 46 | 46 |
| 47 // ECMA-262, section 15.5.4.4 | 47 // ECMA-262, section 15.5.4.4 |
| 48 function StringCharAtJS(pos) { | 48 function StringCharAtJS(pos) { |
| 49 CHECK_OBJECT_COERCIBLE(this, "String.prototype.charAt"); | 49 CHECK_OBJECT_COERCIBLE(this, "String.prototype.charAt"); |
| 50 | 50 |
| 51 var result = %_StringCharAt(this, pos); | 51 var result = %_StringCharAt(this, pos); |
| (...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 "strike", StringStrike, | 1174 "strike", StringStrike, |
| 1175 "sub", StringSub, | 1175 "sub", StringSub, |
| 1176 "sup", StringSup | 1176 "sup", StringSup |
| 1177 ]); | 1177 ]); |
| 1178 | 1178 |
| 1179 $stringCharAt = StringCharAtJS; | 1179 $stringCharAt = StringCharAtJS; |
| 1180 $stringIndexOf = StringIndexOfJS; | 1180 $stringIndexOf = StringIndexOfJS; |
| 1181 $stringSubstring = StringSubstring; | 1181 $stringSubstring = StringSubstring; |
| 1182 | 1182 |
| 1183 })(); | 1183 })(); |
| OLD | NEW |