mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Made WASM benchmarks runable again in Firefox and Chrome
This commit is contained in:
parent
473c35dafa
commit
22670363f9
|
@ -17,16 +17,16 @@
|
||||||
var Benchmark = function() {
|
var Benchmark = function() {
|
||||||
function Benchmark(canvas) {
|
function Benchmark(canvas) {
|
||||||
this.canvas = canvas;
|
this.canvas = canvas;
|
||||||
this.module = null;
|
this.instance = null;
|
||||||
this.line = "";
|
this.line = "";
|
||||||
this.resultTableBody = document.getElementById("result-table-body");
|
this.resultTableBody = document.getElementById("result-table-body");
|
||||||
}
|
}
|
||||||
Benchmark.prototype.runAll = function() {
|
Benchmark.prototype.runAll = function() {
|
||||||
load(this, function() { this.module.exports.main(); }.bind(this));
|
load(this, function() { this.instance.exports.main(); }.bind(this));
|
||||||
};
|
};
|
||||||
|
|
||||||
function tick(benchmark) {
|
function tick(benchmark) {
|
||||||
var exports = benchmark.module.exports;
|
var exports = benchmark.instance.exports;
|
||||||
exports.tick();
|
exports.tick();
|
||||||
var exception = exports.sys$catchException();
|
var exception = exports.sys$catchException();
|
||||||
if (exception !== 0) {
|
if (exception !== 0) {
|
||||||
|
@ -132,9 +132,13 @@ var Benchmark = function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
WebAssembly.compile(response).then(function(module) {
|
|
||||||
benchmark.module = new WebAssembly.Instance(module, importObj);
|
WebAssembly.instantiate(response, importObj).then(function(resultObject) {
|
||||||
|
benchmark.instance = resultObject.instance;
|
||||||
|
console.log("Initialized")
|
||||||
callback();
|
callback();
|
||||||
|
}).catch(function(error) {
|
||||||
|
console.log("Error : " + error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
xhr.send();
|
xhr.send();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user