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) { | 312 void MacroAssembler::Move(Register dst, Register src, Condition cond) { |
313 if (!dst.is(src)) { | 313 if (!dst.is(src)) { |
314 mov(dst, src); | 314 mov(dst, src, LeaveCC, cond); |
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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 | 720 |
721 void MacroAssembler::VFPCompareAndLoadFlags(const DwVfpRegister src1, | 721 void MacroAssembler::VFPCompareAndLoadFlags(const DwVfpRegister src1, |
722 const double src2, | 722 const double src2, |
723 const Register fpscr_flags, | 723 const Register fpscr_flags, |
724 const Condition cond) { | 724 const Condition cond) { |
725 // Compare and load FPSCR. | 725 // Compare and load FPSCR. |
726 vcmp(src1, src2, cond); | 726 vcmp(src1, src2, cond); |
727 vmrs(fpscr_flags, cond); | 727 vmrs(fpscr_flags, cond); |
728 } | 728 } |
729 | 729 |
| 730 void MacroAssembler::Vmov(const DwVfpRegister dst, |
| 731 const double imm, |
| 732 const Condition cond) { |
| 733 ASSERT(CpuFeatures::IsEnabled(VFP3)); |
| 734 static const DoubleRepresentation minus_zero(-0.0); |
| 735 static const DoubleRepresentation zero(0.0); |
| 736 DoubleRepresentation value(imm); |
| 737 // Handle special values first. |
| 738 if (value.bits == zero.bits) { |
| 739 vmov(dst, kDoubleRegZero, cond); |
| 740 } else if (value.bits == minus_zero.bits) { |
| 741 vneg(dst, kDoubleRegZero, cond); |
| 742 } else { |
| 743 vmov(dst, imm, cond); |
| 744 } |
| 745 } |
| 746 |
730 | 747 |
731 void MacroAssembler::EnterFrame(StackFrame::Type type) { | 748 void MacroAssembler::EnterFrame(StackFrame::Type type) { |
732 // r0-r3: preserved | 749 // r0-r3: preserved |
733 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); | 750 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); |
734 mov(ip, Operand(Smi::FromInt(type))); | 751 mov(ip, Operand(Smi::FromInt(type))); |
735 push(ip); | 752 push(ip); |
736 mov(ip, Operand(CodeObject())); | 753 mov(ip, Operand(CodeObject())); |
737 push(ip); | 754 push(ip); |
738 add(fp, sp, Operand(3 * kPointerSize)); // Adjust FP to point to saved FP. | 755 add(fp, sp, Operand(3 * kPointerSize)); // Adjust FP to point to saved FP. |
739 } | 756 } |
(...skipping 2337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3077 } | 3094 } |
3078 | 3095 |
3079 | 3096 |
3080 void MacroAssembler::ClampDoubleToUint8(Register result_reg, | 3097 void MacroAssembler::ClampDoubleToUint8(Register result_reg, |
3081 DoubleRegister input_reg, | 3098 DoubleRegister input_reg, |
3082 DoubleRegister temp_double_reg) { | 3099 DoubleRegister temp_double_reg) { |
3083 Label above_zero; | 3100 Label above_zero; |
3084 Label done; | 3101 Label done; |
3085 Label in_bounds; | 3102 Label in_bounds; |
3086 | 3103 |
3087 vmov(temp_double_reg, 0.0); | 3104 Vmov(temp_double_reg, 0.0); |
3088 VFPCompareAndSetFlags(input_reg, temp_double_reg); | 3105 VFPCompareAndSetFlags(input_reg, temp_double_reg); |
3089 b(gt, &above_zero); | 3106 b(gt, &above_zero); |
3090 | 3107 |
3091 // Double value is less than zero, NaN or Inf, return 0. | 3108 // Double value is less than zero, NaN or Inf, return 0. |
3092 mov(result_reg, Operand(0)); | 3109 mov(result_reg, Operand(0)); |
3093 b(al, &done); | 3110 b(al, &done); |
3094 | 3111 |
3095 // Double value is >= 255, return 255. | 3112 // Double value is >= 255, return 255. |
3096 bind(&above_zero); | 3113 bind(&above_zero); |
3097 vmov(temp_double_reg, 255.0); | 3114 Vmov(temp_double_reg, 255.0); |
3098 VFPCompareAndSetFlags(input_reg, temp_double_reg); | 3115 VFPCompareAndSetFlags(input_reg, temp_double_reg); |
3099 b(le, &in_bounds); | 3116 b(le, &in_bounds); |
3100 mov(result_reg, Operand(255)); | 3117 mov(result_reg, Operand(255)); |
3101 b(al, &done); | 3118 b(al, &done); |
3102 | 3119 |
3103 // In 0-255 range, round and truncate. | 3120 // In 0-255 range, round and truncate. |
3104 bind(&in_bounds); | 3121 bind(&in_bounds); |
3105 vmov(temp_double_reg, 0.5); | 3122 Vmov(temp_double_reg, 0.5); |
3106 vadd(temp_double_reg, input_reg, temp_double_reg); | 3123 vadd(temp_double_reg, input_reg, temp_double_reg); |
3107 vcvt_u32_f64(s0, temp_double_reg); | 3124 vcvt_u32_f64(s0, temp_double_reg); |
3108 vmov(result_reg, s0); | 3125 vmov(result_reg, s0); |
3109 bind(&done); | 3126 bind(&done); |
3110 } | 3127 } |
3111 | 3128 |
3112 | 3129 |
3113 void MacroAssembler::LoadInstanceDescriptors(Register map, | 3130 void MacroAssembler::LoadInstanceDescriptors(Register map, |
3114 Register descriptors) { | 3131 Register descriptors) { |
3115 ldr(descriptors, | 3132 ldr(descriptors, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3156 void CodePatcher::EmitCondition(Condition cond) { | 3173 void CodePatcher::EmitCondition(Condition cond) { |
3157 Instr instr = Assembler::instr_at(masm_.pc_); | 3174 Instr instr = Assembler::instr_at(masm_.pc_); |
3158 instr = (instr & ~kCondMask) | cond; | 3175 instr = (instr & ~kCondMask) | cond; |
3159 masm_.emit(instr); | 3176 masm_.emit(instr); |
3160 } | 3177 } |
3161 | 3178 |
3162 | 3179 |
3163 } } // namespace v8::internal | 3180 } } // namespace v8::internal |
3164 | 3181 |
3165 #endif // V8_TARGET_ARCH_ARM | 3182 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |