]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/ftl-to-ftl-arity-fixup.js
1 function foo(a
, b
, c
) {
2 return (a
|0) + (b
|0) + (c
|0);
6 // Save a bunch of state in local variables.
14 // Make a call that will be subject to arity fixup and then use the saved state. We're
15 // counting on LLVM to put those variables in callee-saves, since that's pretty much the
16 // only sensible choice.
17 return foo(42) + a
+ b
+ c
+ d
+ e
+ f
+ g
;
23 for (var i
= 0; i
< 100000; ++i
) {
24 // Call bar() in such a way that all of those callee-save variables have fairly unique
25 // looking values, to maximize the chances of foo() clobbering them in a recognizable
28 f:i
* 3, g:i
- 1, h:(i
/ 2)|0, i:-i
, j:13 + ((i
/ 5)|0), k:14 - ((i
/ 6)|0),
31 var expected
= 42 + i
* 3 + i
- 1 + ((i
/ 2)|0) - i
+ 13 + ((i
/ 5)|0) + 14 -
34 if (result
!= expected
)
35 throw "Error: for iteration " + i
+ " expected " + expected
+ " but got " + result
;