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

Side by Side Diff: src/js/string.js

Issue 2018983002: [builtins] Also migrate String.prototype.toLowerCase/toUpperCase to C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@StringTrim
Patch Set: REBASE Created 4 years, 6 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/js/i18n.js ('k') | src/objects.h » ('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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 } 480 }
481 } 481 }
482 482
483 var end = start + len; 483 var end = start + len;
484 if (end > s.length) end = s.length; 484 if (end > s.length) end = s.length;
485 485
486 return %_SubString(s, start, end); 486 return %_SubString(s, start, end);
487 } 487 }
488 488
489 489
490 // ECMA-262, 15.5.4.16
491 function StringToLowerCaseJS() {
492 CHECK_OBJECT_COERCIBLE(this, "String.prototype.toLowerCase");
493
494 return %StringToLowerCase(TO_STRING(this));
495 }
496
497
498 // ECMA-262, 15.5.4.17
499 function StringToLocaleLowerCase() {
500 CHECK_OBJECT_COERCIBLE(this, "String.prototype.toLocaleLowerCase");
501
502 return %StringToLowerCase(TO_STRING(this));
503 }
504
505
506 // ECMA-262, 15.5.4.18
507 function StringToUpperCaseJS() {
508 CHECK_OBJECT_COERCIBLE(this, "String.prototype.toUpperCase");
509
510 return %StringToUpperCase(TO_STRING(this));
511 }
512
513
514 // ECMA-262, 15.5.4.19
515 function StringToLocaleUpperCase() {
516 CHECK_OBJECT_COERCIBLE(this, "String.prototype.toLocaleUpperCase");
517
518 return %StringToUpperCase(TO_STRING(this));
519 }
520
521
522 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2.1 490 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2.1
523 function HtmlEscape(str) { 491 function HtmlEscape(str) {
524 return %_Call(StringReplace, TO_STRING(str), /"/g, """); 492 return %_Call(StringReplace, TO_STRING(str), /"/g, """);
525 } 493 }
526 494
527 495
528 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2 496 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2
529 function StringAnchor(name) { 497 function StringAnchor(name) {
530 CHECK_OBJECT_COERCIBLE(this, "String.prototype.anchor"); 498 CHECK_OBJECT_COERCIBLE(this, "String.prototype.anchor");
531 return "<a name=\"" + HtmlEscape(name) + "\">" + TO_STRING(this) + 499 return "<a name=\"" + HtmlEscape(name) + "\">" + TO_STRING(this) +
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 "match", StringMatchJS, 788 "match", StringMatchJS,
821 "normalize", StringNormalize, 789 "normalize", StringNormalize,
822 "repeat", StringRepeat, 790 "repeat", StringRepeat,
823 "replace", StringReplace, 791 "replace", StringReplace,
824 "search", StringSearch, 792 "search", StringSearch,
825 "slice", StringSlice, 793 "slice", StringSlice,
826 "split", StringSplitJS, 794 "split", StringSplitJS,
827 "substring", StringSubstring, 795 "substring", StringSubstring,
828 "substr", StringSubstr, 796 "substr", StringSubstr,
829 "startsWith", StringStartsWith, 797 "startsWith", StringStartsWith,
830 "toLowerCase", StringToLowerCaseJS,
831 "toLocaleLowerCase", StringToLocaleLowerCase,
832 "toUpperCase", StringToUpperCaseJS,
833 "toLocaleUpperCase", StringToLocaleUpperCase,
834 798
835 "link", StringLink, 799 "link", StringLink,
836 "anchor", StringAnchor, 800 "anchor", StringAnchor,
837 "fontcolor", StringFontcolor, 801 "fontcolor", StringFontcolor,
838 "fontsize", StringFontsize, 802 "fontsize", StringFontsize,
839 "big", StringBig, 803 "big", StringBig,
840 "blink", StringBlink, 804 "blink", StringBlink,
841 "bold", StringBold, 805 "bold", StringBold,
842 "fixed", StringFixed, 806 "fixed", StringFixed,
843 "italics", StringItalics, 807 "italics", StringItalics,
(...skipping 12 matching lines...) Expand all
856 to.StringLastIndexOf = StringLastIndexOf; 820 to.StringLastIndexOf = StringLastIndexOf;
857 to.StringMatch = StringMatchJS; 821 to.StringMatch = StringMatchJS;
858 to.StringReplace = StringReplace; 822 to.StringReplace = StringReplace;
859 to.StringSlice = StringSlice; 823 to.StringSlice = StringSlice;
860 to.StringSplit = StringSplitJS; 824 to.StringSplit = StringSplitJS;
861 to.StringSubstr = StringSubstr; 825 to.StringSubstr = StringSubstr;
862 to.StringSubstring = StringSubstring; 826 to.StringSubstring = StringSubstring;
863 }); 827 });
864 828
865 }) 829 })
OLDNEW
« no previous file with comments | « src/js/i18n.js ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698