test262/implementation-contributed/javascriptcore/stress/ic-throw-through-optimized-code.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

30 lines
617 B
JavaScript

function foo(o) {
return o.f + 1;
}
Number.prototype.f = 42;
noInline(foo);
for (var i = 0; i < 100000; ++i) {
var result = foo(23);
if (result != 43)
throw "Error: bad result: " + result;
result = foo({f:25});
if (result != 26)
throw "Error: bad result: " + result;
result = foo({g:12, f:13});
if (result != 14)
throw "Error: bad result: " + result;
}
var didThrow;
try {
foo(void 0);
} catch (e) {
didThrow = e;
}
if (!didThrow || didThrow.toString().indexOf("TypeError:") != 0)
throw "Error: didn't throw or threw wrong exception: " + didThrow;