js/src/jit-test/tests/ion/new-9.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/ion/new-9.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,27 @@
     1.4 +// Test createThisScripted(), without a singleton.
     1.5 +function Foo(a) {
     1.6 +	this.str = "foo";
     1.7 +}
     1.8 +
     1.9 +function Bar(a) {
    1.10 +	this.str = "bar";
    1.11 +}
    1.12 +
    1.13 +function f() {
    1.14 +	var x;
    1.15 +	for (var i = 0; i < 400; i++) {
    1.16 +		if (i % 2 == 0)
    1.17 +			x = Foo;
    1.18 +		else
    1.19 +			x = Bar;
    1.20 +
    1.21 +		var y = new x(5);
    1.22 +
    1.23 +		if (i % 2 == 0)
    1.24 +			assertEq(y.str, "foo");
    1.25 +		else
    1.26 +			assertEq(y.str, "bar");
    1.27 +	}
    1.28 +}
    1.29 +
    1.30 +f();

mercurial