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)
61 lines
1.4 KiB
JavaScript
61 lines
1.4 KiB
JavaScript
'use strict';
|
|
|
|
function shouldBe(actual, expected) {
|
|
if (actual !== expected)
|
|
throw new Error('bad value: ' + actual);
|
|
}
|
|
|
|
var object = { a: 10 };
|
|
Object.defineProperties(object, {
|
|
"0": {
|
|
get: function() { return this.a; },
|
|
set: function(x) { this.a = x; },
|
|
},
|
|
});
|
|
|
|
var array = [ 0, 1, 2, 3, 4, 5 ];
|
|
ensureArrayStorage(array);
|
|
|
|
function testInBound(array)
|
|
{
|
|
return array.length;
|
|
}
|
|
noInline(testInBound);
|
|
for (var i = 0; i < 1e5; ++i)
|
|
shouldBe(testInBound(array), 6);
|
|
|
|
function testUncountable(array)
|
|
{
|
|
return array.length;
|
|
}
|
|
noInline(testUncountable);
|
|
for (var i = 0; i < 1e5; ++i)
|
|
shouldBe(testUncountable(array), 6);
|
|
array.length = 0xffffffff - 1;
|
|
for (var i = 0; i < 1e5; ++i)
|
|
shouldBe(testUncountable(array), 0xffffffff - 1);
|
|
|
|
|
|
var slowPutArray = [ 0, 1, 2, 3, 4, 5 ];
|
|
ensureArrayStorage(slowPutArray);
|
|
slowPutArray.__proto__ = object;
|
|
|
|
function testSlowPutInBound(array)
|
|
{
|
|
return array.length;
|
|
}
|
|
noInline(testSlowPutInBound);
|
|
for (var i = 0; i < 1e5; ++i)
|
|
shouldBe(testSlowPutInBound(slowPutArray), 6);
|
|
|
|
function testSlowPutUncountable(array)
|
|
{
|
|
return array.length;
|
|
}
|
|
noInline(testSlowPutUncountable);
|
|
for (var i = 0; i < 1e5; ++i)
|
|
shouldBe(testSlowPutUncountable(slowPutArray), 6);
|
|
slowPutArray.length = 0xffffffff - 1;
|
|
for (var i = 0; i < 1e5; ++i)
|
|
shouldBe(testSlowPutUncountable(slowPutArray), 0xffffffff - 1);
|