mirror of
https://github.com/tc39/test262.git
synced 2025-05-05 07:20:27 +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
633 B
JavaScript
36 lines
633 B
JavaScript
function bar(o, p) {
|
|
if (p)
|
|
return +o.f;
|
|
return 42;
|
|
}
|
|
|
|
var globalResult;
|
|
Function.prototype.valueOf = function() { globalResult = 1; };
|
|
|
|
function foo(p, q) {
|
|
globalResult = 0;
|
|
var o = function() { };
|
|
var o2 = {f: o};
|
|
if (p)
|
|
bar(o2, q);
|
|
return globalResult;
|
|
}
|
|
|
|
noInline(foo);
|
|
|
|
foo(true, false);
|
|
|
|
for (var i = 0; i < 10000; ++i)
|
|
bar({f:42}, true);
|
|
|
|
for (var i = 0; i < 10000; ++i) {
|
|
var result = foo(false, true);
|
|
if (result !== 0)
|
|
throw "Error: bad result: " + result;
|
|
}
|
|
|
|
var result = foo(true, true);
|
|
if (result !== 1)
|
|
throw "Error: bad result at end: " + result;
|
|
|