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 <math.h> // for isnan. | 5 #include <math.h> // for isnan. |
6 #include <setjmp.h> | 6 #include <setjmp.h> |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
10 #if defined(TARGET_ARCH_MIPS) | 10 #if defined(TARGET_ARCH_MIPS) |
(...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1643 UnimplementedInstruction(instr); | 1643 UnimplementedInstruction(instr); |
1644 break; | 1644 break; |
1645 } | 1645 } |
1646 } | 1646 } |
1647 break; | 1647 break; |
1648 } | 1648 } |
1649 case COP1_CVT_W: { | 1649 case COP1_CVT_W: { |
1650 switch (instr->FormatField()) { | 1650 switch (instr->FormatField()) { |
1651 case FMT_D: { | 1651 case FMT_D: { |
1652 double fs_dbl = get_fregister_double(instr->FsField()); | 1652 double fs_dbl = get_fregister_double(instr->FsField()); |
1653 int32_t fs_int = static_cast<int32_t>(fs_dbl); | 1653 int32_t fs_int; |
| 1654 if (isnan(fs_dbl) || isinf(fs_dbl) || (fs_dbl > INT_MAX) || |
| 1655 (fs_dbl < INT_MIN)) { |
| 1656 fs_int = INT_MIN; |
| 1657 } else { |
| 1658 fs_int = static_cast<int32_t>(fs_dbl); |
| 1659 } |
1654 set_fregister(instr->FdField(), fs_int); | 1660 set_fregister(instr->FdField(), fs_int); |
1655 break; | 1661 break; |
1656 } | 1662 } |
1657 default: { | 1663 default: { |
1658 OS::PrintErr("DecodeCop1: 0x%x\n", instr->InstructionBits()); | 1664 OS::PrintErr("DecodeCop1: 0x%x\n", instr->InstructionBits()); |
1659 UnimplementedInstruction(instr); | 1665 UnimplementedInstruction(instr); |
1660 break; | 1666 break; |
1661 } | 1667 } |
1662 } | 1668 } |
1663 break; | 1669 break; |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2222 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); | 2228 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); |
2223 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); | 2229 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); |
2224 buf->Longjmp(); | 2230 buf->Longjmp(); |
2225 } | 2231 } |
2226 | 2232 |
2227 } // namespace dart | 2233 } // namespace dart |
2228 | 2234 |
2229 #endif // !defined(HOST_ARCH_MIPS) | 2235 #endif // !defined(HOST_ARCH_MIPS) |
2230 | 2236 |
2231 #endif // defined TARGET_ARCH_MIPS | 2237 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |