michael@0: function testUniqueness(asmJSModule) { michael@0: var f = asmJSModule(); michael@0: var g = asmJSModule(); michael@0: assertEq(f === g, false); michael@0: f.x = 4; michael@0: assertEq(f.x, 4); michael@0: assertEq(g.x, undefined); michael@0: } michael@0: michael@0: function deffun() { michael@0: if (Math.sin) { michael@0: function inner() { "use asm"; function g() {} return g } michael@0: } michael@0: return inner; michael@0: } michael@0: michael@0: testUniqueness(deffun); michael@0: michael@0: function lambda() { michael@0: var x = function inner() { "use asm"; function g() {} return g }; michael@0: return x; michael@0: } michael@0: michael@0: testUniqueness(lambda); michael@0: michael@0: function inEval() { michael@0: eval("function inner() { 'use asm'; function g() {} return g }"); michael@0: return inner; michael@0: } michael@0: michael@0: testUniqueness(inEval); michael@0: michael@0: function inWith() { michael@0: with ({}) { michael@0: function inner() { "use asm"; function g() {} return g } michael@0: } michael@0: return inner; michael@0: } michael@0: michael@0: testUniqueness(inWith);