Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: src/string.js

Issue 1282013002: [es6] Add appropriate ToString call to String.prototype.normalize (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/i18n.js ('k') | test/test262-es6/test262-es6.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 })
OLDNEW
« no previous file with comments | « src/i18n.js ('k') | test/test262-es6/test262-es6.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698