| 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 2924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2935 | 2935 |
| 2936 // The following conversion will not work with numbers | 2936 // The following conversion will not work with numbers |
| 2937 // outside of ]-2^32, 2^32[. | 2937 // outside of ]-2^32, 2^32[. |
| 2938 DeoptimizeIf(ge, instr->environment(), scratch, | 2938 DeoptimizeIf(ge, instr->environment(), scratch, |
| 2939 Operand(HeapNumber::kExponentBias + 32)); | 2939 Operand(HeapNumber::kExponentBias + 32)); |
| 2940 | 2940 |
| 2941 // Save the original sign for later comparison. | 2941 // Save the original sign for later comparison. |
| 2942 __ And(scratch, result, Operand(HeapNumber::kSignMask)); | 2942 __ And(scratch, result, Operand(HeapNumber::kSignMask)); |
| 2943 | 2943 |
| 2944 __ Move(double_scratch0(), 0.5); | 2944 __ Move(double_scratch0(), 0.5); |
| 2945 __ add_d(input, input, double_scratch0()); | 2945 __ add_d(double_scratch0(), input, double_scratch0()); |
| 2946 | 2946 |
| 2947 // Check sign of the result: if the sign changed, the input | 2947 // Check sign of the result: if the sign changed, the input |
| 2948 // value was in ]0.5, 0[ and the result should be -0. | 2948 // value was in ]0.5, 0[ and the result should be -0. |
| 2949 __ mfc1(result, input.high()); | 2949 __ mfc1(result, double_scratch0().high()); |
| 2950 __ Xor(result, result, Operand(scratch)); | 2950 __ Xor(result, result, Operand(scratch)); |
| 2951 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 2951 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 2952 // ARM uses 'mi' here, which is 'lt' | 2952 // ARM uses 'mi' here, which is 'lt' |
| 2953 DeoptimizeIf(lt, instr->environment(), result, | 2953 DeoptimizeIf(lt, instr->environment(), result, |
| 2954 Operand(zero_reg)); | 2954 Operand(zero_reg)); |
| 2955 } else { | 2955 } else { |
| 2956 Label skip2; | 2956 Label skip2; |
| 2957 // ARM uses 'mi' here, which is 'lt' | 2957 // ARM uses 'mi' here, which is 'lt' |
| 2958 // Negating it results in 'ge' | 2958 // Negating it results in 'ge' |
| 2959 __ Branch(&skip2, ge, result, Operand(zero_reg)); | 2959 __ Branch(&skip2, ge, result, Operand(zero_reg)); |
| 2960 __ mov(result, zero_reg); | 2960 __ mov(result, zero_reg); |
| 2961 __ Branch(&done); | 2961 __ Branch(&done); |
| 2962 __ bind(&skip2); | 2962 __ bind(&skip2); |
| 2963 } | 2963 } |
| 2964 | 2964 |
| 2965 Register except_flag = scratch; | 2965 Register except_flag = scratch; |
| 2966 | 2966 |
| 2967 __ EmitFPUTruncate(kRoundToMinusInf, | 2967 __ EmitFPUTruncate(kRoundToMinusInf, |
| 2968 double_scratch0().low(), | 2968 double_scratch0().low(), |
| 2969 input, | 2969 double_scratch0(), |
| 2970 result, | 2970 result, |
| 2971 except_flag); | 2971 except_flag); |
| 2972 | 2972 |
| 2973 DeoptimizeIf(ne, instr->environment(), except_flag, Operand(zero_reg)); | 2973 DeoptimizeIf(ne, instr->environment(), except_flag, Operand(zero_reg)); |
| 2974 | 2974 |
| 2975 __ mfc1(result, double_scratch0().low()); | 2975 __ mfc1(result, double_scratch0().low()); |
| 2976 | 2976 |
| 2977 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 2977 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 2978 // Test for -0. | 2978 // Test for -0. |
| 2979 __ Branch(&done, ne, result, Operand(zero_reg)); | 2979 __ Branch(&done, ne, result, Operand(zero_reg)); |
| (...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4642 ASSERT(!environment->HasBeenRegistered()); | 4642 ASSERT(!environment->HasBeenRegistered()); |
| 4643 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 4643 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
| 4644 ASSERT(osr_pc_offset_ == -1); | 4644 ASSERT(osr_pc_offset_ == -1); |
| 4645 osr_pc_offset_ = masm()->pc_offset(); | 4645 osr_pc_offset_ = masm()->pc_offset(); |
| 4646 } | 4646 } |
| 4647 | 4647 |
| 4648 | 4648 |
| 4649 #undef __ | 4649 #undef __ |
| 4650 | 4650 |
| 4651 } } // namespace v8::internal | 4651 } } // namespace v8::internal |
| OLD | NEW |