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)
40 lines
719 B
JavaScript
40 lines
719 B
JavaScript
"use strict";
|
|
|
|
// This test passes when JSC doesn't crash.
|
|
|
|
let p = new Proxy(function() { }, {
|
|
apply: function() {
|
|
return bar();
|
|
}
|
|
});
|
|
|
|
function bar() {
|
|
let item = getItem();
|
|
return item.foo;
|
|
}
|
|
|
|
let i;
|
|
let shouldReturnBad = false;
|
|
let good = [function() {return 1}, {b: 20}, {c: 40}, {d:50}]
|
|
let bad = [{asdfhasf: 20}, {e:50}, {j:70}, {k:100}, null];
|
|
function getItem() {
|
|
if (shouldReturnBad)
|
|
return bad[i % bad.length];
|
|
return good[i % good.length];
|
|
}
|
|
noInline(getItem);
|
|
|
|
function start() {
|
|
for (i = 0; i < 1000; i++) {
|
|
p();
|
|
}
|
|
|
|
shouldReturnBad = true;
|
|
for (i = 0; i < 10000; i++) {
|
|
try {
|
|
p();
|
|
} catch(e) { }
|
|
}
|
|
}
|
|
start();
|