Comment #1 on issue 2258 by [email protected]: Integer division when
operands and target are integers
http://code.google.com/p/v8/issues/detail?id=2258
We have optimizations for the case where you use Math.floor(a/b) to use
integer operations and avoid conversions.
Consider this code:
var image = Int32Array(1);
function f() {
image[0] = 100;
image[0] = Math.floor(image[0] * 0xFF / 3);
}
f();
f();
%OptimizeFunctionOnNextCall(f);
f();
Run d8 to verify:
out/ia32.debug/d8 test.js --print-opt-code --code-comments
--allow-natives-syntax
It is true though that we do not take the type of the typed array into
account and require Math.floor for this optimization.
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev