OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 if (!%_IsSmi(code)) code = ToNumber(code); | 818 if (!%_IsSmi(code)) code = ToNumber(code); |
819 return %_StringCharFromCode(code & 0xffff); | 819 return %_StringCharFromCode(code & 0xffff); |
820 } | 820 } |
821 | 821 |
822 var one_byte = %NewString(n, NEW_ONE_BYTE_STRING); | 822 var one_byte = %NewString(n, NEW_ONE_BYTE_STRING); |
823 var i; | 823 var i; |
824 for (i = 0; i < n; i++) { | 824 for (i = 0; i < n; i++) { |
825 var code = %_Arguments(i); | 825 var code = %_Arguments(i); |
826 if (!%_IsSmi(code)) code = ToNumber(code) & 0xffff; | 826 if (!%_IsSmi(code)) code = ToNumber(code) & 0xffff; |
827 if (code < 0) code = code & 0xffff; | 827 if (code < 0) code = code & 0xffff; |
| 828 // TODO(dcarney): Fix for Latin-1. |
828 if (code > 0x7f) break; | 829 if (code > 0x7f) break; |
829 %_OneByteSeqStringSetChar(one_byte, i, code); | 830 %_OneByteSeqStringSetChar(one_byte, i, code); |
830 } | 831 } |
831 if (i == n) return one_byte; | 832 if (i == n) return one_byte; |
832 one_byte = %TruncateString(one_byte, i); | 833 one_byte = %TruncateString(one_byte, i); |
833 | 834 |
834 var two_byte = %NewString(n - i, NEW_TWO_BYTE_STRING); | 835 var two_byte = %NewString(n - i, NEW_TWO_BYTE_STRING); |
835 for (var j = 0; i < n; i++, j++) { | 836 for (var j = 0; i < n; i++, j++) { |
836 var code = %_Arguments(i); | 837 var code = %_Arguments(i); |
837 if (!%_IsSmi(code)) code = ToNumber(code) & 0xffff; | 838 if (!%_IsSmi(code)) code = ToNumber(code) & 0xffff; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 "fixed", StringFixed, | 1002 "fixed", StringFixed, |
1002 "italics", StringItalics, | 1003 "italics", StringItalics, |
1003 "small", StringSmall, | 1004 "small", StringSmall, |
1004 "strike", StringStrike, | 1005 "strike", StringStrike, |
1005 "sub", StringSub, | 1006 "sub", StringSub, |
1006 "sup", StringSup | 1007 "sup", StringSup |
1007 )); | 1008 )); |
1008 } | 1009 } |
1009 | 1010 |
1010 SetUpString(); | 1011 SetUpString(); |
OLD | NEW |