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