| 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::MovFromFloatResult(const DwVfpRegister dst) { |
| 1077 if (use_eabi_hardfloat()) { | 1085 if (use_eabi_hardfloat()) { |
| 1078 Move(dst, d0); | 1086 Move(dst, d0); |
| 1079 } else { | 1087 } else { |
| 1080 vmov(dst, r0, r1); | 1088 vmov(dst, r0, r1); |
| 1081 } | 1089 } |
| 1082 } | 1090 } |
| 1083 | 1091 |
| 1084 | 1092 |
| 1093 // On ARM this is just a synonym to make the purpose clear. |
| 1094 void MacroAssembler::MovFromFloatParameter(DwVfpRegister dst) { |
| 1095 MovFromFloatResult(dst); |
| 1096 } |
| 1097 |
| 1098 |
| 1085 void MacroAssembler::SetCallKind(Register dst, CallKind call_kind) { | 1099 void MacroAssembler::SetCallKind(Register dst, CallKind call_kind) { |
| 1086 // This macro takes the dst register to make the code more readable | 1100 // This macro takes the dst register to make the code more readable |
| 1087 // at the call sites. However, the dst register has to be r5 to | 1101 // at the call sites. However, the dst register has to be r5 to |
| 1088 // follow the calling convention which requires the call type to be | 1102 // follow the calling convention which requires the call type to be |
| 1089 // in r5. | 1103 // in r5. |
| 1090 ASSERT(dst.is(r5)); | 1104 ASSERT(dst.is(r5)); |
| 1091 if (call_kind == CALL_AS_FUNCTION) { | 1105 if (call_kind == CALL_AS_FUNCTION) { |
| 1092 mov(dst, Operand(Smi::FromInt(1))); | 1106 mov(dst, Operand(Smi::FromInt(1))); |
| 1093 } else { | 1107 } else { |
| 1094 mov(dst, Operand(Smi::FromInt(0))); | 1108 mov(dst, Operand(Smi::FromInt(0))); |
| (...skipping 2430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3525 } | 3539 } |
| 3526 } | 3540 } |
| 3527 | 3541 |
| 3528 | 3542 |
| 3529 void MacroAssembler::PrepareCallCFunction(int num_reg_arguments, | 3543 void MacroAssembler::PrepareCallCFunction(int num_reg_arguments, |
| 3530 Register scratch) { | 3544 Register scratch) { |
| 3531 PrepareCallCFunction(num_reg_arguments, 0, scratch); | 3545 PrepareCallCFunction(num_reg_arguments, 0, scratch); |
| 3532 } | 3546 } |
| 3533 | 3547 |
| 3534 | 3548 |
| 3535 void MacroAssembler::SetCallCDoubleArguments(DwVfpRegister dreg) { | 3549 void MacroAssembler::MovToFloatParameter(DwVfpRegister src) { |
| 3536 ASSERT(dreg.is(d0)); | 3550 ASSERT(src.is(d0)); |
| 3537 if (!use_eabi_hardfloat()) { | 3551 if (!use_eabi_hardfloat()) { |
| 3538 vmov(r0, r1, dreg); | 3552 vmov(r0, r1, src); |
| 3539 } | 3553 } |
| 3540 } | 3554 } |
| 3541 | 3555 |
| 3542 | 3556 |
| 3543 void MacroAssembler::SetCallCDoubleArguments(DwVfpRegister dreg1, | 3557 // On ARM this is just a synonym to make the purpose clear. |
| 3544 DwVfpRegister dreg2) { | 3558 void MacroAssembler::MovToFloatResult(DwVfpRegister src) { |
| 3545 ASSERT(dreg1.is(d0)); | 3559 MovToFloatParameter(src); |
| 3546 ASSERT(dreg2.is(d1)); | 3560 } |
| 3561 |
| 3562 |
| 3563 void MacroAssembler::MovToFloatParameters(DwVfpRegister src1, |
| 3564 DwVfpRegister src2) { |
| 3565 ASSERT(src1.is(d0)); |
| 3566 ASSERT(src2.is(d1)); |
| 3547 if (!use_eabi_hardfloat()) { | 3567 if (!use_eabi_hardfloat()) { |
| 3548 vmov(r0, r1, dreg1); | 3568 vmov(r0, r1, src1); |
| 3549 vmov(r2, r3, dreg2); | 3569 vmov(r2, r3, src2); |
| 3550 } | 3570 } |
| 3551 } | 3571 } |
| 3552 | 3572 |
| 3553 | |
| 3554 void MacroAssembler::SetCallCDoubleArguments(DwVfpRegister dreg, | |
| 3555 Register reg) { | |
| 3556 ASSERT(dreg.is(d0)); | |
| 3557 if (use_eabi_hardfloat()) { | |
| 3558 Move(r0, reg); | |
| 3559 } else { | |
| 3560 Move(r2, reg); | |
| 3561 vmov(r0, r1, dreg); | |
| 3562 } | |
| 3563 } | |
| 3564 | |
| 3565 | 3573 |
| 3566 void MacroAssembler::CallCFunction(ExternalReference function, | 3574 void MacroAssembler::CallCFunction(ExternalReference function, |
| 3567 int num_reg_arguments, | 3575 int num_reg_arguments, |
| 3568 int num_double_arguments) { | 3576 int num_double_arguments) { |
| 3569 mov(ip, Operand(function)); | 3577 mov(ip, Operand(function)); |
| 3570 CallCFunctionHelper(ip, num_reg_arguments, num_double_arguments); | 3578 CallCFunctionHelper(ip, num_reg_arguments, num_double_arguments); |
| 3571 } | 3579 } |
| 3572 | 3580 |
| 3573 | 3581 |
| 3574 void MacroAssembler::CallCFunction(Register function, | 3582 void MacroAssembler::CallCFunction(Register function, |
| (...skipping 544 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 |