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

mercurial