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 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 const double src2, | 782 const double src2, |
783 const Register fpscr_flags, | 783 const Register fpscr_flags, |
784 const Condition cond) { | 784 const Condition cond) { |
785 // Compare and load FPSCR. | 785 // Compare and load FPSCR. |
786 vcmp(src1, src2, cond); | 786 vcmp(src1, src2, cond); |
787 vmrs(fpscr_flags, cond); | 787 vmrs(fpscr_flags, cond); |
788 } | 788 } |
789 | 789 |
790 void MacroAssembler::Vmov(const DwVfpRegister dst, | 790 void MacroAssembler::Vmov(const DwVfpRegister dst, |
791 const double imm, | 791 const double imm, |
792 const Register scratch, | |
793 const Condition cond) { | 792 const Condition cond) { |
794 ASSERT(CpuFeatures::IsEnabled(VFP2)); | 793 ASSERT(CpuFeatures::IsEnabled(VFP2)); |
795 static const DoubleRepresentation minus_zero(-0.0); | 794 static const DoubleRepresentation minus_zero(-0.0); |
796 static const DoubleRepresentation zero(0.0); | 795 static const DoubleRepresentation zero(0.0); |
797 DoubleRepresentation value(imm); | 796 DoubleRepresentation value(imm); |
798 // Handle special values first. | 797 // Handle special values first. |
799 if (value.bits == zero.bits) { | 798 if (value.bits == zero.bits) { |
800 vmov(dst, kDoubleRegZero, cond); | 799 vmov(dst, kDoubleRegZero, cond); |
801 } else if (value.bits == minus_zero.bits) { | 800 } else if (value.bits == minus_zero.bits) { |
802 vneg(dst, kDoubleRegZero, cond); | 801 vneg(dst, kDoubleRegZero, cond); |
803 } else { | 802 } else { |
804 vmov(dst, imm, scratch, cond); | 803 vmov(dst, imm, cond); |
805 } | 804 } |
806 } | 805 } |
807 | 806 |
808 | 807 |
809 void MacroAssembler::EnterFrame(StackFrame::Type type) { | 808 void MacroAssembler::EnterFrame(StackFrame::Type type) { |
810 // r0-r3: preserved | 809 // r0-r3: preserved |
811 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); | 810 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); |
812 mov(ip, Operand(Smi::FromInt(type))); | 811 mov(ip, Operand(Smi::FromInt(type))); |
813 push(ip); | 812 push(ip); |
814 mov(ip, Operand(CodeObject())); | 813 mov(ip, Operand(CodeObject())); |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1981 Operand(key_reg, LSL, kDoubleSizeLog2 - kSmiTagSize)); | 1980 Operand(key_reg, LSL, kDoubleSizeLog2 - kSmiTagSize)); |
1982 // scratch1 is now effective address of the double element | 1981 // scratch1 is now effective address of the double element |
1983 | 1982 |
1984 FloatingPointHelper::Destination destination; | 1983 FloatingPointHelper::Destination destination; |
1985 if (CpuFeatures::IsSupported(VFP2)) { | 1984 if (CpuFeatures::IsSupported(VFP2)) { |
1986 destination = FloatingPointHelper::kVFPRegisters; | 1985 destination = FloatingPointHelper::kVFPRegisters; |
1987 } else { | 1986 } else { |
1988 destination = FloatingPointHelper::kCoreRegisters; | 1987 destination = FloatingPointHelper::kCoreRegisters; |
1989 } | 1988 } |
1990 | 1989 |
1991 Register untagged_value = elements_reg; | 1990 Register untagged_value = receiver_reg; |
1992 SmiUntag(untagged_value, value_reg); | 1991 SmiUntag(untagged_value, value_reg); |
1993 FloatingPointHelper::ConvertIntToDouble(this, | 1992 FloatingPointHelper::ConvertIntToDouble(this, |
1994 untagged_value, | 1993 untagged_value, |
1995 destination, | 1994 destination, |
1996 d0, | 1995 d0, |
1997 mantissa_reg, | 1996 mantissa_reg, |
1998 exponent_reg, | 1997 exponent_reg, |
1999 scratch4, | 1998 scratch4, |
2000 s2); | 1999 s2); |
2001 if (destination == FloatingPointHelper::kVFPRegisters) { | 2000 if (destination == FloatingPointHelper::kVFPRegisters) { |
(...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3670 Vmov(temp_double_reg, 0.0); | 3669 Vmov(temp_double_reg, 0.0); |
3671 VFPCompareAndSetFlags(input_reg, temp_double_reg); | 3670 VFPCompareAndSetFlags(input_reg, temp_double_reg); |
3672 b(gt, &above_zero); | 3671 b(gt, &above_zero); |
3673 | 3672 |
3674 // Double value is less than zero, NaN or Inf, return 0. | 3673 // Double value is less than zero, NaN or Inf, return 0. |
3675 mov(result_reg, Operand(0)); | 3674 mov(result_reg, Operand(0)); |
3676 b(al, &done); | 3675 b(al, &done); |
3677 | 3676 |
3678 // Double value is >= 255, return 255. | 3677 // Double value is >= 255, return 255. |
3679 bind(&above_zero); | 3678 bind(&above_zero); |
3680 Vmov(temp_double_reg, 255.0, result_reg); | 3679 Vmov(temp_double_reg, 255.0); |
3681 VFPCompareAndSetFlags(input_reg, temp_double_reg); | 3680 VFPCompareAndSetFlags(input_reg, temp_double_reg); |
3682 b(le, &in_bounds); | 3681 b(le, &in_bounds); |
3683 mov(result_reg, Operand(255)); | 3682 mov(result_reg, Operand(255)); |
3684 b(al, &done); | 3683 b(al, &done); |
3685 | 3684 |
3686 // In 0-255 range, round and truncate. | 3685 // In 0-255 range, round and truncate. |
3687 bind(&in_bounds); | 3686 bind(&in_bounds); |
3688 // Save FPSCR. | 3687 // Save FPSCR. |
3689 vmrs(ip); | 3688 vmrs(ip); |
3690 // Set rounding mode to round to the nearest integer by clearing bits[23:22]. | 3689 // Set rounding mode to round to the nearest integer by clearing bits[23:22]. |
3691 bic(result_reg, ip, Operand(kVFPRoundingModeMask)); | 3690 bic(result_reg, ip, Operand(kVFPRoundingModeMask)); |
3692 vmsr(result_reg); | 3691 vmsr(result_reg); |
3693 vcvt_s32_f64(input_reg.low(), input_reg, kFPSCRRounding); | 3692 vcvt_s32_f64(input_reg.low(), input_reg, kFPSCRRounding); |
3694 vmov(result_reg, input_reg.low()); | 3693 vmov(result_reg, input_reg.low()); |
3695 // Restore FPSCR. | 3694 // Restore FPSCR. |
3696 vmsr(ip); | 3695 vmsr(ip); |
3697 bind(&done); | 3696 bind(&done); |
3698 } | 3697 } |
3699 | 3698 |
3700 | 3699 |
3701 void MacroAssembler::LoadInstanceDescriptors(Register map, | 3700 void MacroAssembler::LoadInstanceDescriptors(Register map, |
3702 Register descriptors, | 3701 Register descriptors, |
3703 Register scratch) { | 3702 Register scratch) { |
3704 Register temp = descriptors; | 3703 Register temp = descriptors; |
3705 ldr(temp, FieldMemOperand(map, Map::kTransitionsOrBackPointerOffset)); | 3704 ldr(temp, FieldMemOperand(map, Map::kTransitionsOrBackPointerOffset)); |
3706 | 3705 |
3707 Label ok, fail, load_from_back_pointer; | 3706 Label ok, fail; |
3708 CheckMap(temp, | 3707 CheckMap(temp, |
3709 scratch, | 3708 scratch, |
3710 isolate()->factory()->fixed_array_map(), | 3709 isolate()->factory()->fixed_array_map(), |
3711 &fail, | 3710 &fail, |
3712 DONT_DO_SMI_CHECK); | 3711 DONT_DO_SMI_CHECK); |
3713 ldr(temp, FieldMemOperand(temp, TransitionArray::kDescriptorsPointerOffset)); | 3712 ldr(descriptors, FieldMemOperand(temp, TransitionArray::kDescriptorsOffset)); |
3714 ldr(descriptors, FieldMemOperand(temp, JSGlobalPropertyCell::kValueOffset)); | |
3715 jmp(&ok); | 3713 jmp(&ok); |
3716 | |
3717 bind(&fail); | 3714 bind(&fail); |
3718 CompareRoot(temp, Heap::kUndefinedValueRootIndex); | |
3719 b(ne, &load_from_back_pointer); | |
3720 mov(descriptors, Operand(FACTORY->empty_descriptor_array())); | 3715 mov(descriptors, Operand(FACTORY->empty_descriptor_array())); |
3721 jmp(&ok); | |
3722 | |
3723 bind(&load_from_back_pointer); | |
3724 ldr(temp, FieldMemOperand(temp, Map::kTransitionsOrBackPointerOffset)); | |
3725 ldr(temp, FieldMemOperand(temp, TransitionArray::kDescriptorsPointerOffset)); | |
3726 ldr(descriptors, FieldMemOperand(temp, JSGlobalPropertyCell::kValueOffset)); | |
3727 | |
3728 bind(&ok); | 3716 bind(&ok); |
3729 } | 3717 } |
3730 | 3718 |
3731 | 3719 |
3732 void MacroAssembler::NumberOfOwnDescriptors(Register dst, Register map) { | |
3733 ldr(dst, FieldMemOperand(map, Map::kBitField3Offset)); | |
3734 DecodeField<Map::NumberOfOwnDescriptorsBits>(dst); | |
3735 } | |
3736 | |
3737 | |
3738 void MacroAssembler::EnumLength(Register dst, Register map) { | 3720 void MacroAssembler::EnumLength(Register dst, Register map) { |
3739 STATIC_ASSERT(Map::EnumLengthBits::kShift == 0); | 3721 STATIC_ASSERT(Map::EnumLengthBits::kShift == 0); |
3740 ldr(dst, FieldMemOperand(map, Map::kBitField3Offset)); | 3722 ldr(dst, FieldMemOperand(map, Map::kBitField3Offset)); |
3741 and_(dst, dst, Operand(Smi::FromInt(Map::EnumLengthBits::kMask))); | 3723 and_(dst, dst, Operand(Smi::FromInt(Map::EnumLengthBits::kMask))); |
3742 } | 3724 } |
3743 | 3725 |
3744 | 3726 |
3745 void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) { | 3727 void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) { |
3746 Register empty_fixed_array_value = r6; | 3728 Register empty_fixed_array_value = r6; |
3747 LoadRoot(empty_fixed_array_value, Heap::kEmptyFixedArrayRootIndex); | 3729 LoadRoot(empty_fixed_array_value, Heap::kEmptyFixedArrayRootIndex); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3839 void CodePatcher::EmitCondition(Condition cond) { | 3821 void CodePatcher::EmitCondition(Condition cond) { |
3840 Instr instr = Assembler::instr_at(masm_.pc_); | 3822 Instr instr = Assembler::instr_at(masm_.pc_); |
3841 instr = (instr & ~kCondMask) | cond; | 3823 instr = (instr & ~kCondMask) | cond; |
3842 masm_.emit(instr); | 3824 masm_.emit(instr); |
3843 } | 3825 } |
3844 | 3826 |
3845 | 3827 |
3846 } } // namespace v8::internal | 3828 } } // namespace v8::internal |
3847 | 3829 |
3848 #endif // V8_TARGET_ARCH_ARM | 3830 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |