| 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 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 ASSERT(!result.is(scratch1)); | 787 ASSERT(!result.is(scratch1)); |
| 788 ASSERT(!scratch1.is(scratch2)); | 788 ASSERT(!scratch1.is(scratch2)); |
| 789 | 789 |
| 790 // Load address of new object into result and allocation top address into | 790 // Load address of new object into result and allocation top address into |
| 791 // scratch1. | 791 // scratch1. |
| 792 ExternalReference new_space_allocation_top = | 792 ExternalReference new_space_allocation_top = |
| 793 ExternalReference::new_space_allocation_top_address(); | 793 ExternalReference::new_space_allocation_top_address(); |
| 794 mov(scratch1, Operand(new_space_allocation_top)); | 794 mov(scratch1, Operand(new_space_allocation_top)); |
| 795 if ((flags & RESULT_CONTAINS_TOP) == 0) { | 795 if ((flags & RESULT_CONTAINS_TOP) == 0) { |
| 796 ldr(result, MemOperand(scratch1)); | 796 ldr(result, MemOperand(scratch1)); |
| 797 } else { | 797 } else if (FLAG_debug_code) { |
| 798 #ifdef DEBUG | |
| 799 // Assert that result actually contains top on entry. scratch2 is used | 798 // Assert that result actually contains top on entry. scratch2 is used |
| 800 // immediately below so this use of scratch2 does not cause difference with | 799 // immediately below so this use of scratch2 does not cause difference with |
| 801 // respect to register content between debug and release mode. | 800 // respect to register content between debug and release mode. |
| 802 ldr(scratch2, MemOperand(scratch1)); | 801 ldr(scratch2, MemOperand(scratch1)); |
| 803 cmp(result, scratch2); | 802 cmp(result, scratch2); |
| 804 Check(eq, "Unexpected allocation top"); | 803 Check(eq, "Unexpected allocation top"); |
| 805 #endif | |
| 806 } | 804 } |
| 807 | 805 |
| 808 // Calculate new top and bail out if new space is exhausted. Use result | 806 // Calculate new top and bail out if new space is exhausted. Use result |
| 809 // to calculate the new top. | 807 // to calculate the new top. |
| 810 ExternalReference new_space_allocation_limit = | 808 ExternalReference new_space_allocation_limit = |
| 811 ExternalReference::new_space_allocation_limit_address(); | 809 ExternalReference::new_space_allocation_limit_address(); |
| 812 mov(scratch2, Operand(new_space_allocation_limit)); | 810 mov(scratch2, Operand(new_space_allocation_limit)); |
| 813 ldr(scratch2, MemOperand(scratch2)); | 811 ldr(scratch2, MemOperand(scratch2)); |
| 814 add(result, result, Operand(object_size * kPointerSize)); | 812 add(result, result, Operand(object_size * kPointerSize)); |
| 815 cmp(result, Operand(scratch2)); | 813 cmp(result, Operand(scratch2)); |
| 816 b(hi, gc_required); | 814 b(hi, gc_required); |
| 817 | 815 |
| 818 // Update allocation top. result temporarily holds the new top, | 816 // Update allocation top. result temporarily holds the new top. |
| 817 if (FLAG_debug_code) { |
| 818 tst(result, Operand(kObjectAlignmentMask)); |
| 819 Check(eq, "Unaligned allocation in new space"); |
| 820 } |
| 819 str(result, MemOperand(scratch1)); | 821 str(result, MemOperand(scratch1)); |
| 820 | 822 |
| 821 // Tag and adjust back to start of new object. | 823 // Tag and adjust back to start of new object. |
| 822 if ((flags & TAG_OBJECT) != 0) { | 824 if ((flags & TAG_OBJECT) != 0) { |
| 823 sub(result, result, Operand((object_size * kPointerSize) - | 825 sub(result, result, Operand((object_size * kPointerSize) - |
| 824 kHeapObjectTag)); | 826 kHeapObjectTag)); |
| 825 } else { | 827 } else { |
| 826 sub(result, result, Operand(object_size * kPointerSize)); | 828 sub(result, result, Operand(object_size * kPointerSize)); |
| 827 } | 829 } |
| 828 } | 830 } |
| 829 | 831 |
| 830 | 832 |
| 831 void MacroAssembler::AllocateInNewSpace(Register object_size, | 833 void MacroAssembler::AllocateInNewSpace(Register object_size, |
| 832 Register result, | 834 Register result, |
| 833 Register scratch1, | 835 Register scratch1, |
| 834 Register scratch2, | 836 Register scratch2, |
| 835 Label* gc_required, | 837 Label* gc_required, |
| 836 AllocationFlags flags) { | 838 AllocationFlags flags) { |
| 837 ASSERT(!result.is(scratch1)); | 839 ASSERT(!result.is(scratch1)); |
| 838 ASSERT(!scratch1.is(scratch2)); | 840 ASSERT(!scratch1.is(scratch2)); |
| 839 | 841 |
| 840 // Load address of new object into result and allocation top address into | 842 // Load address of new object into result and allocation top address into |
| 841 // scratch1. | 843 // scratch1. |
| 842 ExternalReference new_space_allocation_top = | 844 ExternalReference new_space_allocation_top = |
| 843 ExternalReference::new_space_allocation_top_address(); | 845 ExternalReference::new_space_allocation_top_address(); |
| 844 mov(scratch1, Operand(new_space_allocation_top)); | 846 mov(scratch1, Operand(new_space_allocation_top)); |
| 845 if ((flags & RESULT_CONTAINS_TOP) == 0) { | 847 if ((flags & RESULT_CONTAINS_TOP) == 0) { |
| 846 ldr(result, MemOperand(scratch1)); | 848 ldr(result, MemOperand(scratch1)); |
| 847 } else { | 849 } else if (FLAG_debug_code) { |
| 848 #ifdef DEBUG | |
| 849 // Assert that result actually contains top on entry. scratch2 is used | 850 // Assert that result actually contains top on entry. scratch2 is used |
| 850 // immediately below so this use of scratch2 does not cause difference with | 851 // immediately below so this use of scratch2 does not cause difference with |
| 851 // respect to register content between debug and release mode. | 852 // respect to register content between debug and release mode. |
| 852 ldr(scratch2, MemOperand(scratch1)); | 853 ldr(scratch2, MemOperand(scratch1)); |
| 853 cmp(result, scratch2); | 854 cmp(result, scratch2); |
| 854 Check(eq, "Unexpected allocation top"); | 855 Check(eq, "Unexpected allocation top"); |
| 855 #endif | |
| 856 } | 856 } |
| 857 | 857 |
| 858 // Calculate new top and bail out if new space is exhausted. Use result | 858 // Calculate new top and bail out if new space is exhausted. Use result |
| 859 // to calculate the new top. Object size is in words so a shift is required to | 859 // to calculate the new top. Object size is in words so a shift is required to |
| 860 // get the number of bytes | 860 // get the number of bytes |
| 861 ExternalReference new_space_allocation_limit = | 861 ExternalReference new_space_allocation_limit = |
| 862 ExternalReference::new_space_allocation_limit_address(); | 862 ExternalReference::new_space_allocation_limit_address(); |
| 863 mov(scratch2, Operand(new_space_allocation_limit)); | 863 mov(scratch2, Operand(new_space_allocation_limit)); |
| 864 ldr(scratch2, MemOperand(scratch2)); | 864 ldr(scratch2, MemOperand(scratch2)); |
| 865 add(result, result, Operand(object_size, LSL, kPointerSizeLog2)); | 865 add(result, result, Operand(object_size, LSL, kPointerSizeLog2)); |
| 866 cmp(result, Operand(scratch2)); | 866 cmp(result, Operand(scratch2)); |
| 867 b(hi, gc_required); | 867 b(hi, gc_required); |
| 868 | 868 |
| 869 // Update allocation top. result temporarily holds the new top, | 869 // Update allocation top. result temporarily holds the new top. |
| 870 if (FLAG_debug_code) { |
| 871 tst(result, Operand(kObjectAlignmentMask)); |
| 872 Check(eq, "Unaligned allocation in new space"); |
| 873 } |
| 870 str(result, MemOperand(scratch1)); | 874 str(result, MemOperand(scratch1)); |
| 871 | 875 |
| 872 // Adjust back to start of new object. | 876 // Adjust back to start of new object. |
| 873 sub(result, result, Operand(object_size, LSL, kPointerSizeLog2)); | 877 sub(result, result, Operand(object_size, LSL, kPointerSizeLog2)); |
| 874 | 878 |
| 875 // Tag object if requested. | 879 // Tag object if requested. |
| 876 if ((flags & TAG_OBJECT) != 0) { | 880 if ((flags & TAG_OBJECT) != 0) { |
| 877 add(result, result, Operand(kHeapObjectTag)); | 881 add(result, result, Operand(kHeapObjectTag)); |
| 878 } | 882 } |
| 879 } | 883 } |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 // from the real pointer as a smi. | 1159 // from the real pointer as a smi. |
| 1156 intptr_t p1 = reinterpret_cast<intptr_t>(msg); | 1160 intptr_t p1 = reinterpret_cast<intptr_t>(msg); |
| 1157 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag; | 1161 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag; |
| 1158 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi()); | 1162 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi()); |
| 1159 #ifdef DEBUG | 1163 #ifdef DEBUG |
| 1160 if (msg != NULL) { | 1164 if (msg != NULL) { |
| 1161 RecordComment("Abort message: "); | 1165 RecordComment("Abort message: "); |
| 1162 RecordComment(msg); | 1166 RecordComment(msg); |
| 1163 } | 1167 } |
| 1164 #endif | 1168 #endif |
| 1169 // Disable stub call restrictions to always allow calls to abort. |
| 1170 set_allow_stub_calls(true); |
| 1171 |
| 1165 mov(r0, Operand(p0)); | 1172 mov(r0, Operand(p0)); |
| 1166 push(r0); | 1173 push(r0); |
| 1167 mov(r0, Operand(Smi::FromInt(p1 - p0))); | 1174 mov(r0, Operand(Smi::FromInt(p1 - p0))); |
| 1168 push(r0); | 1175 push(r0); |
| 1169 CallRuntime(Runtime::kAbort, 2); | 1176 CallRuntime(Runtime::kAbort, 2); |
| 1170 // will not return here | 1177 // will not return here |
| 1171 } | 1178 } |
| 1172 | 1179 |
| 1173 | 1180 |
| 1174 void MacroAssembler::LoadContext(Register dst, int context_chain_length) { | 1181 void MacroAssembler::LoadContext(Register dst, int context_chain_length) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1219 } | 1226 } |
| 1220 | 1227 |
| 1221 | 1228 |
| 1222 void CodePatcher::Emit(Address addr) { | 1229 void CodePatcher::Emit(Address addr) { |
| 1223 masm()->emit(reinterpret_cast<Instr>(addr)); | 1230 masm()->emit(reinterpret_cast<Instr>(addr)); |
| 1224 } | 1231 } |
| 1225 #endif // ENABLE_DEBUGGER_SUPPORT | 1232 #endif // ENABLE_DEBUGGER_SUPPORT |
| 1226 | 1233 |
| 1227 | 1234 |
| 1228 } } // namespace v8::internal | 1235 } } // namespace v8::internal |
| OLD | NEW |