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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(form) { | 192 function StringNormalizeJS(form) { |
193 CHECK_OBJECT_COERCIBLE(this, "String.prototype.normalize"); | 193 CHECK_OBJECT_COERCIBLE(this, "String.prototype.normalize"); |
194 | 194 |
195 var form = form ? TO_STRING_INLINE(form) : 'NFC'; | 195 var form = IS_UNDEFINED(form) ? 'NFC' : TO_STRING_INLINE(form); |
196 | 196 |
197 var NORMALIZATION_FORMS = ['NFC', 'NFD', 'NFKC', 'NFKD']; | 197 var NORMALIZATION_FORMS = ['NFC', 'NFD', 'NFKC', 'NFKD']; |
198 var normalizationForm = | 198 var normalizationForm = |
199 %_CallFunction(NORMALIZATION_FORMS, form, ArrayIndexOf); | 199 %_CallFunction(NORMALIZATION_FORMS, form, ArrayIndexOf); |
200 if (normalizationForm === -1) { | 200 if (normalizationForm === -1) { |
201 throw MakeRangeError(kNormalizationForm, | 201 throw MakeRangeError(kNormalizationForm, |
202 %_CallFunction(NORMALIZATION_FORMS, ', ', ArrayJoin)); | 202 %_CallFunction(NORMALIZATION_FORMS, ', ', ArrayJoin)); |
203 } | 203 } |
204 | 204 |
205 return %_ValueOf(this); | 205 return %_ValueOf(this); |
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 to.StringIndexOf = StringIndexOfJS; | 1198 to.StringIndexOf = StringIndexOfJS; |
1199 to.StringLastIndexOf = StringLastIndexOfJS; | 1199 to.StringLastIndexOf = StringLastIndexOfJS; |
1200 to.StringMatch = StringMatchJS; | 1200 to.StringMatch = StringMatchJS; |
1201 to.StringReplace = StringReplace; | 1201 to.StringReplace = StringReplace; |
1202 to.StringSplit = StringSplitJS; | 1202 to.StringSplit = StringSplitJS; |
1203 to.StringSubstr = StringSubstr; | 1203 to.StringSubstr = StringSubstr; |
1204 to.StringSubstring = StringSubstring; | 1204 to.StringSubstring = StringSubstring; |
1205 }); | 1205 }); |
1206 | 1206 |
1207 }) | 1207 }) |
OLD | NEW |