mirror of
				https://github.com/tc39/test262.git
				synced 2025-11-04 05:33:50 +01:00 
			
		
		
		
	[javascriptcore-test262-automation] Changes from https://github.com/webkit/webkit.git at sha d51ed02c2b on Fri Sep 21 2018 18:26:42 GMT+0000 (Coordinated Universal Time)
This commit is contained in:
		
							parent
							
								
									89ec038cf2
								
							
						
					
					
						commit
						cd95f95cf2
					
				@ -0,0 +1,45 @@
 | 
			
		||||
function shouldBe(actual, expected) {
 | 
			
		||||
    if (actual !== expected)
 | 
			
		||||
        throw new Error('bad value: ' + actual);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class AncestorArray extends Object {
 | 
			
		||||
    get 2() {
 | 
			
		||||
        this.called = true;
 | 
			
		||||
        return 42;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Array.prototype.__proto__ = AncestorArray.prototype;
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
    let array = [];
 | 
			
		||||
    array.length = 42;
 | 
			
		||||
    shouldBe(array.indexOf(42), 2);
 | 
			
		||||
    shouldBe(array.called, true);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = [20, 20];
 | 
			
		||||
    array.length = 42;
 | 
			
		||||
    shouldBe(array.indexOf(42), 2);
 | 
			
		||||
    shouldBe(array.called, true);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = ["Hello"];
 | 
			
		||||
    array.length = 42;
 | 
			
		||||
    shouldBe(array.indexOf(42), 2);
 | 
			
		||||
    shouldBe(array.called, true);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = [42.195];
 | 
			
		||||
    array.length = 42;
 | 
			
		||||
    shouldBe(array.indexOf(42), 2);
 | 
			
		||||
    shouldBe(array.called, true);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = ["Hello"];
 | 
			
		||||
    array.length = 42;
 | 
			
		||||
    ensureArrayStorage(array);
 | 
			
		||||
    shouldBe(array.indexOf(42), 2);
 | 
			
		||||
    shouldBe(array.called, true);
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,43 @@
 | 
			
		||||
function shouldBe(actual, expected) {
 | 
			
		||||
    if (actual !== expected)
 | 
			
		||||
        throw new Error('bad value: ' + actual);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(Array.prototype, 2, {
 | 
			
		||||
    get() {
 | 
			
		||||
        this.called = true;
 | 
			
		||||
        return 42;
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
    let array = [];
 | 
			
		||||
    array.length = 42;
 | 
			
		||||
    shouldBe(array.indexOf(42), 2);
 | 
			
		||||
    shouldBe(array.called, true);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = [20, 20];
 | 
			
		||||
    array.length = 42;
 | 
			
		||||
    shouldBe(array.indexOf(42), 2);
 | 
			
		||||
    shouldBe(array.called, true);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = ["Hello"];
 | 
			
		||||
    array.length = 42;
 | 
			
		||||
    shouldBe(array.indexOf(42), 2);
 | 
			
		||||
    shouldBe(array.called, true);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = [42.195];
 | 
			
		||||
    array.length = 42;
 | 
			
		||||
    shouldBe(array.indexOf(42), 2);
 | 
			
		||||
    shouldBe(array.called, true);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = ["Hello"];
 | 
			
		||||
    array.length = 42;
 | 
			
		||||
    ensureArrayStorage(array);
 | 
			
		||||
    shouldBe(array.indexOf(42), 2);
 | 
			
		||||
    shouldBe(array.called, true);
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,19 @@
 | 
			
		||||
function shouldBe(actual, expected) {
 | 
			
		||||
    if (actual !== expected)
 | 
			
		||||
        throw new Error('bad value: ' + actual);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
    let array = [42, , , 0];
 | 
			
		||||
    shouldBe(array.indexOf(Number.NaN), -1);
 | 
			
		||||
    shouldBe(array.indexOf(0), 3);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = [42.195, , , 0];
 | 
			
		||||
    shouldBe(array.indexOf(Number.NaN), -1);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = [42.195, Number.NaN, , 0];
 | 
			
		||||
    shouldBe(array.indexOf(Number.NaN), -1);
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,21 @@
 | 
			
		||||
function shouldBe(actual, expected) {
 | 
			
		||||
    if (actual !== expected)
 | 
			
		||||
        throw new Error('bad value: ' + actual);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
    let array = [42.195, -0.0, -Infinity];
 | 
			
		||||
    shouldBe(array.indexOf(Infinity), -1);
 | 
			
		||||
    shouldBe(array.indexOf(-Infinity), 2);
 | 
			
		||||
    shouldBe(array.indexOf(42), -1);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = [1, 2, 3, 0];
 | 
			
		||||
    shouldBe(array.indexOf(Infinity), -1);
 | 
			
		||||
    shouldBe(array.indexOf(-Infinity), -1);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = ["String", 42.5, Infinity, 33];
 | 
			
		||||
    shouldBe(array.indexOf(Infinity), 2);
 | 
			
		||||
    shouldBe(array.indexOf(-Infinity), -1);
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,20 @@
 | 
			
		||||
function shouldBe(actual, expected) {
 | 
			
		||||
    if (actual !== expected)
 | 
			
		||||
        throw new Error('bad value: ' + actual);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
    let array = [42.195, -0.0];
 | 
			
		||||
    shouldBe(array.indexOf(0), 1);
 | 
			
		||||
    shouldBe(array.indexOf(-0), 1);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = [42.195, 0, -0.0];
 | 
			
		||||
    shouldBe(array.indexOf(0), 1);
 | 
			
		||||
    shouldBe(array.indexOf(-0), 1);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = [42, 0];
 | 
			
		||||
    shouldBe(array.indexOf(0), 1);
 | 
			
		||||
    shouldBe(array.indexOf(-0), 1);
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,66 @@
 | 
			
		||||
function shouldBe(actual, expected) {
 | 
			
		||||
    if (actual !== expected)
 | 
			
		||||
        throw new Error('bad value: ' + actual);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
    let array = [];
 | 
			
		||||
    Object.defineProperty(array, 2, {
 | 
			
		||||
        get() {
 | 
			
		||||
            this.called = true;
 | 
			
		||||
            return 42;
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
    array.length = 42;
 | 
			
		||||
    shouldBe(array.indexOf(42), 2);
 | 
			
		||||
    shouldBe(array.called, true);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = [20, 20];
 | 
			
		||||
    Object.defineProperty(array, 2, {
 | 
			
		||||
        get() {
 | 
			
		||||
            this.called = true;
 | 
			
		||||
            return 42;
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
    array.length = 42;
 | 
			
		||||
    shouldBe(array.indexOf(42), 2);
 | 
			
		||||
    shouldBe(array.called, true);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = ["Hello"];
 | 
			
		||||
    Object.defineProperty(array, 2, {
 | 
			
		||||
        get() {
 | 
			
		||||
            this.called = true;
 | 
			
		||||
            return 42;
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
    array.length = 42;
 | 
			
		||||
    shouldBe(array.indexOf(42), 2);
 | 
			
		||||
    shouldBe(array.called, true);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = [42.195];
 | 
			
		||||
    Object.defineProperty(array, 2, {
 | 
			
		||||
        get() {
 | 
			
		||||
            this.called = true;
 | 
			
		||||
            return 42;
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
    array.length = 42;
 | 
			
		||||
    shouldBe(array.indexOf(42), 2);
 | 
			
		||||
    shouldBe(array.called, true);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = ["Hello"];
 | 
			
		||||
    Object.defineProperty(array, 2, {
 | 
			
		||||
        get() {
 | 
			
		||||
            this.called = true;
 | 
			
		||||
            return 42;
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
    array.length = 42;
 | 
			
		||||
    ensureArrayStorage(array);
 | 
			
		||||
    shouldBe(array.indexOf(42), 2);
 | 
			
		||||
    shouldBe(array.called, true);
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,48 @@
 | 
			
		||||
function shouldBe(actual, expected) {
 | 
			
		||||
    if (actual !== expected)
 | 
			
		||||
        throw new Error('bad value: ' + actual);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class DerivedArray extends Array {
 | 
			
		||||
    get 2() {
 | 
			
		||||
        this.called = true;
 | 
			
		||||
        return 42;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
    let array = [];
 | 
			
		||||
    array.__proto__ = DerivedArray.prototype;
 | 
			
		||||
    array.length = 42;
 | 
			
		||||
    shouldBe(array.indexOf(42), 2);
 | 
			
		||||
    shouldBe(array.called, true);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = [20, 20];
 | 
			
		||||
    array.__proto__ = DerivedArray.prototype;
 | 
			
		||||
    array.length = 42;
 | 
			
		||||
    shouldBe(array.indexOf(42), 2);
 | 
			
		||||
    shouldBe(array.called, true);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = ["Hello"];
 | 
			
		||||
    array.__proto__ = DerivedArray.prototype;
 | 
			
		||||
    array.length = 42;
 | 
			
		||||
    shouldBe(array.indexOf(42), 2);
 | 
			
		||||
    shouldBe(array.called, true);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = [42.195];
 | 
			
		||||
    array.__proto__ = DerivedArray.prototype;
 | 
			
		||||
    array.length = 42;
 | 
			
		||||
    shouldBe(array.indexOf(42), 2);
 | 
			
		||||
    shouldBe(array.called, true);
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
    let array = ["Hello"];
 | 
			
		||||
    array.__proto__ = DerivedArray.prototype;
 | 
			
		||||
    array.length = 42;
 | 
			
		||||
    ensureArrayStorage(array);
 | 
			
		||||
    shouldBe(array.indexOf(42), 2);
 | 
			
		||||
    shouldBe(array.called, true);
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,25 @@
 | 
			
		||||
//@ runDefault("--collectContinuously=1", "--useConcurrentJIT=0", "--useConcurrentGC=1")
 | 
			
		||||
 | 
			
		||||
function foo(oo) {
 | 
			
		||||
    oo.x = 4;
 | 
			
		||||
    oo.y = 4;
 | 
			
		||||
    oo.e = oo;
 | 
			
		||||
    oo.e = 7;
 | 
			
		||||
    oo.f = 8;
 | 
			
		||||
}
 | 
			
		||||
noInline(foo);
 | 
			
		||||
 | 
			
		||||
function Foo() {
 | 
			
		||||
    foo(this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
for (var i = 0; i < 100000; i++) {
 | 
			
		||||
    g();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function g(){
 | 
			
		||||
    foo({f:8});
 | 
			
		||||
    new Foo();
 | 
			
		||||
    new Foo();
 | 
			
		||||
    new Foo();
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user