diff options
Diffstat (limited to 'js/src/jit-test/tests/debug/breakpoint-await.js')
-rw-r--r-- | js/src/jit-test/tests/debug/breakpoint-await.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/breakpoint-await.js b/js/src/jit-test/tests/debug/breakpoint-await.js new file mode 100644 index 0000000000..9a648cab01 --- /dev/null +++ b/js/src/jit-test/tests/debug/breakpoint-await.js @@ -0,0 +1,47 @@ +if (typeof disassemble !== "function") { + quit(); +} + +const g = newGlobal({ newCompartment: true }); +g.eval(` +async function func() { + await 10; +} +async function * func2() { + await 10; +} +var func_dis = disassemble(func); +var func2_dis = disassemble(func2); +`); +const d = new Debugger(); +const dg = d.addDebuggee(g); +const script = dg.makeDebuggeeValue(g.func).script; +const script2 = dg.makeDebuggeeValue(g.func2).script; + +function getOffsets(code) { + let CanSkipAwait_offset = -1; + let Await_offset = -1; + let m; + for (const line of code.split("\n")) { + m = line.match(/(\d+):\s+\d+\s+CanSkipAwait\s/); + if (m) { + CanSkipAwait_offset = parseInt(m[1], 10); + } + + m = line.match(/(\d+):\s+\d+\s+Await\s/); + if (m) { + Await_offset = parseInt(m[1], 10); + } + } + assertEq(CanSkipAwait_offset !== -1, true); + assertEq(Await_offset !== -1, true); + return [CanSkipAwait_offset, Await_offset]; +} + +let [CanSkipAwait_offset, Await_offset] = getOffsets(g.func_dis); +assertEq(script.getEffectfulOffsets().includes(CanSkipAwait_offset), true); +assertEq(script.getEffectfulOffsets().includes(Await_offset), true); + +[CanSkipAwait_offset, Await_offset] = getOffsets(g.func2_dis); +assertEq(script2.getEffectfulOffsets().includes(CanSkipAwait_offset), true); +assertEq(script2.getEffectfulOffsets().includes(Await_offset), true); |