summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/drop.js
blob: 3a2bda66e51edb47f713ecaa91f1074d66eabb4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
for (let type of ['i32', 'f32', 'f64']) {
    assertEq(wasmEvalText(`
        (module
         (func $test (param $p ${type}) (param $p2 ${type}) (result ${type})
            local.get $p
            local.get $p2
            (block)
            drop
         )
         (export "test" (func $test))
        )
    `).exports.test(0x1337abc0, 0xffffffff), 0x1337abc0);
}

assertEq(wasmEvalText(`
    (module
     (func $test (param $p i32) (param $p2 f32) (param $p3 f64) (param $p4 i32) (result i32)
        local.get $p
        local.get $p2
        local.get $p3
        local.get $p4
        (block)
        drop
        (block)
        (block)
        drop
        drop
     )
     (export "test" (func $test))
    )
`).exports.test(0x1337abc0, 0xffffffff), 0x1337abc0);

wasmAssert(`
    (module
     (func $test (param $p i64) (param $p2 i64) (result i64)
        local.get $p
        local.get $p2
        (block)
        drop
     )
     (export "test" (func $test))
    )
`, [
    { type: 'i64', func: '$test', args: ['(i64.const 0x1337abc0)', '(i64.const -1)'], expected: '0x1337abc0' }
]);