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 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
775 mov(FieldOperand(result, HeapObject::kMapOffset), | 775 mov(FieldOperand(result, HeapObject::kMapOffset), |
776 Immediate(Factory::ascii_string_map())); | 776 Immediate(Factory::ascii_string_map())); |
777 mov(scratch1, length); | 777 mov(scratch1, length); |
778 SmiTag(scratch1); | 778 SmiTag(scratch1); |
779 mov(FieldOperand(result, String::kLengthOffset), scratch1); | 779 mov(FieldOperand(result, String::kLengthOffset), scratch1); |
780 mov(FieldOperand(result, String::kHashFieldOffset), | 780 mov(FieldOperand(result, String::kHashFieldOffset), |
781 Immediate(String::kEmptyHashField)); | 781 Immediate(String::kEmptyHashField)); |
782 } | 782 } |
783 | 783 |
784 | 784 |
785 void MacroAssembler::AllocateAsciiString(Register result, | |
786 int length, | |
787 Register scratch, | |
Søren Thygesen Gjesse
2010/09/01 11:19:31
Maybe add another scratch register and pass that a
Vitaly Repeshko
2010/09/01 17:21:51
Done.
| |
788 Label* gc_required) { | |
789 ASSERT(length > 0); | |
790 | |
791 // Allocate ascii string in new space. | |
792 AllocateInNewSpace(SeqAsciiString::SizeFor(length), | |
793 result, | |
794 scratch, | |
795 no_reg, | |
796 gc_required, | |
797 TAG_OBJECT); | |
798 | |
799 // Set the map, length and hash field. | |
800 mov(FieldOperand(result, HeapObject::kMapOffset), | |
801 Immediate(Factory::ascii_string_map())); | |
802 mov(FieldOperand(result, String::kLengthOffset), | |
803 Immediate(Smi::FromInt(length))); | |
804 mov(FieldOperand(result, String::kHashFieldOffset), | |
805 Immediate(String::kEmptyHashField)); | |
806 } | |
807 | |
808 | |
785 void MacroAssembler::AllocateConsString(Register result, | 809 void MacroAssembler::AllocateConsString(Register result, |
786 Register scratch1, | 810 Register scratch1, |
787 Register scratch2, | 811 Register scratch2, |
788 Label* gc_required) { | 812 Label* gc_required) { |
789 // Allocate heap number in new space. | 813 // Allocate heap number in new space. |
790 AllocateInNewSpace(ConsString::kSize, | 814 AllocateInNewSpace(ConsString::kSize, |
791 result, | 815 result, |
792 scratch1, | 816 scratch1, |
793 scratch2, | 817 scratch2, |
794 gc_required, | 818 gc_required, |
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1629 | 1653 |
1630 // Check that the code was patched as expected. | 1654 // Check that the code was patched as expected. |
1631 ASSERT(masm_.pc_ == address_ + size_); | 1655 ASSERT(masm_.pc_ == address_ + size_); |
1632 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1656 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
1633 } | 1657 } |
1634 | 1658 |
1635 | 1659 |
1636 } } // namespace v8::internal | 1660 } } // namespace v8::internal |
1637 | 1661 |
1638 #endif // V8_TARGET_ARCH_IA32 | 1662 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |