| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 | 635 |
| 636 | 636 |
| 637 void MacroAssembler::PopSafepointRegisters() { | 637 void MacroAssembler::PopSafepointRegisters() { |
| 638 const int num_unsaved = kNumSafepointRegisters - kNumSafepointSavedRegisters; | 638 const int num_unsaved = kNumSafepointRegisters - kNumSafepointSavedRegisters; |
| 639 ldm(ia_w, sp, kSafepointSavedRegisters); | 639 ldm(ia_w, sp, kSafepointSavedRegisters); |
| 640 add(sp, sp, Operand(num_unsaved * kPointerSize)); | 640 add(sp, sp, Operand(num_unsaved * kPointerSize)); |
| 641 } | 641 } |
| 642 | 642 |
| 643 | 643 |
| 644 void MacroAssembler::PushSafepointRegistersAndDoubles() { | 644 void MacroAssembler::PushSafepointRegistersAndDoubles() { |
| 645 ASSERT(!Serializer::enabled()); // Nbr of d-regs not known at snapshot time. |
| 645 PushSafepointRegisters(); | 646 PushSafepointRegisters(); |
| 646 sub(sp, sp, Operand(DwVfpRegister::kNumAllocatableRegisters * | 647 sub(sp, sp, Operand(DwVfpRegister::NumAllocatableRegisters() * |
| 647 kDoubleSize)); | 648 kDoubleSize)); |
| 648 for (int i = 0; i < DwVfpRegister::kNumAllocatableRegisters; i++) { | 649 for (int i = 0; i < DwVfpRegister::NumAllocatableRegisters(); i++) { |
| 649 vstr(DwVfpRegister::FromAllocationIndex(i), sp, i * kDoubleSize); | 650 vstr(DwVfpRegister::FromAllocationIndex(i), sp, i * kDoubleSize); |
| 650 } | 651 } |
| 651 } | 652 } |
| 652 | 653 |
| 653 | 654 |
| 654 void MacroAssembler::PopSafepointRegistersAndDoubles() { | 655 void MacroAssembler::PopSafepointRegistersAndDoubles() { |
| 655 for (int i = 0; i < DwVfpRegister::kNumAllocatableRegisters; i++) { | 656 ASSERT(!Serializer::enabled()); // Nbr of d-regs not known at snapshot time. |
| 657 for (int i = 0; i < DwVfpRegister::NumAllocatableRegisters(); i++) { |
| 656 vldr(DwVfpRegister::FromAllocationIndex(i), sp, i * kDoubleSize); | 658 vldr(DwVfpRegister::FromAllocationIndex(i), sp, i * kDoubleSize); |
| 657 } | 659 } |
| 658 add(sp, sp, Operand(DwVfpRegister::kNumAllocatableRegisters * | 660 add(sp, sp, Operand(DwVfpRegister::NumAllocatableRegisters() * |
| 659 kDoubleSize)); | 661 kDoubleSize)); |
| 660 PopSafepointRegisters(); | 662 PopSafepointRegisters(); |
| 661 } | 663 } |
| 662 | 664 |
| 663 void MacroAssembler::StoreToSafepointRegistersAndDoublesSlot(Register src, | 665 void MacroAssembler::StoreToSafepointRegistersAndDoublesSlot(Register src, |
| 664 Register dst) { | 666 Register dst) { |
| 665 str(src, SafepointRegistersAndDoublesSlot(dst)); | 667 str(src, SafepointRegistersAndDoublesSlot(dst)); |
| 666 } | 668 } |
| 667 | 669 |
| 668 | 670 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 683 return reg_code; | 685 return reg_code; |
| 684 } | 686 } |
| 685 | 687 |
| 686 | 688 |
| 687 MemOperand MacroAssembler::SafepointRegisterSlot(Register reg) { | 689 MemOperand MacroAssembler::SafepointRegisterSlot(Register reg) { |
| 688 return MemOperand(sp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); | 690 return MemOperand(sp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); |
| 689 } | 691 } |
| 690 | 692 |
| 691 | 693 |
| 692 MemOperand MacroAssembler::SafepointRegistersAndDoublesSlot(Register reg) { | 694 MemOperand MacroAssembler::SafepointRegistersAndDoublesSlot(Register reg) { |
| 695 ASSERT(!Serializer::enabled()); // Nbr of d-regs not known at snapshot time. |
| 693 // General purpose registers are pushed last on the stack. | 696 // General purpose registers are pushed last on the stack. |
| 694 int doubles_size = DwVfpRegister::kNumAllocatableRegisters * kDoubleSize; | 697 int doubles_size = DwVfpRegister::NumAllocatableRegisters() * kDoubleSize; |
| 695 int register_offset = SafepointRegisterStackIndex(reg.code()) * kPointerSize; | 698 int register_offset = SafepointRegisterStackIndex(reg.code()) * kPointerSize; |
| 696 return MemOperand(sp, doubles_size + register_offset); | 699 return MemOperand(sp, doubles_size + register_offset); |
| 697 } | 700 } |
| 698 | 701 |
| 699 | 702 |
| 700 void MacroAssembler::Ldrd(Register dst1, Register dst2, | 703 void MacroAssembler::Ldrd(Register dst1, Register dst2, |
| 701 const MemOperand& src, Condition cond) { | 704 const MemOperand& src, Condition cond) { |
| 702 ASSERT(src.rm().is(no_reg)); | 705 ASSERT(src.rm().is(no_reg)); |
| 703 ASSERT(!dst1.is(lr)); // r14. | 706 ASSERT(!dst1.is(lr)); // r14. |
| 704 ASSERT_EQ(0, dst1.code() % 2); | 707 ASSERT_EQ(0, dst1.code() % 2); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 if (value.bits == zero.bits) { | 827 if (value.bits == zero.bits) { |
| 825 vmov(dst, kDoubleRegZero, cond); | 828 vmov(dst, kDoubleRegZero, cond); |
| 826 } else if (value.bits == minus_zero.bits) { | 829 } else if (value.bits == minus_zero.bits) { |
| 827 vneg(dst, kDoubleRegZero, cond); | 830 vneg(dst, kDoubleRegZero, cond); |
| 828 } else { | 831 } else { |
| 829 vmov(dst, imm, scratch, cond); | 832 vmov(dst, imm, scratch, cond); |
| 830 } | 833 } |
| 831 } | 834 } |
| 832 | 835 |
| 833 | 836 |
| 837 void MacroAssembler::Vpop(Register base, |
| 838 const DwVfpRegister first, |
| 839 const DwVfpRegister last, |
| 840 Condition cond) { |
| 841 ASSERT(CpuFeatures::IsEnabled(VFP2)); |
| 842 ASSERT_LE(first.code(), last.code()); |
| 843 |
| 844 const int first_code = first.code(); |
| 845 const int last_code = last.code(); |
| 846 const int count = last_code - first_code + 1; |
| 847 |
| 848 if (count <= 16) { |
| 849 vldm(ia_w, base, first, last, cond); |
| 850 } else { |
| 851 // Since we are increasing the address, load the first registers first. |
| 852 ASSERT(first_code < 16 && last_code >= 16); |
| 853 vldm(ia_w, base, first, d15, cond); |
| 854 vldm(ia_w, base, d16, last, cond); |
| 855 } |
| 856 } |
| 857 |
| 858 |
| 859 void MacroAssembler::Vpush(Register base, |
| 860 const DwVfpRegister first, |
| 861 const DwVfpRegister last, |
| 862 Condition cond) { |
| 863 ASSERT(CpuFeatures::IsEnabled(VFP2)); |
| 864 ASSERT_LE(first.code(), last.code()); |
| 865 |
| 866 const int first_code = first.code(); |
| 867 const int last_code = last.code(); |
| 868 const int count = last_code - first_code + 1; |
| 869 |
| 870 if (count <= 16) { |
| 871 vstm(db_w, base, first, last, cond); |
| 872 } else { |
| 873 // Since we are decreasing the address, write the last registers first. |
| 874 ASSERT(first_code < 16 && last_code >= 16); |
| 875 vstm(db_w, base, d16, last, cond); |
| 876 vstm(db_w, base, first, d15, cond); |
| 877 } |
| 878 } |
| 879 |
| 880 |
| 834 void MacroAssembler::EnterFrame(StackFrame::Type type) { | 881 void MacroAssembler::EnterFrame(StackFrame::Type type) { |
| 835 // r0-r3: preserved | 882 // r0-r3: preserved |
| 836 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); | 883 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); |
| 837 mov(ip, Operand(Smi::FromInt(type))); | 884 mov(ip, Operand(Smi::FromInt(type))); |
| 838 push(ip); | 885 push(ip); |
| 839 mov(ip, Operand(CodeObject())); | 886 mov(ip, Operand(CodeObject())); |
| 840 push(ip); | 887 push(ip); |
| 841 add(fp, sp, Operand(3 * kPointerSize)); // Adjust FP to point to saved FP. | 888 add(fp, sp, Operand(3 * kPointerSize)); // Adjust FP to point to saved FP. |
| 842 } | 889 } |
| 843 | 890 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 871 str(ip, MemOperand(fp, ExitFrameConstants::kCodeOffset)); | 918 str(ip, MemOperand(fp, ExitFrameConstants::kCodeOffset)); |
| 872 | 919 |
| 873 // Save the frame pointer and the context in top. | 920 // Save the frame pointer and the context in top. |
| 874 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); | 921 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); |
| 875 str(fp, MemOperand(ip)); | 922 str(fp, MemOperand(ip)); |
| 876 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); | 923 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); |
| 877 str(cp, MemOperand(ip)); | 924 str(cp, MemOperand(ip)); |
| 878 | 925 |
| 879 // Optionally save all double registers. | 926 // Optionally save all double registers. |
| 880 if (save_doubles) { | 927 if (save_doubles) { |
| 928 // Nbr of d-regs not known at snapshot time. |
| 929 ASSERT(!Serializer::enabled()); |
| 881 DwVfpRegister first = d0; | 930 DwVfpRegister first = d0; |
| 882 DwVfpRegister last = | 931 DwVfpRegister last = |
| 883 DwVfpRegister::from_code(DwVfpRegister::kNumRegisters - 1); | 932 DwVfpRegister::from_code(DwVfpRegister::NumAvailableRegisters() - 1); |
| 884 vstm(db_w, sp, first, last); | 933 Vpush(sp, first, last); |
| 885 // Note that d0 will be accessible at | 934 // Note that d0 will be accessible at |
| 886 // fp - 2 * kPointerSize - DwVfpRegister::kNumRegisters * kDoubleSize, | 935 // fp - 2 * kPointerSize - |
| 936 // DwVfpRegister::NumAvailableRegisters() * kDoubleSize, |
| 887 // since the sp slot and code slot were pushed after the fp. | 937 // since the sp slot and code slot were pushed after the fp. |
| 888 } | 938 } |
| 889 | 939 |
| 890 // Reserve place for the return address and stack space and align the frame | 940 // Reserve place for the return address and stack space and align the frame |
| 891 // preparing for calling the runtime function. | 941 // preparing for calling the runtime function. |
| 892 const int frame_alignment = MacroAssembler::ActivationFrameAlignment(); | 942 const int frame_alignment = MacroAssembler::ActivationFrameAlignment(); |
| 893 sub(sp, sp, Operand((stack_space + 1) * kPointerSize)); | 943 sub(sp, sp, Operand((stack_space + 1) * kPointerSize)); |
| 894 if (frame_alignment > 0) { | 944 if (frame_alignment > 0) { |
| 895 ASSERT(IsPowerOf2(frame_alignment)); | 945 ASSERT(IsPowerOf2(frame_alignment)); |
| 896 and_(sp, sp, Operand(-frame_alignment)); | 946 and_(sp, sp, Operand(-frame_alignment)); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 // flag. | 981 // flag. |
| 932 return FLAG_sim_stack_alignment; | 982 return FLAG_sim_stack_alignment; |
| 933 #endif // defined(V8_HOST_ARCH_ARM) | 983 #endif // defined(V8_HOST_ARCH_ARM) |
| 934 } | 984 } |
| 935 | 985 |
| 936 | 986 |
| 937 void MacroAssembler::LeaveExitFrame(bool save_doubles, | 987 void MacroAssembler::LeaveExitFrame(bool save_doubles, |
| 938 Register argument_count) { | 988 Register argument_count) { |
| 939 // Optionally restore all double registers. | 989 // Optionally restore all double registers. |
| 940 if (save_doubles) { | 990 if (save_doubles) { |
| 991 // Nbr of d-regs not known at snapshot time. |
| 992 ASSERT(!Serializer::enabled()); |
| 941 // Calculate the stack location of the saved doubles and restore them. | 993 // Calculate the stack location of the saved doubles and restore them. |
| 942 const int offset = 2 * kPointerSize; | 994 const int offset = 2 * kPointerSize; |
| 943 sub(r3, fp, Operand(offset + DwVfpRegister::kNumRegisters * kDoubleSize)); | 995 sub(r3, fp, Operand(offset + DwVfpRegister::NumAvailableRegisters() * |
| 996 kDoubleSize)); |
| 944 DwVfpRegister first = d0; | 997 DwVfpRegister first = d0; |
| 945 DwVfpRegister last = | 998 DwVfpRegister last = |
| 946 DwVfpRegister::from_code(DwVfpRegister::kNumRegisters - 1); | 999 DwVfpRegister::from_code(DwVfpRegister::NumAvailableRegisters() - 1); |
| 947 vldm(ia, r3, first, last); | 1000 Vpop(r3, first, last); |
| 948 } | 1001 } |
| 949 | 1002 |
| 950 // Clear top frame. | 1003 // Clear top frame. |
| 951 mov(r3, Operand(0, RelocInfo::NONE)); | 1004 mov(r3, Operand(0, RelocInfo::NONE)); |
| 952 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); | 1005 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); |
| 953 str(r3, MemOperand(ip)); | 1006 str(r3, MemOperand(ip)); |
| 954 | 1007 |
| 955 // Restore current context from top and clear it in debug mode. | 1008 // Restore current context from top and clear it in debug mode. |
| 956 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); | 1009 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); |
| 957 ldr(cp, MemOperand(ip)); | 1010 ldr(cp, MemOperand(ip)); |
| (...skipping 2955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3913 void CodePatcher::EmitCondition(Condition cond) { | 3966 void CodePatcher::EmitCondition(Condition cond) { |
| 3914 Instr instr = Assembler::instr_at(masm_.pc_); | 3967 Instr instr = Assembler::instr_at(masm_.pc_); |
| 3915 instr = (instr & ~kCondMask) | cond; | 3968 instr = (instr & ~kCondMask) | cond; |
| 3916 masm_.emit(instr); | 3969 masm_.emit(instr); |
| 3917 } | 3970 } |
| 3918 | 3971 |
| 3919 | 3972 |
| 3920 } } // namespace v8::internal | 3973 } } // namespace v8::internal |
| 3921 | 3974 |
| 3922 #endif // V8_TARGET_ARCH_ARM | 3975 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |