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 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
722 // Load address of new object into result. | 722 // Load address of new object into result. |
723 LoadAllocationTopHelper(result, result_end, scratch, flags); | 723 LoadAllocationTopHelper(result, result_end, scratch, flags); |
724 | 724 |
725 // Calculate new top and bail out if new space is exhausted. | 725 // Calculate new top and bail out if new space is exhausted. |
726 ExternalReference new_space_allocation_limit = | 726 ExternalReference new_space_allocation_limit = |
727 ExternalReference::new_space_allocation_limit_address(); | 727 ExternalReference::new_space_allocation_limit_address(); |
728 lea(result_end, Operand(result, object_size)); | 728 lea(result_end, Operand(result, object_size)); |
729 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); | 729 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); |
730 j(above, gc_required, not_taken); | 730 j(above, gc_required, not_taken); |
731 | 731 |
732 // Update allocation top. | |
733 UpdateAllocationTopHelper(result_end, scratch); | |
734 | |
735 // Tag result if requested. | 732 // Tag result if requested. |
736 if ((flags & TAG_OBJECT) != 0) { | 733 if ((flags & TAG_OBJECT) != 0) { |
737 or_(Operand(result), Immediate(kHeapObjectTag)); | 734 or_(Operand(result), Immediate(kHeapObjectTag)); |
738 } | 735 } |
736 | |
737 // Update allocation top. | |
738 UpdateAllocationTopHelper(result_end, scratch); | |
sra1
2009/12/23 00:56:02
I assume the order was changed here generate instr
| |
739 } | 739 } |
740 | 740 |
741 | 741 |
742 void MacroAssembler::AllocateInNewSpace(int header_size, | 742 void MacroAssembler::AllocateInNewSpace(int header_size, |
743 ScaleFactor element_size, | 743 ScaleFactor element_size, |
744 Register element_count, | 744 Register element_count, |
745 Register result, | 745 Register result, |
746 Register result_end, | 746 Register result_end, |
747 Register scratch, | 747 Register scratch, |
748 Label* gc_required, | 748 Label* gc_required, |
749 AllocationFlags flags) { | 749 AllocationFlags flags) { |
750 ASSERT(!result.is(result_end)); | 750 ASSERT(!result.is(result_end)); |
751 | 751 |
752 // Load address of new object into result. | 752 // Load address of new object into result. |
753 LoadAllocationTopHelper(result, result_end, scratch, flags); | 753 LoadAllocationTopHelper(result, result_end, scratch, flags); |
754 | 754 |
755 // Calculate new top and bail out if new space is exhausted. | 755 // Calculate new top and bail out if new space is exhausted. |
756 ExternalReference new_space_allocation_limit = | 756 ExternalReference new_space_allocation_limit = |
757 ExternalReference::new_space_allocation_limit_address(); | 757 ExternalReference::new_space_allocation_limit_address(); |
758 lea(result_end, Operand(result, element_count, element_size, header_size)); | 758 lea(result_end, Operand(result, element_count, element_size, header_size)); |
759 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); | 759 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); |
760 j(above, gc_required); | 760 j(above, gc_required); |
761 | 761 |
762 // Update allocation top. | |
763 UpdateAllocationTopHelper(result_end, scratch); | |
764 | |
765 // Tag result if requested. | 762 // Tag result if requested. |
766 if ((flags & TAG_OBJECT) != 0) { | 763 if ((flags & TAG_OBJECT) != 0) { |
767 or_(Operand(result), Immediate(kHeapObjectTag)); | 764 or_(Operand(result), Immediate(kHeapObjectTag)); |
768 } | 765 } |
766 | |
767 // Update allocation top. | |
768 UpdateAllocationTopHelper(result_end, scratch); | |
769 | |
769 } | 770 } |
770 | 771 |
771 | 772 |
772 void MacroAssembler::AllocateInNewSpace(Register object_size, | 773 void MacroAssembler::AllocateInNewSpace(Register object_size, |
773 Register result, | 774 Register result, |
774 Register result_end, | 775 Register result_end, |
775 Register scratch, | 776 Register scratch, |
776 Label* gc_required, | 777 Label* gc_required, |
777 AllocationFlags flags) { | 778 AllocationFlags flags) { |
778 ASSERT(!result.is(result_end)); | 779 ASSERT(!result.is(result_end)); |
779 | 780 |
780 // Load address of new object into result. | 781 // Load address of new object into result. |
781 LoadAllocationTopHelper(result, result_end, scratch, flags); | 782 LoadAllocationTopHelper(result, result_end, scratch, flags); |
782 | 783 |
783 // Calculate new top and bail out if new space is exhausted. | 784 // Calculate new top and bail out if new space is exhausted. |
784 ExternalReference new_space_allocation_limit = | 785 ExternalReference new_space_allocation_limit = |
785 ExternalReference::new_space_allocation_limit_address(); | 786 ExternalReference::new_space_allocation_limit_address(); |
786 if (!object_size.is(result_end)) { | 787 if (!object_size.is(result_end)) { |
787 mov(result_end, object_size); | 788 mov(result_end, object_size); |
788 } | 789 } |
789 add(result_end, Operand(result)); | 790 add(result_end, Operand(result)); |
790 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); | 791 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); |
791 j(above, gc_required, not_taken); | 792 j(above, gc_required, not_taken); |
792 | 793 |
793 // Update allocation top. | |
794 UpdateAllocationTopHelper(result_end, scratch); | |
795 | |
796 // Tag result if requested. | 794 // Tag result if requested. |
797 if ((flags & TAG_OBJECT) != 0) { | 795 if ((flags & TAG_OBJECT) != 0) { |
798 or_(Operand(result), Immediate(kHeapObjectTag)); | 796 or_(Operand(result), Immediate(kHeapObjectTag)); |
799 } | 797 } |
798 | |
799 // Update allocation top. | |
800 UpdateAllocationTopHelper(result_end, scratch); | |
800 } | 801 } |
801 | 802 |
802 | 803 |
803 void MacroAssembler::UndoAllocationInNewSpace(Register object) { | 804 void MacroAssembler::UndoAllocationInNewSpace(Register object) { |
804 ExternalReference new_space_allocation_top = | 805 ExternalReference new_space_allocation_top = |
805 ExternalReference::new_space_allocation_top_address(); | 806 ExternalReference::new_space_allocation_top_address(); |
806 | 807 |
807 // Make sure the object has no tag before resetting top. | 808 // Make sure the object has no tag before resetting top. |
808 and_(Operand(object), Immediate(~kHeapObjectTagMask)); | 809 and_(Operand(object), Immediate(~kHeapObjectTagMask)); |
809 #ifdef DEBUG | 810 #ifdef DEBUG |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1497 // Indicate that code has changed. | 1498 // Indicate that code has changed. |
1498 CPU::FlushICache(address_, size_); | 1499 CPU::FlushICache(address_, size_); |
1499 | 1500 |
1500 // Check that the code was patched as expected. | 1501 // Check that the code was patched as expected. |
1501 ASSERT(masm_.pc_ == address_ + size_); | 1502 ASSERT(masm_.pc_ == address_ + size_); |
1502 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1503 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
1503 } | 1504 } |
1504 | 1505 |
1505 | 1506 |
1506 } } // namespace v8::internal | 1507 } } // namespace v8::internal |
OLD | NEW |