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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 mov(ip, Operand(handle)); | 302 mov(ip, Operand(handle)); |
303 push(ip); | 303 push(ip); |
304 } | 304 } |
305 | 305 |
306 | 306 |
307 void MacroAssembler::Move(Register dst, Handle<Object> value) { | 307 void MacroAssembler::Move(Register dst, Handle<Object> value) { |
308 mov(dst, Operand(value)); | 308 mov(dst, Operand(value)); |
309 } | 309 } |
310 | 310 |
311 | 311 |
312 void MacroAssembler::Move(Register dst, Register src, Condition cond) { | 312 void MacroAssembler::Move(Register dst, Register src) { |
313 if (!dst.is(src)) { | 313 if (!dst.is(src)) { |
314 mov(dst, src, LeaveCC, cond); | 314 mov(dst, src); |
315 } | 315 } |
316 } | 316 } |
317 | 317 |
318 | 318 |
319 void MacroAssembler::Move(DoubleRegister dst, DoubleRegister src) { | 319 void MacroAssembler::Move(DoubleRegister dst, DoubleRegister src) { |
320 ASSERT(CpuFeatures::IsSupported(VFP3)); | 320 ASSERT(CpuFeatures::IsSupported(VFP3)); |
321 CpuFeatures::Scope scope(VFP3); | 321 CpuFeatures::Scope scope(VFP3); |
322 if (!dst.is(src)) { | 322 if (!dst.is(src)) { |
323 vmov(dst, src); | 323 vmov(dst, src); |
324 } | 324 } |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 | 748 |
749 void MacroAssembler::VFPCompareAndLoadFlags(const DwVfpRegister src1, | 749 void MacroAssembler::VFPCompareAndLoadFlags(const DwVfpRegister src1, |
750 const double src2, | 750 const double src2, |
751 const Register fpscr_flags, | 751 const Register fpscr_flags, |
752 const Condition cond) { | 752 const Condition cond) { |
753 // Compare and load FPSCR. | 753 // Compare and load FPSCR. |
754 vcmp(src1, src2, cond); | 754 vcmp(src1, src2, cond); |
755 vmrs(fpscr_flags, cond); | 755 vmrs(fpscr_flags, cond); |
756 } | 756 } |
757 | 757 |
758 void MacroAssembler::Vmov(const DwVfpRegister dst, | |
759 const double imm, | |
760 const Condition cond) { | |
761 ASSERT(CpuFeatures::IsEnabled(VFP3)); | |
762 static const DoubleRepresentation minus_zero(-0.0); | |
763 static const DoubleRepresentation zero(0.0); | |
764 DoubleRepresentation value(imm); | |
765 // Handle special values first. | |
766 if (value.bits == zero.bits) { | |
767 vmov(dst, kDoubleRegZero, cond); | |
768 } else if (value.bits == minus_zero.bits) { | |
769 vneg(dst, kDoubleRegZero, cond); | |
770 } else { | |
771 vmov(dst, imm, cond); | |
772 } | |
773 } | |
774 | |
775 | 758 |
776 void MacroAssembler::EnterFrame(StackFrame::Type type) { | 759 void MacroAssembler::EnterFrame(StackFrame::Type type) { |
777 // r0-r3: preserved | 760 // r0-r3: preserved |
778 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); | 761 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); |
779 mov(ip, Operand(Smi::FromInt(type))); | 762 mov(ip, Operand(Smi::FromInt(type))); |
780 push(ip); | 763 push(ip); |
781 mov(ip, Operand(CodeObject())); | 764 mov(ip, Operand(CodeObject())); |
782 push(ip); | 765 push(ip); |
783 add(fp, sp, Operand(3 * kPointerSize)); // Adjust FP to point to saved FP. | 766 add(fp, sp, Operand(3 * kPointerSize)); // Adjust FP to point to saved FP. |
784 } | 767 } |
(...skipping 2337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3122 } | 3105 } |
3123 | 3106 |
3124 | 3107 |
3125 void MacroAssembler::ClampDoubleToUint8(Register result_reg, | 3108 void MacroAssembler::ClampDoubleToUint8(Register result_reg, |
3126 DoubleRegister input_reg, | 3109 DoubleRegister input_reg, |
3127 DoubleRegister temp_double_reg) { | 3110 DoubleRegister temp_double_reg) { |
3128 Label above_zero; | 3111 Label above_zero; |
3129 Label done; | 3112 Label done; |
3130 Label in_bounds; | 3113 Label in_bounds; |
3131 | 3114 |
3132 Vmov(temp_double_reg, 0.0); | 3115 vmov(temp_double_reg, 0.0); |
3133 VFPCompareAndSetFlags(input_reg, temp_double_reg); | 3116 VFPCompareAndSetFlags(input_reg, temp_double_reg); |
3134 b(gt, &above_zero); | 3117 b(gt, &above_zero); |
3135 | 3118 |
3136 // Double value is less than zero, NaN or Inf, return 0. | 3119 // Double value is less than zero, NaN or Inf, return 0. |
3137 mov(result_reg, Operand(0)); | 3120 mov(result_reg, Operand(0)); |
3138 b(al, &done); | 3121 b(al, &done); |
3139 | 3122 |
3140 // Double value is >= 255, return 255. | 3123 // Double value is >= 255, return 255. |
3141 bind(&above_zero); | 3124 bind(&above_zero); |
3142 Vmov(temp_double_reg, 255.0); | 3125 vmov(temp_double_reg, 255.0); |
3143 VFPCompareAndSetFlags(input_reg, temp_double_reg); | 3126 VFPCompareAndSetFlags(input_reg, temp_double_reg); |
3144 b(le, &in_bounds); | 3127 b(le, &in_bounds); |
3145 mov(result_reg, Operand(255)); | 3128 mov(result_reg, Operand(255)); |
3146 b(al, &done); | 3129 b(al, &done); |
3147 | 3130 |
3148 // In 0-255 range, round and truncate. | 3131 // In 0-255 range, round and truncate. |
3149 bind(&in_bounds); | 3132 bind(&in_bounds); |
3150 Vmov(temp_double_reg, 0.5); | 3133 vmov(temp_double_reg, 0.5); |
3151 vadd(temp_double_reg, input_reg, temp_double_reg); | 3134 vadd(temp_double_reg, input_reg, temp_double_reg); |
3152 vcvt_u32_f64(s0, temp_double_reg); | 3135 vcvt_u32_f64(s0, temp_double_reg); |
3153 vmov(result_reg, s0); | 3136 vmov(result_reg, s0); |
3154 bind(&done); | 3137 bind(&done); |
3155 } | 3138 } |
3156 | 3139 |
3157 | 3140 |
3158 void MacroAssembler::LoadInstanceDescriptors(Register map, | 3141 void MacroAssembler::LoadInstanceDescriptors(Register map, |
3159 Register descriptors) { | 3142 Register descriptors) { |
3160 ldr(descriptors, | 3143 ldr(descriptors, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3201 void CodePatcher::EmitCondition(Condition cond) { | 3184 void CodePatcher::EmitCondition(Condition cond) { |
3202 Instr instr = Assembler::instr_at(masm_.pc_); | 3185 Instr instr = Assembler::instr_at(masm_.pc_); |
3203 instr = (instr & ~kCondMask) | cond; | 3186 instr = (instr & ~kCondMask) | cond; |
3204 masm_.emit(instr); | 3187 masm_.emit(instr); |
3205 } | 3188 } |
3206 | 3189 |
3207 | 3190 |
3208 } } // namespace v8::internal | 3191 } } // namespace v8::internal |
3209 | 3192 |
3210 #endif // V8_TARGET_ARCH_ARM | 3193 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |