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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
595 StoreBufferOverflowStub(fp_mode); | 595 StoreBufferOverflowStub(fp_mode); |
596 CallStub(&store_buffer_overflow); | 596 CallStub(&store_buffer_overflow); |
597 pop(lr); | 597 pop(lr); |
598 bind(&done); | 598 bind(&done); |
599 if (and_then == kReturnAtEnd) { | 599 if (and_then == kReturnAtEnd) { |
600 Ret(); | 600 Ret(); |
601 } | 601 } |
602 } | 602 } |
603 | 603 |
604 | 604 |
605 void MacroAssembler::PushFixedFrame(Register marker_reg) { | |
606 ASSERT(!marker_reg.is_valid() || marker_reg.code() < cp.code()); | |
607 stm(db_w, sp, (marker_reg.is_valid() ? marker_reg.bit() : 0) | | |
608 cp.bit() | | |
609 (FLAG_enable_ool_constant_pool ? pp.bit() : 0) | | |
610 fp.bit() | | |
611 lr.bit()); | |
612 } | |
613 | |
614 | |
615 void MacroAssembler::PopFixedFrame(Register marker_reg) { | |
616 ASSERT(!marker_reg.is_valid() || marker_reg.code() < cp.code()); | |
617 ldm(ia_w, sp, (marker_reg.is_valid() ? marker_reg.bit() : 0) | | |
618 cp.bit() | | |
619 (FLAG_enable_ool_constant_pool ? pp.bit() : 0) | | |
620 fp.bit() | | |
621 lr.bit()); | |
622 } | |
623 | |
624 | |
605 // Push and pop all registers that can hold pointers. | 625 // Push and pop all registers that can hold pointers. |
606 void MacroAssembler::PushSafepointRegisters() { | 626 void MacroAssembler::PushSafepointRegisters() { |
607 // Safepoints expect a block of contiguous register values starting with r0: | 627 // Safepoints expect a block of contiguous register values starting with r0: |
608 ASSERT(((1 << kNumSafepointSavedRegisters) - 1) == kSafepointSavedRegisters); | 628 ASSERT(((1 << kNumSafepointSavedRegisters) - 1) == kSafepointSavedRegisters); |
609 // Safepoints expect a block of kNumSafepointRegisters values on the | 629 // Safepoints expect a block of kNumSafepointRegisters values on the |
610 // stack, so adjust the stack for unsaved registers. | 630 // stack, so adjust the stack for unsaved registers. |
611 const int num_unsaved = kNumSafepointRegisters - kNumSafepointSavedRegisters; | 631 const int num_unsaved = kNumSafepointRegisters - kNumSafepointSavedRegisters; |
612 ASSERT(num_unsaved >= 0); | 632 ASSERT(num_unsaved >= 0); |
613 sub(sp, sp, Operand(num_unsaved * kPointerSize)); | 633 sub(sp, sp, Operand(num_unsaved * kPointerSize)); |
614 stm(db_w, sp, kSafepointSavedRegisters); | 634 stm(db_w, sp, kSafepointSavedRegisters); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
863 const LowDwVfpRegister loc = LowDwVfpRegister::from_code(dst.code()); | 883 const LowDwVfpRegister loc = LowDwVfpRegister::from_code(dst.code()); |
864 vmov(loc.low(), src); | 884 vmov(loc.low(), src); |
865 } else { | 885 } else { |
866 vmov(dst, VmovIndexLo, src); | 886 vmov(dst, VmovIndexLo, src); |
867 } | 887 } |
868 } | 888 } |
869 | 889 |
870 | 890 |
871 void MacroAssembler::Prologue(PrologueFrameMode frame_mode) { | 891 void MacroAssembler::Prologue(PrologueFrameMode frame_mode) { |
872 if (frame_mode == BUILD_STUB_FRAME) { | 892 if (frame_mode == BUILD_STUB_FRAME) { |
873 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); | 893 PushFixedFrame(); |
874 Push(Smi::FromInt(StackFrame::STUB)); | 894 Push(Smi::FromInt(StackFrame::STUB)); |
875 // Adjust FP to point to saved FP. | 895 // Adjust FP to point to saved FP. |
876 add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 896 add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
877 } else { | 897 } else { |
878 PredictableCodeSizeScope predictible_code_size_scope( | 898 PredictableCodeSizeScope predictible_code_size_scope( |
879 this, kNoCodeAgeSequenceLength * Assembler::kInstrSize); | 899 this, kNoCodeAgeSequenceLength * Assembler::kInstrSize); |
880 // The following three instructions must remain together and unmodified | 900 // The following three instructions must remain together and unmodified |
881 // for code aging to work properly. | 901 // for code aging to work properly. |
882 if (isolate()->IsCodePreAgingActive()) { | 902 if (isolate()->IsCodePreAgingActive()) { |
883 // Pre-age the code. | 903 // Pre-age the code. |
884 Code* stub = Code::GetPreAgedCodeAgeStub(isolate()); | 904 Code* stub = Code::GetPreAgedCodeAgeStub(isolate()); |
885 add(r0, pc, Operand(-8)); | 905 add(r0, pc, Operand(-8)); |
886 ldr(pc, MemOperand(pc, -4)); | 906 ldr(pc, MemOperand(pc, -4)); |
887 emit_code_stub_address(stub); | 907 emit_code_stub_address(stub); |
888 } else { | 908 } else { |
889 stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit()); | 909 PushFixedFrame(r1); |
890 nop(ip.code()); | 910 nop(ip.code()); |
891 // Adjust FP to point to saved FP. | 911 // Adjust FP to point to saved FP. |
892 add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 912 add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
893 } | 913 } |
894 } | 914 } |
895 } | 915 } |
896 | 916 |
897 | 917 |
918 void MacroAssembler::LoadConstantPoolPointerRegister() { | |
919 if (FLAG_enable_ool_constant_pool) { | |
920 ldr(pp, MemOperand(pc, Code::kConstantPoolOffset - Code::kHeaderSize - | |
ulan
2013/12/18 15:06:56
Ensure that the offset doesn't require constant po
rmcilroy
2013/12/19 11:08:25
Done.
| |
921 pc_offset() - 8)); | |
922 } | |
923 } | |
924 | |
925 | |
898 void MacroAssembler::EnterFrame(StackFrame::Type type) { | 926 void MacroAssembler::EnterFrame(StackFrame::Type type) { |
899 // r0-r3: preserved | 927 // r0-r3: preserved |
900 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); | 928 PushFixedFrame(); |
901 mov(ip, Operand(Smi::FromInt(type))); | 929 mov(ip, Operand(Smi::FromInt(type))); |
902 push(ip); | 930 push(ip); |
903 mov(ip, Operand(CodeObject())); | 931 mov(ip, Operand(CodeObject())); |
904 push(ip); | 932 push(ip); |
905 // Adjust FP to point to saved FP. | 933 // Adjust FP to point to saved FP. |
906 add(fp, sp, | 934 add(fp, sp, |
907 Operand(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize)); | 935 Operand(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize)); |
908 } | 936 } |
909 | 937 |
910 | 938 |
911 void MacroAssembler::LeaveFrame(StackFrame::Type type) { | 939 int MacroAssembler::LeaveFrame(StackFrame::Type type) { |
912 // r0: preserved | 940 // r0: preserved |
913 // r1: preserved | 941 // r1: preserved |
914 // r2: preserved | 942 // r2: preserved |
915 | 943 |
916 // Drop the execution stack down to the frame pointer and restore | 944 // Drop the execution stack down to the frame pointer and restore |
917 // the caller frame pointer and return address. | 945 // the caller frame pointer, return address and constant pool pointer |
918 mov(sp, fp); | 946 // (if FLAG_enable_ool_constant_pool). |
919 ldm(ia_w, sp, fp.bit() | lr.bit()); | 947 int frame_ends; |
948 if (FLAG_enable_ool_constant_pool) { | |
949 add(sp, fp, Operand(StandardFrameConstants::kConstantPoolOffset)); | |
950 frame_ends = pc_offset(); | |
951 ldm(ia_w, sp, pp.bit() | fp.bit() | lr.bit()); | |
952 } else { | |
953 mov(sp, fp); | |
954 frame_ends = pc_offset(); | |
955 ldm(ia_w, sp, fp.bit() | lr.bit()); | |
956 } | |
957 return frame_ends; | |
920 } | 958 } |
921 | 959 |
922 | 960 |
923 void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space) { | 961 void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space) { |
924 // Set up the frame structure on the stack. | 962 // Set up the frame structure on the stack. |
925 ASSERT_EQ(2 * kPointerSize, ExitFrameConstants::kCallerSPDisplacement); | 963 ASSERT_EQ(2 * kPointerSize, ExitFrameConstants::kCallerSPDisplacement); |
926 ASSERT_EQ(1 * kPointerSize, ExitFrameConstants::kCallerPCOffset); | 964 ASSERT_EQ(1 * kPointerSize, ExitFrameConstants::kCallerPCOffset); |
927 ASSERT_EQ(0 * kPointerSize, ExitFrameConstants::kCallerFPOffset); | 965 ASSERT_EQ(0 * kPointerSize, ExitFrameConstants::kCallerFPOffset); |
928 Push(lr, fp); | 966 Push(lr, fp); |
929 mov(fp, Operand(sp)); // Set up new frame pointer. | 967 mov(fp, Operand(sp)); // Set up new frame pointer. |
(...skipping 3140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4070 void CodePatcher::EmitCondition(Condition cond) { | 4108 void CodePatcher::EmitCondition(Condition cond) { |
4071 Instr instr = Assembler::instr_at(masm_.pc_); | 4109 Instr instr = Assembler::instr_at(masm_.pc_); |
4072 instr = (instr & ~kCondMask) | cond; | 4110 instr = (instr & ~kCondMask) | cond; |
4073 masm_.emit(instr); | 4111 masm_.emit(instr); |
4074 } | 4112 } |
4075 | 4113 |
4076 | 4114 |
4077 } } // namespace v8::internal | 4115 } } // namespace v8::internal |
4078 | 4116 |
4079 #endif // V8_TARGET_ARCH_ARM | 4117 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |