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 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 | 960 |
961 | 961 |
962 void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space) { | 962 void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space) { |
963 // Set up the frame structure on the stack. | 963 // Set up the frame structure on the stack. |
964 ASSERT_EQ(2 * kPointerSize, ExitFrameConstants::kCallerSPDisplacement); | 964 ASSERT_EQ(2 * kPointerSize, ExitFrameConstants::kCallerSPDisplacement); |
965 ASSERT_EQ(1 * kPointerSize, ExitFrameConstants::kCallerPCOffset); | 965 ASSERT_EQ(1 * kPointerSize, ExitFrameConstants::kCallerPCOffset); |
966 ASSERT_EQ(0 * kPointerSize, ExitFrameConstants::kCallerFPOffset); | 966 ASSERT_EQ(0 * kPointerSize, ExitFrameConstants::kCallerFPOffset); |
967 Push(lr, fp); | 967 Push(lr, fp); |
968 mov(fp, Operand(sp)); // Set up new frame pointer. | 968 mov(fp, Operand(sp)); // Set up new frame pointer. |
969 // Reserve room for saved entry sp and code object. | 969 // Reserve room for saved entry sp and code object. |
970 sub(sp, sp, Operand(2 * kPointerSize)); | 970 sub(sp, sp, Operand(ExitFrameConstants::kFrameSize)); |
971 if (emit_debug_code()) { | 971 if (emit_debug_code()) { |
972 mov(ip, Operand::Zero()); | 972 mov(ip, Operand::Zero()); |
973 str(ip, MemOperand(fp, ExitFrameConstants::kSPOffset)); | 973 str(ip, MemOperand(fp, ExitFrameConstants::kSPOffset)); |
974 } | 974 } |
| 975 if (FLAG_enable_ool_constant_pool) { |
| 976 str(pp, MemOperand(fp, ExitFrameConstants::kConstantPoolOffset)); |
| 977 } |
975 mov(ip, Operand(CodeObject())); | 978 mov(ip, Operand(CodeObject())); |
976 str(ip, MemOperand(fp, ExitFrameConstants::kCodeOffset)); | 979 str(ip, MemOperand(fp, ExitFrameConstants::kCodeOffset)); |
977 | 980 |
978 // Save the frame pointer and the context in top. | 981 // Save the frame pointer and the context in top. |
979 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); | 982 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); |
980 str(fp, MemOperand(ip)); | 983 str(fp, MemOperand(ip)); |
981 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); | 984 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); |
982 str(cp, MemOperand(ip)); | 985 str(cp, MemOperand(ip)); |
983 | 986 |
984 // Optionally save all double registers. | 987 // Optionally save all double registers. |
985 if (save_doubles) { | 988 if (save_doubles) { |
986 SaveFPRegs(sp, ip); | 989 SaveFPRegs(sp, ip); |
987 // Note that d0 will be accessible at | 990 // Note that d0 will be accessible at |
988 // fp - 2 * kPointerSize - DwVfpRegister::kMaxNumRegisters * kDoubleSize, | 991 // fp - ExitFrameConstants::kFrameSize - |
989 // since the sp slot and code slot were pushed after the fp. | 992 // DwVfpRegister::kMaxNumRegisters * kDoubleSize, |
| 993 // since the sp slot, code slot and constant pool slot (if |
| 994 // FLAG_enable_ool_constant_pool) were pushed after the fp. |
990 } | 995 } |
991 | 996 |
992 // Reserve place for the return address and stack space and align the frame | 997 // Reserve place for the return address and stack space and align the frame |
993 // preparing for calling the runtime function. | 998 // preparing for calling the runtime function. |
994 const int frame_alignment = MacroAssembler::ActivationFrameAlignment(); | 999 const int frame_alignment = MacroAssembler::ActivationFrameAlignment(); |
995 sub(sp, sp, Operand((stack_space + 1) * kPointerSize)); | 1000 sub(sp, sp, Operand((stack_space + 1) * kPointerSize)); |
996 if (frame_alignment > 0) { | 1001 if (frame_alignment > 0) { |
997 ASSERT(IsPowerOf2(frame_alignment)); | 1002 ASSERT(IsPowerOf2(frame_alignment)); |
998 and_(sp, sp, Operand(-frame_alignment)); | 1003 and_(sp, sp, Operand(-frame_alignment)); |
999 } | 1004 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 #endif // V8_HOST_ARCH_ARM | 1040 #endif // V8_HOST_ARCH_ARM |
1036 } | 1041 } |
1037 | 1042 |
1038 | 1043 |
1039 void MacroAssembler::LeaveExitFrame(bool save_doubles, | 1044 void MacroAssembler::LeaveExitFrame(bool save_doubles, |
1040 Register argument_count, | 1045 Register argument_count, |
1041 bool restore_context) { | 1046 bool restore_context) { |
1042 // Optionally restore all double registers. | 1047 // Optionally restore all double registers. |
1043 if (save_doubles) { | 1048 if (save_doubles) { |
1044 // Calculate the stack location of the saved doubles and restore them. | 1049 // Calculate the stack location of the saved doubles and restore them. |
1045 const int offset = 2 * kPointerSize; | 1050 const int offset = ExitFrameConstants::kFrameSize; |
1046 sub(r3, fp, | 1051 sub(r3, fp, |
1047 Operand(offset + DwVfpRegister::kMaxNumRegisters * kDoubleSize)); | 1052 Operand(offset + DwVfpRegister::kMaxNumRegisters * kDoubleSize)); |
1048 RestoreFPRegs(r3, ip); | 1053 RestoreFPRegs(r3, ip); |
1049 } | 1054 } |
1050 | 1055 |
1051 // Clear top frame. | 1056 // Clear top frame. |
1052 mov(r3, Operand::Zero()); | 1057 mov(r3, Operand::Zero()); |
1053 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); | 1058 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); |
1054 str(r3, MemOperand(ip)); | 1059 str(r3, MemOperand(ip)); |
1055 | 1060 |
1056 | 1061 |
1057 // Restore current context from top and clear it in debug mode. | 1062 // Restore current context from top and clear it in debug mode. |
1058 if (restore_context) { | 1063 if (restore_context) { |
1059 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); | 1064 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); |
1060 ldr(cp, MemOperand(ip)); | 1065 ldr(cp, MemOperand(ip)); |
1061 } | 1066 } |
1062 #ifdef DEBUG | 1067 #ifdef DEBUG |
1063 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); | 1068 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); |
1064 str(r3, MemOperand(ip)); | 1069 str(r3, MemOperand(ip)); |
1065 #endif | 1070 #endif |
1066 | 1071 |
1067 // Tear down the exit frame, pop the arguments, and return. | 1072 // Tear down the exit frame, pop the arguments, and return. |
| 1073 if (FLAG_enable_ool_constant_pool) { |
| 1074 ldr(pp, MemOperand(fp, ExitFrameConstants::kConstantPoolOffset)); |
| 1075 } |
1068 mov(sp, Operand(fp)); | 1076 mov(sp, Operand(fp)); |
1069 ldm(ia_w, sp, fp.bit() | lr.bit()); | 1077 ldm(ia_w, sp, fp.bit() | lr.bit()); |
1070 if (argument_count.is_valid()) { | 1078 if (argument_count.is_valid()) { |
1071 add(sp, sp, Operand(argument_count, LSL, kPointerSizeLog2)); | 1079 add(sp, sp, Operand(argument_count, LSL, kPointerSizeLog2)); |
1072 } | 1080 } |
1073 } | 1081 } |
1074 | 1082 |
1075 | 1083 |
1076 void MacroAssembler::GetCFunctionDoubleResult(const DwVfpRegister dst) { | 1084 void MacroAssembler::GetCFunctionDoubleResult(const DwVfpRegister dst) { |
1077 if (use_eabi_hardfloat()) { | 1085 if (use_eabi_hardfloat()) { |
(...skipping 3041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4119 void CodePatcher::EmitCondition(Condition cond) { | 4127 void CodePatcher::EmitCondition(Condition cond) { |
4120 Instr instr = Assembler::instr_at(masm_.pc_); | 4128 Instr instr = Assembler::instr_at(masm_.pc_); |
4121 instr = (instr & ~kCondMask) | cond; | 4129 instr = (instr & ~kCondMask) | cond; |
4122 masm_.emit(instr); | 4130 masm_.emit(instr); |
4123 } | 4131 } |
4124 | 4132 |
4125 | 4133 |
4126 } } // namespace v8::internal | 4134 } } // namespace v8::internal |
4127 | 4135 |
4128 #endif // V8_TARGET_ARCH_ARM | 4136 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |