OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdarg.h> | 5 #include <stdarg.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 2942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2953 } else if (instr->Opc3Value() == 0x0) { | 2953 } else if (instr->Opc3Value() == 0x0) { |
2954 // vmov immediate. | 2954 // vmov immediate. |
2955 if (instr->SzValue() == 0x1) { | 2955 if (instr->SzValue() == 0x1) { |
2956 set_d_register_from_double(vd, instr->DoubleImmedVmov()); | 2956 set_d_register_from_double(vd, instr->DoubleImmedVmov()); |
2957 } else { | 2957 } else { |
2958 UNREACHABLE(); // Not used by v8. | 2958 UNREACHABLE(); // Not used by v8. |
2959 } | 2959 } |
2960 } else if (((instr->Opc2Value() == 0x6)) && (instr->Opc3Value() == 0x3)) { | 2960 } else if (((instr->Opc2Value() == 0x6)) && (instr->Opc3Value() == 0x3)) { |
2961 // vrintz - truncate | 2961 // vrintz - truncate |
2962 double dm_value = get_double_from_d_register(vm); | 2962 double dm_value = get_double_from_d_register(vm); |
2963 double dd_value = std::trunc(dm_value); | 2963 double dd_value = trunc(dm_value); |
2964 dd_value = canonicalizeNaN(dd_value); | 2964 dd_value = canonicalizeNaN(dd_value); |
2965 set_d_register_from_double(vd, dd_value); | 2965 set_d_register_from_double(vd, dd_value); |
2966 } else { | 2966 } else { |
2967 UNREACHABLE(); // Not used by V8. | 2967 UNREACHABLE(); // Not used by V8. |
2968 } | 2968 } |
2969 } else if (instr->Opc1Value() == 0x3) { | 2969 } else if (instr->Opc1Value() == 0x3) { |
2970 if (instr->SzValue() != 0x1) { | 2970 if (instr->SzValue() != 0x1) { |
2971 UNREACHABLE(); // Not used by V8. | 2971 UNREACHABLE(); // Not used by V8. |
2972 } | 2972 } |
2973 | 2973 |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3617 if (instr->Opc1Value() == 0x7 && instr->Opc3Value() == 0x1 && | 3617 if (instr->Opc1Value() == 0x7 && instr->Opc3Value() == 0x1 && |
3618 instr->Bits(11, 9) == 0x5 && instr->Bits(19, 18) == 0x2 && | 3618 instr->Bits(11, 9) == 0x5 && instr->Bits(19, 18) == 0x2 && |
3619 instr->Bit(8) == 0x1) { | 3619 instr->Bit(8) == 0x1) { |
3620 int vm = instr->VFPMRegValue(kDoublePrecision); | 3620 int vm = instr->VFPMRegValue(kDoublePrecision); |
3621 int vd = instr->VFPDRegValue(kDoublePrecision); | 3621 int vd = instr->VFPDRegValue(kDoublePrecision); |
3622 double dm_value = get_double_from_d_register(vm); | 3622 double dm_value = get_double_from_d_register(vm); |
3623 double dd_value = 0.0; | 3623 double dd_value = 0.0; |
3624 int rounding_mode = instr->Bits(17, 16); | 3624 int rounding_mode = instr->Bits(17, 16); |
3625 switch (rounding_mode) { | 3625 switch (rounding_mode) { |
3626 case 0x0: // vrinta - round with ties to away from zero | 3626 case 0x0: // vrinta - round with ties to away from zero |
3627 dd_value = std::round(dm_value); | 3627 dd_value = round(dm_value); |
3628 break; | 3628 break; |
3629 case 0x1: { // vrintn - round with ties to even | 3629 case 0x1: { // vrintn - round with ties to even |
3630 dd_value = std::floor(dm_value); | 3630 dd_value = std::floor(dm_value); |
3631 double error = dm_value - dd_value; | 3631 double error = dm_value - dd_value; |
3632 // Take care of correctly handling the range [-0.5, -0.0], which | 3632 // Take care of correctly handling the range [-0.5, -0.0], which |
3633 // must yield -0.0. | 3633 // must yield -0.0. |
3634 if ((-0.5 <= dm_value) && (dm_value < 0.0)) { | 3634 if ((-0.5 <= dm_value) && (dm_value < 0.0)) { |
3635 dd_value = -0.0; | 3635 dd_value = -0.0; |
3636 // If the error is greater than 0.5, or is equal to 0.5 and the | 3636 // If the error is greater than 0.5, or is equal to 0.5 and the |
3637 // integer result is odd, round up. | 3637 // integer result is odd, round up. |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3900 uintptr_t address = *stack_slot; | 3900 uintptr_t address = *stack_slot; |
3901 set_register(sp, current_sp + sizeof(uintptr_t)); | 3901 set_register(sp, current_sp + sizeof(uintptr_t)); |
3902 return address; | 3902 return address; |
3903 } | 3903 } |
3904 | 3904 |
3905 } } // namespace v8::internal | 3905 } } // namespace v8::internal |
3906 | 3906 |
3907 #endif // USE_SIMULATOR | 3907 #endif // USE_SIMULATOR |
3908 | 3908 |
3909 #endif // V8_TARGET_ARCH_ARM | 3909 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |