| 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 (function(global, utils) { | 5 (function(global, utils) { |
| 6 | 6 |
| 7 %CheckIsBootstrapping(); | 7 %CheckIsBootstrapping(); |
| 8 | 8 |
| 9 // ------------------------------------------------------------------- | 9 // ------------------------------------------------------------------- |
| 10 // Imports | 10 // Imports |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 } | 184 } |
| 185 | 185 |
| 186 | 186 |
| 187 // ECMA-262 v6, section 21.1.3.12 | 187 // ECMA-262 v6, section 21.1.3.12 |
| 188 // | 188 // |
| 189 // For now we do nothing, as proper normalization requires big tables. | 189 // For now we do nothing, as proper normalization requires big tables. |
| 190 // If Intl is enabled, then i18n.js will override it and provide the the | 190 // If Intl is enabled, then i18n.js will override it and provide the the |
| 191 // proper functionality. | 191 // proper functionality. |
| 192 function StringNormalizeJS() { | 192 function StringNormalizeJS() { |
| 193 CHECK_OBJECT_COERCIBLE(this, "String.prototype.normalize"); | 193 CHECK_OBJECT_COERCIBLE(this, "String.prototype.normalize"); |
| 194 var s = TO_STRING_INLINE(this); |
| 194 | 195 |
| 195 var formArg = %_Arguments(0); | 196 var formArg = %_Arguments(0); |
| 196 var form = IS_UNDEFINED(formArg) ? 'NFC' : TO_STRING_INLINE(formArg); | 197 var form = IS_UNDEFINED(formArg) ? 'NFC' : TO_STRING_INLINE(formArg); |
| 197 | 198 |
| 198 var NORMALIZATION_FORMS = ['NFC', 'NFD', 'NFKC', 'NFKD']; | 199 var NORMALIZATION_FORMS = ['NFC', 'NFD', 'NFKC', 'NFKD']; |
| 199 var normalizationForm = | 200 var normalizationForm = |
| 200 %_CallFunction(NORMALIZATION_FORMS, form, ArrayIndexOf); | 201 %_CallFunction(NORMALIZATION_FORMS, form, ArrayIndexOf); |
| 201 if (normalizationForm === -1) { | 202 if (normalizationForm === -1) { |
| 202 throw MakeRangeError(kNormalizationForm, | 203 throw MakeRangeError(kNormalizationForm, |
| 203 %_CallFunction(NORMALIZATION_FORMS, ', ', ArrayJoin)); | 204 %_CallFunction(NORMALIZATION_FORMS, ', ', ArrayJoin)); |
| 204 } | 205 } |
| 205 | 206 |
| 206 return %_ValueOf(this); | 207 return s; |
| 207 } | 208 } |
| 208 | 209 |
| 209 | 210 |
| 210 // This has the same size as the RegExpLastMatchInfo array, and can be used | 211 // This has the same size as the RegExpLastMatchInfo array, and can be used |
| 211 // for functions that expect that structure to be returned. It is used when | 212 // for functions that expect that structure to be returned. It is used when |
| 212 // the needle is a string rather than a regexp. In this case we can't update | 213 // the needle is a string rather than a regexp. In this case we can't update |
| 213 // lastMatchArray without erroneously affecting the properties on the global | 214 // lastMatchArray without erroneously affecting the properties on the global |
| 214 // RegExp object. | 215 // RegExp object. |
| 215 var reusableMatchInfo = [2, "", "", -1, -1]; | 216 var reusableMatchInfo = [2, "", "", -1, -1]; |
| 216 | 217 |
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 to.StringIndexOf = StringIndexOfJS; | 1200 to.StringIndexOf = StringIndexOfJS; |
| 1200 to.StringLastIndexOf = StringLastIndexOfJS; | 1201 to.StringLastIndexOf = StringLastIndexOfJS; |
| 1201 to.StringMatch = StringMatchJS; | 1202 to.StringMatch = StringMatchJS; |
| 1202 to.StringReplace = StringReplace; | 1203 to.StringReplace = StringReplace; |
| 1203 to.StringSplit = StringSplitJS; | 1204 to.StringSplit = StringSplitJS; |
| 1204 to.StringSubstr = StringSubstr; | 1205 to.StringSubstr = StringSubstr; |
| 1205 to.StringSubstring = StringSubstring; | 1206 to.StringSubstring = StringSubstring; |
| 1206 }); | 1207 }); |
| 1207 | 1208 |
| 1208 }) | 1209 }) |
| OLD | NEW |