OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 scratch1, | 882 scratch1, |
883 scratch2, | 883 scratch2, |
884 gc_required, | 884 gc_required, |
885 TAG_OBJECT); | 885 TAG_OBJECT); |
886 | 886 |
887 // Set the map. The other fields are left uninitialized. | 887 // Set the map. The other fields are left uninitialized. |
888 mov(FieldOperand(result, HeapObject::kMapOffset), | 888 mov(FieldOperand(result, HeapObject::kMapOffset), |
889 Immediate(Factory::cons_ascii_string_map())); | 889 Immediate(Factory::cons_ascii_string_map())); |
890 } | 890 } |
891 | 891 |
| 892 // All registers must be distinct. Only current_string needs valid contents |
| 893 // on entry. All registers may be invalid on exit. result_operand is |
| 894 // unchanged, padding_chars is updated correctly. |
| 895 void MacroAssembler::AppendStringToTopOfNewSpace( |
| 896 Register current_string, // Tagged pointer to string to copy. |
| 897 Register current_string_length, |
| 898 Register result_pos, |
| 899 Register scratch, |
| 900 Register new_padding_chars, |
| 901 Operand operand_result, |
| 902 Operand operand_padding_chars, |
| 903 Label* bailout) { |
| 904 mov(current_string_length, |
| 905 FieldOperand(current_string, String::kLengthOffset)); |
| 906 shr(current_string_length, 1); |
| 907 sub(current_string_length, operand_padding_chars); |
| 908 mov(new_padding_chars, current_string_length); |
| 909 add(Operand(current_string_length), Immediate(kObjectAlignmentMask)); |
| 910 and_(Operand(current_string_length), Immediate(~kObjectAlignmentMask)); |
| 911 sub(new_padding_chars, Operand(current_string_length)); |
| 912 neg(new_padding_chars); |
| 913 // We need an allocation even if current_string_length is 0, to fetch |
| 914 // result_pos. Consider using a faster fetch of result_pos in that case. |
| 915 AllocateInNewSpace(current_string_length, result_pos, scratch, no_reg, |
| 916 bailout, NO_ALLOCATION_FLAGS); |
| 917 sub(result_pos, operand_padding_chars); |
| 918 mov(operand_padding_chars, new_padding_chars); |
| 919 |
| 920 Register scratch_2 = new_padding_chars; // Used to compute total length. |
| 921 // Copy string to the end of result. |
| 922 mov(current_string_length, |
| 923 FieldOperand(current_string, String::kLengthOffset)); |
| 924 mov(scratch, operand_result); |
| 925 mov(scratch_2, current_string_length); |
| 926 add(scratch_2, FieldOperand(scratch, String::kLengthOffset)); |
| 927 mov(FieldOperand(scratch, String::kLengthOffset), scratch_2); |
| 928 shr(current_string_length, 1); |
| 929 lea(current_string, |
| 930 FieldOperand(current_string, SeqAsciiString::kHeaderSize)); |
| 931 // Loop condition: while (--current_string_length >= 0). |
| 932 Label copy_loop; |
| 933 Label copy_loop_entry; |
| 934 jmp(©_loop_entry); |
| 935 bind(©_loop); |
| 936 mov_b(scratch, Operand(current_string, current_string_length, times_1, 0)); |
| 937 mov_b(Operand(result_pos, current_string_length, times_1, 0), scratch); |
| 938 bind(©_loop_entry); |
| 939 sub(Operand(current_string_length), Immediate(1)); |
| 940 j(greater_equal, ©_loop); |
| 941 } |
| 942 |
892 | 943 |
893 void MacroAssembler::NegativeZeroTest(CodeGenerator* cgen, | 944 void MacroAssembler::NegativeZeroTest(CodeGenerator* cgen, |
894 Register result, | 945 Register result, |
895 Register op, | 946 Register op, |
896 JumpTarget* then_target) { | 947 JumpTarget* then_target) { |
897 JumpTarget ok; | 948 JumpTarget ok; |
898 test(result, Operand(result)); | 949 test(result, Operand(result)); |
899 ok.Branch(not_zero, taken); | 950 ok.Branch(not_zero, taken); |
900 test(op, Operand(op)); | 951 test(op, Operand(op)); |
901 then_target->Branch(sign, not_taken); | 952 then_target->Branch(sign, not_taken); |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1808 | 1859 |
1809 // Check that the code was patched as expected. | 1860 // Check that the code was patched as expected. |
1810 ASSERT(masm_.pc_ == address_ + size_); | 1861 ASSERT(masm_.pc_ == address_ + size_); |
1811 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1862 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
1812 } | 1863 } |
1813 | 1864 |
1814 | 1865 |
1815 } } // namespace v8::internal | 1866 } } // namespace v8::internal |
1816 | 1867 |
1817 #endif // V8_TARGET_ARCH_IA32 | 1868 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |