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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 } | 511 } |
512 | 512 |
513 | 513 |
514 // ECMA-262, 15.5.4.19 | 514 // ECMA-262, 15.5.4.19 |
515 function StringToLocaleUpperCase() { | 515 function StringToLocaleUpperCase() { |
516 CHECK_OBJECT_COERCIBLE(this, "String.prototype.toLocaleUpperCase"); | 516 CHECK_OBJECT_COERCIBLE(this, "String.prototype.toLocaleUpperCase"); |
517 | 517 |
518 return %StringToUpperCase(TO_STRING(this)); | 518 return %StringToUpperCase(TO_STRING(this)); |
519 } | 519 } |
520 | 520 |
521 // ES5, 15.5.4.20 | |
522 function StringTrimJS() { | |
523 CHECK_OBJECT_COERCIBLE(this, "String.prototype.trim"); | |
524 | |
525 return %StringTrim(TO_STRING(this), true, true); | |
526 } | |
527 | |
528 function StringTrimLeft() { | |
529 CHECK_OBJECT_COERCIBLE(this, "String.prototype.trimLeft"); | |
530 | |
531 return %StringTrim(TO_STRING(this), true, false); | |
532 } | |
533 | |
534 function StringTrimRight() { | |
535 CHECK_OBJECT_COERCIBLE(this, "String.prototype.trimRight"); | |
536 | |
537 return %StringTrim(TO_STRING(this), false, true); | |
538 } | |
539 | |
540 | 521 |
541 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2.1 | 522 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2.1 |
542 function HtmlEscape(str) { | 523 function HtmlEscape(str) { |
543 return %_Call(StringReplace, TO_STRING(str), /"/g, """); | 524 return %_Call(StringReplace, TO_STRING(str), /"/g, """); |
544 } | 525 } |
545 | 526 |
546 | 527 |
547 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2 | 528 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2 |
548 function StringAnchor(name) { | 529 function StringAnchor(name) { |
549 CHECK_OBJECT_COERCIBLE(this, "String.prototype.anchor"); | 530 CHECK_OBJECT_COERCIBLE(this, "String.prototype.anchor"); |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 "search", StringSearch, | 824 "search", StringSearch, |
844 "slice", StringSlice, | 825 "slice", StringSlice, |
845 "split", StringSplitJS, | 826 "split", StringSplitJS, |
846 "substring", StringSubstring, | 827 "substring", StringSubstring, |
847 "substr", StringSubstr, | 828 "substr", StringSubstr, |
848 "startsWith", StringStartsWith, | 829 "startsWith", StringStartsWith, |
849 "toLowerCase", StringToLowerCaseJS, | 830 "toLowerCase", StringToLowerCaseJS, |
850 "toLocaleLowerCase", StringToLocaleLowerCase, | 831 "toLocaleLowerCase", StringToLocaleLowerCase, |
851 "toUpperCase", StringToUpperCaseJS, | 832 "toUpperCase", StringToUpperCaseJS, |
852 "toLocaleUpperCase", StringToLocaleUpperCase, | 833 "toLocaleUpperCase", StringToLocaleUpperCase, |
853 "trim", StringTrimJS, | |
854 "trimLeft", StringTrimLeft, | |
855 "trimRight", StringTrimRight, | |
856 | 834 |
857 "link", StringLink, | 835 "link", StringLink, |
858 "anchor", StringAnchor, | 836 "anchor", StringAnchor, |
859 "fontcolor", StringFontcolor, | 837 "fontcolor", StringFontcolor, |
860 "fontsize", StringFontsize, | 838 "fontsize", StringFontsize, |
861 "big", StringBig, | 839 "big", StringBig, |
862 "blink", StringBlink, | 840 "blink", StringBlink, |
863 "bold", StringBold, | 841 "bold", StringBold, |
864 "fixed", StringFixed, | 842 "fixed", StringFixed, |
865 "italics", StringItalics, | 843 "italics", StringItalics, |
(...skipping 12 matching lines...) Expand all Loading... |
878 to.StringLastIndexOf = StringLastIndexOf; | 856 to.StringLastIndexOf = StringLastIndexOf; |
879 to.StringMatch = StringMatchJS; | 857 to.StringMatch = StringMatchJS; |
880 to.StringReplace = StringReplace; | 858 to.StringReplace = StringReplace; |
881 to.StringSlice = StringSlice; | 859 to.StringSlice = StringSlice; |
882 to.StringSplit = StringSplitJS; | 860 to.StringSplit = StringSplitJS; |
883 to.StringSubstr = StringSubstr; | 861 to.StringSubstr = StringSubstr; |
884 to.StringSubstring = StringSubstring; | 862 to.StringSubstring = StringSubstring; |
885 }); | 863 }); |
886 | 864 |
887 }) | 865 }) |
OLD | NEW |