js/src/jit-test/tests/ion/new-1.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-1.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,15 @@
     1.4 +// Some testing for JSOP_NEW.
     1.5 +function foo(prop) {
     1.6 +	this.name = "Foo";
     1.7 +	this.prop = prop;
     1.8 +}
     1.9 +
    1.10 +// Construct an object with a unique assignation to a property.
    1.11 +function f(i) {
    1.12 +	var x = new foo(i);
    1.13 +	return x.prop;
    1.14 +}
    1.15 +
    1.16 +// Assert that a unique object really was created.
    1.17 +for (var i = 0; i < 100; i++)
    1.18 +	assertEq(f(i), i);

mercurial