| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script> | 4 <script> |
| 5 function log(message) | 5 function log(message) |
| 6 { | 6 { |
| 7 document.getElementById('console').appendChild(document.createTextNode(messa
ge + "\n")); | 7 document.getElementById('console').appendChild(document.createTextNode(messa
ge + "\n")); |
| 8 } | 8 } |
| 9 | 9 |
| 10 function runTest() | 10 function runTest() |
| 11 { | 11 { |
| 12 log("Test calling asm functions across workers with the same heap."); | 12 log("Test calling asm functions across workers with the same heap."); |
| 13 var string = [ | 13 var string = [ |
| 14 "worker = this;", | 14 "worker = this;", |
| 15 "onmessage = function(e) {", | 15 "onmessage = function(e) {", |
| 16 " function Module(stdlib, foreign, heap) {", | 16 " function Module(stdlib, foreign, heap) {", |
| 17 " 'use asm';", | 17 " 'use asm';", |
| 18 " var MEM32 = new stdlib.Int32Array(heap);", | 18 " var MEM32 = new stdlib.Int32Array(heap);", |
| 19 " function load() { var res = MEM32[255]; MEM32[255] = 123457; re
turn res; }", | 19 " function load() { var res = 0; res = MEM32[255]|0; MEM32[255] =
123457; return res|0; }", |
| 20 " return { load: load };", | 20 " return { load: load };", |
| 21 " }", | 21 " }", |
| 22 " var buffer = e.data;", | 22 " var buffer = e.data;", |
| 23 " var result = Module(worker, {}, buffer).load();", | 23 " var result = Module(worker, {}, buffer).load();", |
| 24 " var message = result == 123456 ? 'SUCCESS' : 'FAILURE ' + result;", | 24 " var message = result == 123456 ? 'SUCCESS' : 'FAILURE ' + result;", |
| 25 " postMessage(message);", | 25 " postMessage(message);", |
| 26 "};" | 26 "};" |
| 27 ].join('\n'); | 27 ].join('\n'); |
| 28 var blobURL = URL.createObjectURL(new Blob([string])); | 28 var blobURL = URL.createObjectURL(new Blob([string])); |
| 29 var worker = new Worker(blobURL); | 29 var worker = new Worker(blobURL); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 55 testRunner.setAllowFileAccessFromFileURLs(true); | 55 testRunner.setAllowFileAccessFromFileURLs(true); |
| 56 testRunner.dumpAsText(); | 56 testRunner.dumpAsText(); |
| 57 testRunner.waitUntilDone(); | 57 testRunner.waitUntilDone(); |
| 58 } | 58 } |
| 59 </script> | 59 </script> |
| 60 </head> | 60 </head> |
| 61 <body onload="runTest()"> | 61 <body onload="runTest()"> |
| 62 <pre id='console'></pre> | 62 <pre id='console'></pre> |
| 63 </body> | 63 </body> |
| 64 </html> | 64 </html> |
| OLD | NEW |