зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1435360 - Improve wasm IDB serialization tests to verify modules deterministically (rs=bbouvier)
--HG-- extra : rebase_source : c88177f6f486e425133355513a26b6c8328b86cf
This commit is contained in:
Родитель
d389a89796
Коммит
82986c8859
|
@ -207,17 +207,12 @@ function verifyView(view1, view2)
|
|||
|
||||
function verifyWasmModule(module1, module2)
|
||||
{
|
||||
let getGlobalForObject = SpecialPowers.Cu.getGlobalForObject;
|
||||
let testingFunctions = SpecialPowers.Cu.getJSTestingFunctions();
|
||||
let wasmExtractCode = SpecialPowers.unwrap(testingFunctions.wasmExtractCode);
|
||||
let exp1 = wasmExtractCode(module1, "ion");
|
||||
let exp2 = wasmExtractCode(module2, "ion");
|
||||
let code1 = exp1.code;
|
||||
let code2 = exp2.code;
|
||||
ok(code1 instanceof getGlobalForObject(code1).Uint8Array, "Instance of Uint8Array");
|
||||
ok(code2 instanceof getGlobalForObject(code1).Uint8Array, "Instance of Uint8Array");
|
||||
ok(code1.length == code2.length, "Correct length");
|
||||
verifyBuffers(code1, code2);
|
||||
// We assume the given modules have no imports and export a single function
|
||||
// named 'run'.
|
||||
var instance1 = new WebAssembly.Instance(module1);
|
||||
var instance2 = new WebAssembly.Instance(module2);
|
||||
is(instance1.exports.run(), instance2.exports.run(), "same run() result");
|
||||
|
||||
continueToNextStep();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,35 +23,35 @@ function* testSteps()
|
|||
return;
|
||||
}
|
||||
|
||||
getWasmBinary("(module (func (result i32) (i32.const 1)))");
|
||||
getWasmBinary(`(module (func (export "run") (result i32) (i32.const 1)))`);
|
||||
let binary = yield undefined;
|
||||
wasmData[1].value[0] = getWasmModule(binary);
|
||||
|
||||
getWasmBinary("(module (func (result i32) (i32.const 2)))");
|
||||
getWasmBinary(`(module (func (export "run") (result i32) (i32.const 2)))`);
|
||||
binary = yield undefined;
|
||||
wasmData[1].value[1] = getWasmModule(binary);
|
||||
|
||||
getWasmBinary("(module (func (result i32) (i32.const 3)))");
|
||||
getWasmBinary(`(module (func (export "run") (result i32) (i32.const 3)))`);
|
||||
binary = yield undefined;
|
||||
wasmData[1].value[2] = getWasmModule(binary);
|
||||
|
||||
getWasmBinary("(module (func (result i32) (i32.const 4)))");
|
||||
getWasmBinary(`(module (func (export "run") (result i32) (i32.const 4)))`);
|
||||
binary = yield undefined;
|
||||
wasmData[2].value[0] = getWasmModule(binary);
|
||||
|
||||
getWasmBinary("(module (func (result i32) (i32.const 5)))");
|
||||
getWasmBinary(`(module (func (export "run") (result i32) (i32.const 5)))`);
|
||||
binary = yield undefined;
|
||||
wasmData[2].value[1] = getWasmModule(binary);
|
||||
|
||||
getWasmBinary("(module (func (result i32) (i32.const 6)))");
|
||||
getWasmBinary(`(module (func (export "run") (result i32) (i32.const 6)))`);
|
||||
binary = yield undefined;
|
||||
wasmData[2].value[2] = getWasmModule(binary);
|
||||
|
||||
getWasmBinary("(module (func (result i32) (i32.const 7)))");
|
||||
getWasmBinary(`(module (func (export "run") (result i32) (i32.const 7)))`);
|
||||
binary = yield undefined;
|
||||
wasmData[2].value[3] = getWasmModule(binary);
|
||||
|
||||
getWasmBinary("(module (func (result i32) (i32.const 8)))");
|
||||
getWasmBinary(`(module (func (export "run") (result i32) (i32.const 8)))`);
|
||||
binary = yield undefined;
|
||||
wasmData[2].value[4] = getWasmModule(binary);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ function* testSteps()
|
|||
return;
|
||||
}
|
||||
|
||||
getWasmBinary("(module (func (nop)))");
|
||||
getWasmBinary(`(module (func (export "run") (result i32) (i32.const 13)))`);
|
||||
let binary = yield undefined;
|
||||
wasmData.value = getWasmModule(binary);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ function* testSteps()
|
|||
yield undefined;
|
||||
}
|
||||
|
||||
getWasmBinary("(module (func (nop)))");
|
||||
getWasmBinary('(module (func $f (result i32) (i32.const 42)) (func (export "run") (result i32) (call $f)))');
|
||||
let binary = yield undefined;
|
||||
|
||||
wasmData.wasm = getWasmModule(binary);
|
||||
|
@ -31,7 +31,7 @@ function* testSteps()
|
|||
clearAllDatabases(continueToNextStepSync);
|
||||
yield undefined;
|
||||
|
||||
// The profile was created by an older build (buildId: 20161116145318,
|
||||
// The profile was created with a mythical build (buildId: 20180309213541,
|
||||
// cpuId: X64=0x2). It contains one stored wasm module (file id 1 - bytecode
|
||||
// and file id 2 - compiled/machine code). The file create_db.js in the
|
||||
// package was run locally (specifically it was temporarily added to
|
||||
|
|
Двоичные данные
dom/indexedDB/test/unit/wasm_recompile_profile.zip
Двоичные данные
dom/indexedDB/test/unit/wasm_recompile_profile.zip
Двоичный файл не отображается.
|
@ -491,14 +491,12 @@ function verifyView(view1, view2)
|
|||
|
||||
function verifyWasmModule(module1, module2)
|
||||
{
|
||||
let testingFunctions = Cu.getJSTestingFunctions();
|
||||
let exp1 = testingFunctions.wasmExtractCode(module1, "ion");
|
||||
let exp2 = testingFunctions.wasmExtractCode(module2, "ion");
|
||||
let code1 = exp1.code;
|
||||
let code2 = exp2.code;
|
||||
ok(code1 instanceof Uint8Array, "Instance of Uint8Array");
|
||||
ok(code1.length == code2.length, "Correct length");
|
||||
verifyBuffers(code1, code2);
|
||||
// We assume the given modules have no imports and export a single function
|
||||
// named 'run'.
|
||||
var instance1 = new WebAssembly.Instance(module1);
|
||||
var instance2 = new WebAssembly.Instance(module2);
|
||||
is(instance1.exports.run(), instance2.exports.run(), "same run() result");
|
||||
|
||||
continueToNextStep();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче