mirror of
https://github.com/tc39/test262.git
synced 2025-05-28 02:30:29 +02:00
* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
35 lines
984 B
JavaScript
35 lines
984 B
JavaScript
// Test that the ClonedArguments created by the Function.arguments will properly
|
|
// keep its callee alive. This test should not crash and should not print any error
|
|
// messages.
|
|
|
|
var cachedArguments = [];
|
|
var numberOfEntries = 1000;
|
|
|
|
function makeTransientFunction(i) {
|
|
function transientFunc() {
|
|
cachedArguments[i] = transientFunc.arguments;
|
|
}
|
|
return transientFunc;
|
|
}
|
|
|
|
for (i = 0; i < numberOfEntries; i++) {
|
|
var transientFunc = makeTransientFunction(i);
|
|
transientFunc();
|
|
// At this point, the only reference to the transient function is from
|
|
// cachedArguments[i].callee.
|
|
}
|
|
|
|
gc();
|
|
|
|
// Allocate a bunch of memory to stomp over the transient functions that may have been
|
|
// erroneously collected. webkit.org/b/145709
|
|
for (i = 0; i < numberOfEntries; i++) {
|
|
new Object();
|
|
}
|
|
|
|
for (i = 0; i < numberOfEntries; i++) {
|
|
var callee = cachedArguments[i].callee;
|
|
if (typeof callee != "function")
|
|
print("ERROR: callee is " + callee);
|
|
}
|