js/src/jit-test/tests/ion/bug818023.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 Function.prototype.callX = Function.prototype.call;
michael@0 2 var x;
michael@0 3 function f() {
michael@0 4 x = f.caller;
michael@0 5 return x;
michael@0 6 }
michael@0 7
michael@0 8 function g() {
michael@0 9 return f.callX(null);
michael@0 10 }
michael@0 11
michael@0 12 function h1() {
michael@0 13 // native
michael@0 14 return ([0].map(f))[0];
michael@0 15 }
michael@0 16
michael@0 17 function h2() {
michael@0 18 // self-hosted
michael@0 19 x = null;
michael@0 20 [0].forEach(f);
michael@0 21 return x;
michael@0 22 }
michael@0 23
michael@0 24 function k() {
michael@0 25 x = null;
michael@0 26 [0, 1].sort(f);
michael@0 27 return x;
michael@0 28 }
michael@0 29
michael@0 30 function l() {
michael@0 31 return f();
michael@0 32 }
michael@0 33
michael@0 34 assertEq(g(), g);
michael@0 35 assertEq(h1(), h1);
michael@0 36 assertEq(h2(), h2);
michael@0 37 assertEq(k(), k);
michael@0 38 assertEq(l(), l);
michael@0 39
michael@0 40 var baz;
michael@0 41 var foo = {callX: function() { return "m"; }};
michael@0 42 function bar() {
michael@0 43 return baz.caller;
michael@0 44 }
michael@0 45 function m() {
michael@0 46 return baz.callX(null);
michael@0 47 }
michael@0 48
michael@0 49 baz = foo;
michael@0 50 assertEq(m(), "m");
michael@0 51 baz = bar;
michael@0 52 assertEq(m(), m);
michael@0 53 assertEq(m(), m);

mercurial