Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 11428137: ARM: Make use of d16-d31 when available. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: The tests does not use fp Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 PushSafepointRegisters(); 645 PushSafepointRegisters();
646 sub(sp, sp, Operand(DwVfpRegister::kNumAllocatableRegisters * 646 sub(sp, sp, Operand(DwVfpRegister::NumAllocatableRegisters() *
647 kDoubleSize)); 647 kDoubleSize));
648 for (int i = 0; i < DwVfpRegister::kNumAllocatableRegisters; i++) { 648 for (int i = 0; i < DwVfpRegister::NumAllocatableRegisters(); i++) {
649 vstr(DwVfpRegister::FromAllocationIndex(i), sp, i * kDoubleSize); 649 vstr(DwVfpRegister::FromAllocationIndex(i), sp, i * kDoubleSize);
650 } 650 }
651 } 651 }
652 652
653 653
654 void MacroAssembler::PopSafepointRegistersAndDoubles() { 654 void MacroAssembler::PopSafepointRegistersAndDoubles() {
655 for (int i = 0; i < DwVfpRegister::kNumAllocatableRegisters; i++) { 655 for (int i = 0; i < DwVfpRegister::NumAllocatableRegisters(); i++) {
656 vldr(DwVfpRegister::FromAllocationIndex(i), sp, i * kDoubleSize); 656 vldr(DwVfpRegister::FromAllocationIndex(i), sp, i * kDoubleSize);
657 } 657 }
658 add(sp, sp, Operand(DwVfpRegister::kNumAllocatableRegisters * 658 add(sp, sp, Operand(DwVfpRegister::NumAllocatableRegisters() *
659 kDoubleSize)); 659 kDoubleSize));
660 PopSafepointRegisters(); 660 PopSafepointRegisters();
661 } 661 }
662 662
663 void MacroAssembler::StoreToSafepointRegistersAndDoublesSlot(Register src, 663 void MacroAssembler::StoreToSafepointRegistersAndDoublesSlot(Register src,
664 Register dst) { 664 Register dst) {
665 str(src, SafepointRegistersAndDoublesSlot(dst)); 665 str(src, SafepointRegistersAndDoublesSlot(dst));
666 } 666 }
667 667
668 668
(...skipping 15 matching lines...) Expand all
684 } 684 }
685 685
686 686
687 MemOperand MacroAssembler::SafepointRegisterSlot(Register reg) { 687 MemOperand MacroAssembler::SafepointRegisterSlot(Register reg) {
688 return MemOperand(sp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); 688 return MemOperand(sp, SafepointRegisterStackIndex(reg.code()) * kPointerSize);
689 } 689 }
690 690
691 691
692 MemOperand MacroAssembler::SafepointRegistersAndDoublesSlot(Register reg) { 692 MemOperand MacroAssembler::SafepointRegistersAndDoublesSlot(Register reg) {
693 // General purpose registers are pushed last on the stack. 693 // General purpose registers are pushed last on the stack.
694 int doubles_size = DwVfpRegister::kNumAllocatableRegisters * kDoubleSize; 694 int doubles_size = DwVfpRegister::NumAllocatableRegisters() * kDoubleSize;
695 int register_offset = SafepointRegisterStackIndex(reg.code()) * kPointerSize; 695 int register_offset = SafepointRegisterStackIndex(reg.code()) * kPointerSize;
696 return MemOperand(sp, doubles_size + register_offset); 696 return MemOperand(sp, doubles_size + register_offset);
697 } 697 }
698 698
699 699
700 void MacroAssembler::Ldrd(Register dst1, Register dst2, 700 void MacroAssembler::Ldrd(Register dst1, Register dst2,
701 const MemOperand& src, Condition cond) { 701 const MemOperand& src, Condition cond) {
702 ASSERT(src.rm().is(no_reg)); 702 ASSERT(src.rm().is(no_reg));
703 ASSERT(!dst1.is(lr)); // r14. 703 ASSERT(!dst1.is(lr)); // r14.
704 ASSERT_EQ(0, dst1.code() % 2); 704 ASSERT_EQ(0, dst1.code() % 2);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 void MacroAssembler::Vmov(const DwVfpRegister dst, 815 void MacroAssembler::Vmov(const DwVfpRegister dst,
816 const double imm, 816 const double imm,
817 const Register scratch, 817 const Register scratch,
818 const Condition cond) { 818 const Condition cond) {
819 ASSERT(CpuFeatures::IsEnabled(VFP2)); 819 ASSERT(CpuFeatures::IsEnabled(VFP2));
820 static const DoubleRepresentation minus_zero(-0.0); 820 static const DoubleRepresentation minus_zero(-0.0);
821 static const DoubleRepresentation zero(0.0); 821 static const DoubleRepresentation zero(0.0);
822 DoubleRepresentation value(imm); 822 DoubleRepresentation value(imm);
823 // Handle special values first. 823 // Handle special values first.
824 if (value.bits == zero.bits) { 824 if (value.bits == zero.bits) {
825 vmov(dst, kDoubleRegZero, cond); 825 vmov(dst, DwVfpRegister::ZeroReg(), cond);
826 } else if (value.bits == minus_zero.bits) { 826 } else if (value.bits == minus_zero.bits) {
827 vneg(dst, kDoubleRegZero, cond); 827 vneg(dst, DwVfpRegister::ZeroReg(), cond);
828 } else { 828 } else {
829 vmov(dst, imm, scratch, cond); 829 vmov(dst, imm, scratch, cond);
830 } 830 }
831 } 831 }
832 832
833 833
834 void MacroAssembler::Vldm(BlockAddrMode am,
Rodolph Perfetta 2012/12/12 14:29:15 Do you intend to support all addressing modes for
hans 2012/12/12 17:58:47 Yes, that sounds like a good idea. Done.
835 Register base,
836 const DwVfpRegister first,
837 const DwVfpRegister last,
838 Condition cond) {
839 ASSERT(CpuFeatures::IsEnabled(VFP2));
840 ASSERT_LE(first.code(), last.code());
841 ASSERT(am == ia_w);
842
843 const int first_code = first.code();
Rodolph Perfetta 2012/12/12 14:29:15 const should start with a k
hans 2012/12/12 17:58:47 I think that's for compile-time constants only.
844 const int last_code = last.code();
845 const int count = last_code - first_code + 1;
846
847 if (count <= 16) {
848 vldm(am, base, first, last, cond);
849 } else {
850 // Since we are increasing the address, load the first registers first.
851 ASSERT(first_code < 16 && last_code >= 16);
852 vldm(am, base, first, d15, cond);
853 vldm(am, base, d16, last, cond);
854 }
855 }
856
857
858 void MacroAssembler::Vstm(BlockAddrMode am,
859 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 ASSERT(am == db_w);
866
867 const int first_code = first.code();
Rodolph Perfetta 2012/12/12 14:29:15 const should start with a k.
hans 2012/12/12 17:58:47 Ditto.
868 const int last_code = last.code();
869 const int count = last_code - first_code + 1;
870
871 if (count <= 16) {
872 vstm(am, base, first, last, cond);
873 } else {
874 // Since we are decreasing the address, write the last registers first.
875 ASSERT(first_code < 16 && last_code >= 16);
876 vstm(am, base, d16, last, cond);
877 vstm(am, base, first, d15, cond);
878 }
879 }
880
881
834 void MacroAssembler::EnterFrame(StackFrame::Type type) { 882 void MacroAssembler::EnterFrame(StackFrame::Type type) {
835 // r0-r3: preserved 883 // r0-r3: preserved
836 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); 884 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit());
837 mov(ip, Operand(Smi::FromInt(type))); 885 mov(ip, Operand(Smi::FromInt(type)));
838 push(ip); 886 push(ip);
839 mov(ip, Operand(CodeObject())); 887 mov(ip, Operand(CodeObject()));
840 push(ip); 888 push(ip);
841 add(fp, sp, Operand(3 * kPointerSize)); // Adjust FP to point to saved FP. 889 add(fp, sp, Operand(3 * kPointerSize)); // Adjust FP to point to saved FP.
842 } 890 }
843 891
(...skipping 29 matching lines...) Expand all
873 // Save the frame pointer and the context in top. 921 // Save the frame pointer and the context in top.
874 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); 922 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate())));
875 str(fp, MemOperand(ip)); 923 str(fp, MemOperand(ip));
876 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); 924 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate())));
877 str(cp, MemOperand(ip)); 925 str(cp, MemOperand(ip));
878 926
879 // Optionally save all double registers. 927 // Optionally save all double registers.
880 if (save_doubles) { 928 if (save_doubles) {
881 DwVfpRegister first = d0; 929 DwVfpRegister first = d0;
882 DwVfpRegister last = 930 DwVfpRegister last =
883 DwVfpRegister::from_code(DwVfpRegister::kNumRegisters - 1); 931 DwVfpRegister::from_code(DwVfpRegister::NumAvailableRegisters() - 1);
884 vstm(db_w, sp, first, last); 932 Vstm(db_w, sp, first, last);
885 // Note that d0 will be accessible at 933 // Note that d0 will be accessible at
886 // fp - 2 * kPointerSize - DwVfpRegister::kNumRegisters * kDoubleSize, 934 // fp - 2 * kPointerSize -
935 // DwVfpRegister::NumAvailableRegisters() * kDoubleSize,
887 // since the sp slot and code slot were pushed after the fp. 936 // since the sp slot and code slot were pushed after the fp.
888 } 937 }
889 938
890 // Reserve place for the return address and stack space and align the frame 939 // Reserve place for the return address and stack space and align the frame
891 // preparing for calling the runtime function. 940 // preparing for calling the runtime function.
892 const int frame_alignment = MacroAssembler::ActivationFrameAlignment(); 941 const int frame_alignment = MacroAssembler::ActivationFrameAlignment();
893 sub(sp, sp, Operand((stack_space + 1) * kPointerSize)); 942 sub(sp, sp, Operand((stack_space + 1) * kPointerSize));
894 if (frame_alignment > 0) { 943 if (frame_alignment > 0) {
895 ASSERT(IsPowerOf2(frame_alignment)); 944 ASSERT(IsPowerOf2(frame_alignment));
896 and_(sp, sp, Operand(-frame_alignment)); 945 and_(sp, sp, Operand(-frame_alignment));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 #endif // defined(V8_HOST_ARCH_ARM) 982 #endif // defined(V8_HOST_ARCH_ARM)
934 } 983 }
935 984
936 985
937 void MacroAssembler::LeaveExitFrame(bool save_doubles, 986 void MacroAssembler::LeaveExitFrame(bool save_doubles,
938 Register argument_count) { 987 Register argument_count) {
939 // Optionally restore all double registers. 988 // Optionally restore all double registers.
940 if (save_doubles) { 989 if (save_doubles) {
941 // Calculate the stack location of the saved doubles and restore them. 990 // Calculate the stack location of the saved doubles and restore them.
942 const int offset = 2 * kPointerSize; 991 const int offset = 2 * kPointerSize;
943 sub(r3, fp, Operand(offset + DwVfpRegister::kNumRegisters * kDoubleSize)); 992 sub(r3, fp, Operand(offset + DwVfpRegister::NumAvailableRegisters() *
993 kDoubleSize));
944 DwVfpRegister first = d0; 994 DwVfpRegister first = d0;
945 DwVfpRegister last = 995 DwVfpRegister last =
946 DwVfpRegister::from_code(DwVfpRegister::kNumRegisters - 1); 996 DwVfpRegister::from_code(DwVfpRegister::NumAvailableRegisters() - 1);
947 vldm(ia, r3, first, last); 997 Vldm(ia_w, r3, first, last);
948 } 998 }
949 999
950 // Clear top frame. 1000 // Clear top frame.
951 mov(r3, Operand(0, RelocInfo::NONE)); 1001 mov(r3, Operand(0, RelocInfo::NONE));
952 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); 1002 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate())));
953 str(r3, MemOperand(ip)); 1003 str(r3, MemOperand(ip));
954 1004
955 // Restore current context from top and clear it in debug mode. 1005 // Restore current context from top and clear it in debug mode.
956 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); 1006 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate())));
957 ldr(cp, MemOperand(ip)); 1007 ldr(cp, MemOperand(ip));
(...skipping 2955 matching lines...) Expand 10 before | Expand all | Expand 10 after
3913 void CodePatcher::EmitCondition(Condition cond) { 3963 void CodePatcher::EmitCondition(Condition cond) {
3914 Instr instr = Assembler::instr_at(masm_.pc_); 3964 Instr instr = Assembler::instr_at(masm_.pc_);
3915 instr = (instr & ~kCondMask) | cond; 3965 instr = (instr & ~kCondMask) | cond;
3916 masm_.emit(instr); 3966 masm_.emit(instr);
3917 } 3967 }
3918 3968
3919 3969
3920 } } // namespace v8::internal 3970 } } // namespace v8::internal
3921 3971
3922 #endif // V8_TARGET_ARCH_ARM 3972 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698