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

Side by Side Diff: src/string.js

Issue 1274653002: Ensure `String.prototype.normalize.length` is `0` (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update as per @rossberg’s feedback 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/intl/string/normalization.js » ('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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 regexp = new GlobalRegExp(regexp); 182 regexp = new GlobalRegExp(regexp);
183 return RegExpExecNoTests(regexp, subject, 0); 183 return RegExpExecNoTests(regexp, subject, 0);
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(form) { 192 function StringNormalizeJS() {
193 CHECK_OBJECT_COERCIBLE(this, "String.prototype.normalize"); 193 CHECK_OBJECT_COERCIBLE(this, "String.prototype.normalize");
194 194
195 var form = IS_UNDEFINED(form) ? 'NFC' : TO_STRING_INLINE(form); 195 var formArg = %_Arguments(0);
196 var form = IS_UNDEFINED(formArg) ? 'NFC' : TO_STRING_INLINE(formArg);
196 197
197 var NORMALIZATION_FORMS = ['NFC', 'NFD', 'NFKC', 'NFKD']; 198 var NORMALIZATION_FORMS = ['NFC', 'NFD', 'NFKC', 'NFKD'];
198 var normalizationForm = 199 var normalizationForm =
199 %_CallFunction(NORMALIZATION_FORMS, form, ArrayIndexOf); 200 %_CallFunction(NORMALIZATION_FORMS, form, ArrayIndexOf);
200 if (normalizationForm === -1) { 201 if (normalizationForm === -1) {
201 throw MakeRangeError(kNormalizationForm, 202 throw MakeRangeError(kNormalizationForm,
202 %_CallFunction(NORMALIZATION_FORMS, ', ', ArrayJoin)); 203 %_CallFunction(NORMALIZATION_FORMS, ', ', ArrayJoin));
203 } 204 }
204 205
205 return %_ValueOf(this); 206 return %_ValueOf(this);
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 to.StringIndexOf = StringIndexOfJS; 1199 to.StringIndexOf = StringIndexOfJS;
1199 to.StringLastIndexOf = StringLastIndexOfJS; 1200 to.StringLastIndexOf = StringLastIndexOfJS;
1200 to.StringMatch = StringMatchJS; 1201 to.StringMatch = StringMatchJS;
1201 to.StringReplace = StringReplace; 1202 to.StringReplace = StringReplace;
1202 to.StringSplit = StringSplitJS; 1203 to.StringSplit = StringSplitJS;
1203 to.StringSubstr = StringSubstr; 1204 to.StringSubstr = StringSubstr;
1204 to.StringSubstring = StringSubstring; 1205 to.StringSubstring = StringSubstring;
1205 }); 1206 });
1206 1207
1207 }) 1208 })
OLDNEW
« no previous file with comments | « src/i18n.js ('k') | test/intl/string/normalization.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698