js/src/jit-test/tests/asm.js/testParallelCompile.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

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 }

mercurial