mirror of
https://github.com/tc39/test262.git
synced 2025-05-03 22:40:28 +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)
36 lines
770 B
JavaScript
36 lines
770 B
JavaScript
function foo() {
|
|
var result = 0;
|
|
for (var i = 0; i < arguments.length; ++i)
|
|
result += arguments[i];
|
|
return result;
|
|
}
|
|
|
|
function bar() {
|
|
return foo.apply(this, arguments);
|
|
}
|
|
|
|
function baz(p) {
|
|
if (p)
|
|
return bar(1, 42);
|
|
return 0;
|
|
}
|
|
|
|
noInline(baz);
|
|
|
|
// Execute baz() once with p set, so that the call has a valid prediction.
|
|
baz(true);
|
|
|
|
// Warm up profiling in bar and foo. Convince this profiling that bar()'s varargs call will tend to
|
|
// pass a small number of arguments;
|
|
for (var i = 0; i < 1000; ++i)
|
|
bar(1);
|
|
|
|
// Now compile baz(), but don't run the bad code yet.
|
|
for (var i = 0; i < 10000; ++i)
|
|
baz(false);
|
|
|
|
// Finally, trigger the bug.
|
|
var result = baz(true);
|
|
if (result != 43)
|
|
throw "Error: bad result: " + result;
|