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)
31 lines
567 B
JavaScript
31 lines
567 B
JavaScript
function Cons() {
|
|
}
|
|
Cons.prototype.__defineGetter__("f", function() {
|
|
counter++;
|
|
return 84;
|
|
});
|
|
|
|
function foo(o) {
|
|
return o.f;
|
|
}
|
|
|
|
noInline(foo);
|
|
|
|
var counter = 0;
|
|
|
|
function test(o, expected, expectedCount) {
|
|
var result = foo(o);
|
|
if (result != expected)
|
|
throw new Error("Bad result: " + result);
|
|
if (counter != expectedCount)
|
|
throw new Error("Bad counter value: " + counter);
|
|
}
|
|
|
|
for (var i = 0; i < 100000; ++i) {
|
|
test(new Cons(), 84, counter + 1);
|
|
|
|
var o = new Cons();
|
|
o.g = 54;
|
|
test(o, 84, counter + 1);
|
|
}
|