1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/ion/inlining/inline-callarg-bailout-phi.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,29 @@ 1.4 +function add(x, y) { 1.5 + if (x & 0x1) 1.6 + return x + y; 1.7 + else 1.8 + return y + x; 1.9 +} 1.10 + 1.11 +function runBinop(binop, lhs, rhs) { 1.12 + return binop(lhs, rhs); 1.13 +} 1.14 + 1.15 +//dis(run_binop); 1.16 + 1.17 +// Get the add function to compile. 1.18 +var accum = 0; 1.19 +for (var i = 0; i < 1000; ++i) 1.20 + accum += add(1, 1); 1.21 +assertEq(accum, 2000); 1.22 + 1.23 +// Get the runBinop function to compile and inline the add function. 1.24 +var accum = 0; 1.25 +for (var i = 0; i < 11000; ++i) 1.26 + accum = runBinop(add, i, i); 1.27 +assertEq(accum, 21998); 1.28 + 1.29 +var t30 = 1 << 30; 1.30 +var t31 = t30 + t30; 1.31 +var result = runBinop(add, t31, t31); 1.32 +assertEq(result, Math.pow(2, 32));