To allow efficient single-pass validation and avoid semantic corner cases with FFI calls, ValidateCall currently requires all callsites to be explicitly coerced. This coercion determines the expected return type of the callee:
f()|0 for signed,
+f() for double,
fround(f()) for float32,
(…, f(), …) for void.
Of course, this coercion isn’t necessary for stdlib functions, whose return types are locally determined by the name of the callee and types of arguments. Incorporating SIMD.js into asm.js makes this wart much more noticeable since all SIMD operations are stdlib calls.
The proposed change here (landed in Firefox 34) is to drop this requirement for all stdlib functions. Since stdlib functions can now be used without coercion, some of their signatures change to reflect the range of the value returned before coercion (previous signatures reflected the range of the value after coercion):
- The signed overload of
Math.abs now returns unsigned (instead of signed)
- The float? overloads of
Math.ceil,floor,sqrt,abs now return floatish (instead of float)
Since the return types of stdlib functions are subtypes of the previously-required callsite coercions, this is a backwards-compatible change.