Chromium Code Reviews
Descriptiondart2js js_runtime: faster code for floor() & ceil()
Within the [-2^31, 2^31) range it is faster to truncate and correct at boundaries than call Math.ceil/Math.floor.
Each call to toInt() has been specialized to the calling operator (ceil, floor, ~/ etc).
This makes the conversion faster (values are already integral) and lets us put the name of the operation and original operands in conversion errors, e.g
(a / b).floor(); // b == 0
Unsupported operation: Infinity
-->
Unsupported operation: Infinity.floor()
a ~/ b; // b == 0
Unsupported operation: Infinity
-->
Unsupported operation: Result of truncating division is Infinity: 132 ~/ 0
R=sigmund@google.com
Downside: an extra 400 bytes
Committed: https://github.com/dart-lang/sdk/commit/1eee3c7dc74aa22ef9b3a45b0fd821e67ac8da1d
Patch Set 1 : #
Total comments: 4
Patch Set 2 : rebase #Patch Set 3 : whitespace #Patch Set 4 : bug fix for floor() #
Messages
Total messages: 12 (8 generated)
|
|||||||||||||||||||||||||||||||||||||