OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <cmath> | 6 #include <cmath> |
7 #include <cstdarg> | 7 #include <cstdarg> |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #if V8_TARGET_ARCH_ARM64 | 10 #if V8_TARGET_ARCH_ARM64 |
(...skipping 2445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2456 case FNEG_s: set_sreg(fd, -sreg(fn)); break; | 2456 case FNEG_s: set_sreg(fd, -sreg(fn)); break; |
2457 case FNEG_d: set_dreg(fd, -dreg(fn)); break; | 2457 case FNEG_d: set_dreg(fd, -dreg(fn)); break; |
2458 case FSQRT_s: set_sreg(fd, FPSqrt(sreg(fn))); break; | 2458 case FSQRT_s: set_sreg(fd, FPSqrt(sreg(fn))); break; |
2459 case FSQRT_d: set_dreg(fd, FPSqrt(dreg(fn))); break; | 2459 case FSQRT_d: set_dreg(fd, FPSqrt(dreg(fn))); break; |
2460 case FRINTA_s: set_sreg(fd, FPRoundInt(sreg(fn), FPTieAway)); break; | 2460 case FRINTA_s: set_sreg(fd, FPRoundInt(sreg(fn), FPTieAway)); break; |
2461 case FRINTA_d: set_dreg(fd, FPRoundInt(dreg(fn), FPTieAway)); break; | 2461 case FRINTA_d: set_dreg(fd, FPRoundInt(dreg(fn), FPTieAway)); break; |
2462 case FRINTM_s: | 2462 case FRINTM_s: |
2463 set_sreg(fd, FPRoundInt(sreg(fn), FPNegativeInfinity)); break; | 2463 set_sreg(fd, FPRoundInt(sreg(fn), FPNegativeInfinity)); break; |
2464 case FRINTM_d: | 2464 case FRINTM_d: |
2465 set_dreg(fd, FPRoundInt(dreg(fn), FPNegativeInfinity)); break; | 2465 set_dreg(fd, FPRoundInt(dreg(fn), FPNegativeInfinity)); break; |
| 2466 case FRINTP_s: |
| 2467 set_sreg(fd, FPRoundInt(sreg(fn), FPPositiveInfinity)); |
| 2468 break; |
| 2469 case FRINTP_d: |
| 2470 set_dreg(fd, FPRoundInt(dreg(fn), FPPositiveInfinity)); |
| 2471 break; |
2466 case FRINTN_s: set_sreg(fd, FPRoundInt(sreg(fn), FPTieEven)); break; | 2472 case FRINTN_s: set_sreg(fd, FPRoundInt(sreg(fn), FPTieEven)); break; |
2467 case FRINTN_d: set_dreg(fd, FPRoundInt(dreg(fn), FPTieEven)); break; | 2473 case FRINTN_d: set_dreg(fd, FPRoundInt(dreg(fn), FPTieEven)); break; |
2468 case FRINTZ_s: set_sreg(fd, FPRoundInt(sreg(fn), FPZero)); break; | 2474 case FRINTZ_s: set_sreg(fd, FPRoundInt(sreg(fn), FPZero)); break; |
2469 case FRINTZ_d: set_dreg(fd, FPRoundInt(dreg(fn), FPZero)); break; | 2475 case FRINTZ_d: set_dreg(fd, FPRoundInt(dreg(fn), FPZero)); break; |
2470 case FCVT_ds: set_dreg(fd, FPToDouble(sreg(fn))); break; | 2476 case FCVT_ds: set_dreg(fd, FPToDouble(sreg(fn))); break; |
2471 case FCVT_sd: set_sreg(fd, FPToFloat(dreg(fn), FPTieEven)); break; | 2477 case FCVT_sd: set_sreg(fd, FPToFloat(dreg(fn), FPTieEven)); break; |
2472 default: UNIMPLEMENTED(); | 2478 default: UNIMPLEMENTED(); |
2473 } | 2479 } |
2474 } | 2480 } |
2475 | 2481 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2760 // otherwise, ceil(value) | 2766 // otherwise, ceil(value) |
2761 if (value < 0) { | 2767 if (value < 0) { |
2762 int_result = ceil(value); | 2768 int_result = ceil(value); |
2763 } | 2769 } |
2764 break; | 2770 break; |
2765 } | 2771 } |
2766 case FPNegativeInfinity: { | 2772 case FPNegativeInfinity: { |
2767 // We always use floor(value). | 2773 // We always use floor(value). |
2768 break; | 2774 break; |
2769 } | 2775 } |
| 2776 case FPPositiveInfinity: { |
| 2777 int_result = ceil(value); |
| 2778 break; |
| 2779 } |
2770 default: UNIMPLEMENTED(); | 2780 default: UNIMPLEMENTED(); |
2771 } | 2781 } |
2772 return int_result; | 2782 return int_result; |
2773 } | 2783 } |
2774 | 2784 |
2775 | 2785 |
2776 double Simulator::FPToDouble(float value) { | 2786 double Simulator::FPToDouble(float value) { |
2777 switch (std::fpclassify(value)) { | 2787 switch (std::fpclassify(value)) { |
2778 case FP_NAN: { | 2788 case FP_NAN: { |
2779 if (fpcr().DN()) return kFP64DefaultNaN; | 2789 if (fpcr().DN()) return kFP64DefaultNaN; |
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3820 | 3830 |
3821 delete[] format; | 3831 delete[] format; |
3822 } | 3832 } |
3823 | 3833 |
3824 | 3834 |
3825 #endif // USE_SIMULATOR | 3835 #endif // USE_SIMULATOR |
3826 | 3836 |
3827 } } // namespace v8::internal | 3837 } } // namespace v8::internal |
3828 | 3838 |
3829 #endif // V8_TARGET_ARCH_ARM64 | 3839 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |