| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include <setjmp.h> | 5 #include <setjmp.h> |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 | 7 |
| 8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
| 9 #if defined(TARGET_ARCH_ARM) | 9 #if defined(TARGET_ARCH_ARM) |
| 10 | 10 |
| (...skipping 2826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2837 } | 2837 } |
| 2838 } else { | 2838 } else { |
| 2839 UnimplementedInstruction(instr); | 2839 UnimplementedInstruction(instr); |
| 2840 } | 2840 } |
| 2841 } | 2841 } |
| 2842 | 2842 |
| 2843 | 2843 |
| 2844 static float arm_reciprocal_sqrt_estimate(float a) { | 2844 static float arm_reciprocal_sqrt_estimate(float a) { |
| 2845 // From the ARM Architecture Reference Manual A2-87. | 2845 // From the ARM Architecture Reference Manual A2-87. |
| 2846 if (isinf(a) || (fabs(a) >= exp2f(126))) return 0.0; | 2846 if (isinf(a) || (fabs(a) >= exp2f(126))) return 0.0; |
| 2847 else if (a == 0.0) return INFINITY; | 2847 else if (a == 0.0) return kPosInfinity; |
| 2848 else if (isnan(a)) return a; | 2848 else if (isnan(a)) return a; |
| 2849 | 2849 |
| 2850 uint32_t a_bits = bit_cast<uint32_t, float>(a); | 2850 uint32_t a_bits = bit_cast<uint32_t, float>(a); |
| 2851 uint64_t scaled; | 2851 uint64_t scaled; |
| 2852 if (((a_bits >> 23) & 1) != 0) { | 2852 if (((a_bits >> 23) & 1) != 0) { |
| 2853 // scaled = '0 01111111101' : operand<22:0> : Zeros(29) | 2853 // scaled = '0 01111111101' : operand<22:0> : Zeros(29) |
| 2854 scaled = (static_cast<uint64_t>(0x3fd) << 52) | | 2854 scaled = (static_cast<uint64_t>(0x3fd) << 52) | |
| 2855 ((static_cast<uint64_t>(a_bits) & 0x7fffff) << 29); | 2855 ((static_cast<uint64_t>(a_bits) & 0x7fffff) << 29); |
| 2856 } else { | 2856 } else { |
| 2857 // scaled = '0 01111111110' : operand<22:0> : Zeros(29) | 2857 // scaled = '0 01111111110' : operand<22:0> : Zeros(29) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2888 // result = 0 : result_exp<7:0> : estimate<51:29> | 2888 // result = 0 : result_exp<7:0> : estimate<51:29> |
| 2889 int32_t result_bits = ((result_exp & 0xff) << 23) | | 2889 int32_t result_bits = ((result_exp & 0xff) << 23) | |
| 2890 ((bit_cast<uint64_t, double>(estimate) >> 29) & 0x7fffff); | 2890 ((bit_cast<uint64_t, double>(estimate) >> 29) & 0x7fffff); |
| 2891 return bit_cast<float, int32_t>(result_bits); | 2891 return bit_cast<float, int32_t>(result_bits); |
| 2892 } | 2892 } |
| 2893 | 2893 |
| 2894 | 2894 |
| 2895 static float arm_recip_estimate(float a) { | 2895 static float arm_recip_estimate(float a) { |
| 2896 // From the ARM Architecture Reference Manual A2-85. | 2896 // From the ARM Architecture Reference Manual A2-85. |
| 2897 if (isinf(a) || (fabs(a) >= exp2f(126))) return 0.0; | 2897 if (isinf(a) || (fabs(a) >= exp2f(126))) return 0.0; |
| 2898 else if (a == 0.0) return INFINITY; | 2898 else if (a == 0.0) return kPosInfinity; |
| 2899 else if (isnan(a)) return a; | 2899 else if (isnan(a)) return a; |
| 2900 | 2900 |
| 2901 uint32_t a_bits = bit_cast<uint32_t, float>(a); | 2901 uint32_t a_bits = bit_cast<uint32_t, float>(a); |
| 2902 // scaled = '0011 1111 1110' : a<22:0> : Zeros(29) | 2902 // scaled = '0011 1111 1110' : a<22:0> : Zeros(29) |
| 2903 uint64_t scaled = (static_cast<uint64_t>(0x3fe) << 52) | | 2903 uint64_t scaled = (static_cast<uint64_t>(0x3fe) << 52) | |
| 2904 ((static_cast<uint64_t>(a_bits) & 0x7fffff) << 29); | 2904 ((static_cast<uint64_t>(a_bits) & 0x7fffff) << 29); |
| 2905 // result_exp = 253 - UInt(a<30:23>) | 2905 // result_exp = 253 - UInt(a<30:23>) |
| 2906 int32_t result_exp = 253 - ((a_bits >> 23) & 0xff); | 2906 int32_t result_exp = 253 - ((a_bits >> 23) & 0xff); |
| 2907 ASSERT((result_exp >= 1) && (result_exp <= 252)); | 2907 ASSERT((result_exp >= 1) && (result_exp <= 252)); |
| 2908 | 2908 |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3722 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); | 3722 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); |
| 3723 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); | 3723 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); |
| 3724 buf->Longjmp(); | 3724 buf->Longjmp(); |
| 3725 } | 3725 } |
| 3726 | 3726 |
| 3727 } // namespace dart | 3727 } // namespace dart |
| 3728 | 3728 |
| 3729 #endif // !defined(HOST_ARCH_ARM) | 3729 #endif // !defined(HOST_ARCH_ARM) |
| 3730 | 3730 |
| 3731 #endif // defined TARGET_ARCH_ARM | 3731 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |