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