Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | load(libdir + "asm.js"); |
michael@0 | 2 | |
michael@0 | 3 | if (!isAsmJSCompilationAvailable()) |
michael@0 | 4 | quit(); |
michael@0 | 5 | |
michael@0 | 6 | var module = "'use asm';\n"; |
michael@0 | 7 | for (var i = 0; i < 100; i++) { |
michael@0 | 8 | module += "function f" + i + "(i) {\n"; |
michael@0 | 9 | module += " i=i|0; var j=0; j=(i+1)|0; i=(j-4)|0; i=(i+j)|0; return i|0\n"; |
michael@0 | 10 | module += "}\n"; |
michael@0 | 11 | } |
michael@0 | 12 | module += "return f0"; |
michael@0 | 13 | var script = "(function() {\n" + module + "})"; |
michael@0 | 14 | |
michael@0 | 15 | for (var i = 0; i < 10; i++) { |
michael@0 | 16 | try { |
michael@0 | 17 | offThreadCompileScript(script); |
michael@0 | 18 | var f = new Function(module); |
michael@0 | 19 | var g = runOffThreadScript(); |
michael@0 | 20 | assertEq(isAsmJSModule(f), true); |
michael@0 | 21 | assertEq(isAsmJSModule(g), true); |
michael@0 | 22 | } catch (e) { |
michael@0 | 23 | // ignore spurious error when offThreadCompileScript can't run in |
michael@0 | 24 | // parallel |
michael@0 | 25 | } |
michael@0 | 26 | } |