| 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 |
| 11 %CheckIsBootstrapping(); | 11 %CheckIsBootstrapping(); |
| 12 | 12 |
| 13 var GlobalArray = global.Array; | 13 var GlobalArray = global.Array; |
| 14 var GlobalRegExp = global.RegExp; | 14 var GlobalRegExp = global.RegExp; |
| 15 var GlobalString = global.String; | 15 var GlobalString = global.String; |
| 16 | 16 |
| 17 //------------------------------------------------------------------- | 17 //------------------------------------------------------------------- |
| 18 | 18 |
| 19 function StringConstructor(x) { | 19 function StringConstructor(x) { |
| 20 if (%_ArgumentsLength() == 0) x = ''; | 20 if (%_ArgumentsLength() == 0) x = ''; |
| 21 if (%_IsConstructCall()) { | 21 if (%_IsConstructCall()) { |
| 22 %_SetValueOf(this, TO_STRING_INLINE(x)); | 22 %_SetValueOf(this, TO_STRING_INLINE(x)); |
| 23 } else { | 23 } else { |
| 24 return IS_SYMBOL(x) ? | 24 return IS_SYMBOL(x) ? |
| 25 %_CallFunction(x, SymbolToString) : TO_STRING_INLINE(x); | 25 %_CallFunction(x, $symbolToString) : TO_STRING_INLINE(x); |
| 26 } | 26 } |
| 27 } | 27 } |
| 28 | 28 |
| 29 | 29 |
| 30 // ECMA-262 section 15.5.4.2 | 30 // ECMA-262 section 15.5.4.2 |
| 31 function StringToString() { | 31 function StringToString() { |
| 32 if (!IS_STRING(this) && !IS_STRING_WRAPPER(this)) { | 32 if (!IS_STRING(this) && !IS_STRING_WRAPPER(this)) { |
| 33 throw new $TypeError('String.prototype.toString is not generic'); | 33 throw new $TypeError('String.prototype.toString is not generic'); |
| 34 } | 34 } |
| 35 return %_ValueOf(this); | 35 return %_ValueOf(this); |
| (...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 "strike", StringStrike, | 984 "strike", StringStrike, |
| 985 "sub", StringSub, | 985 "sub", StringSub, |
| 986 "sup", StringSup | 986 "sup", StringSup |
| 987 )); | 987 )); |
| 988 | 988 |
| 989 $stringCharAt = StringCharAt; | 989 $stringCharAt = StringCharAt; |
| 990 $stringIndexOf = StringIndexOfJS; | 990 $stringIndexOf = StringIndexOfJS; |
| 991 $stringSubstring = StringSubstring; | 991 $stringSubstring = StringSubstring; |
| 992 | 992 |
| 993 })(); | 993 })(); |
| OLD | NEW |