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 // Tag result if requested. |
| 733 if ((flags & TAG_OBJECT) != 0) { |
| 734 lea(result, Operand(result, kHeapObjectTag)); |
| 735 } |
| 736 |
732 // Update allocation top. | 737 // Update allocation top. |
733 UpdateAllocationTopHelper(result_end, scratch); | 738 UpdateAllocationTopHelper(result_end, scratch); |
734 | |
735 // Tag result if requested. | |
736 if ((flags & TAG_OBJECT) != 0) { | |
737 or_(Operand(result), Immediate(kHeapObjectTag)); | |
738 } | |
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 // Tag result if requested. |
| 763 if ((flags & TAG_OBJECT) != 0) { |
| 764 lea(result, Operand(result, kHeapObjectTag)); |
| 765 } |
| 766 |
762 // Update allocation top. | 767 // Update allocation top. |
763 UpdateAllocationTopHelper(result_end, scratch); | 768 UpdateAllocationTopHelper(result_end, scratch); |
764 | |
765 // Tag result if requested. | |
766 if ((flags & TAG_OBJECT) != 0) { | |
767 or_(Operand(result), Immediate(kHeapObjectTag)); | |
768 } | |
769 } | 769 } |
770 | 770 |
771 | 771 |
772 void MacroAssembler::AllocateInNewSpace(Register object_size, | 772 void MacroAssembler::AllocateInNewSpace(Register object_size, |
773 Register result, | 773 Register result, |
774 Register result_end, | 774 Register result_end, |
775 Register scratch, | 775 Register scratch, |
776 Label* gc_required, | 776 Label* gc_required, |
777 AllocationFlags flags) { | 777 AllocationFlags flags) { |
778 ASSERT(!result.is(result_end)); | 778 ASSERT(!result.is(result_end)); |
779 | 779 |
780 // Load address of new object into result. | 780 // Load address of new object into result. |
781 LoadAllocationTopHelper(result, result_end, scratch, flags); | 781 LoadAllocationTopHelper(result, result_end, scratch, flags); |
782 | 782 |
783 // Calculate new top and bail out if new space is exhausted. | 783 // Calculate new top and bail out if new space is exhausted. |
784 ExternalReference new_space_allocation_limit = | 784 ExternalReference new_space_allocation_limit = |
785 ExternalReference::new_space_allocation_limit_address(); | 785 ExternalReference::new_space_allocation_limit_address(); |
786 if (!object_size.is(result_end)) { | 786 if (!object_size.is(result_end)) { |
787 mov(result_end, object_size); | 787 mov(result_end, object_size); |
788 } | 788 } |
789 add(result_end, Operand(result)); | 789 add(result_end, Operand(result)); |
790 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); | 790 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); |
791 j(above, gc_required, not_taken); | 791 j(above, gc_required, not_taken); |
792 | 792 |
| 793 // Tag result if requested. |
| 794 if ((flags & TAG_OBJECT) != 0) { |
| 795 lea(result, Operand(result, kHeapObjectTag)); |
| 796 } |
| 797 |
793 // Update allocation top. | 798 // Update allocation top. |
794 UpdateAllocationTopHelper(result_end, scratch); | 799 UpdateAllocationTopHelper(result_end, scratch); |
795 | |
796 // Tag result if requested. | |
797 if ((flags & TAG_OBJECT) != 0) { | |
798 or_(Operand(result), Immediate(kHeapObjectTag)); | |
799 } | |
800 } | 800 } |
801 | 801 |
802 | 802 |
803 void MacroAssembler::UndoAllocationInNewSpace(Register object) { | 803 void MacroAssembler::UndoAllocationInNewSpace(Register object) { |
804 ExternalReference new_space_allocation_top = | 804 ExternalReference new_space_allocation_top = |
805 ExternalReference::new_space_allocation_top_address(); | 805 ExternalReference::new_space_allocation_top_address(); |
806 | 806 |
807 // Make sure the object has no tag before resetting top. | 807 // Make sure the object has no tag before resetting top. |
808 and_(Operand(object), Immediate(~kHeapObjectTagMask)); | 808 and_(Operand(object), Immediate(~kHeapObjectTagMask)); |
809 #ifdef DEBUG | 809 #ifdef DEBUG |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 // Indicate that code has changed. | 1497 // Indicate that code has changed. |
1498 CPU::FlushICache(address_, size_); | 1498 CPU::FlushICache(address_, size_); |
1499 | 1499 |
1500 // Check that the code was patched as expected. | 1500 // Check that the code was patched as expected. |
1501 ASSERT(masm_.pc_ == address_ + size_); | 1501 ASSERT(masm_.pc_ == address_ + size_); |
1502 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1502 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
1503 } | 1503 } |
1504 | 1504 |
1505 | 1505 |
1506 } } // namespace v8::internal | 1506 } } // namespace v8::internal |
OLD | NEW |