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 2843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2854 } | 2854 } |
2855 | 2855 |
2856 | 2856 |
2857 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { | 2857 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { |
2858 DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); | 2858 DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); |
2859 ASSERT(ToDoubleRegister(instr->result()).is(input)); | 2859 ASSERT(ToDoubleRegister(instr->result()).is(input)); |
2860 __ vsqrt(input, input); | 2860 __ vsqrt(input, input); |
2861 } | 2861 } |
2862 | 2862 |
2863 | 2863 |
2864 void LCodeGen::DoPower(LPower* instr) { | |
2865 LOperand* left = instr->InputAt(0); | |
2866 LOperand* right = instr->InputAt(1); | |
2867 Register scratch = scratch0(); | |
2868 DoubleRegister result_reg = ToDoubleRegister(instr->result()); | |
2869 Representation exponent_type = instr->hydrogen()->right()->representation(); | |
2870 if (exponent_type.IsDouble()) { | |
2871 // Save r0-r3 on the stack, prepare arguments and call C function. | |
2872 __ stm(db_w, sp, r0.bit() | r1.bit() | r2.bit() | r3.bit()); | |
Søren Thygesen Gjesse
2011/02/17 09:59:56
As discussed off-line this saving is not needed.
Karl Klose
2011/02/21 13:34:59
Done.
| |
2873 __ PrepareCallCFunction(4, scratch); | |
2874 __ vmov(r0, r1, ToDoubleRegister(left)); | |
2875 __ vmov(r2, r3, ToDoubleRegister(right)); | |
2876 __ CallCFunction(ExternalReference::power_double_double_function(), 4); | |
2877 } else if (exponent_type.IsInteger32()) { | |
2878 ASSERT(ToRegister(right).is(r0)); | |
2879 // Save r0-r3 on the stack, prepare arguments and call C function. | |
2880 __ stm(db_w, sp, r0.bit() | r1.bit() | r2.bit() | r3.bit()); | |
Søren Thygesen Gjesse
2011/02/17 09:59:56
Ditto.
Karl Klose
2011/02/21 13:34:59
Done.
| |
2881 __ PrepareCallCFunction(4, scratch); | |
2882 __ mov(r2, ToRegister(right)); | |
2883 __ vmov(r0, r1, ToDoubleRegister(left)); | |
2884 __ CallCFunction(ExternalReference::power_double_int_function(), 4); | |
2885 } else { | |
2886 ASSERT(exponent_type.IsTagged()); | |
2887 ASSERT(instr->hydrogen()->left()->representation().IsDouble()); | |
2888 ASSERT(CpuFeatures::IsSupported(VFP3)); | |
Søren Thygesen Gjesse
2011/02/17 09:59:56
Crankshaft implies VFP3, and we are already in a V
Karl Klose
2011/02/21 13:34:59
Done.
| |
2889 | |
2890 Register right_reg = ToRegister(right); | |
2891 | |
2892 // Check for smi on the right hand side. | |
2893 Label non_smi, call; | |
Søren Thygesen Gjesse
2011/02/17 09:59:56
Please use JumpIfNotSmi.
Karl Klose
2011/02/21 13:34:59
Done.
| |
2894 __ tst(right_reg, Operand(kSmiTagMask)); | |
2895 __ b(ne, &non_smi); | |
2896 | |
2897 // Untag smi and convert it to a double. | |
2898 __ SmiUntag(right_reg); | |
2899 SwVfpRegister single_scratch = double_scratch0().low(); | |
2900 __ vmov(single_scratch, right_reg); | |
2901 __ vcvt_f64_s32(result_reg, single_scratch); | |
2902 __ jmp(&call); | |
2903 | |
2904 // Heap number map check. | |
2905 __ bind(&non_smi); | |
2906 __ ldr(scratch, FieldMemOperand(right_reg, HeapObject::kMapOffset)); | |
2907 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | |
2908 __ cmp(scratch, Operand(ip)); | |
2909 DeoptimizeIf(ne, instr->environment()); | |
2910 int32_t value_offset = HeapNumber::kValueOffset - kHeapObjectTag; | |
2911 __ add(scratch, right_reg, Operand(value_offset), LeaveCC); | |
Søren Thygesen Gjesse
2011/02/17 09:59:56
LeaveCC is default for add.
Karl Klose
2011/02/21 13:34:59
Done.
| |
2912 __ vldr(result_reg, scratch, 0); | |
2913 | |
2914 // Save r0-r3 on the stack, prepare arguments and call C function. | |
2915 __ bind(&call); | |
2916 __ stm(db_w, sp, r0.bit() | r1.bit() | r2.bit() | r3.bit()); | |
2917 __ PrepareCallCFunction(4, scratch); | |
2918 __ vmov(r0, r1, ToDoubleRegister(left)); | |
2919 __ vmov(r2, r3, result_reg); | |
2920 __ CallCFunction(ExternalReference::power_double_double_function(), 4); | |
2921 } | |
2922 // Store the result in the result register and restore r0-r3. | |
Søren Thygesen Gjesse
2011/02/17 09:59:56
We need to support non USE_ARM_EABI, where fp resu
Karl Klose
2011/02/21 13:34:59
Implemented MacroAssembler::GetCFunctionDoubleResu
| |
2923 __ vmov(result_reg, r0, r1); | |
2924 __ ldm(ia_w, sp, r0.bit() | r1.bit() | r2.bit() | r3.bit()); | |
2925 } | |
2926 | |
2927 | |
2864 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) { | 2928 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) { |
2865 switch (instr->op()) { | 2929 switch (instr->op()) { |
2866 case kMathAbs: | 2930 case kMathAbs: |
2867 DoMathAbs(instr); | 2931 DoMathAbs(instr); |
2868 break; | 2932 break; |
2869 case kMathFloor: | 2933 case kMathFloor: |
2870 DoMathFloor(instr); | 2934 DoMathFloor(instr); |
2871 break; | 2935 break; |
2872 case kMathSqrt: | 2936 case kMathSqrt: |
2873 DoMathSqrt(instr); | 2937 DoMathSqrt(instr); |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3967 ASSERT(!environment->HasBeenRegistered()); | 4031 ASSERT(!environment->HasBeenRegistered()); |
3968 RegisterEnvironmentForDeoptimization(environment); | 4032 RegisterEnvironmentForDeoptimization(environment); |
3969 ASSERT(osr_pc_offset_ == -1); | 4033 ASSERT(osr_pc_offset_ == -1); |
3970 osr_pc_offset_ = masm()->pc_offset(); | 4034 osr_pc_offset_ = masm()->pc_offset(); |
3971 } | 4035 } |
3972 | 4036 |
3973 | 4037 |
3974 #undef __ | 4038 #undef __ |
3975 | 4039 |
3976 } } // namespace v8::internal | 4040 } } // namespace v8::internal |
OLD | NEW |