Make test_asmjs.html run faster (no bug,r=me)

--HG--
extra : rebase_source : 22f32a01d39e1de3ae7e2a070ee1ea01dc4b9a75
This commit is contained in:
Luke Wagner 2013-05-07 16:47:18 -07:00
parent af63beda97
commit 2b44dddc9c
2 changed files with 21 additions and 3 deletions

View File

@ -20,7 +20,7 @@ if (fMain(4) !== 6)
throw "f.main(4)";
if (fMain(100) !== 4950)
throw "f.main(100)";
if (fMain(3000000) !== 4950)
throw "f.main(3000000)";
if (fMain(5000) !== 4950)
throw "f.main(5000)";
postMessage("ok");

View File

@ -46,7 +46,25 @@ var f2Main = f2(this, null, i32.buffer);
ok(f2Main, "f2.main is an asm.js function");
ok(f2Main(4) == 6, "f2.main(4)");
ok(f2Main(100) == 4950, "f2.main(100)");
ok(f2Main(3000000) == 4950, "f2.main(3000000)");
ok(f2Main(5000) == 4950, "f2.main(5000)");
function f3(stdlib, foreign, buffer) {
"use asm";
var i32 = new stdlib.Int32Array(buffer);
function main(n,o) {
n = n|0;
o = o|0;
var i = 0, j = 0, sum = 0;
for (i = 0; (i|0) < (n|0); i=(i+1)|0)
for (j = 0; (j|0) < (o|0); j=(j+1)|0)
sum = (sum + (i32[(j<<2)>>2]|0))|0;
return sum|0;
}
return main;
}
var f3Main = f3(this, null, i32.buffer);
ok(f3Main, "f3.main is an asm.js function");
ok(f3Main(2000000, 1000) == ((4950*2000000)|0), "f3.main(2000000, 1000)");
var w = new Worker('http://mochi.test:8888/tests/js/xpconnect/tests/mochitest/file_asmjs.js');
w.onmessage = function(e) {