| 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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 if (!%_IsSmi(code)) code = ToNumber(code); | 831 if (!%_IsSmi(code)) code = ToNumber(code); |
| 832 return %_StringCharFromCode(code & 0xffff); | 832 return %_StringCharFromCode(code & 0xffff); |
| 833 } | 833 } |
| 834 | 834 |
| 835 var one_byte = %NewString(n, NEW_ONE_BYTE_STRING); | 835 var one_byte = %NewString(n, NEW_ONE_BYTE_STRING); |
| 836 var i; | 836 var i; |
| 837 for (i = 0; i < n; i++) { | 837 for (i = 0; i < n; i++) { |
| 838 var code = %_Arguments(i); | 838 var code = %_Arguments(i); |
| 839 if (!%_IsSmi(code)) code = ToNumber(code) & 0xffff; | 839 if (!%_IsSmi(code)) code = ToNumber(code) & 0xffff; |
| 840 if (code < 0) code = code & 0xffff; | 840 if (code < 0) code = code & 0xffff; |
| 841 // TODO(dcarney): Fix for Latin-1. | 841 if (code > 0xff) break; |
| 842 if (code > 0x7f) break; | |
| 843 %_OneByteSeqStringSetChar(one_byte, i, code); | 842 %_OneByteSeqStringSetChar(one_byte, i, code); |
| 844 } | 843 } |
| 845 if (i == n) return one_byte; | 844 if (i == n) return one_byte; |
| 846 one_byte = %TruncateString(one_byte, i); | 845 one_byte = %TruncateString(one_byte, i); |
| 847 | 846 |
| 848 var two_byte = %NewString(n - i, NEW_TWO_BYTE_STRING); | 847 var two_byte = %NewString(n - i, NEW_TWO_BYTE_STRING); |
| 849 for (var j = 0; i < n; i++, j++) { | 848 for (var j = 0; i < n; i++, j++) { |
| 850 var code = %_Arguments(i); | 849 var code = %_Arguments(i); |
| 851 if (!%_IsSmi(code)) code = ToNumber(code) & 0xffff; | 850 if (!%_IsSmi(code)) code = ToNumber(code) & 0xffff; |
| 852 %_TwoByteSeqStringSetChar(two_byte, j, code); | 851 %_TwoByteSeqStringSetChar(two_byte, j, code); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 "fixed", StringFixed, | 1014 "fixed", StringFixed, |
| 1016 "italics", StringItalics, | 1015 "italics", StringItalics, |
| 1017 "small", StringSmall, | 1016 "small", StringSmall, |
| 1018 "strike", StringStrike, | 1017 "strike", StringStrike, |
| 1019 "sub", StringSub, | 1018 "sub", StringSub, |
| 1020 "sup", StringSup | 1019 "sup", StringSup |
| 1021 )); | 1020 )); |
| 1022 } | 1021 } |
| 1023 | 1022 |
| 1024 SetUpString(); | 1023 SetUpString(); |
| OLD | NEW |