| 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; | |
| 14 var GlobalRegExp = global.RegExp; | 13 var GlobalRegExp = global.RegExp; |
| 15 var GlobalString = global.String; | 14 var GlobalString = global.String; |
| 16 | 15 |
| 17 //------------------------------------------------------------------- | 16 //------------------------------------------------------------------- |
| 18 | 17 |
| 19 function StringConstructor(x) { | 18 function StringConstructor(x) { |
| 20 if (%_ArgumentsLength() == 0) x = ''; | 19 if (%_ArgumentsLength() == 0) x = ''; |
| 21 if (%_IsConstructCall()) { | 20 if (%_IsConstructCall()) { |
| 22 %_SetValueOf(this, TO_STRING_INLINE(x)); | 21 %_SetValueOf(this, TO_STRING_INLINE(x)); |
| 23 } else { | 22 } else { |
| (...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 | 1117 |
| 1119 // Set the String function and constructor. | 1118 // Set the String function and constructor. |
| 1120 %SetCode(GlobalString, StringConstructor); | 1119 %SetCode(GlobalString, StringConstructor); |
| 1121 %FunctionSetPrototype(GlobalString, new GlobalString()); | 1120 %FunctionSetPrototype(GlobalString, new GlobalString()); |
| 1122 | 1121 |
| 1123 // Set up the constructor property on the String prototype object. | 1122 // Set up the constructor property on the String prototype object. |
| 1124 %AddNamedProperty( | 1123 %AddNamedProperty( |
| 1125 GlobalString.prototype, "constructor", GlobalString, DONT_ENUM); | 1124 GlobalString.prototype, "constructor", GlobalString, DONT_ENUM); |
| 1126 | 1125 |
| 1127 // Set up the non-enumerable functions on the String object. | 1126 // Set up the non-enumerable functions on the String object. |
| 1128 InstallFunctions(GlobalString, DONT_ENUM, GlobalArray( | 1127 InstallFunctions(GlobalString, DONT_ENUM, [ |
| 1129 "fromCharCode", StringFromCharCode, | 1128 "fromCharCode", StringFromCharCode, |
| 1130 "fromCodePoint", StringFromCodePoint, | 1129 "fromCodePoint", StringFromCodePoint, |
| 1131 "raw", StringRaw | 1130 "raw", StringRaw |
| 1132 )); | 1131 ]); |
| 1133 | 1132 |
| 1134 // Set up the non-enumerable functions on the String prototype object. | 1133 // Set up the non-enumerable functions on the String prototype object. |
| 1135 InstallFunctions(GlobalString.prototype, DONT_ENUM, GlobalArray( | 1134 InstallFunctions(GlobalString.prototype, DONT_ENUM, [ |
| 1136 "valueOf", StringValueOf, | 1135 "valueOf", StringValueOf, |
| 1137 "toString", StringToString, | 1136 "toString", StringToString, |
| 1138 "charAt", StringCharAtJS, | 1137 "charAt", StringCharAtJS, |
| 1139 "charCodeAt", StringCharCodeAtJS, | 1138 "charCodeAt", StringCharCodeAtJS, |
| 1140 "codePointAt", StringCodePointAt, | 1139 "codePointAt", StringCodePointAt, |
| 1141 "concat", StringConcat, | 1140 "concat", StringConcat, |
| 1142 "endsWith", StringEndsWith, | 1141 "endsWith", StringEndsWith, |
| 1143 "includes", StringIncludes, | 1142 "includes", StringIncludes, |
| 1144 "indexOf", StringIndexOfJS, | 1143 "indexOf", StringIndexOfJS, |
| 1145 "lastIndexOf", StringLastIndexOfJS, | 1144 "lastIndexOf", StringLastIndexOfJS, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1168 "fontsize", StringFontsize, | 1167 "fontsize", StringFontsize, |
| 1169 "big", StringBig, | 1168 "big", StringBig, |
| 1170 "blink", StringBlink, | 1169 "blink", StringBlink, |
| 1171 "bold", StringBold, | 1170 "bold", StringBold, |
| 1172 "fixed", StringFixed, | 1171 "fixed", StringFixed, |
| 1173 "italics", StringItalics, | 1172 "italics", StringItalics, |
| 1174 "small", StringSmall, | 1173 "small", StringSmall, |
| 1175 "strike", StringStrike, | 1174 "strike", StringStrike, |
| 1176 "sub", StringSub, | 1175 "sub", StringSub, |
| 1177 "sup", StringSup | 1176 "sup", StringSup |
| 1178 )); | 1177 ]); |
| 1179 | 1178 |
| 1180 $stringCharAt = StringCharAtJS; | 1179 $stringCharAt = StringCharAtJS; |
| 1181 $stringIndexOf = StringIndexOfJS; | 1180 $stringIndexOf = StringIndexOfJS; |
| 1182 $stringSubstring = StringSubstring; | 1181 $stringSubstring = StringSubstring; |
| 1183 | 1182 |
| 1184 })(); | 1183 })(); |
| OLD | NEW |