mirror of
https://github.com/tc39/test262.git
synced 2025-05-04 15:00:42 +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)
29 lines
633 B
JavaScript
29 lines
633 B
JavaScript
function createBuffer() {
|
|
return [1, 2];
|
|
}
|
|
noInline(createBuffer);
|
|
|
|
function shouldBe(a, b) {
|
|
if (a !== b)
|
|
throw new Error(a + " should be === to " + b);
|
|
}
|
|
|
|
function test() {
|
|
let array = createBuffer();
|
|
array[-1] = 7.43;
|
|
shouldBe(createBuffer()[-1], undefined);
|
|
array = createBuffer();
|
|
array[1] = 6.9023;
|
|
shouldBe(createBuffer()[1], 2);
|
|
array = createBuffer();
|
|
let o = Object.create(array);
|
|
o[1] = 5.43;
|
|
shouldBe(array[1], 2);
|
|
shouldBe(createBuffer()[1], 2);
|
|
shouldBe(Object.create(createBuffer())[1], 2);
|
|
}
|
|
noInline(test);
|
|
|
|
for (let i = 0; i < 10000; i++)
|
|
test();
|