Adding Math.fround everywhere is a significant change and would probably can't be done without lots of changes in different parts of the compiler. As such, I would suggest forking the compiler.
Wrt your project: you will need to pay attention to (at least) the following places (the files have been moved recently, so you might need to look in other places if you don't have the exact same revision as me):
- pkg/compiler/lib/src/ssa/codegen.dart: visitAdd,...
This produces the JS binary operations. We also use the operator + for string concatenation, so you will need to look at the left-operator's type before you add a `Math.fround` there.
- sdk/lib/_internal/compiler/js_lib/js_number.dart: operator+, ...
In theory you also need to adapt the compile-time constant operations:
- pkg/compiler/lib/src/js_backend/constant_system_javascript.dart
There might be other places that I forgot, but it should be a good start.
If I were you I would start temporarily with an environment flag to toggle the rounding:
`const FORCE_SINGLE_PRECISION = const bool.fromEnvironment("force-single-precision");`
which you can then enable as follows:
DART_VM_OPTIONS='-Dforce-single-precision=true' sdk/lib/bin/dart2js ...
Hope that helps.