зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1310949: Use wasmFullPass for even more tests; r=luke
MozReview-Commit-ID: 1FmHsS6R76Y --HG-- extra : rebase_source : c1e258472cddd84a4682cd672576b80c938d121c
This commit is contained in:
Родитель
b87511701c
Коммит
72356e9d78
|
@ -551,6 +551,8 @@ RenderBinaryOperator(WasmRenderContext& c, AstBinaryOperator& op)
|
|||
case Expr::I32Shl: opStr = "i32.shl"; break;
|
||||
case Expr::I32ShrS: opStr = "i32.shr_s"; break;
|
||||
case Expr::I32ShrU: opStr = "i32.shr_u"; break;
|
||||
case Expr::I32Rotl: opStr = "i32.rotl"; break;
|
||||
case Expr::I32Rotr: opStr = "i32.rotr"; break;
|
||||
case Expr::I64Add: opStr = "i64.add"; break;
|
||||
case Expr::I64Sub: opStr = "i64.sub"; break;
|
||||
case Expr::I64Mul: opStr = "i64.mul"; break;
|
||||
|
@ -564,6 +566,8 @@ RenderBinaryOperator(WasmRenderContext& c, AstBinaryOperator& op)
|
|||
case Expr::I64Shl: opStr = "i64.shl"; break;
|
||||
case Expr::I64ShrS: opStr = "i64.shr_s"; break;
|
||||
case Expr::I64ShrU: opStr = "i64.shr_u"; break;
|
||||
case Expr::I64Rotl: opStr = "i64.rotl"; break;
|
||||
case Expr::I64Rotr: opStr = "i64.rotr"; break;
|
||||
case Expr::F32Add: opStr = "f32.add"; break;
|
||||
case Expr::F32Sub: opStr = "f32.sub"; break;
|
||||
case Expr::F32Mul: opStr = "f32.mul"; break;
|
||||
|
|
|
@ -6,21 +6,21 @@ assertEq(wasmEvalText('(module (func (result i32) (i32.const -2147483648)) (expo
|
|||
assertEq(wasmEvalText('(module (func (result i32) (i32.const 4294967295)) (export "" 0))').exports[""](), -1);
|
||||
|
||||
function testUnary(type, opcode, op, expect) {
|
||||
var assertFunc = assertEq;
|
||||
var fullPass = wasmFullPass;
|
||||
if (type === 'i64') {
|
||||
expect = createI64(expect);
|
||||
assertFunc = assertEqI64;
|
||||
fullPass = wasmFullPassI64;
|
||||
}
|
||||
|
||||
// Test with constant
|
||||
assertFunc(wasmEvalText(`(module (func (result ${type}) (${type}.${opcode} (${type}.const ${op}))) (export "" 0))`).exports[""](), expect);
|
||||
fullPass(`(module (func (result ${type}) (${type}.${opcode} (${type}.const ${op}))) (export "run" 0))`, expect);
|
||||
|
||||
if (type === 'i64') {
|
||||
op = createI64(op);
|
||||
}
|
||||
|
||||
// Test with param
|
||||
assertFunc(wasmEvalText(`(module (func (param ${type}) (result ${type}) (${type}.${opcode} (get_local 0))) (export "" 0))`).exports[""](op), expect);
|
||||
fullPass(`(module (func (param ${type}) (result ${type}) (${type}.${opcode} (get_local 0))) (export "run" 0))`, expect, {}, op);
|
||||
}
|
||||
|
||||
function testBinary64(opcode, lhs, rhs, expect) {
|
||||
|
@ -28,44 +28,44 @@ function testBinary64(opcode, lhs, rhs, expect) {
|
|||
let robj = createI64(rhs);
|
||||
expect = createI64(expect);
|
||||
|
||||
assertEqI64(wasmEvalText(`(module (func (param i64) (param i64) (result i64) (i64.${opcode} (get_local 0) (get_local 1))) (export "" 0))`).exports[""](lobj, robj), expect);
|
||||
wasmFullPassI64(`(module (func (param i64) (param i64) (result i64) (i64.${opcode} (get_local 0) (get_local 1))) (export "run" 0))`, expect, {}, lobj, robj);
|
||||
// The same, but now the RHS is a constant.
|
||||
assertEqI64(wasmEvalText(`(module (func (param i64) (result i64) (i64.${opcode} (get_local 0) (i64.const ${rhs}))) (export "" 0))`).exports[""](lobj), expect);
|
||||
wasmFullPassI64(`(module (func (param i64) (result i64) (i64.${opcode} (get_local 0) (i64.const ${rhs}))) (export "run" 0))`, expect, {}, lobj);
|
||||
// LHS and RHS are constants.
|
||||
assertEqI64(wasmEvalText(`(module (func (result i64) (i64.${opcode} (i64.const ${lhs}) (i64.const ${rhs}))) (export "" 0))`).exports[""](), expect);
|
||||
wasmFullPassI64(`(module (func (result i64) (i64.${opcode} (i64.const ${lhs}) (i64.const ${rhs}))) (export "run" 0))`, expect);
|
||||
}
|
||||
|
||||
function testBinary32(opcode, lhs, rhs, expect) {
|
||||
assertEq(wasmEvalText(`(module (func (param i32) (param i32) (result i32) (i32.${opcode} (get_local 0) (get_local 1))) (export "" 0))`).exports[""](lhs, rhs), expect);
|
||||
wasmFullPass(`(module (func (param i32) (param i32) (result i32) (i32.${opcode} (get_local 0) (get_local 1))) (export "run" 0))`, expect, {}, lhs, rhs);
|
||||
// The same, but now the RHS is a constant.
|
||||
assertEq(wasmEvalText(`(module (func (param i32) (result i32) (i32.${opcode} (get_local 0) (i32.const ${rhs}))) (export "" 0))`).exports[""](lhs), expect);
|
||||
wasmFullPass(`(module (func (param i32) (result i32) (i32.${opcode} (get_local 0) (i32.const ${rhs}))) (export "run" 0))`, expect, {}, lhs);
|
||||
// LHS and RHS are constants.
|
||||
assertEq(wasmEvalText(`(module (func (result i32) (i32.${opcode} (i32.const ${lhs}) (i32.const ${rhs}))) (export "" 0))`).exports[""](), expect);
|
||||
wasmFullPass(`(module (func (result i32) (i32.${opcode} (i32.const ${lhs}) (i32.const ${rhs}))) (export "run" 0))`, expect);
|
||||
}
|
||||
|
||||
function testComparison32(opcode, lhs, rhs, expect) {
|
||||
assertEq(wasmEvalText(`(module (func (param i32) (param i32) (result i32) (i32.${opcode} (get_local 0) (get_local 1))) (export "" 0))`).exports[""](lhs, rhs), expect);
|
||||
wasmFullPass(`(module (func (param i32) (param i32) (result i32) (i32.${opcode} (get_local 0) (get_local 1))) (export "run" 0))`, expect, {}, lhs, rhs);
|
||||
}
|
||||
function testComparison64(opcode, lhs, rhs, expect) {
|
||||
let lobj = createI64(lhs);
|
||||
let robj = createI64(rhs);
|
||||
|
||||
assertEq(wasmEvalText(`(module
|
||||
(func (param i64) (param i64) (result i32) (i64.${opcode} (get_local 0) (get_local 1)))
|
||||
(export "" 0))`).exports[""](lobj, robj), expect);
|
||||
wasmFullPass(`(module
|
||||
(func (param i64) (param i64) (result i32) (i64.${opcode} (get_local 0) (get_local 1)))
|
||||
(export "run" 0))`, expect, {}, lobj, robj);
|
||||
|
||||
// Also test if, for the compare-and-branch path.
|
||||
assertEq(wasmEvalText(`(module
|
||||
(func (param i64) (param i64) (result i32)
|
||||
(if i32 (i64.${opcode} (get_local 0) (get_local 1))
|
||||
(i32.const 1)
|
||||
(i32.const 0)))
|
||||
(export "" 0))`).exports[""](lobj, robj), expect);
|
||||
// Also test `if`, for the compare-and-branch path.
|
||||
wasmFullPass(`(module
|
||||
(func (param i64) (param i64) (result i32)
|
||||
(if i32 (i64.${opcode} (get_local 0) (get_local 1))
|
||||
(i32.const 1)
|
||||
(i32.const 0)))
|
||||
(export "run" 0))`, expect, {}, lobj, robj);
|
||||
}
|
||||
function testI64Eqz(input, expect) {
|
||||
assertEq(wasmEvalText(`(module (func (result i32) (i64.eqz (i64.const ${input}))) (export "" 0))`).exports[""](input), expect);
|
||||
wasmFullPass(`(module (func (result i32) (i64.eqz (i64.const ${input}))) (export "run" 0))`, expect, {});
|
||||
input = createI64(input);
|
||||
assertEq(wasmEvalText(`(module (func (param i64) (result i32) (i64.eqz (get_local 0))) (export "" 0))`).exports[""](input), expect);
|
||||
wasmFullPass(`(module (func (param i64) (result i32) (i64.eqz (get_local 0))) (export "run" 0))`, expect, {}, input);
|
||||
}
|
||||
|
||||
function testTrap32(opcode, lhs, rhs, expect) {
|
||||
|
|
|
@ -14,7 +14,7 @@ const RuntimeError = WebAssembly.RuntimeError;
|
|||
// Test for stale heap pointers after resize
|
||||
|
||||
// Grow directly from builtin call:
|
||||
assertEq(wasmEvalText(`(module
|
||||
wasmFullPass(`(module
|
||||
(memory 1)
|
||||
(func $test (result i32)
|
||||
(i32.store (i32.const 0) (i32.const 1))
|
||||
|
@ -26,8 +26,8 @@ assertEq(wasmEvalText(`(module
|
|||
(i32.add
|
||||
(i32.load (i32.const 65532))
|
||||
(i32.load (i32.const 6553596)))))
|
||||
(export "test" $test)
|
||||
)`).exports.test(), 111);
|
||||
(export "run" $test)
|
||||
)`, 111);
|
||||
|
||||
// Grow during import call:
|
||||
var exports = wasmEvalText(`(module
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
load(libdir + "wasm.js");
|
||||
|
||||
// Test instructions with no return value interposed between pushes and pops.
|
||||
assertEq(wasmEvalText(` (module
|
||||
wasmFullPass(` (module
|
||||
(memory 1)
|
||||
|
||||
(func (result i32)
|
||||
|
@ -66,5 +66,5 @@ assertEq(wasmEvalText(` (module
|
|||
|
||||
(func $returnVoid)
|
||||
|
||||
(export "" 0)
|
||||
)`).exports[""](), 33);
|
||||
(export "run" 0)
|
||||
)`, 33);
|
||||
|
|
|
@ -5,7 +5,7 @@ load(libdir + "wasm.js");
|
|||
// meaning we have to have a special mode in the decoder for decoding code
|
||||
// that won't actually run.
|
||||
|
||||
assertEq(wasmEvalText(`(module
|
||||
wasmFullPass(`(module
|
||||
(func (result i32)
|
||||
(return (i32.const 42))
|
||||
(i32.add (f64.const 1.0) (f32.const 0.0))
|
||||
|
@ -13,10 +13,10 @@ assertEq(wasmEvalText(`(module
|
|||
(if (f32.const 3.0) (i64.const 2) (i32.const 1))
|
||||
(select (f64.const -5.0) (f32.const 2.3) (f64.const 8.9))
|
||||
)
|
||||
(export "" 0)
|
||||
)`).exports[""](), 42);
|
||||
(export "run" 0)
|
||||
)`, 42);
|
||||
|
||||
assertEq(wasmEvalText(`(module
|
||||
wasmFullPass(`(module
|
||||
(func (result i32) (param i32)
|
||||
(block
|
||||
(br_if 1 (i32.const 41) (get_local 0))
|
||||
|
@ -27,5 +27,5 @@ assertEq(wasmEvalText(`(module
|
|||
(if (f32.const 3.0) (i64.const 2) (i32.const 1))
|
||||
(select (f64.const -5.0) (f32.const 2.3) (f64.const 8.9))
|
||||
)
|
||||
(export "" 0)
|
||||
)`).exports[""](0), 42);
|
||||
(export "run" 0)
|
||||
)`, 42, {}, 0);
|
||||
|
|
Загрузка…
Ссылка в новой задаче