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 // Number of d-regs not known at snapshot time. |
| 646 ASSERT(!Serializer::enabled()); |
645 PushSafepointRegisters(); | 647 PushSafepointRegisters(); |
646 sub(sp, sp, Operand(DwVfpRegister::NumAllocatableRegisters() * | 648 sub(sp, sp, Operand(DwVfpRegister::NumAllocatableRegisters() * |
647 kDoubleSize)); | 649 kDoubleSize)); |
648 for (int i = 0; i < DwVfpRegister::NumAllocatableRegisters(); i++) { | 650 for (int i = 0; i < DwVfpRegister::NumAllocatableRegisters(); i++) { |
649 vstr(DwVfpRegister::FromAllocationIndex(i), sp, i * kDoubleSize); | 651 vstr(DwVfpRegister::FromAllocationIndex(i), sp, i * kDoubleSize); |
650 } | 652 } |
651 } | 653 } |
652 | 654 |
653 | 655 |
654 void MacroAssembler::PopSafepointRegistersAndDoubles() { | 656 void MacroAssembler::PopSafepointRegistersAndDoubles() { |
| 657 // Number of d-regs not known at snapshot time. |
| 658 ASSERT(!Serializer::enabled()); |
655 for (int i = 0; i < DwVfpRegister::NumAllocatableRegisters(); i++) { | 659 for (int i = 0; i < DwVfpRegister::NumAllocatableRegisters(); i++) { |
656 vldr(DwVfpRegister::FromAllocationIndex(i), sp, i * kDoubleSize); | 660 vldr(DwVfpRegister::FromAllocationIndex(i), sp, i * kDoubleSize); |
657 } | 661 } |
658 add(sp, sp, Operand(DwVfpRegister::NumAllocatableRegisters() * | 662 add(sp, sp, Operand(DwVfpRegister::NumAllocatableRegisters() * |
659 kDoubleSize)); | 663 kDoubleSize)); |
660 PopSafepointRegisters(); | 664 PopSafepointRegisters(); |
661 } | 665 } |
662 | 666 |
663 void MacroAssembler::StoreToSafepointRegistersAndDoublesSlot(Register src, | 667 void MacroAssembler::StoreToSafepointRegistersAndDoublesSlot(Register src, |
664 Register dst) { | 668 Register dst) { |
(...skipping 18 matching lines...) Expand all Loading... |
683 return reg_code; | 687 return reg_code; |
684 } | 688 } |
685 | 689 |
686 | 690 |
687 MemOperand MacroAssembler::SafepointRegisterSlot(Register reg) { | 691 MemOperand MacroAssembler::SafepointRegisterSlot(Register reg) { |
688 return MemOperand(sp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); | 692 return MemOperand(sp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); |
689 } | 693 } |
690 | 694 |
691 | 695 |
692 MemOperand MacroAssembler::SafepointRegistersAndDoublesSlot(Register reg) { | 696 MemOperand MacroAssembler::SafepointRegistersAndDoublesSlot(Register reg) { |
| 697 // Number of d-regs not known at snapshot time. |
| 698 ASSERT(!Serializer::enabled()); |
693 // General purpose registers are pushed last on the stack. | 699 // General purpose registers are pushed last on the stack. |
694 int doubles_size = DwVfpRegister::NumAllocatableRegisters() * kDoubleSize; | 700 int doubles_size = DwVfpRegister::NumAllocatableRegisters() * kDoubleSize; |
695 int register_offset = SafepointRegisterStackIndex(reg.code()) * kPointerSize; | 701 int register_offset = SafepointRegisterStackIndex(reg.code()) * kPointerSize; |
696 return MemOperand(sp, doubles_size + register_offset); | 702 return MemOperand(sp, doubles_size + register_offset); |
697 } | 703 } |
698 | 704 |
699 | 705 |
700 void MacroAssembler::Ldrd(Register dst1, Register dst2, | 706 void MacroAssembler::Ldrd(Register dst1, Register dst2, |
701 const MemOperand& src, Condition cond) { | 707 const MemOperand& src, Condition cond) { |
702 ASSERT(src.rm().is(no_reg)); | 708 ASSERT(src.rm().is(no_reg)); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 str(ip, MemOperand(fp, ExitFrameConstants::kCodeOffset)); | 877 str(ip, MemOperand(fp, ExitFrameConstants::kCodeOffset)); |
872 | 878 |
873 // Save the frame pointer and the context in top. | 879 // Save the frame pointer and the context in top. |
874 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); | 880 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); |
875 str(fp, MemOperand(ip)); | 881 str(fp, MemOperand(ip)); |
876 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); | 882 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); |
877 str(cp, MemOperand(ip)); | 883 str(cp, MemOperand(ip)); |
878 | 884 |
879 // Optionally save all double registers. | 885 // Optionally save all double registers. |
880 if (save_doubles) { | 886 if (save_doubles) { |
881 DwVfpRegister first = d0; | 887 // Check CPU flags for number of registers. |
882 DwVfpRegister last = | 888 // 16 regs => Z==1, 32 regs => Z==0. |
883 DwVfpRegister::from_code(DwVfpRegister::kNumRegisters - 1); | 889 mov(ip, Operand(ExternalReference::cpu_features())); |
884 vstm(db_w, sp, first, last); | 890 ldr(ip, MemOperand(ip)); |
| 891 and_(ip, ip, Operand(1u << VFP32DREGS), SetCC); |
| 892 |
| 893 vstm(db_w, sp, d16, d31, ne); |
| 894 sub(sp, sp, Operand(16 * kDoubleSize), LeaveCC, eq); |
| 895 vstm(db_w, sp, d0, d15); |
885 // Note that d0 will be accessible at | 896 // Note that d0 will be accessible at |
886 // fp - 2 * kPointerSize - DwVfpRegister::kNumRegisters * kDoubleSize, | 897 // fp - 2 * kPointerSize - DwVfpRegister::kNumRegisters * kDoubleSize, |
887 // since the sp slot and code slot were pushed after the fp. | 898 // since the sp slot and code slot were pushed after the fp. |
888 } | 899 } |
889 | 900 |
890 // Reserve place for the return address and stack space and align the frame | 901 // Reserve place for the return address and stack space and align the frame |
891 // preparing for calling the runtime function. | 902 // preparing for calling the runtime function. |
892 const int frame_alignment = MacroAssembler::ActivationFrameAlignment(); | 903 const int frame_alignment = MacroAssembler::ActivationFrameAlignment(); |
893 sub(sp, sp, Operand((stack_space + 1) * kPointerSize)); | 904 sub(sp, sp, Operand((stack_space + 1) * kPointerSize)); |
894 if (frame_alignment > 0) { | 905 if (frame_alignment > 0) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 } | 945 } |
935 | 946 |
936 | 947 |
937 void MacroAssembler::LeaveExitFrame(bool save_doubles, | 948 void MacroAssembler::LeaveExitFrame(bool save_doubles, |
938 Register argument_count) { | 949 Register argument_count) { |
939 // Optionally restore all double registers. | 950 // Optionally restore all double registers. |
940 if (save_doubles) { | 951 if (save_doubles) { |
941 // Calculate the stack location of the saved doubles and restore them. | 952 // Calculate the stack location of the saved doubles and restore them. |
942 const int offset = 2 * kPointerSize; | 953 const int offset = 2 * kPointerSize; |
943 sub(r3, fp, Operand(offset + DwVfpRegister::kNumRegisters * kDoubleSize)); | 954 sub(r3, fp, Operand(offset + DwVfpRegister::kNumRegisters * kDoubleSize)); |
944 DwVfpRegister first = d0; | 955 |
945 DwVfpRegister last = | 956 // Check CPU flags for number of registers. |
946 DwVfpRegister::from_code(DwVfpRegister::kNumRegisters - 1); | 957 // 16 regs => Z==1, 32 regs => Z==0. |
947 vldm(ia, r3, first, last); | 958 mov(ip, Operand(ExternalReference::cpu_features())); |
| 959 ldr(ip, MemOperand(ip)); |
| 960 and_(ip, ip, Operand(1u << VFP32DREGS), SetCC); |
| 961 |
| 962 vldm(ia_w, r3, d0, d15); |
| 963 vldm(ia_w, r3, d16, d31, ne); |
| 964 add(r3, r3, Operand(16 * kDoubleSize), LeaveCC, eq); |
948 } | 965 } |
949 | 966 |
950 // Clear top frame. | 967 // Clear top frame. |
951 mov(r3, Operand::Zero()); | 968 mov(r3, Operand::Zero()); |
952 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); | 969 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); |
953 str(r3, MemOperand(ip)); | 970 str(r3, MemOperand(ip)); |
954 | 971 |
955 // Restore current context from top and clear it in debug mode. | 972 // Restore current context from top and clear it in debug mode. |
956 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); | 973 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); |
957 ldr(cp, MemOperand(ip)); | 974 ldr(cp, MemOperand(ip)); |
(...skipping 3003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3961 void CodePatcher::EmitCondition(Condition cond) { | 3978 void CodePatcher::EmitCondition(Condition cond) { |
3962 Instr instr = Assembler::instr_at(masm_.pc_); | 3979 Instr instr = Assembler::instr_at(masm_.pc_); |
3963 instr = (instr & ~kCondMask) | cond; | 3980 instr = (instr & ~kCondMask) | cond; |
3964 masm_.emit(instr); | 3981 masm_.emit(instr); |
3965 } | 3982 } |
3966 | 3983 |
3967 | 3984 |
3968 } } // namespace v8::internal | 3985 } } // namespace v8::internal |
3969 | 3986 |
3970 #endif // V8_TARGET_ARCH_ARM | 3987 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |