| 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 "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if defined(V8_OS_AIX) |
| 8 #include <fenv.h> |
| 9 #endif |
| 7 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| 8 #include "src/codegen.h" | 11 #include "src/codegen.h" |
| 9 #include "src/compiler.h" | 12 #include "src/compiler.h" |
| 10 #include "src/cpu-profiler.h" | 13 #include "src/cpu-profiler.h" |
| 11 #include "src/debug.h" | 14 #include "src/debug.h" |
| 12 #include "src/prettyprinter.h" | 15 #include "src/prettyprinter.h" |
| 13 #include "src/rewriter.h" | 16 #include "src/rewriter.h" |
| 14 #include "src/runtime/runtime.h" | 17 #include "src/runtime/runtime.h" |
| 15 | 18 |
| 16 namespace v8 { | 19 namespace v8 { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 41 // dividend is a zero and divisor is nonzero finite => result equals dividend | 44 // dividend is a zero and divisor is nonzero finite => result equals dividend |
| 42 if (!(std::isfinite(x) && (!std::isfinite(y) && !std::isnan(y))) && | 45 if (!(std::isfinite(x) && (!std::isfinite(y) && !std::isnan(y))) && |
| 43 !(x == 0 && (y != 0 && std::isfinite(y)))) { | 46 !(x == 0 && (y != 0 && std::isfinite(y)))) { |
| 44 x = fmod(x, y); | 47 x = fmod(x, y); |
| 45 } | 48 } |
| 46 return x; | 49 return x; |
| 47 } | 50 } |
| 48 #else // POSIX | 51 #else // POSIX |
| 49 | 52 |
| 50 double modulo(double x, double y) { | 53 double modulo(double x, double y) { |
| 54 #if defined(V8_OS_AIX) |
| 55 // AIX raises an underflow exception for (Number.MIN_VALUE % Number.MAX_VALUE) |
| 56 feclearexcept(FE_ALL_EXCEPT); |
| 57 double result = std::fmod(x, y); |
| 58 int exception = fetestexcept(FE_UNDERFLOW); |
| 59 return (exception ? x : result); |
| 60 #else |
| 51 return std::fmod(x, y); | 61 return std::fmod(x, y); |
| 62 #endif |
| 52 } | 63 } |
| 53 #endif // defined(_WIN64) | 64 #endif // defined(_WIN64) |
| 54 | 65 |
| 55 | 66 |
| 56 #define UNARY_MATH_FUNCTION(name, generator) \ | 67 #define UNARY_MATH_FUNCTION(name, generator) \ |
| 57 static UnaryMathFunction fast_##name##_function = NULL; \ | 68 static UnaryMathFunction fast_##name##_function = NULL; \ |
| 58 void init_fast_##name##_function() { \ | 69 void init_fast_##name##_function() { \ |
| 59 fast_##name##_function = generator; \ | 70 fast_##name##_function = generator; \ |
| 60 } \ | 71 } \ |
| 61 double fast_##name(double x) { \ | 72 double fast_##name(double x) { \ |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 masm->positions_recorder()->RecordStatementPosition(pos); | 239 masm->positions_recorder()->RecordStatementPosition(pos); |
| 229 masm->positions_recorder()->RecordPosition(pos); | 240 masm->positions_recorder()->RecordPosition(pos); |
| 230 if (right_here) { | 241 if (right_here) { |
| 231 return masm->positions_recorder()->WriteRecordedPositions(); | 242 return masm->positions_recorder()->WriteRecordedPositions(); |
| 232 } | 243 } |
| 233 } | 244 } |
| 234 return false; | 245 return false; |
| 235 } | 246 } |
| 236 | 247 |
| 237 } } // namespace v8::internal | 248 } } // namespace v8::internal |
| OLD | NEW |