summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/new-9.js
blob: ef346ffc5880ec14f80a8710b15602f5708c035b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Test createThisScripted(), without a singleton.
function Foo(a) {
	this.str = "foo";
}

function Bar(a) {
	this.str = "bar";
}

function f() {
	var x;
	for (var i = 0; i < 400; i++) {
		if (i % 2 == 0)
			x = Foo;
		else
			x = Bar;

		var y = new x(5);

		if (i % 2 == 0)
			assertEq(y.str, "foo");
		else
			assertEq(y.str, "bar");
	}
}

f();