summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/regress/jit-updatepcquad.js
blob: 69f9371b846cdb588ad58d4a3044b8355b7135e9 (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
var evalInFrame = (function (global) {
    var dbgGlobal = newGlobal({newCompartment: true});
    var dbg = new dbgGlobal.Debugger();
    return function evalInFrame(code) {
        dbg.addDebuggee(global);
        var frame = dbg.getNewestFrame().older;
        frame = frame.older || frame;
        let completion = frame.eval(code);
        return completion.return;
    };
})(this);

const { exports } = wasmEvalText(`
    (module
        (import "global" "func" (func (param i32) (result i32)))
        (func (export "func_0") (param i32)(result i32)
         local.get 0
         call 0
        )
    )
`, {
    global: {
        func: function jscode(i) {
            return evalInFrame(`a = ${i}`);
        }
    }
});

for (i = 0; i < 20; ++i) {
    assertEq(exports.func_0(i), i);
}