Skip to content

Commit e306c78

Browse files
committed
src: disable fast math on arm
The "fast" implementation of Math.exp() and Math.tanh() emits ARMv7 movt/movw instructions on ARMv6 (notably, the original Raspberry Pi.) Disable fast math for now. The adventurous can enable it again with the --fast_math switch. PR-URL: #1398 Refs: #1376 Reviewed-By: Roman Reiss <me@silverwind.io> V8-Bug: https://code.google.com/p/v8/issues/detail?id=4019
1 parent cd38a4a commit e306c78

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

src/node.cc

+8
Original file line numberDiff line numberDiff line change
@@ -3541,6 +3541,14 @@ void Init(int* argc,
35413541
DispatchDebugMessagesAsyncCallback);
35423542
uv_unref(reinterpret_cast<uv_handle_t*>(&dispatch_debug_messages_async));
35433543

3544+
#if defined(__arm__)
3545+
// See https://github.com/iojs/io.js/issues/1376
3546+
// and https://code.google.com/p/v8/issues/detail?id=4019
3547+
// TODO(bnoordhuis): Remove test/parallel/test-arm-math-exp-regress-1376.js
3548+
// and this workaround when v8:4019 has been fixed and the patch back-ported.
3549+
V8::SetFlagsFromString("--nofast_math", sizeof("--nofast_math") - 1);
3550+
#endif
3551+
35443552
#if defined(NODE_V8_OPTIONS)
35453553
// Should come before the call to V8::SetFlagsFromCommandLine()
35463554
// so the user can disable a flag --foo at run-time by passing
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// See https://github.com/iojs/io.js/issues/1376
2+
// and https://code.google.com/p/v8/issues/detail?id=4019
3+
4+
Math.abs(-0.5);
5+
Math.acos(-0.5);
6+
Math.acosh(-0.5);
7+
Math.asin(-0.5);
8+
Math.asinh(-0.5);
9+
Math.atan(-0.5);
10+
Math.atanh(-0.5);
11+
Math.cbrt(-0.5);
12+
Math.ceil(-0.5);
13+
Math.cos(-0.5);
14+
Math.cosh(-0.5);
15+
Math.exp(-0.5);
16+
Math.expm1(-0.5);
17+
Math.floor(-0.5);
18+
Math.fround(-0.5);
19+
Math.log(-0.5);
20+
Math.log10(-0.5);
21+
Math.log1p(-0.5);
22+
Math.log2(-0.5);
23+
Math.round(-0.5);
24+
Math.sign(-0.5);
25+
Math.sin(-0.5);
26+
Math.sinh(-0.5);
27+
Math.sqrt(-0.5);
28+
Math.tan(-0.5);
29+
Math.tanh(-0.5);
30+
Math.trunc(-0.5);

0 commit comments

Comments
 (0)