| 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 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 | 846 |
| 847 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2.1 | 847 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2.1 |
| 848 function HtmlEscape(str) { | 848 function HtmlEscape(str) { |
| 849 return TO_STRING_INLINE(str).replace(/"/g, """); | 849 return TO_STRING_INLINE(str).replace(/"/g, """); |
| 850 } | 850 } |
| 851 | 851 |
| 852 | 852 |
| 853 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2 | 853 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2 |
| 854 function StringAnchor(name) { | 854 function StringAnchor(name) { |
| 855 CHECK_OBJECT_COERCIBLE(this, "String.prototype.anchor"); | 855 CHECK_OBJECT_COERCIBLE(this, "String.prototype.anchor"); |
| 856 return "<a name=\"" + HtmlEscape(name) + "\">" + this + "</a>"; | 856 return "<a name=\"" + HtmlEscape(name) + "\">" + TO_STRING_INLINE(this) + |
| 857 "</a>"; |
| 857 } | 858 } |
| 858 | 859 |
| 859 | 860 |
| 860 // ES6 draft, revision 26 (2014-07-18), section B.2.3.3 | 861 // ES6 draft, revision 26 (2014-07-18), section B.2.3.3 |
| 861 function StringBig() { | 862 function StringBig() { |
| 862 CHECK_OBJECT_COERCIBLE(this, "String.prototype.big"); | 863 CHECK_OBJECT_COERCIBLE(this, "String.prototype.big"); |
| 863 return "<big>" + this + "</big>"; | 864 return "<big>" + TO_STRING_INLINE(this) + "</big>"; |
| 864 } | 865 } |
| 865 | 866 |
| 866 | 867 |
| 867 // ES6 draft, revision 26 (2014-07-18), section B.2.3.4 | 868 // ES6 draft, revision 26 (2014-07-18), section B.2.3.4 |
| 868 function StringBlink() { | 869 function StringBlink() { |
| 869 CHECK_OBJECT_COERCIBLE(this, "String.prototype.blink"); | 870 CHECK_OBJECT_COERCIBLE(this, "String.prototype.blink"); |
| 870 return "<blink>" + this + "</blink>"; | 871 return "<blink>" + TO_STRING_INLINE(this) + "</blink>"; |
| 871 } | 872 } |
| 872 | 873 |
| 873 | 874 |
| 874 // ES6 draft, revision 26 (2014-07-18), section B.2.3.5 | 875 // ES6 draft, revision 26 (2014-07-18), section B.2.3.5 |
| 875 function StringBold() { | 876 function StringBold() { |
| 876 CHECK_OBJECT_COERCIBLE(this, "String.prototype.bold"); | 877 CHECK_OBJECT_COERCIBLE(this, "String.prototype.bold"); |
| 877 return "<b>" + this + "</b>"; | 878 return "<b>" + TO_STRING_INLINE(this) + "</b>"; |
| 878 } | 879 } |
| 879 | 880 |
| 880 | 881 |
| 881 // ES6 draft, revision 26 (2014-07-18), section B.2.3.6 | 882 // ES6 draft, revision 26 (2014-07-18), section B.2.3.6 |
| 882 function StringFixed() { | 883 function StringFixed() { |
| 883 CHECK_OBJECT_COERCIBLE(this, "String.prototype.fixed"); | 884 CHECK_OBJECT_COERCIBLE(this, "String.prototype.fixed"); |
| 884 return "<tt>" + this + "</tt>"; | 885 return "<tt>" + TO_STRING_INLINE(this) + "</tt>"; |
| 885 } | 886 } |
| 886 | 887 |
| 887 | 888 |
| 888 // ES6 draft, revision 26 (2014-07-18), section B.2.3.7 | 889 // ES6 draft, revision 26 (2014-07-18), section B.2.3.7 |
| 889 function StringFontcolor(color) { | 890 function StringFontcolor(color) { |
| 890 CHECK_OBJECT_COERCIBLE(this, "String.prototype.fontcolor"); | 891 CHECK_OBJECT_COERCIBLE(this, "String.prototype.fontcolor"); |
| 891 return "<font color=\"" + HtmlEscape(color) + "\">" + this + "</font>"; | 892 return "<font color=\"" + HtmlEscape(color) + "\">" + TO_STRING_INLINE(this) + |
| 893 "</font>"; |
| 892 } | 894 } |
| 893 | 895 |
| 894 | 896 |
| 895 // ES6 draft, revision 26 (2014-07-18), section B.2.3.8 | 897 // ES6 draft, revision 26 (2014-07-18), section B.2.3.8 |
| 896 function StringFontsize(size) { | 898 function StringFontsize(size) { |
| 897 CHECK_OBJECT_COERCIBLE(this, "String.prototype.fontsize"); | 899 CHECK_OBJECT_COERCIBLE(this, "String.prototype.fontsize"); |
| 898 return "<font size=\"" + HtmlEscape(size) + "\">" + this + "</font>"; | 900 return "<font size=\"" + HtmlEscape(size) + "\">" + TO_STRING_INLINE(this) + |
| 901 "</font>"; |
| 899 } | 902 } |
| 900 | 903 |
| 901 | 904 |
| 902 // ES6 draft, revision 26 (2014-07-18), section B.2.3.9 | 905 // ES6 draft, revision 26 (2014-07-18), section B.2.3.9 |
| 903 function StringItalics() { | 906 function StringItalics() { |
| 904 CHECK_OBJECT_COERCIBLE(this, "String.prototype.italics"); | 907 CHECK_OBJECT_COERCIBLE(this, "String.prototype.italics"); |
| 905 return "<i>" + this + "</i>"; | 908 return "<i>" + TO_STRING_INLINE(this) + "</i>"; |
| 906 } | 909 } |
| 907 | 910 |
| 908 | 911 |
| 909 // ES6 draft, revision 26 (2014-07-18), section B.2.3.10 | 912 // ES6 draft, revision 26 (2014-07-18), section B.2.3.10 |
| 910 function StringLink(s) { | 913 function StringLink(s) { |
| 911 CHECK_OBJECT_COERCIBLE(this, "String.prototype.link"); | 914 CHECK_OBJECT_COERCIBLE(this, "String.prototype.link"); |
| 912 return "<a href=\"" + HtmlEscape(s) + "\">" + this + "</a>"; | 915 return "<a href=\"" + HtmlEscape(s) + "\">" + TO_STRING_INLINE(this) + "</a>"; |
| 913 } | 916 } |
| 914 | 917 |
| 915 | 918 |
| 916 // ES6 draft, revision 26 (2014-07-18), section B.2.3.11 | 919 // ES6 draft, revision 26 (2014-07-18), section B.2.3.11 |
| 917 function StringSmall() { | 920 function StringSmall() { |
| 918 CHECK_OBJECT_COERCIBLE(this, "String.prototype.small"); | 921 CHECK_OBJECT_COERCIBLE(this, "String.prototype.small"); |
| 919 return "<small>" + this + "</small>"; | 922 return "<small>" + TO_STRING_INLINE(this) + "</small>"; |
| 920 } | 923 } |
| 921 | 924 |
| 922 | 925 |
| 923 // ES6 draft, revision 26 (2014-07-18), section B.2.3.12 | 926 // ES6 draft, revision 26 (2014-07-18), section B.2.3.12 |
| 924 function StringStrike() { | 927 function StringStrike() { |
| 925 CHECK_OBJECT_COERCIBLE(this, "String.prototype.strike"); | 928 CHECK_OBJECT_COERCIBLE(this, "String.prototype.strike"); |
| 926 return "<strike>" + this + "</strike>"; | 929 return "<strike>" + TO_STRING_INLINE(this) + "</strike>"; |
| 927 } | 930 } |
| 928 | 931 |
| 929 | 932 |
| 930 // ES6 draft, revision 26 (2014-07-18), section B.2.3.13 | 933 // ES6 draft, revision 26 (2014-07-18), section B.2.3.13 |
| 931 function StringSub() { | 934 function StringSub() { |
| 932 CHECK_OBJECT_COERCIBLE(this, "String.prototype.sub"); | 935 CHECK_OBJECT_COERCIBLE(this, "String.prototype.sub"); |
| 933 return "<sub>" + this + "</sub>"; | 936 return "<sub>" + TO_STRING_INLINE(this) + "</sub>"; |
| 934 } | 937 } |
| 935 | 938 |
| 936 | 939 |
| 937 // ES6 draft, revision 26 (2014-07-18), section B.2.3.14 | 940 // ES6 draft, revision 26 (2014-07-18), section B.2.3.14 |
| 938 function StringSup() { | 941 function StringSup() { |
| 939 CHECK_OBJECT_COERCIBLE(this, "String.prototype.sup"); | 942 CHECK_OBJECT_COERCIBLE(this, "String.prototype.sup"); |
| 940 return "<sup>" + this + "</sup>"; | 943 return "<sup>" + TO_STRING_INLINE(this) + "</sup>"; |
| 941 } | 944 } |
| 942 | 945 |
| 943 // ES6 draft 01-20-14, section 21.1.3.13 | 946 // ES6 draft 01-20-14, section 21.1.3.13 |
| 944 function StringRepeat(count) { | 947 function StringRepeat(count) { |
| 945 CHECK_OBJECT_COERCIBLE(this, "String.prototype.repeat"); | 948 CHECK_OBJECT_COERCIBLE(this, "String.prototype.repeat"); |
| 946 | 949 |
| 947 var s = TO_STRING_INLINE(this); | 950 var s = TO_STRING_INLINE(this); |
| 948 var n = $toInteger(count); | 951 var n = $toInteger(count); |
| 949 // The maximum string length is stored in a smi, so a longer repeat | 952 // The maximum string length is stored in a smi, so a longer repeat |
| 950 // must result in a range error. | 953 // must result in a range error. |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 // ------------------------------------------------------------------- | 1188 // ------------------------------------------------------------------- |
| 1186 // Exports | 1189 // Exports |
| 1187 | 1190 |
| 1188 utils.Export(function(to) { | 1191 utils.Export(function(to) { |
| 1189 to.StringCharAt = StringCharAtJS; | 1192 to.StringCharAt = StringCharAtJS; |
| 1190 to.StringIndexOf = StringIndexOfJS; | 1193 to.StringIndexOf = StringIndexOfJS; |
| 1191 to.StringSubstring = StringSubstring; | 1194 to.StringSubstring = StringSubstring; |
| 1192 }); | 1195 }); |
| 1193 | 1196 |
| 1194 }) | 1197 }) |
| OLD | NEW |