Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | function lameFunc(x, y) { |
michael@0 | 2 | var lsw = (x & 0xFFFF) + (y & 0xFFFF); |
michael@0 | 3 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16); |
michael@0 | 4 | return (msw << 16) | (lsw & 0xFFFF); |
michael@0 | 5 | } |
michael@0 | 6 | |
michael@0 | 7 | function runSomeTimes(func, iters) { |
michael@0 | 8 | var result; |
michael@0 | 9 | for (var i = 0; i < iters; ++i) { |
michael@0 | 10 | result = func(42, 42); |
michael@0 | 11 | result = func(42, 42); |
michael@0 | 12 | } |
michael@0 | 13 | return result; |
michael@0 | 14 | } |
michael@0 | 15 | |
michael@0 | 16 | // First, run the inner function to get TI information. |
michael@0 | 17 | for (var i = 0; i < 100; ++i) |
michael@0 | 18 | lameFunc(42, 42); |
michael@0 | 19 | |
michael@0 | 20 | // Then, run the outer function with the inner function as a CALLARG to get it |
michael@0 | 21 | // to Ion compile with inlining. |
michael@0 | 22 | for (var i = 0; i < 11000; ++i) |
michael@0 | 23 | runSomeTimes(lameFunc, 1); |
michael@0 | 24 | |
michael@0 | 25 | // Lastly, now that we're all inlined and compiled, perform the test! |
michael@0 | 26 | var iterations = 100; |
michael@0 | 27 | assertEq(84, runSomeTimes(lameFunc, iterations)); |