test262/implementation-contributed/javascriptcore/stress/exit-from-ftl-when-caller-passed-extra-args-then-use-function-dot-arguments.js
test262-automation e9a5a7f918 [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) (#1620)
* [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)
2018-07-03 15:59:58 -04:00

38 lines
951 B
JavaScript

function foo(a, b) {
var result = a + b;
bar();
return result;
}
var capturedArgs;
function bar() {
capturedArgs = foo.arguments;
}
noInline(foo);
noInline(bar);
function arraycmp(a, b) {
if (a.length != b.length)
return false;
for (var i = 0; i < a.length; ++i) {
if (a[i] != b[i])
return false;
}
return true;
}
for (var i = 0; i < 10000; ++i) {
var result = foo(1, 2, 3, 4, 5, 6);
if (result != 3)
throw "Error: bad result in loop: " + result;
if (!arraycmp(capturedArgs, [1, 2, 3, 4, 5, 6]))
throw "Error: bad captured arguments in loop: " + capturedArgs;
}
var result = foo(2000000000, 2000000000, 3, 4, 5, 6);
if (result != 4000000000)
throw "Error: bad result at end: " + result;
if (!arraycmp(capturedArgs, [2000000000, 2000000000, 3, 4, 5, 6]))
throw "Error: bad captured arguments at end: " + Array.prototype.join.apply(capturedArgs, ",");