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 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 ExternalReference::new_space_allocation_top_address(); | 783 ExternalReference::new_space_allocation_top_address(); |
784 mov(scratch1, Operand(new_space_allocation_top)); | 784 mov(scratch1, Operand(new_space_allocation_top)); |
785 ldr(result, MemOperand(scratch1)); | 785 ldr(result, MemOperand(scratch1)); |
786 | 786 |
787 // Calculate new top and bail out if new space is exhausted. Use result | 787 // Calculate new top and bail out if new space is exhausted. Use result |
788 // to calculate the new top. | 788 // to calculate the new top. |
789 ExternalReference new_space_allocation_limit = | 789 ExternalReference new_space_allocation_limit = |
790 ExternalReference::new_space_allocation_limit_address(); | 790 ExternalReference::new_space_allocation_limit_address(); |
791 mov(scratch2, Operand(new_space_allocation_limit)); | 791 mov(scratch2, Operand(new_space_allocation_limit)); |
792 ldr(scratch2, MemOperand(scratch2)); | 792 ldr(scratch2, MemOperand(scratch2)); |
793 add(result, result, Operand(object_size)); | 793 add(result, result, Operand(object_size * kPointerSize)); |
794 cmp(result, Operand(scratch2)); | 794 cmp(result, Operand(scratch2)); |
795 b(hi, gc_required); | 795 b(hi, gc_required); |
796 | 796 |
797 // Update allocation top. result temporarily holds the new top, | 797 // Update allocation top. result temporarily holds the new top, |
798 str(result, MemOperand(scratch1)); | 798 str(result, MemOperand(scratch1)); |
799 | 799 |
800 // Tag and adjust back to start of new object. | 800 // Tag and adjust back to start of new object. |
801 if (tag_allocated_object) { | 801 if (tag_allocated_object) { |
802 sub(result, result, Operand(object_size - kHeapObjectTag)); | 802 sub(result, result, Operand((object_size * kPointerSize) - |
| 803 kHeapObjectTag)); |
803 } else { | 804 } else { |
804 sub(result, result, Operand(object_size)); | 805 sub(result, result, Operand(object_size * kPointerSize)); |
805 } | 806 } |
806 } | 807 } |
807 | 808 |
808 | 809 |
| 810 void MacroAssembler::AllocateObjectInNewSpace(Register object_size, |
| 811 Register result, |
| 812 Register scratch1, |
| 813 Register scratch2, |
| 814 Label* gc_required, |
| 815 bool tag_allocated_object) { |
| 816 ASSERT(!result.is(scratch1)); |
| 817 ASSERT(!scratch1.is(scratch2)); |
| 818 |
| 819 // Load address of new object into result and allocation top address into |
| 820 // scratch1. |
| 821 ExternalReference new_space_allocation_top = |
| 822 ExternalReference::new_space_allocation_top_address(); |
| 823 mov(scratch1, Operand(new_space_allocation_top)); |
| 824 ldr(result, MemOperand(scratch1)); |
| 825 |
| 826 // Calculate new top and bail out if new space is exhausted. Use result |
| 827 // to calculate the new top. Object size is in words so a shift is required to |
| 828 // get the number of bytes |
| 829 ExternalReference new_space_allocation_limit = |
| 830 ExternalReference::new_space_allocation_limit_address(); |
| 831 mov(scratch2, Operand(new_space_allocation_limit)); |
| 832 ldr(scratch2, MemOperand(scratch2)); |
| 833 add(result, result, Operand(object_size, LSL, kPointerSizeLog2)); |
| 834 |
| 835 cmp(result, Operand(scratch2)); |
| 836 b(hi, gc_required); |
| 837 |
| 838 // Update allocation top. result temporarily holds the new top, |
| 839 str(result, MemOperand(scratch1)); |
| 840 |
| 841 // Tag and adjust back to start of new object. |
| 842 if (tag_allocated_object) { |
| 843 sub(result, result, Operand(object_size, LSL, kPointerSizeLog2)); |
| 844 add(result, result, Operand(kHeapObjectTag)); |
| 845 } else { |
| 846 sub(result, result, Operand(object_size, LSL, kPointerSizeLog2)); |
| 847 } |
| 848 } |
| 849 |
| 850 |
| 851 void MacroAssembler::UndoAllocationInNewSpace(Register object, |
| 852 Register scratch) { |
| 853 ExternalReference new_space_allocation_top = |
| 854 ExternalReference::new_space_allocation_top_address(); |
| 855 |
| 856 // Make sure the object has no tag before resetting top. |
| 857 and_(object, object, Operand(~kHeapObjectTagMask)); |
| 858 #ifdef DEBUG |
| 859 mov(scratch, Operand(new_space_allocation_top)); |
| 860 ldr(scratch, MemOperand(scratch)); |
| 861 cmp(object, scratch); |
| 862 Check(lt, "Undo allocation of non allocated memory"); |
| 863 #endif |
| 864 str(object, MemOperand(scratch)); |
| 865 } |
| 866 |
| 867 |
809 void MacroAssembler::CompareObjectType(Register function, | 868 void MacroAssembler::CompareObjectType(Register function, |
810 Register map, | 869 Register map, |
811 Register type_reg, | 870 Register type_reg, |
812 InstanceType type) { | 871 InstanceType type) { |
813 ldr(map, FieldMemOperand(function, HeapObject::kMapOffset)); | 872 ldr(map, FieldMemOperand(function, HeapObject::kMapOffset)); |
| 873 CompareInstanceType(map, type_reg, type); |
| 874 } |
| 875 |
| 876 |
| 877 void MacroAssembler::CompareInstanceType(Register map, |
| 878 Register type_reg, |
| 879 InstanceType type) { |
814 ldrb(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); | 880 ldrb(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
815 cmp(type_reg, Operand(type)); | 881 cmp(type_reg, Operand(type)); |
816 } | 882 } |
817 | 883 |
818 | 884 |
819 void MacroAssembler::TryGetFunctionPrototype(Register function, | 885 void MacroAssembler::TryGetFunctionPrototype(Register function, |
820 Register result, | 886 Register result, |
821 Register scratch, | 887 Register scratch, |
822 Label* miss) { | 888 Label* miss) { |
823 // Check that the receiver isn't a smi. | 889 // Check that the receiver isn't a smi. |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 mov(r0, Operand(p0)); | 1121 mov(r0, Operand(p0)); |
1056 push(r0); | 1122 push(r0); |
1057 mov(r0, Operand(Smi::FromInt(p1 - p0))); | 1123 mov(r0, Operand(Smi::FromInt(p1 - p0))); |
1058 push(r0); | 1124 push(r0); |
1059 CallRuntime(Runtime::kAbort, 2); | 1125 CallRuntime(Runtime::kAbort, 2); |
1060 // will not return here | 1126 // will not return here |
1061 } | 1127 } |
1062 | 1128 |
1063 | 1129 |
1064 } } // namespace v8::internal | 1130 } } // namespace v8::internal |
OLD | NEW |