OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 | 734 |
735 void MacroAssembler::VFPCompareAndLoadFlags(const DwVfpRegister src1, | 735 void MacroAssembler::VFPCompareAndLoadFlags(const DwVfpRegister src1, |
736 const double src2, | 736 const double src2, |
737 const Register fpscr_flags, | 737 const Register fpscr_flags, |
738 const Condition cond) { | 738 const Condition cond) { |
739 // Compare and load FPSCR. | 739 // Compare and load FPSCR. |
740 vcmp(src1, src2, cond); | 740 vcmp(src1, src2, cond); |
741 vmrs(fpscr_flags, cond); | 741 vmrs(fpscr_flags, cond); |
742 } | 742 } |
743 | 743 |
| 744 void MacroAssembler::Vmov(const DwVfpRegister dst, |
| 745 const double imm, |
| 746 const Condition cond) { |
| 747 ASSERT(CpuFeatures::IsEnabled(VFP3)); |
| 748 static const DoubleRepresentation minus_zero(-0.0); |
| 749 static const DoubleRepresentation zero(0.0); |
| 750 DoubleRepresentation value(imm); |
| 751 // Handle special values first. |
| 752 if (imm == 255.0) { |
| 753 vmov(dst, kDoubleReg255, cond); |
| 754 } else if (value.bits == minus_zero.bits) { |
| 755 vmov(dst, kDoubleRegMinusZero, cond); |
| 756 } else if (value.bits == zero.bits) { |
| 757 vmov(dst, kDoubleRegZero, cond); |
| 758 } else { |
| 759 vmov(dst, imm, cond); |
| 760 } |
| 761 } |
| 762 |
744 | 763 |
745 void MacroAssembler::EnterFrame(StackFrame::Type type) { | 764 void MacroAssembler::EnterFrame(StackFrame::Type type) { |
746 // r0-r3: preserved | 765 // r0-r3: preserved |
747 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); | 766 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); |
748 mov(ip, Operand(Smi::FromInt(type))); | 767 mov(ip, Operand(Smi::FromInt(type))); |
749 push(ip); | 768 push(ip); |
750 mov(ip, Operand(CodeObject())); | 769 mov(ip, Operand(CodeObject())); |
751 push(ip); | 770 push(ip); |
752 add(fp, sp, Operand(3 * kPointerSize)); // Adjust FP to point to saved FP. | 771 add(fp, sp, Operand(3 * kPointerSize)); // Adjust FP to point to saved FP. |
753 } | 772 } |
(...skipping 2338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3092 } | 3111 } |
3093 | 3112 |
3094 | 3113 |
3095 void MacroAssembler::ClampDoubleToUint8(Register result_reg, | 3114 void MacroAssembler::ClampDoubleToUint8(Register result_reg, |
3096 DoubleRegister input_reg, | 3115 DoubleRegister input_reg, |
3097 DoubleRegister temp_double_reg) { | 3116 DoubleRegister temp_double_reg) { |
3098 Label above_zero; | 3117 Label above_zero; |
3099 Label done; | 3118 Label done; |
3100 Label in_bounds; | 3119 Label in_bounds; |
3101 | 3120 |
3102 vmov(temp_double_reg, 0.0); | 3121 Vmov(temp_double_reg, 0.0); |
3103 VFPCompareAndSetFlags(input_reg, temp_double_reg); | 3122 VFPCompareAndSetFlags(input_reg, temp_double_reg); |
3104 b(gt, &above_zero); | 3123 b(gt, &above_zero); |
3105 | 3124 |
3106 // Double value is less than zero, NaN or Inf, return 0. | 3125 // Double value is less than zero, NaN or Inf, return 0. |
3107 mov(result_reg, Operand(0)); | 3126 mov(result_reg, Operand(0)); |
3108 b(al, &done); | 3127 b(al, &done); |
3109 | 3128 |
3110 // Double value is >= 255, return 255. | 3129 // Double value is >= 255, return 255. |
3111 bind(&above_zero); | 3130 bind(&above_zero); |
3112 vmov(temp_double_reg, 255.0); | 3131 Vmov(temp_double_reg, 255.0); |
3113 VFPCompareAndSetFlags(input_reg, temp_double_reg); | 3132 VFPCompareAndSetFlags(input_reg, temp_double_reg); |
3114 b(le, &in_bounds); | 3133 b(le, &in_bounds); |
3115 mov(result_reg, Operand(255)); | 3134 mov(result_reg, Operand(255)); |
3116 b(al, &done); | 3135 b(al, &done); |
3117 | 3136 |
3118 // In 0-255 range, round and truncate. | 3137 // In 0-255 range, round and truncate. |
3119 bind(&in_bounds); | 3138 bind(&in_bounds); |
3120 vmov(temp_double_reg, 0.5); | 3139 Vmov(temp_double_reg, 0.5); |
3121 vadd(temp_double_reg, input_reg, temp_double_reg); | 3140 vadd(temp_double_reg, input_reg, temp_double_reg); |
3122 vcvt_u32_f64(s0, temp_double_reg); | 3141 vcvt_u32_f64(s0, temp_double_reg); |
3123 vmov(result_reg, s0); | 3142 vmov(result_reg, s0); |
3124 bind(&done); | 3143 bind(&done); |
3125 } | 3144 } |
3126 | 3145 |
3127 | 3146 |
3128 void MacroAssembler::LoadInstanceDescriptors(Register map, | 3147 void MacroAssembler::LoadInstanceDescriptors(Register map, |
3129 Register descriptors) { | 3148 Register descriptors) { |
3130 ldr(descriptors, | 3149 ldr(descriptors, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3171 void CodePatcher::EmitCondition(Condition cond) { | 3190 void CodePatcher::EmitCondition(Condition cond) { |
3172 Instr instr = Assembler::instr_at(masm_.pc_); | 3191 Instr instr = Assembler::instr_at(masm_.pc_); |
3173 instr = (instr & ~kCondMask) | cond; | 3192 instr = (instr & ~kCondMask) | cond; |
3174 masm_.emit(instr); | 3193 masm_.emit(instr); |
3175 } | 3194 } |
3176 | 3195 |
3177 | 3196 |
3178 } } // namespace v8::internal | 3197 } } // namespace v8::internal |
3179 | 3198 |
3180 #endif // V8_TARGET_ARCH_ARM | 3199 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |