| 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> // NOLINT | 5 #include <setjmp.h> // NOLINT |
| 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_MIPS) | 9 #if defined(TARGET_ARCH_MIPS) |
| 10 | 10 |
| (...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1881 set_fcsr_bit(fcsr_cc, (fs_val <= ft_val)); | 1881 set_fcsr_bit(fcsr_cc, (fs_val <= ft_val)); |
| 1882 break; | 1882 break; |
| 1883 } | 1883 } |
| 1884 case COP1_C_ULE: { | 1884 case COP1_C_ULE: { |
| 1885 ASSERT(instr->FormatField() == FMT_D); // Only D supported. | 1885 ASSERT(instr->FormatField() == FMT_D); // Only D supported. |
| 1886 ASSERT(instr->FdField() == F0); | 1886 ASSERT(instr->FdField() == F0); |
| 1887 set_fcsr_bit(fcsr_cc, | 1887 set_fcsr_bit(fcsr_cc, |
| 1888 (fs_val <= ft_val) || isnan(fs_val) || isnan(ft_val)); | 1888 (fs_val <= ft_val) || isnan(fs_val) || isnan(ft_val)); |
| 1889 break; | 1889 break; |
| 1890 } | 1890 } |
| 1891 case COP1_CVT_D: { | 1891 case COP1_TRUNC_W: { |
| 1892 switch (instr->FormatField()) { | 1892 switch (instr->FormatField()) { |
| 1893 case FMT_W: { | 1893 case FMT_D: { |
| 1894 int32_t fs_int = get_fregister(instr->FsField()); | 1894 double fs_dbl = get_fregister_double(instr->FsField()); |
| 1895 double fs_dbl = static_cast<double>(fs_int); | 1895 int32_t fs_int; |
| 1896 set_fregister_double(instr->FdField(), fs_dbl); | 1896 if (isnan(fs_dbl) || isinf(fs_dbl) || (fs_dbl > kMaxInt32) || |
| 1897 break; | 1897 (fs_dbl < kMinInt32)) { |
| 1898 } | 1898 fs_int = kMaxInt32; |
| 1899 case FMT_S: { | 1899 } else { |
| 1900 float fs_flt = get_fregister_float(instr->FsField()); | 1900 fs_int = static_cast<int32_t>(fs_dbl); |
| 1901 double fs_dbl = static_cast<double>(fs_flt); | 1901 } |
| 1902 set_fregister_double(instr->FdField(), fs_dbl); | 1902 set_fregister(instr->FdField(), fs_int); |
| 1903 break; | |
| 1904 } | |
| 1905 case FMT_L: { | |
| 1906 int64_t fs_int = get_fregister_long(instr->FsField()); | |
| 1907 double fs_dbl = static_cast<double>(fs_int); | |
| 1908 set_fregister_double(instr->FdField(), fs_dbl); | |
| 1909 break; | 1903 break; |
| 1910 } | 1904 } |
| 1911 default: { | 1905 default: { |
| 1912 OS::PrintErr("DecodeCop1: 0x%x\n", instr->InstructionBits()); | 1906 OS::PrintErr("DecodeCop1: 0x%x\n", instr->InstructionBits()); |
| 1913 UnimplementedInstruction(instr); | 1907 UnimplementedInstruction(instr); |
| 1914 break; | 1908 break; |
| 1915 } | 1909 } |
| 1916 } | 1910 } |
| 1917 break; | 1911 break; |
| 1918 } | 1912 } |
| 1919 case COP1_CVT_W: { | 1913 case COP1_CVT_D: { |
| 1920 switch (instr->FormatField()) { | 1914 switch (instr->FormatField()) { |
| 1921 case FMT_D: { | 1915 case FMT_W: { |
| 1922 double fs_dbl = get_fregister_double(instr->FsField()); | 1916 int32_t fs_int = get_fregister(instr->FsField()); |
| 1923 int32_t fs_int; | 1917 double fs_dbl = static_cast<double>(fs_int); |
| 1924 if (isnan(fs_dbl) || isinf(fs_dbl) || (fs_dbl > INT_MAX) || | 1918 set_fregister_double(instr->FdField(), fs_dbl); |
| 1925 (fs_dbl < INT_MIN)) { | 1919 break; |
| 1926 fs_int = INT_MIN; | 1920 } |
| 1927 } else { | 1921 case FMT_S: { |
| 1928 fs_int = static_cast<int32_t>(fs_dbl); | 1922 float fs_flt = get_fregister_float(instr->FsField()); |
| 1929 } | 1923 double fs_dbl = static_cast<double>(fs_flt); |
| 1930 set_fregister(instr->FdField(), fs_int); | 1924 set_fregister_double(instr->FdField(), fs_dbl); |
| 1931 break; | 1925 break; |
| 1932 } | 1926 } |
| 1933 default: { | 1927 default: { |
| 1934 OS::PrintErr("DecodeCop1: 0x%x\n", instr->InstructionBits()); | 1928 OS::PrintErr("DecodeCop1: 0x%x\n", instr->InstructionBits()); |
| 1935 UnimplementedInstruction(instr); | 1929 UnimplementedInstruction(instr); |
| 1936 break; | 1930 break; |
| 1937 } | 1931 } |
| 1938 } | 1932 } |
| 1939 break; | 1933 break; |
| 1940 } | 1934 } |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2538 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); | 2532 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); |
| 2539 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); | 2533 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); |
| 2540 buf->Longjmp(); | 2534 buf->Longjmp(); |
| 2541 } | 2535 } |
| 2542 | 2536 |
| 2543 } // namespace dart | 2537 } // namespace dart |
| 2544 | 2538 |
| 2545 #endif // defined(USING_SIMULATOR) | 2539 #endif // defined(USING_SIMULATOR) |
| 2546 | 2540 |
| 2547 #endif // defined TARGET_ARCH_MIPS | 2541 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |