OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 <limits.h> | 5 #include <limits.h> |
6 #include <stdarg.h> | 6 #include <stdarg.h> |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "src/v8.h" | 10 #include "src/v8.h" |
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 | 1197 |
1198 if (!std::isfinite(original) || !std::isfinite(rounded)) { | 1198 if (!std::isfinite(original) || !std::isfinite(rounded)) { |
1199 set_fcsr_bit(kFCSRInvalidOpFlagBit, true); | 1199 set_fcsr_bit(kFCSRInvalidOpFlagBit, true); |
1200 ret = true; | 1200 ret = true; |
1201 } | 1201 } |
1202 | 1202 |
1203 if (original != rounded) { | 1203 if (original != rounded) { |
1204 set_fcsr_bit(kFCSRInexactFlagBit, true); | 1204 set_fcsr_bit(kFCSRInexactFlagBit, true); |
1205 } | 1205 } |
1206 | 1206 |
1207 if (rounded < std::numeric_limits<double>::min() && | 1207 if (rounded < DBL_MIN && rounded > -DBL_MIN && rounded != 0) { |
1208 rounded > -std::numeric_limits<double>::min() && rounded != 0) { | |
1209 set_fcsr_bit(kFCSRUnderflowFlagBit, true); | 1208 set_fcsr_bit(kFCSRUnderflowFlagBit, true); |
1210 ret = true; | 1209 ret = true; |
1211 } | 1210 } |
1212 | 1211 |
1213 if (rounded > max_int32 || rounded < min_int32) { | 1212 if (rounded > max_int32 || rounded < min_int32) { |
1214 set_fcsr_bit(kFCSROverflowFlagBit, true); | 1213 set_fcsr_bit(kFCSROverflowFlagBit, true); |
1215 // The reference is not really clear but it seems this is required: | 1214 // The reference is not really clear but it seems this is required: |
1216 set_fcsr_bit(kFCSRInvalidOpFlagBit, true); | 1215 set_fcsr_bit(kFCSRInvalidOpFlagBit, true); |
1217 ret = true; | 1216 ret = true; |
1218 } | 1217 } |
(...skipping 11 matching lines...) Expand all Loading... |
1230 | 1229 |
1231 if (!std::isfinite(original) || !std::isfinite(rounded)) { | 1230 if (!std::isfinite(original) || !std::isfinite(rounded)) { |
1232 set_fcsr_bit(kFCSRInvalidOpFlagBit, true); | 1231 set_fcsr_bit(kFCSRInvalidOpFlagBit, true); |
1233 ret = true; | 1232 ret = true; |
1234 } | 1233 } |
1235 | 1234 |
1236 if (original != rounded) { | 1235 if (original != rounded) { |
1237 set_fcsr_bit(kFCSRInexactFlagBit, true); | 1236 set_fcsr_bit(kFCSRInexactFlagBit, true); |
1238 } | 1237 } |
1239 | 1238 |
1240 if (rounded < std::numeric_limits<double>::min() && | 1239 if (rounded < DBL_MIN && rounded > -DBL_MIN && rounded != 0) { |
1241 rounded > -std::numeric_limits<double>::min() && rounded != 0) { | |
1242 set_fcsr_bit(kFCSRUnderflowFlagBit, true); | 1240 set_fcsr_bit(kFCSRUnderflowFlagBit, true); |
1243 ret = true; | 1241 ret = true; |
1244 } | 1242 } |
1245 | 1243 |
1246 if (rounded > max_int64 || rounded < min_int64) { | 1244 if (rounded > max_int64 || rounded < min_int64) { |
1247 set_fcsr_bit(kFCSROverflowFlagBit, true); | 1245 set_fcsr_bit(kFCSROverflowFlagBit, true); |
1248 // The reference is not really clear but it seems this is required: | 1246 // The reference is not really clear but it seems this is required: |
1249 set_fcsr_bit(kFCSRInvalidOpFlagBit, true); | 1247 set_fcsr_bit(kFCSRInvalidOpFlagBit, true); |
1250 ret = true; | 1248 ret = true; |
1251 } | 1249 } |
(...skipping 2197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3449 } | 3447 } |
3450 | 3448 |
3451 | 3449 |
3452 #undef UNSUPPORTED | 3450 #undef UNSUPPORTED |
3453 | 3451 |
3454 } } // namespace v8::internal | 3452 } } // namespace v8::internal |
3455 | 3453 |
3456 #endif // USE_SIMULATOR | 3454 #endif // USE_SIMULATOR |
3457 | 3455 |
3458 #endif // V8_TARGET_ARCH_MIPS64 | 3456 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |