test262/implementation-contributed/javascriptcore/stress/put-by-val-direct-out-of-bounds-setter.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

27 lines
598 B
JavaScript

var createBuiltin = $vm.createBuiltin;
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
var testInt32 = createBuiltin(`(function (array, index, value) {
@putByValDirect(array, index, value);
})`);
noInline(testInt32);
Object.defineProperty(Array.prototype, 42, {
get() {
return 30;
},
set(value) {
}
});
for (var i = 0; i < 1e5; ++i) {
var array = [1, 2, 3, 4, 5];
shouldBe(array[42], 30);
testInt32(array, 42, 42);
shouldBe(array[42], 42);
shouldBe(Array.prototype[42], 30);
}