summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/asm.js/testModuleFunctions.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/asm.js/testModuleFunctions.js')
-rw-r--r--js/src/jit-test/tests/asm.js/testModuleFunctions.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/asm.js/testModuleFunctions.js b/js/src/jit-test/tests/asm.js/testModuleFunctions.js
new file mode 100644
index 0000000000..2e3c80f45f
--- /dev/null
+++ b/js/src/jit-test/tests/asm.js/testModuleFunctions.js
@@ -0,0 +1,41 @@
+
+function testUniqueness(asmJSModule) {
+ var f = asmJSModule();
+ var g = asmJSModule();
+ assertEq(f === g, false);
+ f.x = 4;
+ assertEq(f.x, 4);
+ assertEq(g.x, undefined);
+}
+
+function deffun() {
+ if (Math.sin) {
+ function inner() { "use asm"; function g() {} return g }
+ }
+ return inner;
+}
+
+testUniqueness(deffun);
+
+function lambda() {
+ var x = function inner() { "use asm"; function g() {} return g };
+ return x;
+}
+
+testUniqueness(lambda);
+
+function inEval() {
+ eval("function inner() { 'use asm'; function g() {} return g }");
+ return inner;
+}
+
+testUniqueness(inEval);
+
+function inWith() {
+ with ({}) {
+ function inner() { "use asm"; function g() {} return g }
+ }
+ return inner;
+}
+
+testUniqueness(inWith);