| 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 * kPointerSize)); | 793 add(result, result, Operand(object_size)); |
| 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 * kPointerSize) - | 802 sub(result, result, Operand(object_size - kHeapObjectTag)); |
| 803 kHeapObjectTag)); | |
| 804 } else { | 803 } else { |
| 805 sub(result, result, Operand(object_size * kPointerSize)); | 804 sub(result, result, Operand(object_size)); |
| 806 } | 805 } |
| 807 } | 806 } |
| 808 | 807 |
| 809 | 808 |
| 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 | |
| 868 void MacroAssembler::CompareObjectType(Register function, | 809 void MacroAssembler::CompareObjectType(Register function, |
| 869 Register map, | 810 Register map, |
| 870 Register type_reg, | 811 Register type_reg, |
| 871 InstanceType type) { | 812 InstanceType type) { |
| 872 ldr(map, FieldMemOperand(function, HeapObject::kMapOffset)); | 813 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) { | |
| 880 ldrb(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); | 814 ldrb(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
| 881 cmp(type_reg, Operand(type)); | 815 cmp(type_reg, Operand(type)); |
| 882 } | 816 } |
| 883 | 817 |
| 884 | 818 |
| 885 void MacroAssembler::TryGetFunctionPrototype(Register function, | 819 void MacroAssembler::TryGetFunctionPrototype(Register function, |
| 886 Register result, | 820 Register result, |
| 887 Register scratch, | 821 Register scratch, |
| 888 Label* miss) { | 822 Label* miss) { |
| 889 // Check that the receiver isn't a smi. | 823 // Check that the receiver isn't a smi. |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 mov(r0, Operand(p0)); | 1055 mov(r0, Operand(p0)); |
| 1122 push(r0); | 1056 push(r0); |
| 1123 mov(r0, Operand(Smi::FromInt(p1 - p0))); | 1057 mov(r0, Operand(Smi::FromInt(p1 - p0))); |
| 1124 push(r0); | 1058 push(r0); |
| 1125 CallRuntime(Runtime::kAbort, 2); | 1059 CallRuntime(Runtime::kAbort, 2); |
| 1126 // will not return here | 1060 // will not return here |
| 1127 } | 1061 } |
| 1128 | 1062 |
| 1129 | 1063 |
| 1130 } } // namespace v8::internal | 1064 } } // namespace v8::internal |
| OLD | NEW |