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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 | 827 |
828 void MacroAssembler::AllocateTwoByteString(Register result, | 828 void MacroAssembler::AllocateTwoByteString(Register result, |
829 Register length, | 829 Register length, |
830 Register scratch1, | 830 Register scratch1, |
831 Register scratch2, | 831 Register scratch2, |
832 Register scratch3, | 832 Register scratch3, |
833 Label* gc_required) { | 833 Label* gc_required) { |
834 // Calculate the number of bytes needed for the characters in the string while | 834 // Calculate the number of bytes needed for the characters in the string while |
835 // observing object alignment. | 835 // observing object alignment. |
836 ASSERT((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0); | 836 ASSERT((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0); |
837 mov(scratch1, length); | |
838 ASSERT(kShortSize == 2); | 837 ASSERT(kShortSize == 2); |
839 shl(scratch1, 1); | 838 // scratch1 = length * 2 + kObjectAlignmentMask. |
840 add(Operand(scratch1), Immediate(kObjectAlignmentMask)); | 839 lea(scratch1, Operand(length, length, times_1, kObjectAlignmentMask)); |
841 and_(Operand(scratch1), Immediate(~kObjectAlignmentMask)); | 840 and_(Operand(scratch1), Immediate(~kObjectAlignmentMask)); |
842 | 841 |
843 // Allocate two byte string in new space. | 842 // Allocate two byte string in new space. |
844 AllocateInNewSpace(SeqTwoByteString::kHeaderSize, | 843 AllocateInNewSpace(SeqTwoByteString::kHeaderSize, |
845 times_1, | 844 times_1, |
846 scratch1, | 845 scratch1, |
847 result, | 846 result, |
848 scratch2, | 847 scratch2, |
849 scratch3, | 848 scratch3, |
850 gc_required, | 849 gc_required, |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1418 // Indicate that code has changed. | 1417 // Indicate that code has changed. |
1419 CPU::FlushICache(address_, size_); | 1418 CPU::FlushICache(address_, size_); |
1420 | 1419 |
1421 // Check that the code was patched as expected. | 1420 // Check that the code was patched as expected. |
1422 ASSERT(masm_.pc_ == address_ + size_); | 1421 ASSERT(masm_.pc_ == address_ + size_); |
1423 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1422 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
1424 } | 1423 } |
1425 | 1424 |
1426 | 1425 |
1427 } } // namespace v8::internal | 1426 } } // namespace v8::internal |
OLD | NEW |