]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/cloned-arguments-should-visit-callee-during-gc.js
1 // Test that the ClonedArguments created by the Function.arguments will properly
2 // keep its callee alive. This test should not crash and should not print any error
5 var cachedArguments
= [];
6 var numberOfEntries
= 1000;
8 function makeTransientFunction(i
) {
9 function transientFunc() {
10 cachedArguments
[i
] = transientFunc
.arguments
;
15 for (i
= 0; i
< numberOfEntries
; i
++) {
16 var transientFunc
= makeTransientFunction(i
);
18 // At this point, the only reference to the transient function is from
19 // cachedArguments[i].callee.
24 // Allocate a bunch of memory to stomp over the transient functions that may have been
25 // erroneously collected. webkit.org/b/145709
26 for (i
= 0; i
< numberOfEntries
; i
++) {
30 for (i
= 0; i
< numberOfEntries
; i
++) {
31 var callee
= cachedArguments
[i
].callee
;
32 if (typeof callee
!= "function")
33 print("ERROR: callee is " + callee
);